initSystem.c: revise heap code, disable global destructors due to crashes
This commit is contained in:
parent
0a1d0403d1
commit
66523edaae
@ -19,17 +19,17 @@ extern char* fake_heap_start;
|
|||||||
extern char* fake_heap_end;
|
extern char* fake_heap_end;
|
||||||
|
|
||||||
static void initArgv();
|
static void initArgv();
|
||||||
|
static u32 heapBase;
|
||||||
|
|
||||||
void __attribute__((noreturn)) __ctru_exit(int rc)
|
void __attribute__((noreturn)) __ctru_exit(int rc)
|
||||||
{
|
{
|
||||||
// Run the global destructors
|
// Run the global destructors -- disabled for now (it crashes for an unknown reason)
|
||||||
__libc_fini_array();
|
//__libc_fini_array();
|
||||||
|
|
||||||
// TODO: APT exit goes here
|
// TODO: APT exit goes here
|
||||||
|
|
||||||
// Unmap the heap
|
// Unmap the heap
|
||||||
u32 blockAddr;
|
svcControlMemory(&heapBase, heapBase, 0x0, __heap_size, MEMOP_FREE, 0x0);
|
||||||
svcControlMemory(&blockAddr, 0x08000000, 0x0, __heap_size, MEMOP_FREE, 0x0);
|
|
||||||
|
|
||||||
// Jump to the loader if it provided a callback
|
// Jump to the loader if it provided a callback
|
||||||
if (__system_retAddr)
|
if (__system_retAddr)
|
||||||
@ -46,11 +46,11 @@ void initSystem(void (*retAddr)(void))
|
|||||||
__system_retAddr = __service_ptr ? retAddr : NULL;
|
__system_retAddr = __service_ptr ? retAddr : NULL;
|
||||||
|
|
||||||
// Allocate the application heap
|
// Allocate the application heap
|
||||||
u32 blockAddr;
|
heapBase = 0x08000000;
|
||||||
svcControlMemory(&blockAddr, 0x08000000, 0x0, __heap_size, MEMOP_ALLOC, 0x3);
|
svcControlMemory(&heapBase, heapBase, 0x0, __heap_size, MEMOP_ALLOC, 0x3);
|
||||||
|
|
||||||
// Set up newlib heap
|
// Set up newlib heap
|
||||||
fake_heap_start = (char*)0x08000000;
|
fake_heap_start = (char*)heapBase;
|
||||||
fake_heap_end = fake_heap_start + __heap_size;
|
fake_heap_end = fake_heap_start + __heap_size;
|
||||||
|
|
||||||
// Build argc/argv if present
|
// Build argc/argv if present
|
||||||
|
Loading…
Reference in New Issue
Block a user