To protect your data, the CISO officer has suggested users to enable 2FA as soon as possible.
Currently 2.7% of users enabled 2FA.

Commit ff313350 authored by qinsoon's avatar qinsoon
Browse files

[wip] swapstack with stack arguments work

parent 3cb1eb83
......@@ -4636,10 +4636,17 @@ impl<'a> InstructionSelection {
vm
);
// move arguments that can be passed by registers
let (arg_regs, _) =
self.emit_precall_convention_regs_only(&arg_values, &callconv, f_context, vm);
if is_kill {
// save first GPR argument
self.backend.emit_push_r64(&x86_64::RDI);
// kill the old stack
self.emit_runtime_entry(
&entrypoints::KILL_STACK,
&entrypoints::SAFECALL_KILL_STACK,
vec![cur_stackref],
None,
Some(node),
......@@ -4647,11 +4654,9 @@ impl<'a> InstructionSelection {
f_context,
vm
);
}
// move arguments that can be passed by registers
let (arg_regs, _) =
self.emit_precall_convention_regs_only(&arg_values, &callconv, f_context, vm);
self.backend.emit_pop_r64(&x86_64::RDI);
}
// arguments are ready, we are starting continuation
let potential_exception_dest = match resumption {
......
......@@ -90,6 +90,17 @@ lazy_static! {
jit: RwLock::new(None),
};
// impl/decl: thread.rs
pub static ref SAFECALL_KILL_STACK: RuntimeEntrypoint = RuntimeEntrypoint {
sig: P(MuFuncSig{
hdr: MuEntityHeader::unnamed(ir::new_internal_id()),
ret_tys: vec![],
arg_tys: vec![STACKREF_TYPE.clone()]
}),
aot: ValueLocation::Relocatable(RegGroup::GPR, String::from("muentry_safecall_kill_stack")),
jit: RwLock::new(None),
};
// impl/decl: thread.rs
pub static ref NEW_THREAD_NORMAL: RuntimeEntrypoint = RuntimeEntrypoint {
sig: P(MuFuncSig{
......
......@@ -113,6 +113,51 @@ begin_func muentry_thread_exit
ret
end_func muentry_thread_exit
# muentry_safecall_kill_stack(cur_stackref: Address)
# %rdi
# This function will save all registers
begin_func muentry_safecall_kill_stack
pushq %rbp
movq %rsp, %rbp
pushq %rsi
pushq %rdx
pushq %rcx
pushq %r8
pushq %r9
subq $64, %rsp
movsd %xmm0, 0(%rsp)
movsd %xmm1, 8(%rsp)
movsd %xmm2, 16(%rsp)
movsd %xmm3, 24(%rsp)
movsd %xmm4, 32(%rsp)
movsd %xmm5, 40(%rsp)
movsd %xmm6, 48(%rsp)
movsd %xmm7, 56(%rsp)
call_to muentry_kill_stack
movsd 0(%rsp) ,%xmm0
movsd 8(%rsp) ,%xmm1
movsd 16(%rsp),%xmm2
movsd 24(%rsp),%xmm3
movsd 32(%rsp),%xmm4
movsd 40(%rsp),%xmm5
movsd 48(%rsp),%xmm6
movsd 56(%rsp),%xmm7
addq $64, %rsp
popq %r9
popq %r8
popq %rcx
popq %rdx
popq %rsi
popq %rbp
ret
end_func muentry_safecall_kill_stack
# muentry_throw_exception(obj: Address)
# %rdi
begin_func muentry_throw_exception
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment