[okl4-developer] IPC

Josh Matthews jmatthews at ok-labs.com
Tue Apr 22 23:34:47 EST 2008


Hi Peter,

On Tue, Apr 22, 2008 at 7:52 PM, Peter Nguyen <peter.nguyen at adelaide.edu.au>
wrote:

>
> OK, so what functions can i use (assuming they exist) to specify how
> many message registers that i want to be transferred in an IPC call?


 All meta-data for a message - flags, label, and count of message registers
used - are stored in the message tag (a word of type L4_MsgTag_t, defined in
libs/l4/include/message.h). When an IPC is effected, the message tag is
stored in MR[0] (with the actual payload of the message stored in subsequent
MRs), and the OKL4 kernel extracts from MR[0] that meta-data.

Convenience functions are provided for the construction of a message that
appropriately modify the meta-data in the message tag. For example,
L4_MsgAppendWord will add the given word to the given message at the next
unused MR slot and increment the count of MRs in the given message's tag.
It's important to note that modifying a message (of type L4_Msg_t) does not
directly modify the MRs of the thread: an L4_MsgLoad must be performed after
constructing the message. This simply loads the message words out of the
message struct and into the thread's message registers - with the first,
MR[0], being set to the tag of the message.

Using such convenience functions means you needn't worry about setting the
number of MRs to be transferred yourself. That's still technically possible
though; if you wanted to construct an IPC using only L4_LoadMR you would
just need to ensure that you load MR[0] with an appropriately constructed
L4_MsgTag. The convenience functions are definitely recommended, however.

Additionally, the current number of MRs set in a given message tag can be
determined via L4_UntypedWords(msgtag), and the message tag from a received
(or just loaded) IPC can be retrieved via L4_MsgTag().

Best regards,

Josh Matthews
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.okl4.org/pipermail/developer/attachments/20080422/8357c2e0/attachment-0001.htm 


More information about the Developer mailing list