OKL4 Inter-Process Communication (IPC)
The Message Tag: meta-data for your message
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 (with the actual payload of the message stored in subsequent MRs), and the OKL4 kernel extracts from MR 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, 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 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().