An implementation of SYS_SUPERVISE

3 Likes

that sounds very cool. iā€™d like to ask some ā€œnoobishā€ questions about potential applications of this:

if the parents process manages the syscalls of the supervised process, does that mean they donā€™t have to be Redox syscalls? that, for example, the parent process may offer syscalls for Linux, Windows, BSD, Haiku or whatever, and may provide libraries accordingly? i donā€™t know how Wine (for example) handles syscalls, but this looks like something that can make things like that easier or more transparentā€¦?

and speaking of transparency, this is kindof another issue but it seems to fit the ā€œthemeā€: what about cpu emulation and bytecode machines? i guess one can expose syscall interfaces to those as wellā€¦ basically i recently saw Wine running on an Linux ARM machine, using qemu to run x86 windows programs and i thought it was very cool. :wink:

as i (kinda) said, i donā€™t know too much about operating systems. but it seems interesting enough to ask anyway. :stuck_out_tongue:

1 Like

If Iā€™m not mistaken, this is only for Redox syscalls since you cannot call Windows syscalls on Redox. But if you want to run some process that emulates Windows and then run some process inside it and block its syscalls, then your emulator needs to do the "supervision " itself.

I found this question about wine and I think it answers few of your questions:
link

Thatā€™s sort of true. As long as the follow the same method for syscalling as Redox (INT 0x80 with fast-call and respond in RAX), you can customize the syscall interface as you want. So if the platform is similar enough (e.g. Linux), you can certainly use it for emulation. And that is one of the many motivations for introducing this syscall. It is faster than other methods for emulation, such as API translation or dynamic recompilation.

That is not really something for supervise. CPU-level emulation is a lot more than just system calls. It is not something that need a syscall (there would be near to zero advantages over having it in userspace). CPU-level emulation often requires some form of translation of the instruction, often through dynamic recompilation.