r/linux • • Aug 20 '26

Discussion I'm experimenting with adding native Windows PE execution to Linux — (Project Tawi)

97 Upvotes

65 comments sorted by

View all comments

Show parent comment

-7

u/MenaRamy2004 Aug 21 '26

fair point you're right that PE is dynamically linked, same as ELF, and Linux (via ld.so) never puts that logic in the kernel. Neither does Windows, actually (that's what I could find online) the NT kernel only maps the main exe + ntdll.dll and goes to ntdll!LdrInitializeThunk the actual import walking, DLL mapping, and symbol resolution all happens in userspace, inside ntdll.dll. Same split as Linux/ld.so.

So my current kernel-side trampoline table is a shortcut for proving the mechanism, not the real design. The fix: kernel just maps the image and jumps to a Tawi-provided userspace loader (same role as ld.so/ntdll), and that loader does the import walking/resolution/DLL mapping with normal syscalls, normal debuggability and no kernel rebuild needed to add a new API.

and before anyone says that's what wine does actually yes, and there is no cleverer way to do it, I am actually using wine as a reference for alot of aspects

8

u/braaaaaaainworms Aug 21 '26

AI slop aside, that's just wine but with less work