mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 12:17:44 +00:00
Kernel/aarch64: Implement set_exec_state in ThreadRegisters
This sets up the correct ThreadRegisters state when a process is exec'ed, which happens when the first userspace application is executed. Also changes Processor.cpp to get the stack pointer from the ThreadRegisters.
This commit is contained in:
parent
8960662e57
commit
5781d58fe8
2 changed files with 5 additions and 5 deletions
|
@ -241,7 +241,7 @@ FlatPtr Processor::init_context(Thread& thread, bool leave_crit)
|
||||||
// x30 is the Link Register for the aarch64 ABI, so this will return to exit_kernel_thread when main thread function returns.
|
// x30 is the Link Register for the aarch64 ABI, so this will return to exit_kernel_thread when main thread function returns.
|
||||||
eretframe.x[30] = FlatPtr(&exit_kernel_thread);
|
eretframe.x[30] = FlatPtr(&exit_kernel_thread);
|
||||||
eretframe.elr_el1 = thread_regs.elr_el1;
|
eretframe.elr_el1 = thread_regs.elr_el1;
|
||||||
eretframe.sp_el0 = kernel_stack_top;
|
eretframe.sp_el0 = thread_regs.sp_el0;
|
||||||
eretframe.tpidr_el0 = 0; // FIXME: Correctly initialize this when aarch64 has support for thread local storage.
|
eretframe.tpidr_el0 = 0; // FIXME: Correctly initialize this when aarch64 has support for thread local storage.
|
||||||
eretframe.spsr_el1 = thread_regs.spsr_el1;
|
eretframe.spsr_el1 = thread_regs.spsr_el1;
|
||||||
|
|
||||||
|
|
|
@ -39,10 +39,10 @@ struct ThreadRegisters {
|
||||||
|
|
||||||
void set_exec_state(FlatPtr entry_ip, FlatPtr userspace_sp, Memory::AddressSpace& space)
|
void set_exec_state(FlatPtr entry_ip, FlatPtr userspace_sp, Memory::AddressSpace& space)
|
||||||
{
|
{
|
||||||
(void)entry_ip;
|
set_ip(entry_ip);
|
||||||
(void)userspace_sp;
|
set_sp(userspace_sp);
|
||||||
(void)space;
|
ttbr0_el1 = space.page_directory().ttbr0();
|
||||||
TODO_AARCH64();
|
set_spsr_el1(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void set_spsr_el1(bool is_kernel_process)
|
void set_spsr_el1(bool is_kernel_process)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue