diff --git a/source/main.c b/source/main.c index 2cf4ecf..b74cd3c 100644 --- a/source/main.c +++ b/source/main.c @@ -9,7 +9,7 @@ const char* g_easterEgg = "Do you mean to tell me that you're thinking seriously static char g_argv[2048]; static char g_nextArgv[2048]; static char g_nextNroPath[512]; -static u64 g_nroAddr = 0; +u64 g_nroAddr = 0; static u64 g_nroSize = 0; static NroHeader g_nroHeader; static bool g_isApplication = 0; diff --git a/source/trampoline.s b/source/trampoline.s index acc25d8..aba82e1 100644 --- a/source/trampoline.s +++ b/source/trampoline.s @@ -4,6 +4,9 @@ .type nroEntrypointTrampoline, %function .align 2 +.global __libnx_exception_entry +.type __libnx_exception_entry, %function + .cfi_startproc nroEntrypointTrampoline: @@ -29,3 +32,21 @@ nroEntrypointTrampoline: b loadNro .cfi_endproc + +.section .text.__libnx_exception_entry, "ax", %progbits +.align 2 + +.cfi_startproc + +__libnx_exception_entry: + adrp x7, g_nroAddr + ldr x7, [x7, #:lo12:g_nroAddr] + cbz x7, __libnx_exception_entry_fail + br x7 + +__libnx_exception_entry_fail: + mov w0, #0xf801 + bl svcReturnFromException + b . + +.cfi_endproc