Skip to content

Commit 314605f

Browse files
crabtwbrson
authored andcommitted
rt: fix some bugs for MIPS target
1 parent c2a61d7 commit 314605f

File tree

4 files changed

+23
-2
lines changed

4 files changed

+23
-2
lines changed

src/rt/arch/mips/_context.S

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,4 +78,5 @@ swap_registers:
7878
lw $31, 31 * 4($5)
7979

8080
jr $31
81+
nop
8182
.end swap_registers

src/rt/arch/mips/ccall.S

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,22 @@
88
__morestack:
99
.set noreorder
1010
.set nomacro
11+
move $7, $29
12+
move $29, $6
1113

14+
sw $7, 0($29)
15+
sw $31, -4($29)
16+
17+
addiu $29, $29, -24
18+
move $25, $5
19+
jalr $25
20+
nop
21+
addiu $29, $29, 24
22+
23+
lw $31, -4($29)
24+
lw $7, 0($29)
25+
26+
move $29, $7
27+
jr $31
28+
nop
1229
.end __morestack

src/rt/arch/mips/gpr.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ class rust_gpr : public rust_gpr_base {
2121
uintptr_t r24, r25, r26, r27, r28, r29, r30, r31;
2222

2323
inline uintptr_t get_fp() { return r30; }
24-
inline uintptr_t get_ip() { return r0; }
24+
inline uintptr_t get_ip() { return r31; }
2525

2626
inline void set_fp(uintptr_t new_fp) { r30 = new_fp; }
27-
inline void set_ip(uintptr_t new_ip) { r0 = new_ip; }
27+
inline void set_ip(uintptr_t new_ip) { r31 = new_ip; }
2828

2929
void load();
3030
};

src/rt/arch/mips/record_sp.S

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ record_sp_limit:
1414
addiu $3, $3, -0x7008
1515
sw $4, 4($3)
1616
jr $31
17+
nop
1718
.end record_sp_limit
1819

1920
.globl get_sp_limit
@@ -30,6 +31,7 @@ get_sp_limit:
3031
addiu $3, $3, -0x7008
3132
lw $2, 4($3)
3233
jr $31
34+
nop
3335
.end get_sp_limit
3436

3537
.globl get_sp
@@ -41,4 +43,5 @@ get_sp:
4143
.set nomacro
4244
move $2, $29
4345
jr $31
46+
nop
4447
.end get_sp

0 commit comments

Comments
 (0)