Loader: Fix (all?) remaining bugs in ldr:pm.

Loader now works when booted as a KIP1. NOTE: ldr:ro still needs
debugging.
This commit is contained in:
Michael Scire 2018-05-01 16:49:20 -06:00
parent 9944d8e7e1
commit e05f199394
18 changed files with 331 additions and 417 deletions

View file

@ -44,29 +44,30 @@ void __appInit(void) {
/* Initialize services we need (TODO: SPL) */
rc = smInitialize();
if (R_FAILED(rc))
if (R_FAILED(rc)) {
fatalSimple(MAKERESULT(Module_Libnx, LibnxError_InitFail_SM));
}
rc = fsInitialize();
if (R_FAILED(rc))
if (R_FAILED(rc)) {
fatalSimple(MAKERESULT(Module_Libnx, LibnxError_InitFail_FS));
}
rc = lrInitialize();
if (R_FAILED(rc))
if (R_FAILED(rc)) {
fatalSimple(0xCAFE << 4 | 1);
}
/* Disable.
rc = fsldrInitialize();
if (R_FAILED(rc))
if (R_FAILED(rc)) {
fatalSimple(0xCAFE << 4 | 2);
*/
fsdevInit();
}
}
void __appExit(void) {
/* Cleanup services. */
fsdevExit();
fsdevUnmountAll();
fsldrExit();
lrExit();
fsExit();
@ -81,12 +82,12 @@ int main(int argc, char **argv)
WaitableManager *server_manager = new WaitableManager(U64_MAX);
/* Add services to manager. */
server_manager->add_waitable(new ServiceServer<ProcessManagerService>("dbg:pm", 1));
server_manager->add_waitable(new ServiceServer<ShellService>("dbg:shel", 3));
server_manager->add_waitable(new ServiceServer<DebugMonitorService>("dbg:dmnt", 2));
server_manager->add_waitable(new ServiceServer<ProcessManagerService>("ldr:pm", 1));
server_manager->add_waitable(new ServiceServer<ShellService>("ldr:shel", 3));
server_manager->add_waitable(new ServiceServer<DebugMonitorService>("ldr:dmnt", 2));
if (!kernelAbove300()) {
/* On 1.0.0-2.3.0, Loader services ldr:ro instead of ro. */
server_manager->add_waitable(new ServiceServer<RelocatableObjectsService>("dbg:ro", 0x20));
server_manager->add_waitable(new ServiceServer<RelocatableObjectsService>("ldr:ro", 0x20));
}
/* Loop forever, servicing our services. */