forked from M-Labs/libfringe
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:
parent
f3954ff7e5
commit
cd4fe1ecc8
|
@ -7,7 +7,6 @@
|
||||||
//! * eax: stack pointer
|
//! * eax: stack pointer
|
||||||
//! * ebx: function pointer
|
//! * ebx: function pointer
|
||||||
//! * ecx: data pointer
|
//! * ecx: data pointer
|
||||||
//! * edx: stack limit
|
|
||||||
//!
|
//!
|
||||||
//! return values:
|
//! return values:
|
||||||
//! * eax: new stack pointer
|
//! * eax: new stack pointer
|
||||||
|
@ -15,18 +14,15 @@
|
||||||
// switch to the fresh stack
|
// switch to the fresh stack
|
||||||
xchg %esp, %eax
|
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 %ecx
|
||||||
pushl %ebx
|
pushl %ebx
|
||||||
pushl %edx
|
|
||||||
|
|
||||||
// save the return address, control flow continues at label 1
|
// save the return address, control flow continues at label 1
|
||||||
call 1f
|
call 1f
|
||||||
// we arrive here once this context is reactivated (see swap.s)
|
// we arrive here once this context is reactivated (see swap.s)
|
||||||
|
|
||||||
// restore the stack limit, data pointer, and function pointer, respectively
|
// restore the function pointer (the data pointer is the first argument, which lives at the top of the stack)
|
||||||
// TODO: this stack limit location is specific to Linux/FreeBSD.
|
|
||||||
popl %gs:0x30
|
|
||||||
popl %eax
|
popl %eax
|
||||||
|
|
||||||
// initialise the frame pointer
|
// initialise the frame pointer
|
||||||
|
|
|
@ -18,7 +18,6 @@ impl Registers {
|
||||||
#[inline]
|
#[inline]
|
||||||
pub unsafe fn new<S, F>(stack: &mut S, f: F) -> Registers
|
pub unsafe fn new<S, F>(stack: &mut S, f: F) -> Registers
|
||||||
where S: Stack, F: FnOnce() -> Void {
|
where S: Stack, F: FnOnce() -> Void {
|
||||||
let sp_limit = stack.limit();
|
|
||||||
let mut sp = stack.top() as *mut usize;
|
let mut sp = stack.top() as *mut usize;
|
||||||
let f_ptr = push(&mut sp, f);
|
let f_ptr = push(&mut sp, f);
|
||||||
|
|
||||||
|
@ -26,8 +25,7 @@ impl Registers {
|
||||||
: "={eax}"(sp)
|
: "={eax}"(sp)
|
||||||
: "{eax}" (sp),
|
: "{eax}" (sp),
|
||||||
"{ebx}" (rust_trampoline::<F>),
|
"{ebx}" (rust_trampoline::<F>),
|
||||||
"{ecx}" (f_ptr),
|
"{ecx}" (f_ptr)
|
||||||
"{edx}" (sp_limit)
|
|
||||||
:
|
:
|
||||||
: "volatile");
|
: "volatile");
|
||||||
|
|
||||||
|
|
|
@ -6,19 +6,15 @@
|
||||||
//! arguments:
|
//! arguments:
|
||||||
//! * eax: stack pointer pointer
|
//! * eax: stack pointer pointer
|
||||||
|
|
||||||
// save the Rust stack limit and the frame pointer, respectively
|
// save the frame pointer
|
||||||
// TODO: this stack limit location is specific to Linux/FreeBSD.
|
|
||||||
pushl %gs:0x30
|
|
||||||
pushl %ebp
|
pushl %ebp
|
||||||
|
|
||||||
// save the return address to the stack, control flow continues at label 1
|
// save the return address to the stack, control flow continues at label 1
|
||||||
call 1f
|
call 1f
|
||||||
// we arrive here once this context is reactivated
|
// we arrive here once this context is reactivated
|
||||||
|
|
||||||
// restore the frame pointer and the Rust stack limit, respectively
|
// restore the frame pointer
|
||||||
popl %ebp
|
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
|
// and we merrily go on our way, back into Rust-land
|
||||||
jmp 2f
|
jmp 2f
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
//! * rdi: stack pointer
|
//! * rdi: stack pointer
|
||||||
//! * rsi: function pointer
|
//! * rsi: function pointer
|
||||||
//! * rdx: data pointer
|
//! * rdx: data pointer
|
||||||
//! * rcx: stack limit
|
|
||||||
//!
|
//!
|
||||||
//! return values:
|
//! return values:
|
||||||
//! * rdi: new stack pointer
|
//! * rdi: new stack pointer
|
||||||
|
@ -15,17 +14,15 @@
|
||||||
// switch to the fresh stack
|
// switch to the fresh stack
|
||||||
xchg %rsp, %rdi
|
xchg %rsp, %rdi
|
||||||
|
|
||||||
// save the function pointer, data pointer, and stack limit, respectively
|
// save the function pointer the data pointer, respectively
|
||||||
pushq %rsi
|
pushq %rsi
|
||||||
pushq %rdx
|
pushq %rdx
|
||||||
pushq %rcx
|
|
||||||
|
|
||||||
// save the return address, control flow continues at label 1
|
// save the return address, control flow continues at label 1
|
||||||
call 1f
|
call 1f
|
||||||
// we arrive here once this context is reactivated (see swap.s)
|
// we arrive here once this context is reactivated (see swap.s)
|
||||||
|
|
||||||
// restore the stack limit, data pointer, and function pointer, respectively
|
// restore the data pointer and the function pointer, respectively
|
||||||
popq %fs:0x70
|
|
||||||
popq %rdi
|
popq %rdi
|
||||||
popq %rax
|
popq %rax
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,6 @@ impl Registers {
|
||||||
#[inline]
|
#[inline]
|
||||||
pub unsafe fn new<S, F>(stack: &mut S, f: F) -> Registers
|
pub unsafe fn new<S, F>(stack: &mut S, f: F) -> Registers
|
||||||
where S: Stack, F: FnOnce() -> Void {
|
where S: Stack, F: FnOnce() -> Void {
|
||||||
let sp_limit = stack.limit();
|
|
||||||
let mut sp = stack.top() as *mut usize;
|
let mut sp = stack.top() as *mut usize;
|
||||||
let f_ptr = push(&mut sp, f);
|
let f_ptr = push(&mut sp, f);
|
||||||
|
|
||||||
|
@ -25,8 +24,7 @@ impl Registers {
|
||||||
: "={rdi}"(sp)
|
: "={rdi}"(sp)
|
||||||
: "{rdi}" (sp),
|
: "{rdi}" (sp),
|
||||||
"{rsi}" (rust_trampoline::<F>),
|
"{rsi}" (rust_trampoline::<F>),
|
||||||
"{rdx}" (f_ptr),
|
"{rdx}" (f_ptr)
|
||||||
"{rcx}" (sp_limit)
|
|
||||||
:
|
:
|
||||||
: "volatile");
|
: "volatile");
|
||||||
|
|
||||||
|
|
|
@ -9,17 +9,15 @@
|
||||||
// make sure we leave the red zone alone
|
// make sure we leave the red zone alone
|
||||||
sub $$128, %rsp
|
sub $$128, %rsp
|
||||||
|
|
||||||
// save the Rust stack limit and the frame pointer, respectively
|
// save the frame pointer
|
||||||
pushq %fs:0x70
|
|
||||||
pushq %rbp
|
pushq %rbp
|
||||||
|
|
||||||
// save the return address to the stack, control flow continues at label 1
|
// save the return address to the stack, control flow continues at label 1
|
||||||
call 1f
|
call 1f
|
||||||
// we arrive here once this context is reactivated
|
// 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 %rbp
|
||||||
popq %fs:0x70
|
|
||||||
|
|
||||||
// give back the red zone
|
// give back the red zone
|
||||||
add $$128, %rsp
|
add $$128, %rsp
|
||||||
|
|
Loading…
Reference in New Issue