Skip to content

Windows: Introduce a FEX unixlib and use for all linux syscalls#5424

Closed
bylaws wants to merge 2 commits into
FEX-Emu:mainfrom
bylaws:unixliiii
Closed

Windows: Introduce a FEX unixlib and use for all linux syscalls#5424
bylaws wants to merge 2 commits into
FEX-Emu:mainfrom
bylaws:unixliiii

Conversation

@bylaws

@bylaws bylaws commented Apr 17, 2026

Copy link
Copy Markdown
Collaborator

This avoids the ever increasing need to expose obscure or fex-specific linux features in wine patches and instead allows FEX to run its own linux code nicely - this could pave way for faster sigbus handling or smc (with far too much effort to the degree i think it's still a bad idea over hashing)

This is somewhat of a breaking change in that wine fex users will also need to install the unixlibs for full functionality, but seems far better in long-run.

Needs testing with shm stats and madvise naming to confirm it still works though before merging.

Mostly authored by claude, which is much better now than jan I must say

Comment thread Source/Windows/Unixlib/CMakeLists.txt
Comment thread Source/Windows/Unixlib/CMakeLists.txt
Comment thread Source/Windows/Unixlib/CMakeLists.txt
@bylaws

bylaws commented Apr 29, 2026

Copy link
Copy Markdown
Collaborator Author

updated


FEXCore::Allocator::HookPtrs Ptrs {};

// Wine will soon require us to use unixlib for calling helper routines that use Linux syscalls.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you double-check that the context/background provided in the original comments isn't just dropped (to the extent that it still applies)? The new comments are very sparse, and it seems easy enough to avoid repeating the lengthy conversation we had to produce the original comment.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think any of it is really meaningful to have as a code comment tbh, the comment exists to justify a codepath that no longer exists

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

// Wine will soon require us to use unixlib for calling helper routines that use Linux syscalls.
// It needs this for userspace syscall dispatch to capture rogue applications doing raw Windows syscalls.

That's the least bit that's still relevant context. Probably makes sense to reword it with the new implementation, but without this context the code begs the same questions we went through when adding this code initially (see discussion over there, trying to avoid repeating it here since adapting existing comments doesn't take that much time).

@bylaws

bylaws commented May 17, 2026

Copy link
Copy Markdown
Collaborator Author

updated

@Sonicadvance1

Copy link
Copy Markdown
Member

Since this is primarily authored by AI tools, I'm going to need to spend extra effort reviewing this PR, which is why I've been putting it off.

Dispatcher = *DispatcherPtr;
#endif

if (NtQueryVirtualMemory(NtCurrentProcess(), &__ImageBase, MemoryWineUnixFuncs, &UnixlibHandle, sizeof(UnixlibHandle), nullptr)) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Current Wine has MemoryWineLoadUnixLibByName, which allows passing unixlib name. With that, it should be possible to share unixlib among wow64 and arm64ec builds. We may backport that to Proton if needed.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh nice, that's much cleaner will switch :)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was this switched?

@Sonicadvance1

Copy link
Copy Markdown
Member

This is now implemented through a series of non-LLM related PRs, and I even understand it now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants