diff --git a/libctru/include/3ds/synchronization.h b/libctru/include/3ds/synchronization.h index d8edfdc39..60cc2c806 100755 --- a/libctru/include/3ds/synchronization.h +++ b/libctru/include/3ds/synchronization.h @@ -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) { diff --git a/libctru/include/3ds/thread.h b/libctru/include/3ds/thread.h index 68c99ebf5..d37fdf3d5 100644 --- a/libctru/include/3ds/thread.h +++ b/libctru/include/3ds/thread.h @@ -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(); }