Remix.run Logo
lifis 3 hours ago

The code doesn't really seem to use any kernel functionality other than spinlocks/mutexes and waiting and waking up tasks.

That same code should be portable to userspace by: - Allocating everything into shared memory, where the shared memory fd replaces the ntsync device fd

- Using an index into a global table of object pointers instead of object fds

- Using futex-based mutexes instead of kernel spinlocks

- Using a futex-based parking/unparking system like parking_lot does

Obviously this breaks if the shared memory is corrupted or if you SIGKILL any process while it's touching it, but for Wine getting that seems acceptable. A kernel driver is clearly better though for this reason.

topspin an hour ago | parent [-]

People such as Figura and Bertazi have been attempting to do what you propose for most of a decade now[1]. They've ended up with this, after two previous implementations running in Wine for many years. Thier reasons are explained in their documentation[2]. Perhaps you know better. We all look forward to your work.

[1] https://lkml.org/lkml/2019/7/30/1399 [2] https://docs.kernel.org/userspace-api/ntsync.html