]> Chaos Git - corbenik/ctrulib.git/commitdiff
adjust stack before appInit
authorDave Murphy <davem@devkitpro.org>
Mon, 2 Mar 2015 10:41:37 +0000 (10:41 +0000)
committerDave Murphy <davem@devkitpro.org>
Mon, 2 Mar 2015 10:41:52 +0000 (10:41 +0000)
libctru/source/system/ctru_exit.c
libctru/source/system/initSystem.c
libctru/source/system/stack_adjust.s

index 6cd4a380012155e4b26041fc0451d4a6391160ca..a65cc4eac8417291db8394e9c4ce11a4e1ca3c16 100644 (file)
@@ -15,8 +15,6 @@ void __attribute__((weak)) __attribute__((noreturn)) __libctru_exit(int rc)
 {
        u32 tmp=0;
 
-       __appExit();
-
        // Unmap the linear heap
        svcControlMemory(&tmp, __linear_heap, 0x0, __linear_heap_size, MEMOP_FREE, 0x0);
 
index 4f1c59746bdee0fd013c07659a19d66b2d826ccd..b0cde6cf9731c4f6f5937dc7b3bc44d85e7b72e4 100644 (file)
@@ -32,6 +32,4 @@ void __attribute__((weak)) __libctru_init(void (*retAddr)(void))
        // Build argc/argv if present
        __system_initArgv();
 
-       __appInit();
-
 }
index 03513f06882f8a0e92e103a17e3220cca3b38888..2d15767c6025070511fbd8ca9c40a6cc9f54cc7d 100644 (file)
@@ -22,6 +22,8 @@ initSystem:
        bics    sp, sp, #7
        str     sp, [r2]
 
+
+       bl      __appInit
        bl      __libc_init_array
 
        ldr     r2, =saved_stack
@@ -34,6 +36,7 @@ initSystem:
 
 __ctru_exit:
        bl      __libc_fini_array
+       bl      __appExit
 
        ldr     r2, =saved_stack
        ldr     sp, [r2]