diff options
author | Gunnar Beutner <gbeutner@serenityos.org> | 2021-06-28 17:08:41 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-06-28 22:29:28 +0200 |
commit | e979a88af4d4a1fea392a7620436bd37579a6a1f (patch) | |
tree | ee88010fa5efe788ec3bc796e36b0241b502955c /Kernel | |
parent | 247af7aa6addbd11303a56cce5a18def8cdf86bb (diff) | |
download | serenity-e979a88af4d4a1fea392a7620436bd37579a6a1f.zip |
Kernel: Implement do_assume_context for execve() on x86_64
Diffstat (limited to 'Kernel')
-rw-r--r-- | Kernel/Arch/x86/x86_64/Processor.cpp | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/Kernel/Arch/x86/x86_64/Processor.cpp b/Kernel/Arch/x86/x86_64/Processor.cpp index fbbe0f9528..ccf46873b3 100644 --- a/Kernel/Arch/x86/x86_64/Processor.cpp +++ b/Kernel/Arch/x86/x86_64/Processor.cpp @@ -36,29 +36,25 @@ asm( ); // clang-format on -#if ARCH(I386) // clang-format off asm( ".global do_assume_context \n" "do_assume_context: \n" -" movl 4(%esp), %ebx \n" -" movl 8(%esp), %esi \n" +" movq %rdi, %r12 \n" // save thread ptr +" movq %rsi, %r13 \n" // save flags // We're going to call Processor::init_context, so just make sure // we have enough stack space so we don't stomp over it -" subl $(" __STRINGIFY(4 + REGISTER_STATE_SIZE + TRAP_FRAME_SIZE + 4) "), %esp \n" -" pushl %esi \n" -" pushl %ebx \n" +" subq $(" __STRINGIFY(16 + REGISTER_STATE_SIZE + TRAP_FRAME_SIZE + 8) "), %rsp \n" " cld \n" " call do_init_context \n" -" addl $8, %esp \n" -" movl %eax, %esp \n" // move stack pointer to what Processor::init_context set up for us -" pushl %ebx \n" // push to_thread -" pushl %ebx \n" // push from_thread -" pushl $thread_context_first_enter \n" // should be same as tss.eip +" movq %rax, %rsp \n" // move stack pointer to what Processor::init_context set up for us +" movq %r12, %rdi \n" // to_thread +" movq %r12, %rsi \n" // from_thread +" movabs $thread_context_first_enter, %r12 \n" // should be same as regs.rip +" pushq %r12 \n" " jmp enter_thread_context \n" ); // clang-format on -#endif String Processor::platform_string() const { |