1
0
Fork 0

remove obsolete support for Rust stack limits

rustc removed these in 7a3fdfbf674a08b7f6fd32c9124e52924a2f9a1c, and
this removes a Linux-specific TLS slot from our code.
This commit is contained in:
edef 2016-01-04 03:41:03 +01:00
parent f3954ff7e5
commit cd4fe1ecc8
6 changed files with 10 additions and 27 deletions

View File

@ -7,7 +7,6 @@
//! * eax: stack pointer
//! * ebx: function pointer
//! * ecx: data pointer
//! * edx: stack limit
//!
//! return values:
//! * eax: new stack pointer
@ -15,18 +14,15 @@
// switch to the fresh stack
xchg %esp, %eax
// save the data pointer, function pointer, and stack limit, respectively
// save the data pointer and the function pointer, respectively
pushl %ecx
pushl %ebx
pushl %edx
// save the return address, control flow continues at label 1
call 1f
// we arrive here once this context is reactivated (see swap.s)
// restore the stack limit, data pointer, and function pointer, respectively
// TODO: this stack limit location is specific to Linux/FreeBSD.
popl %gs:0x30
// restore the function pointer (the data pointer is the first argument, which lives at the top of the stack)
popl %eax
// initialise the frame pointer

View File

@ -18,7 +18,6 @@ impl Registers {
#[inline]
pub unsafe fn new<S, F>(stack: &mut S, f: F) -> Registers
where S: Stack, F: FnOnce() -> Void {
let sp_limit = stack.limit();
let mut sp = stack.top() as *mut usize;
let f_ptr = push(&mut sp, f);
@ -26,8 +25,7 @@ impl Registers {
: "={eax}"(sp)
: "{eax}" (sp),
"{ebx}" (rust_trampoline::<F>),
"{ecx}" (f_ptr),
"{edx}" (sp_limit)
"{ecx}" (f_ptr)
:
: "volatile");

View File

@ -6,19 +6,15 @@
//! arguments:
//! * eax: stack pointer pointer
// save the Rust stack limit and the frame pointer, respectively
// TODO: this stack limit location is specific to Linux/FreeBSD.
pushl %gs:0x30
// save the frame pointer
pushl %ebp
// save the return address to the stack, control flow continues at label 1
call 1f
// we arrive here once this context is reactivated
// restore the frame pointer and the Rust stack limit, respectively
// restore the frame pointer
popl %ebp
// TODO: this stack limit location is specific to Linux/FreeBSD.
popl %gs:0x30
// and we merrily go on our way, back into Rust-land
jmp 2f

View File

@ -7,7 +7,6 @@
//! * rdi: stack pointer
//! * rsi: function pointer
//! * rdx: data pointer
//! * rcx: stack limit
//!
//! return values:
//! * rdi: new stack pointer
@ -15,17 +14,15 @@
// switch to the fresh stack
xchg %rsp, %rdi
// save the function pointer, data pointer, and stack limit, respectively
// save the function pointer the data pointer, respectively
pushq %rsi
pushq %rdx
pushq %rcx
// save the return address, control flow continues at label 1
call 1f
// we arrive here once this context is reactivated (see swap.s)
// restore the stack limit, data pointer, and function pointer, respectively
popq %fs:0x70
// restore the data pointer and the function pointer, respectively
popq %rdi
popq %rax

View File

@ -17,7 +17,6 @@ impl Registers {
#[inline]
pub unsafe fn new<S, F>(stack: &mut S, f: F) -> Registers
where S: Stack, F: FnOnce() -> Void {
let sp_limit = stack.limit();
let mut sp = stack.top() as *mut usize;
let f_ptr = push(&mut sp, f);
@ -25,8 +24,7 @@ impl Registers {
: "={rdi}"(sp)
: "{rdi}" (sp),
"{rsi}" (rust_trampoline::<F>),
"{rdx}" (f_ptr),
"{rcx}" (sp_limit)
"{rdx}" (f_ptr)
:
: "volatile");

View File

@ -9,17 +9,15 @@
// make sure we leave the red zone alone
sub $$128, %rsp
// save the Rust stack limit and the frame pointer, respectively
pushq %fs:0x70
// save the frame pointer
pushq %rbp
// save the return address to the stack, control flow continues at label 1
call 1f
// we arrive here once this context is reactivated
// restore the frame pointer and the Rust stack limit, respectively
// restore the frame pointer
popq %rbp
popq %fs:0x70
// give back the red zone
add $$128, %rsp