Adding microkernel interface to RDOS
Posted: Mon Dec 17, 2012 12:21 am
Interesting design: http://i30www.ira.uka.de/~neider/edu/mk ... index.html.
Much of the design could be used as a starting-point for integrating a microkernel-like interface into RDOS.
For instance, the syscall interface from 64-bit applications would need to add some variables (in registers R8-R15) describing parameters so that pointers could be copied (with or without paging) to the lower 4G address space. Something similar to "strings" in L4 could be used.
The interface from a syscall in kernel to a 64-bit device driver could use a similar interface as well. Maybe I'll put 64-bit device-drivers at ring 1 or 2 instead of ring 3, mostly because such devices should be able to access the kernel-only syscalls, while applications should not.
One thing I think is not so good is to always use IPC. Looking at my current interface, there are quite a few server threads that looks like they could be replaced by an IPC mechanism. However, on closer inspection, most of the syscalls that interacts with server threads needs to do things before they interact, and typically also do things after they interact. Also, some syscalls block waiting for the server thread, while others don't. L4 have optimizations for handing over timeslice, and doing partial schedules. However, I really wonder why this is really necessary? Why not let the original thread migrate to the device-driver address space, and itself call the syscall entrypoint in "userland"? That would speed up the call considerably, mostly because the scheduler will not become involved at all. It would also allow multiple threads to execute in the device at the same time without starting multiple server-threads.
Another thing I don't like in L4 is timeouts. Why would anybody want to slow-down syscalls with timeouts when they really shouldn't be necessary? I think it is much better to ensure that server threads and functions requested are guaranteed to exist and work. This can be ensured in a similar manner as today's gate registrations. 64-bit device drivers would simply need to define entry-points and pointer parameters on startup, and the syscalls could only be executed when this information is present (that's another advantage of not using IPC).
Much of the design could be used as a starting-point for integrating a microkernel-like interface into RDOS.
For instance, the syscall interface from 64-bit applications would need to add some variables (in registers R8-R15) describing parameters so that pointers could be copied (with or without paging) to the lower 4G address space. Something similar to "strings" in L4 could be used.
The interface from a syscall in kernel to a 64-bit device driver could use a similar interface as well. Maybe I'll put 64-bit device-drivers at ring 1 or 2 instead of ring 3, mostly because such devices should be able to access the kernel-only syscalls, while applications should not.
One thing I think is not so good is to always use IPC. Looking at my current interface, there are quite a few server threads that looks like they could be replaced by an IPC mechanism. However, on closer inspection, most of the syscalls that interacts with server threads needs to do things before they interact, and typically also do things after they interact. Also, some syscalls block waiting for the server thread, while others don't. L4 have optimizations for handing over timeslice, and doing partial schedules. However, I really wonder why this is really necessary? Why not let the original thread migrate to the device-driver address space, and itself call the syscall entrypoint in "userland"? That would speed up the call considerably, mostly because the scheduler will not become involved at all. It would also allow multiple threads to execute in the device at the same time without starting multiple server-threads.
Another thing I don't like in L4 is timeouts. Why would anybody want to slow-down syscalls with timeouts when they really shouldn't be necessary? I think it is much better to ensure that server threads and functions requested are guaranteed to exist and work. This can be ensured in a similar manner as today's gate registrations. 64-bit device drivers would simply need to define entry-points and pointer parameters on startup, and the syscalls could only be executed when this information is present (that's another advantage of not using IPC).