allow user configurable stack

This commit is contained in:
Dave Murphy 2014-12-30 22:37:53 +00:00
parent c68afb5f31
commit 192b88b6a2
3 changed files with 51 additions and 2 deletions

View File

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

View File

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

View File

@ -0,0 +1,49 @@
.arm
.align 2
.global initSystem
.type initSystem, %function
initSystem:
ldr r2, =saved_stack
str sp, [r2]
str lr, [r2,#4]
bl __libctru_init
ldr r2, =fake_heap_start
ldr sp, [r2]
ldr r3, =__stacksize__
ldr r3, [r3]
add sp, r3, #7
bics sp, sp, #7
str sp, [r2]
ldr r2, =saved_stack
ldr lr, [r2,#4]
bx lr
.global __ctru_exit
.type __ctru_exit, %function
__ctru_exit:
ldr r2, =saved_stack
ldr sp, [r2]
b __libctru_exit
.data
.align 2
__stacksize__:
.word 32 * 1024
.weak __stacksize__
.bss
.align 2
saved_stack:
.space 8