diff options
| author | Brian Anderson <banderson@mozilla.com> | 2011-12-15 00:24:35 -0800 |
|---|---|---|
| committer | Brian Anderson <banderson@mozilla.com> | 2011-12-16 18:18:43 -0800 |
| commit | 121c4201844c1bec4a8f2a4450e4b9330ee9bf28 (patch) | |
| tree | 54b9576ba501dc5de392ad5a1a49d4ff11cd9c63 /src/rt/rust_upcall.cpp | |
| parent | 4f826b34cbb101f2bfe2660f5c4f8db6d044f83a (diff) | |
| download | rust-121c4201844c1bec4a8f2a4450e4b9330ee9bf28.tar.gz rust-121c4201844c1bec4a8f2a4450e4b9330ee9bf28.zip | |
rt: Insert stack alignment checks into upcalls
Diffstat (limited to 'src/rt/rust_upcall.cpp')
| -rw-r--r-- | src/rt/rust_upcall.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/rt/rust_upcall.cpp b/src/rt/rust_upcall.cpp index 97e1321c02d..dd7e275cd04 100644 --- a/src/rt/rust_upcall.cpp +++ b/src/rt/rust_upcall.cpp @@ -14,6 +14,14 @@ #include "rust_upcall.h" #include <stdint.h> + +// This is called to ensure we've set up our rust stacks +// correctly. Strategically placed at entry to upcalls because they begin on +// the rust stack and happen frequently enough to catch most stack changes, +// including at the beginning of all landing pads. +extern "C" void +check_stack_alignment() __attribute__ ((aligned (16))); + #define SWITCH_STACK(A, F) upcall_call_shim_on_c_stack((void*)A, (void*)F) extern "C" void record_sp(void *limit); @@ -26,6 +34,7 @@ extern "C" void record_sp(void *limit); */ extern "C" CDECL void upcall_call_shim_on_c_stack(void *args, void *fn_ptr) { + check_stack_alignment(); rust_task *task = rust_scheduler::get_task(); // FIXME (1226) - The shim functions generated by rustc contain the @@ -594,6 +603,7 @@ upcall_del_stack() { // needs to acquire the value of the stack pointer extern "C" CDECL void upcall_reset_stack_limit() { + check_stack_alignment(); rust_task *task = rust_scheduler::get_task(); task->reset_stack_limit(); } |
