mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 09:47:35 +00:00
Kernel: Implement do_assume_context for execve() on x86_64
This commit is contained in:
parent
247af7aa6a
commit
e979a88af4
1 changed files with 8 additions and 12 deletions
|
@ -36,29 +36,25 @@ asm(
|
||||||
);
|
);
|
||||||
// clang-format on
|
// clang-format on
|
||||||
|
|
||||||
#if ARCH(I386)
|
|
||||||
// clang-format off
|
// clang-format off
|
||||||
asm(
|
asm(
|
||||||
".global do_assume_context \n"
|
".global do_assume_context \n"
|
||||||
"do_assume_context: \n"
|
"do_assume_context: \n"
|
||||||
" movl 4(%esp), %ebx \n"
|
" movq %rdi, %r12 \n" // save thread ptr
|
||||||
" movl 8(%esp), %esi \n"
|
" movq %rsi, %r13 \n" // save flags
|
||||||
// We're going to call Processor::init_context, so just make sure
|
// We're going to call Processor::init_context, so just make sure
|
||||||
// we have enough stack space so we don't stomp over it
|
// we have enough stack space so we don't stomp over it
|
||||||
" subl $(" __STRINGIFY(4 + REGISTER_STATE_SIZE + TRAP_FRAME_SIZE + 4) "), %esp \n"
|
" subq $(" __STRINGIFY(16 + REGISTER_STATE_SIZE + TRAP_FRAME_SIZE + 8) "), %rsp \n"
|
||||||
" pushl %esi \n"
|
|
||||||
" pushl %ebx \n"
|
|
||||||
" cld \n"
|
" cld \n"
|
||||||
" call do_init_context \n"
|
" call do_init_context \n"
|
||||||
" addl $8, %esp \n"
|
" movq %rax, %rsp \n" // move stack pointer to what Processor::init_context set up for us
|
||||||
" movl %eax, %esp \n" // move stack pointer to what Processor::init_context set up for us
|
" movq %r12, %rdi \n" // to_thread
|
||||||
" pushl %ebx \n" // push to_thread
|
" movq %r12, %rsi \n" // from_thread
|
||||||
" pushl %ebx \n" // push from_thread
|
" movabs $thread_context_first_enter, %r12 \n" // should be same as regs.rip
|
||||||
" pushl $thread_context_first_enter \n" // should be same as tss.eip
|
" pushq %r12 \n"
|
||||||
" jmp enter_thread_context \n"
|
" jmp enter_thread_context \n"
|
||||||
);
|
);
|
||||||
// clang-format on
|
// clang-format on
|
||||||
#endif
|
|
||||||
|
|
||||||
String Processor::platform_string() const
|
String Processor::platform_string() const
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue