about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorJyun-Yan You <jyyou@cs.nctu.edu.tw>2013-01-30 23:42:48 +0800
committerBrian Anderson <banderson@mozilla.com>2013-03-03 20:02:06 -0800
commit314605f94844dcff0b1fc5f94f195ab042023002 (patch)
tree99c6b388b4203ce13f9bcc6cb8fb2811d28b0339 /src
parentc2a61d7df33acc606209b0b020208c7f20212394 (diff)
rt: fix some bugs for MIPS target
Diffstat (limited to 'src')
-rw-r--r--src/rt/arch/mips/_context.S1
-rw-r--r--src/rt/arch/mips/ccall.S17
-rw-r--r--src/rt/arch/mips/gpr.h4
-rw-r--r--src/rt/arch/mips/record_sp.S3
4 files changed, 23 insertions, 2 deletions
diff --git a/src/rt/arch/mips/_context.S b/src/rt/arch/mips/_context.S
index a903557ba6c..614cf686817 100644
--- a/src/rt/arch/mips/_context.S
+++ b/src/rt/arch/mips/_context.S
@@ -78,4 +78,5 @@ swap_registers:
         lw $31, 31 * 4($5)
 
         jr $31
+        nop
 .end swap_registers
diff --git a/src/rt/arch/mips/ccall.S b/src/rt/arch/mips/ccall.S
index 184c4cd7e45..522714a8807 100644
--- a/src/rt/arch/mips/ccall.S
+++ b/src/rt/arch/mips/ccall.S
@@ -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
diff --git a/src/rt/arch/mips/gpr.h b/src/rt/arch/mips/gpr.h
index a174146e692..4ff0729633a 100644
--- a/src/rt/arch/mips/gpr.h
+++ b/src/rt/arch/mips/gpr.h
@@ -21,10 +21,10 @@ public:
     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();
 };
diff --git a/src/rt/arch/mips/record_sp.S b/src/rt/arch/mips/record_sp.S
index 6821b175c9e..6b782fc4629 100644
--- a/src/rt/arch/mips/record_sp.S
+++ b/src/rt/arch/mips/record_sp.S
@@ -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
@@ -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
@@ -41,4 +43,5 @@ get_sp:
         .set nomacro
         move $2, $29
         jr $31
+        nop
 .end get_sp