Comments

Martin Decky

28 Aug 2017 18:07

Another, slightly related option would be to emulate the Linux syscalls on the exception-handling level, i.e. capturing the Linux system calls in the kernel and forwarding them to a user space emulator (possibly as IPC messages). This is basically what WINE (for Win32 binaries) and Windows Subsystem for Linux (for Linux binaries) is doing.

This would certainly require some small processing in the microkernel. I acknowledge that this is not very nice from the design point of view, even if done in a very abstract and emulation-neutral way. But the benefits would be total independence on the actual POSIX run-time (supporting musl would be as simple as supporting glibc) and the possibility to emulate even unmodified Linux binaries without any recompilation.

Certainly, the same approach could be used to emulate any syscall API, including Win32, *BSD, etc.

Vojtěch Horký

29 Aug 2017 14:43

Another, slightly related option would be to emulate the Linux syscalls on the exception-handling level, i.e. capturing the Linux system calls in the kernel and forwarding them to a user space emulator (possibly as IPC messages). This is basically what WINE (for Win32 binaries) and Windows Subsystem for Linux (for Linux binaries) is doing.

I also thought about this approach. But I decided that patching the syscalls at compile-time is much simpler to implement. But we can switch to the exception-handling later on (reusing the actual emulation layer). Now, I want to see whether it is doable at all: i.e. how much work would be needed to get GCC working again with this layer.