rust/src/rt/arch/mips/record_sp.S
Alex Crichton 6d8330afb6 Use __morestack to detect stack overflow
This commit resumes management of the stack boundaries and limits when switching
between tasks. This additionally leverages the __morestack function to run code
on "stack overflow". The current behavior is to abort the process, but this is
probably not the best behavior in the long term (for deails, see the comment I
wrote up in the stack exhaustion routine).
2013-10-19 09:43:31 -07:00

40 lines
731 B
ArmAsm

// Mark stack as non-executable
#if defined(__linux__) && defined(__ELF__)
.section .note.GNU-stack, "", @progbits
#endif
.text
.globl record_sp_limit
.align 2
.set nomips16
.ent record_sp_limit
record_sp_limit:
.set noreorder
.set nomacro
.set push
.set mips32r2
rdhwr $3, $29
.set pop
addiu $3, $3, -0x7004
sw $4, 0($3)
jr $31
nop
.end record_sp_limit
.globl get_sp_limit
.align 2
.set nomips16
.ent get_sp_limit
get_sp_limit:
.set noreorder
.set nomacro
.set push
.set mips32r2
rdhwr $3, $29
.set pop
addiu $3, $3, -0x7004
lw $2, 0($3)
jr $31
nop
.end get_sp_limit