Quote:
So basically how do you copy from one user space to another?
There are many ways.
1) Use a segmented memory model so that more than one process can appear in memory at a time. Then memcpy.
2) Map part (or all) of the 2nd process into the 1st process' address space. Then memcpy.
3) Convert the 2nd process addresses to physical and map required pages. Then memcpy.
4) If messages are small, memcpy to kernel buffer, switch context then memcpy from kernel buffer to process.
5) Permanently map part (or all in x86_64) of physical mem into every address space. Convert one of the messages from virt to phys. Then memcpy page at a time.
6) Pass messages in a shared memory area, either globally shared, or shared between pairs of processes.
7) Have a kernel call that allocates a message buffer that can be transferred by the kernel from process to process.
etc.
For synchronous messages, in my 32bit x86 kernel I used 1, 4 and 3 (stopped using 3 when I bought more than 1G of RAM). In my 64bit x86 kernel I use 4 and 5.
For asynchronous messages, if the receive side isn't ready, I use fixed size allocations from the slaballocator and do a double copy.