L 5.18:  Processing memory messages in do_long_ipc

(Revision 0 - 27 November 2000)

 

overview    This  section is a prologue for  the processing of memory messages. It checks if there are send and receive message buffers and if there are whether the addresses including header, memory words and string dopes are in the valid range. If there's a receiver fpage in the message header, it maps the message header in a similar way to the way it mapped the fpage in the message header in L5.16. A check is also made to see if the sender is sending too many dwords to fit in the total dword buffer space. If all these tests are passed, then the processing of direct and indirect strings is undertaken (L5.19 - L5.21). Else a return with and error message is taken.

data	L4_IPC_FPAGE_MASK    0x02 (m bit in message descriptor)
        L4_IPC_DECEIT_MASK   0x01 (d bit in message descriptor)
	RECEIVE_WINDOW_BASE  0x4000 0000 0000 0000 (base of XKSSEG)
	USER_ADDRESS_TOP     0x0000010000000000 (1 TB)
	TID_THREAD_MASK	     0000376000 (7 bit thread number field in tid)
	TID_THREAD_SHIFT     10 (shift to get thread # in lo order bit positions)
	RECV_WINDOW_SIZE     16*1024*1024 (16MB window size)
59-60 if send descriptor has address of a send message buffer
61-62,102 and if this address + the size of the message header is less than the 1TB max user VA
63-64 look at the send message header
65-74 and if there are no memory dwords and no strings
flush the tlb temporary window mapping entries (if there is a window) and return with the 'dope' on this
75-78 else if the receive descriptor m-bit is off (meaning that if there is an fpage, it is in the message header)
and if the receive descriptor has the address of a receive message buffer
and if this address + the size of the message header is less than the 1TB max user VA
we need to make a temporary mapping in the sender's VA space of the receiver's message buffer so sender can access receiver's header directly without a second copy
80-82 then  a receiver window base address in the sender VA space is constructed by adding the sender thread number * 16MB to the base of XKSSEG
80,83 and the receive descriptor address (rounded to a double word boundary) modulo 4MB is placed within that window and window_addr is set to that VA
84 the base address of the receiver's window in the receiver's VA space is stored in the sender's tcb
this is assumed to be on a 4MB boundary
79,85 finally an attempt is made to access the mapped receiver's message header which causes a page fault called a window fault (as in listing 5.16). This results in the window being mapped in the tlb so that the receive message header can be accessed  in the sender's address space (see L4.12 and L4.13)
86-90 if the sender message header + message dwords + message string dope words exceeds the top of  the 1TB user address space (see API slide 14) 
91-94 or if the receiver message header + message dwords + message string dope words exceeds the top of 1TB user address space 
95-97 or if the buffer space for send message dwords is greater than the total buffer space for message dwords
98-101 then return with a "message truncated" status without copying anything