Add isb and prevent CPU from postponing threadOnException memory writes

This commit is contained in:
TuxSH 2023-09-15 23:15:58 +02:00
parent a4634c0290
commit 0f098853f2
2 changed files with 9 additions and 0 deletions

View File

@ -42,6 +42,12 @@ static inline void __dmb(void)
__asm__ __volatile__("mcr p15, 0, %[val], c7, c10, 5" :: [val] "r" (0) : "memory");
}
/// Performs an Instruction Synchronization Barrier (officially "flush prefetch buffer") operation.
static inline void __isb(void)
{
__asm__ __volatile__("mcr p15, 0, %[val], c7, c5, 4" :: [val] "r" (0) : "memory");
}
/// Performs a clrex operation.
static inline void __clrex(void)
{

View File

@ -117,4 +117,7 @@ static inline void threadOnException(ExceptionHandler handler, void* stack_top,
*(u32*)(tls + 0x40) = (u32)handler;
*(u32*)(tls + 0x44) = (u32)stack_top;
*(u32*)(tls + 0x48) = (u32)exception_data;
__dsb();
__isb();
}