]> Chaos Git - corbenik/ctrulib.git/commitdiff
__ctru_exit(): perform svcExitProcess() if there's no retAddr
authorfincs <fincs.alt1@gmail.com>
Wed, 20 Aug 2014 20:16:28 +0000 (22:16 +0200)
committerfincs <fincs.alt1@gmail.com>
Wed, 20 Aug 2014 20:16:28 +0000 (22:16 +0200)
libctru/include/3ds/svc.h
libctru/source/initSystem.c

index 9d4dcf6ba07edcc940dbc161be5271560b114899..535229a2df2e71594ab5803e8117f96b3c9ef5f5 100644 (file)
@@ -27,9 +27,9 @@ typedef enum {
 u32* getThreadCommandBuffer(void);
 
 s32  svcControlMemory(u32* addr_out, u32 addr0, u32 addr1, u32 size, MemOp op, MemPerm perm);
-void svcExitProcess();
+void __attribute__((noreturn)) svcExitProcess();
 s32  svcCreateThread(Handle* thread, ThreadFunc entrypoint, u32 arg, u32* stack_top, s32 thread_priority, s32 processor_id);
-void svcExitThread();
+void __attribute__((noreturn)) svcExitThread();
 void svcSleepThread(s64 ns);
 s32  svcCreateMutex(Handle* mutex, bool initially_locked);
 s32  svcReleaseMutex(Handle handle);
index 1f51c0340dc9abcc41151e068bc6d5d1fe4f462a..6176b344a86f378227d97ca4d1b40e48c7c6b07a 100644 (file)
@@ -20,7 +20,7 @@ extern char* fake_heap_end;
 
 static void initArgv();
 
-void __ctru_exit(int rc)
+void __attribute__((noreturn)) __ctru_exit(int rc)
 {
        // Run the global destructors
        __libc_fini_array();
@@ -35,8 +35,8 @@ void __ctru_exit(int rc)
        if (__system_retAddr)
                __system_retAddr();
 
-       // Since above did not jump: hang
-       for (;;);
+       // Since above did not jump, end this process
+       svcExitProcess();
 }
 
 void initSystem(void (*retAddr)(void))