react-os

ReactOS – Where are the ntdll.dll stubs?


I was just searching through the ReactOS source code on github and I can't find the system call stubs in ntdll. How is this implemented? I can see SharedUserData->SystemCall being set to KiIntSystemCall / KiFastSystemCall but I can't trace any use of it or where the call stubs actually are. I was expecting to see a big list of them in an asm file that gets assembled and linked when ntdll is built.


Solution

  • If you look closely at the CMakeFiles.txt of ReactOS' ntdll, you will notice it is linked with a static library called "ntdllsys". Grepping through the code shows that the build rules for this "ntdllsys" library are defined in ReactOS' ntoskrnl CMakeFiles.txt file. Looking further, the only source file for this library is a preprocessed-assembly file named "ntdll.S" It includes helper header files that do the magic ("syscalls.inc" for the platform-specific assembly helper, and "sysfuncs.h" for the list of the syscalls). The idea is that the actual stubs get automatically generated.