Skip to content

Commit

Permalink
rt: fix some bugs for MIPS target
Browse files Browse the repository at this point in the history
  • Loading branch information
crabtw authored and brson committed Mar 4, 2013
1 parent c2a61d7 commit 314605f
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/rt/arch/mips/_context.S
Expand Up @@ -78,4 +78,5 @@ swap_registers:
lw $31, 31 * 4($5)

jr $31
nop
.end swap_registers
17 changes: 17 additions & 0 deletions src/rt/arch/mips/ccall.S
Expand Up @@ -8,5 +8,22 @@
__morestack:
.set noreorder
.set nomacro
move $7, $29
move $29, $6

sw $7, 0($29)
sw $31, -4($29)

addiu $29, $29, -24
move $25, $5
jalr $25
nop
addiu $29, $29, 24

lw $31, -4($29)
lw $7, 0($29)

move $29, $7
jr $31
nop
.end __morestack
4 changes: 2 additions & 2 deletions src/rt/arch/mips/gpr.h
Expand Up @@ -21,10 +21,10 @@ class rust_gpr : public rust_gpr_base {
uintptr_t r24, r25, r26, r27, r28, r29, r30, r31;

inline uintptr_t get_fp() { return r30; }
inline uintptr_t get_ip() { return r0; }
inline uintptr_t get_ip() { return r31; }

inline void set_fp(uintptr_t new_fp) { r30 = new_fp; }
inline void set_ip(uintptr_t new_ip) { r0 = new_ip; }
inline void set_ip(uintptr_t new_ip) { r31 = new_ip; }

void load();
};
Expand Down
3 changes: 3 additions & 0 deletions src/rt/arch/mips/record_sp.S
Expand Up @@ -14,6 +14,7 @@ record_sp_limit:
addiu $3, $3, -0x7008
sw $4, 4($3)
jr $31
nop
.end record_sp_limit

.globl get_sp_limit
Expand All @@ -30,6 +31,7 @@ get_sp_limit:
addiu $3, $3, -0x7008
lw $2, 4($3)
jr $31
nop
.end get_sp_limit

.globl get_sp
Expand All @@ -41,4 +43,5 @@ get_sp:
.set nomacro
move $2, $29
jr $31
nop
.end get_sp

0 comments on commit 314605f

Please sign in to comment.