Line 4:
Line 4:
===__LoaderStart()===
===__LoaderStart()===
__LoaderStart() is the entry point of loader.elf, the first function called by both the kernel on process startup and loader calls from OSDynLoad. It takes a caller argument from the kernel in r3, which is 0 if called on process startup and 1 if called from OSDynLoad. There is also a loader call buffer passed in r4. If the function has been called from OSDynLoad, it goes to LOADER_Entry() and processes the loader call. Otherwise, it continues and sets up the app address space.
__LoaderStart() is the entry point of loader.elf, the first function called by both the kernel on process startup and loader calls from OSDynLoad. It takes a caller argument from the kernel in r3, which is 0 if called on process startup and 1 if called from OSDynLoad. There is also a loader call buffer passed in r4. If the function has been called from OSDynLoad, it goes to LOADER_Entry() and processes the loader call. Otherwise, it continues and sets up the app address space.
+
+
===LOADER_Entry(LoaderRequest* request)===
+
+
LoaderRequest structure:
+
+
<pre>
+
void* context; // 0
+
int procId; // 4
+
void* procConfig; // 8
+
void* anotherContext? // 12
+
char filler[24-12];// unknown
+
int dispatchCode; // 24
+
</pre>
+
+
These are copied to the matching LoaderEntry global variables at the start of this method.
+
+
Dispatch codes are from 0-11 (inclusive).