mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 22:07:35 +00:00
Kernel/aarch64: Execute kernel with SP_EL1 instead of SP_EL0
Until now the kernel was always executing with SP_EL0, as this made the initial dropping to EL1 a bit easier. This commit changes this behaviour to use the corresponding SP_ELx for each exception level. To make sure that the execution of the C++ code can continue, the current stack pointer is copied into the corresponding SP_ELx just before dropping an exception level.
This commit is contained in:
parent
05659debd1
commit
247109cee6
5 changed files with 23 additions and 20 deletions
|
@ -252,9 +252,9 @@ FlatPtr Processor::init_context(Thread& thread, bool leave_crit)
|
|||
saved_program_status_register_el1.I = 0;
|
||||
saved_program_status_register_el1.F = 0;
|
||||
|
||||
// Set exception origin mode to EL1t, so when the context is restored, we'll be executing in EL1 with SP_EL0
|
||||
// Set exception origin mode to EL1h, so when the context is restored, we'll be executing in EL1 with SP_EL1
|
||||
// FIXME: This must be EL0t when aarch64 supports userspace applications.
|
||||
saved_program_status_register_el1.M = Aarch64::SPSR_EL1::Mode::EL1t;
|
||||
saved_program_status_register_el1.M = Aarch64::SPSR_EL1::Mode::EL1h;
|
||||
memcpy(&eretframe.spsr_el1, &saved_program_status_register_el1, sizeof(u64));
|
||||
|
||||
// Push a TrapFrame onto the stack
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue