void __attribute__((noreturn)) __libctru_exit(int rc) { u32 tmp=0; if(__system_argv) free(__system_argv); // Unmap the linear heap svcControlMemory(&tmp, __linear_heap, 0x0, __linear_heap_size, MEMOP_FREE, 0x0); // Unmap the application heap svcControlMemory(&tmp, __heapBase, 0x0, __heap_size, MEMOP_FREE, 0x0); if (__stack_size_extra) svcControlMemory(&tmp, __stack_bottom, 0x0, __stack_size_extra, MEMOP_FREE, 0x0); // Close some handles envDestroyHandles(); if (__sync_fini) __sync_fini(); // Jump to the loader if it provided a callback if (__system_retAddr) __system_retAddr(); // Since above did not jump, end this process svcExitProcess(); }
void __attribute__((noreturn)) __ctru_exit(int rc) { // Run the global destructors __libc_fini_array(); // TODO: APT exit goes here // Unmap the linear heap svcControlMemory(&__linear_heap, __linear_heap, 0x0, __linear_heap_size, MEMOP_FREE, 0x0); // Unmap the application heap svcControlMemory(&heapBase, heapBase, 0x0, __heap_size, MEMOP_FREE, 0x0); // Jump to the loader if it provided a callback if (__system_retAddr) __system_retAddr(); // Since above did not jump, end this process svcExitProcess(); }
void __attribute__((noreturn)) __libctru_exit(int rc) { u32 tmp=0; // Unmap the linear heap svcControlMemory(&tmp, __linear_heap, 0x0, linear_heap_size, MEMOP_FREE, 0x0); // Unmap the application heap svcControlMemory(&tmp, __heapBase, 0x0, heap_size, MEMOP_FREE, 0x0); // Close some handles __destroy_handle_list(); // Jump to the loader if it provided a callback if (__system_retAddr) __system_retAddr(); // Since above did not jump, end this process svcExitProcess(); }