diff options
| author | bors <bors@rust-lang.org> | 2014-06-24 13:46:54 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2014-06-24 13:46:54 +0000 |
| commit | 82ec1aef293ddc5c6373bd7f5ec323fafbdf7901 (patch) | |
| tree | 52730fbfa9ef29c85dd537fbd13829275e180504 /src/rt | |
| parent | 71fe44def9676d519f5ce5d7304e581a42cf2c70 (diff) | |
| parent | 34a384a128d9630679f9c90bb27eaa0822e5b798 (diff) | |
| download | rust-82ec1aef293ddc5c6373bd7f5ec323fafbdf7901.tar.gz rust-82ec1aef293ddc5c6373bd7f5ec323fafbdf7901.zip | |
auto merge of #14963 : w3ln4/rust/master, r=alexcrichton
The aim of these changes is not working out a generic bi-endianness architectures support but to allow people develop for little endian MIPS machines (issue #7190).
Diffstat (limited to 'src/rt')
| -rw-r--r-- | src/rt/arch/mipsel/_context.S | 88 | ||||
| -rw-r--r-- | src/rt/arch/mipsel/morestack.S | 43 | ||||
| -rw-r--r-- | src/rt/arch/mipsel/record_sp.S | 40 |
3 files changed, 171 insertions, 0 deletions
diff --git a/src/rt/arch/mipsel/_context.S b/src/rt/arch/mipsel/_context.S new file mode 100644 index 00000000000..cfe77cc3045 --- /dev/null +++ b/src/rt/arch/mipsel/_context.S @@ -0,0 +1,88 @@ +// Mark stack as non-executable +#if defined(__linux__) && defined(__ELF__) +.section .note.GNU-stack, "", @progbits +#endif + +.text +.globl rust_swap_registers +.align 2 +.set nomips16 +.ent rust_swap_registers +rust_swap_registers: + .set noreorder + .set nomacro + .set noat + sw $1, 1 * 4($4) + sw $2, 2 * 4($4) + sw $3, 3 * 4($4) + sw $4, 4 * 4($4) + sw $5, 5 * 4($4) + sw $6, 6 * 4($4) + sw $7, 7 * 4($4) + + sw $8, 8 * 4($4) + sw $9, 9 * 4($4) + sw $10, 10 * 4($4) + sw $11, 11 * 4($4) + sw $12, 12 * 4($4) + sw $13, 13 * 4($4) + sw $14, 14 * 4($4) + sw $15, 15 * 4($4) + + sw $16, 16 * 4($4) + sw $17, 17 * 4($4) + sw $18, 18 * 4($4) + sw $19, 19 * 4($4) + sw $20, 20 * 4($4) + sw $21, 21 * 4($4) + sw $22, 22 * 4($4) + sw $23, 23 * 4($4) + + sw $24, 24 * 4($4) + sw $25, 25 * 4($4) + sw $26, 26 * 4($4) + sw $27, 27 * 4($4) + sw $28, 28 * 4($4) + sw $29, 29 * 4($4) + sw $30, 30 * 4($4) + sw $31, 31 * 4($4) + + lw $1, 1 * 4($5) + lw $2, 2 * 4($5) + lw $3, 3 * 4($5) + lw $4, 4 * 4($5) + lw $6, 6 * 4($5) + lw $7, 7 * 4($5) + + lw $8, 8 * 4($5) + lw $9, 9 * 4($5) + lw $10, 10 * 4($5) + lw $11, 11 * 4($5) + lw $12, 12 * 4($5) + lw $13, 13 * 4($5) + lw $14, 14 * 4($5) + lw $15, 15 * 4($5) + + lw $16, 16 * 4($5) + lw $17, 17 * 4($5) + lw $18, 18 * 4($5) + lw $19, 19 * 4($5) + lw $20, 20 * 4($5) + lw $21, 21 * 4($5) + lw $22, 22 * 4($5) + lw $23, 23 * 4($5) + + lw $24, 24 * 4($5) + lw $25, 25 * 4($5) + lw $26, 26 * 4($5) + lw $27, 27 * 4($5) + lw $28, 28 * 4($5) + lw $29, 29 * 4($5) + lw $30, 30 * 4($5) + lw $31, 31 * 4($5) + + lw $5, 5 * 4($5) + + jr $31 + nop +.end rust_swap_registers diff --git a/src/rt/arch/mipsel/morestack.S b/src/rt/arch/mipsel/morestack.S new file mode 100644 index 00000000000..266933df8c5 --- /dev/null +++ b/src/rt/arch/mipsel/morestack.S @@ -0,0 +1,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 diff --git a/src/rt/arch/mipsel/record_sp.S b/src/rt/arch/mipsel/record_sp.S new file mode 100644 index 00000000000..a6dfa04edbb --- /dev/null +++ b/src/rt/arch/mipsel/record_sp.S @@ -0,0 +1,40 @@ +// 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 |
