Skip to content

Commit dc7b83d

Browse files
committed
auto merge of rust-lang#6650 : crabtw/rust/mips-rt, r=sanxiyn
Results of libcore and libstd tests ``` failures: rand::tests::test_rng_seeded_custom_seed2 time::tests::run_tests uv_ll::test::test_uv_ll_struct_size_addrinfo uv_ll::test::test_uv_ll_struct_size_uv_timer_t segfaults: stackwalk::test_simple stackwalk::test_simple_deep ```
2 parents 329d8e2 + d86a32b commit dc7b83d

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

src/libcore/rt/context.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,9 @@ fn new_regs() -> ~Registers { ~([0, .. 32]) }
183183

184184
#[cfg(target_arch = "mips")]
185185
fn initialize_call_frame(regs: &mut Registers, fptr: *c_void, arg: *c_void, sp: *mut uint) {
186-
let sp = mut_offset(sp, -1);
186+
let sp = align_down(sp);
187+
// sp of mips o32 is 8-byte aligned
188+
let sp = mut_offset(sp, -2);
187189

188190
// The final return address. 0 indicates the bottom of the stack
189191
unsafe { *sp = 0; }

src/rt/arch/mips/context.cpp

+4-2
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,11 @@ void context::call(void *f, void *arg, void *stack)
3434

3535
// set up the stack
3636
uint32_t *sp = (uint32_t *)stack;
37-
//sp = align_down(sp);
37+
sp = align_down(sp);
3838
// The final return address. 0 indicates the bottom of the stack
39-
*--sp = 0;
39+
// sp of mips o32 is 8-byte aligned
40+
sp -= 2;
41+
*sp = 0;
4042

4143
regs.data[4] = (uint32_t)arg;
4244
regs.data[29] = (uint32_t)sp;

0 commit comments

Comments
 (0)