The Pedigree Project  0.1
Public Member Functions | Private Attributes | List of all members
Ipc::IpcMessage Class Reference
+ Collaboration diagram for Ipc::IpcMessage:

Public Member Functions

 IpcMessage (size_t nBytes, uintptr_t regionHandle=0)
 Constructor for regions > 4 KB in size. More...
 
virtual ~IpcMessage ()
 
void * getBuffer ()
 
void * getHandle ()
 
 IpcMessage (const IpcMessage &src)
 

Private Attributes

size_t nPages
 
uintptr_t m_vAddr
 Virtual address of a message when m_pMemRegion is invalid.
 
MemoryRegionm_pMemRegion
 

Detailed Description

Definition at line 36 of file system/include/pedigree/kernel/process/Ipc.h.

Constructor & Destructor Documentation

Ipc::IpcMessage::IpcMessage ( size_t  nBytes,
uintptr_t  regionHandle = 0 
)

Constructor for regions > 4 KB in size.

If you pass an existing region handle, this will link the instance being created to an existing message that may well be in another address space. That handle is obtained via IpcMessage::getHandle, and should be passed via conventional < 4 KB IPC messages.

Parameters
nBytesNumber of bytes to allocate for this region.
regionHandleHandle to a region. Each message allocated with this method when this parameter is 0 is given a unique handle to pass to other processes in order to share memory.

Definition at line 176 of file system/kernel/core/process/Ipc.cc.

References PhysicalMemoryManager::continuous, ERROR, VirtualAddressSpace::getMapping(), Processor::information(), PhysicalMemoryManager::instance(), VirtualAddressSpace::isMapped(), m_pMemRegion, MemoryRegion::physicalAddress(), MemoryRegion::virtualAddress(), and VirtualAddressSpace::Write.

Ipc::IpcMessage::~IpcMessage ( )
virtual
Todo:
Problem: an endpoint might still have this message in a queue. We should notify it that we're now dead.

Definition at line 242 of file system/kernel/core/process/Ipc.cc.

References MemoryPool::free(), m_pMemRegion, and m_vAddr.

Ipc::IpcMessage::IpcMessage ( const IpcMessage src)
inline

Copy constructor. Used to create an IpcMessage on the other side of a send (ie, in the receiving process) when the size is < 4 KB. Creating an IpcMessage in another process when the size is over 4 KB should be done with IpcMessage(size_t, uintptr_t).

Definition at line 71 of file system/include/pedigree/kernel/process/Ipc.h.

References FATAL, m_pMemRegion, and m_vAddr.

Member Function Documentation

void * Ipc::IpcMessage::getBuffer ( )

Get the memory buffer for this IPC message. This is typically a shared memory region to avoid copies where possible.

Definition at line 256 of file system/kernel/core/process/Ipc.cc.

References m_pMemRegion, m_vAddr, and MemoryRegion::virtualAddress().

void * Ipc::IpcMessage::getHandle ( )

Get a handle for the region this message is in. Returns NULL for messages that do not have a size greater than 4 KB, as these are shared by default.

Definition at line 266 of file system/kernel/core/process/Ipc.cc.

References m_pMemRegion.

Member Data Documentation

MemoryRegion* Ipc::IpcMessage::m_pMemRegion
private

This is the memory region we can pass around as a handle IFF we are working with a region > 4 KB in size. Allocated as a result of the constructor with regionHandle == 0 and nBytes > 4096

Definition at line 89 of file system/include/pedigree/kernel/process/Ipc.h.

Referenced by getBuffer(), getHandle(), IpcMessage(), and ~IpcMessage().


The documentation for this class was generated from the following files: