summary refs log tree commit diff
path: root/src/rt/arch/mips/morestack.S
blob: 266933df8c51c94d595ec935c00ea746b1c1204e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// Mark stack as non-executable
#if defined(__linux__) && defined(__ELF__)
.section        .note.GNU-stack, "", @progbits
#endif

/* See i386/morestack.S for the lengthy, general explanation. */

.text

.globl rust_stack_exhausted
.globl __morestack

.hidden __morestack

.cfi_startproc
.set nomips16
.ent __morestack
__morestack:
        .set noreorder
        .set nomacro

        addiu $29, $29, -4
        sw $30, 0($29)

        // 16 = 4 (current) + 12 (previous)
        .cfi_def_cfa_offset 16
        .cfi_offset 31, -4
        .cfi_offset 30, -16

        move $30, $29
        .cfi_def_cfa_register 30

        // O32 ABI always reserves 16 bytes for arguments
        addiu $29, $29, -16

        lw $25, %call16(rust_stack_exhausted)($28)
        jalr $25
        nop

        // the above function make sure that we never get here

.end __morestack
.cfi_endproc