Kernel: Call exit_trap in AArch64 restore_context_and_eret
This matches x86_64's behaviour in common_trap_exit. (called from thread_context_first_enter) Currently thread_context_first_enter is only called when creating new processes from scratch, in which case this doesn't change the actual behaviour. But once thread_context_first_enter is called as part of execve support, this will ensure the Thread's m_current_trap is set correctly to the new trap frame.
This commit is contained in:
parent
a349570a04
commit
0dc5c49938
Notes:
sideshowbarker
2024-07-17 09:49:33 +09:00
Author: https://github.com/IdanHo Commit: https://github.com/SerenityOS/serenity/commit/0dc5c49938 Pull-request: https://github.com/SerenityOS/serenity/pull/18143 Reviewed-by: https://github.com/ADKaster Reviewed-by: https://github.com/FireFox317 Reviewed-by: https://github.com/Hendiadyoin1
4 changed files with 23 additions and 0 deletions
18
Kernel/Arch/aarch64/TrapFrame.cpp
Normal file
18
Kernel/Arch/aarch64/TrapFrame.cpp
Normal file
|
@ -0,0 +1,18 @@
|
|||
/*
|
||||
* Copyright (c) 2023, Idan Horowitz <idan.horowitz@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <Kernel/Arch/Processor.h>
|
||||
#include <Kernel/Arch/aarch64/TrapFrame.h>
|
||||
#include <Kernel/InterruptDisabler.h>
|
||||
|
||||
namespace Kernel {
|
||||
|
||||
extern "C" void exit_trap(TrapFrame* trap)
|
||||
{
|
||||
return Processor::current().exit_trap(*trap);
|
||||
}
|
||||
|
||||
}
|
|
@ -24,4 +24,6 @@ struct TrapFrame {
|
|||
TrapFrame& operator=(TrapFrame&&) = delete;
|
||||
};
|
||||
|
||||
extern "C" void exit_trap(TrapFrame*) __attribute__((used));
|
||||
|
||||
}
|
||||
|
|
|
@ -208,5 +208,7 @@ system_error_lower_el:
|
|||
|
||||
.global restore_context_and_eret
|
||||
restore_context_and_eret:
|
||||
mov x0, sp
|
||||
bl exit_trap
|
||||
restore_previous_context
|
||||
eret
|
||||
|
|
|
@ -471,6 +471,7 @@ elseif("${SERENITY_ARCH}" STREQUAL "aarch64")
|
|||
Arch/aarch64/Processor.cpp
|
||||
Arch/aarch64/SafeMem.cpp
|
||||
Arch/aarch64/SmapDisabler.cpp
|
||||
Arch/aarch64/TrapFrame.cpp
|
||||
Arch/aarch64/vector_table.S
|
||||
)
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue