sneak an extra argument in by using rbx for the jump target
This commit is contained in:
parent
3d35f5280d
commit
e0f2d48196
|
@ -62,11 +62,11 @@ pub fn initialise_call_frame(stack: &mut Stack, init: uintptr_t, args: &[uintptr
|
|||
rbp: 0,
|
||||
rsp: sp as uintptr_t,
|
||||
ip: bootstrap as uintptr_t,
|
||||
r12: init,
|
||||
rbx: init,
|
||||
.. Registers::new()
|
||||
};
|
||||
|
||||
match into_fields!(regs { rdi, r13, r14, r15 } <- args.iter().cloned()) {
|
||||
match into_fields!(regs { rdi, r12, r13, r14, r15 } <- args.iter().cloned()) {
|
||||
Some(mut args) => if args.next().is_some() {
|
||||
panic!("too many arguments")
|
||||
},
|
||||
|
|
11
src/arch.s
11
src/arch.s
|
@ -84,11 +84,12 @@ lwt_bootstrap:
|
|||
;; places the parameters in unrelated registers, and we frob them into place
|
||||
;; out here, in assembly-land. below are the parameter registers in order,
|
||||
;; along with the alternative register used in parentheses, if there is one.
|
||||
;; rdi, rsi (r13), rdx (r14), rcx (r15), r8, r9
|
||||
mov rsi, r13
|
||||
mov rdx, r14
|
||||
mov rcx, r15
|
||||
jmp r12
|
||||
;; rdi, rsi (r12), rdx (r13), rcx (r14), r8(r15), r9
|
||||
mov rsi, r12
|
||||
mov rdx, r13
|
||||
mov rcx, r14
|
||||
mov r8, r15
|
||||
jmp rbx
|
||||
|
||||
|
||||
;; Rust stores a stack limit at [fs:0x70]. These two functions set and retrieve
|
||||
|
|
Loading…
Reference in New Issue