about summary refs log tree commit diff
path: root/src/libcore
diff options
context:
space:
mode:
authorJyun-Yan You <jyyou@cs.nctu.edu.tw>2013-05-21 11:58:08 +0800
committerJyun-Yan You <jyyou@cs.nctu.edu.tw>2013-05-21 11:58:30 +0800
commitd86a32bbb2ff79232bf3edc0f475062f45b6ea90 (patch)
tree964199611d195b2a10ff45d59614cd6c0804756a /src/libcore
parent6c0a4693c94ffbb5601b59d0c82c7785d347107d (diff)
downloadrust-d86a32bbb2ff79232bf3edc0f475062f45b6ea90.tar.gz
rust-d86a32bbb2ff79232bf3edc0f475062f45b6ea90.zip
fix mips stack alignment
Diffstat (limited to 'src/libcore')
-rw-r--r--src/libcore/rt/context.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/libcore/rt/context.rs b/src/libcore/rt/context.rs
index 2add314fd11..f60ce342957 100644
--- a/src/libcore/rt/context.rs
+++ b/src/libcore/rt/context.rs
@@ -183,7 +183,9 @@ fn new_regs() -> ~Registers { ~([0, .. 32]) }
 
 #[cfg(target_arch = "mips")]
 fn initialize_call_frame(regs: &mut Registers, fptr: *c_void, arg: *c_void, sp: *mut uint) {
-    let sp = mut_offset(sp, -1);
+    let sp = align_down(sp);
+    // sp of mips o32 is 8-byte aligned
+    let sp = mut_offset(sp, -2);
 
     // The final return address. 0 indicates the bottom of the stack
     unsafe { *sp = 0; }