revert stack changes, broken on hardware :(

This commit is contained in:
Dave Murphy 2014-12-30 04:05:12 +00:00
parent 02011660d5
commit da496b6a89
4 changed files with 5 additions and 41 deletions

View File

@ -7,7 +7,6 @@ u32 __linear_heap;
u32 __heapBase;
extern u32 __heap_size, __linear_heap_size;
u32 __attribute__((weak)) __stacksize__ = 32 * 1024;
void __attribute__((weak)) __system_allocateHeaps() {
u32 tmp=0;
@ -19,7 +18,7 @@ void __attribute__((weak)) __system_allocateHeaps() {
// Allocate the linear heap
svcControlMemory(&__linear_heap, 0x0, 0x0, __linear_heap_size, MEMOP_ALLOC_LINEAR, 0x3);
// Set up newlib heap
fake_heap_start = (char*)__heapBase + __stacksize__;
fake_heap_end = fake_heap_start + __heap_size - __stacksize__;
fake_heap_start = (char*)__heapBase;
fake_heap_end = fake_heap_start + __heap_size;
}
}

View File

@ -11,7 +11,7 @@ void __appExit();
void __libc_fini_array(void);
void __attribute__((weak)) __attribute__((noreturn)) __libctru_exit(int rc)
void __attribute__((weak)) __attribute__((noreturn)) __ctru_exit(int rc)
{
u32 tmp=0;

View File

@ -18,7 +18,7 @@ void __libc_init_array(void);
void __ctru_exit(int rc);
void __attribute__((weak)) __ctru_initSystem(void (*retAddr)(void))
void __attribute__((weak)) initSystem(void (*retAddr)(void))
{
// Register newlib exit() syscall

View File

@ -1,35 +0,0 @@
.text
.arm
.cpu mpcore
.global initSystem
.type initSystem STT_FUNC
@---------------------------------------------------------------------------------
initSystem:
@---------------------------------------------------------------------------------
ldr r0, =saved_lr
str lr, [r0]
str sp, [r0,#4]
bl __ctru_initSystem
ldr r0,=fake_heap_start
ldr sp, [r0]
ldr r0, =saved_lr
ldr pc, [r0]
.global __ctru_exit
.type __ctru_exit STT_FUNC
@---------------------------------------------------------------------------------
__ctru_exit:
@---------------------------------------------------------------------------------
ldr r1, =saved_stack
ldr sp, [r1]
b __libctru_exit
.pool
.bss
.align 2
saved_lr:
.space 4
saved_stack:
.space 4