Skip to content

Commit

Permalink
Kernel/aarch64: Perform an ISB after setting TTBR*_EL1
Browse files Browse the repository at this point in the history
Changes to ARM system registers are not guaranteed to be visible until
a context synchronization event, like performing an ISB.
  • Loading branch information
spholz committed Dec 18, 2024
1 parent 1d3a255 commit e447342
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions Kernel/Arch/aarch64/ASM_wrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,18 @@ namespace Kernel::Aarch64::Asm {

inline void set_ttbr1_el1(FlatPtr ttbr1_el1)
{
asm volatile("msr ttbr1_el1, %[value]" ::[value] "r"(ttbr1_el1));
asm volatile(R"(
msr ttbr1_el1, %[value]
isb
)" ::[value] "r"(ttbr1_el1));
}

inline void set_ttbr0_el1(FlatPtr ttbr0_el1)
{
asm volatile("msr ttbr0_el1, %[value]" ::[value] "r"(ttbr0_el1));
asm volatile(R"(
msr ttbr0_el1, %[value]
isb
)" ::[value] "r"(ttbr0_el1));
}

inline FlatPtr get_ttbr0_el1()
Expand Down

0 comments on commit e447342

Please sign in to comment.