]> git.lizzy.rs Git - rust.git/commitdiff
libnative should not mess with stack limits in the TIB. Only libgreen has a legitima...
authorVadim Chugunov <vadimcn@gmail.com>
Sat, 5 Jul 2014 07:47:09 +0000 (00:47 -0700)
committerVadim Chugunov <vadimcn@gmail.com>
Tue, 5 Aug 2014 00:43:47 +0000 (17:43 -0700)
src/libgreen/context.rs
src/librustrt/stack.rs

index 45f41181bf8c71be1c4a9f1fcd7def9892e4b5d4..d681e53af42d57bb2868719bae612aa92108250a 100644 (file)
@@ -105,11 +105,11 @@ pub fn swap(out_context: &mut Context, in_context: &Context) {
             // invalid for the current task. Lucky for us `rust_swap_registers`
             // is a C function so we don't have to worry about that!
             match in_context.stack_bounds {
-                Some((lo, hi)) => stack::record_stack_bounds(lo, hi),
+                Some((lo, hi)) => stack::record_stack_bounds_green(lo, hi),
                 // If we're going back to one of the original contexts or
                 // something that's possibly not a "normal task", then reset
                 // the stack limit to 0 to make morestack never fail
-                None => stack::record_stack_bounds(0, uint::MAX),
+                None => stack::record_stack_bounds_green(0, uint::MAX),
             }
             rust_swap_registers(out_regs, in_regs)
         }
index 6544c020e09494bfd6707ac13fe97f7f69da8710..a79f453cf1ecb50634c1e9b31ae6cdcc3c028e07 100644 (file)
 }
 
 #[inline(always)]
-pub unsafe fn record_stack_bounds(stack_lo: uint, stack_hi: uint) {
+pub unsafe fn record_stack_bounds_green(stack_lo: uint, stack_hi: uint) {
     // When the old runtime had segmented stacks, it used a calculation that was
     // "limit + RED_ZONE + FUDGE". The red zone was for things like dynamic
     // symbol resolution, llvm function calls, etc. In theory this red zone
@@ -154,6 +154,11 @@ unsafe fn target_record_stack_bounds(stack_lo: uint, stack_hi: uint) {
     }
 }
 
+#[inline(always)]
+pub unsafe fn record_stack_bounds(stack_lo: uint, _stack_hi: uint) {
+    record_sp_limit(stack_lo + RED_ZONE);
+}
+
 /// Records the current limit of the stack as specified by `end`.
 ///
 /// This is stored in an OS-dependent location, likely inside of the thread