Minor revisions to xapi0.c comments

This commit is contained in:
KeybadeBlox 2026-02-22 19:26:09 -05:00
parent 823b19371c
commit 4dded02b58

View file

@ -71,7 +71,7 @@ the middle part of the function match is through writing the instructions
directly. Given that the C parts of this function are so simple that a human directly. Given that the C parts of this function are so simple that a human
and a compiler would reasonably produce the exact same code, and this function and a compiler would reasonably produce the exact same code, and this function
exhibits other oddities mentioned in the body, it's likely this whole function exhibits other oddities mentioned in the body, it's likely this whole function
was originally written purely in assemblys. In the spirit of decompilation, was originally written purely in assembly. In the spirit of decompilation,
however, we'll lift what we can into C. however, we'll lift what we can into C.
*/ */
XapiInitProcess(); XapiInitProcess();
@ -107,7 +107,7 @@ however, we'll lift what we can into C.
written function. If it was a function, it must have been written function. If it was a function, it must have been
inlined, but it couldn't be because it must be called from inlined, but it couldn't be because it must be called from
assembly to use the value in ecx that never went on the stack assembly to use the value in ecx that never went on the stack
(as passing data from C to assembly has to do). Notably, this (as passing data from assembly to C has to do). Notably, this
function's calling convention does require edi to be preserved, function's calling convention does require edi to be preserved,
but if left up to the compiler, it will push and pop edi in the but if left up to the compiler, it will push and pop edi in the
prologue and epilogue, not here (which this function must be prologue and epilogue, not here (which this function must be
@ -135,6 +135,7 @@ however, we'll lift what we can into C.
_cinit(); _cinit();
main(0, NULL, NULL); main(0, NULL, NULL);
// main() is not supposed to return, so error out if it does
XapiBootToDash(XLD_LAUNCH_DASHBOARD_ERROR, XLD_ERROR_INVALID_XBE, 0); XapiBootToDash(XLD_LAUNCH_DASHBOARD_ERROR, XLD_ERROR_INVALID_XBE, 0);
// Return 0 to satisfy signature required for thread functions // Return 0 to satisfy signature required for thread functions
@ -152,7 +153,7 @@ The linker automatically sets this function to the entrypoint.
*/ */
HANDLE thread; HANDLE thread;
// Figure out available thread-local storage // Figure out available thread-local storage (used by CreateThread())
XapiTlsSize = 4 + (( XapiTlsSize = 4 + ((
(_tls_used.EndAddressOfRawData - _tls_used.StartAddressOfRawData) + (_tls_used.EndAddressOfRawData - _tls_used.StartAddressOfRawData) +
_tls_used.SizeOfZeroFill _tls_used.SizeOfZeroFill