From d0309c67cba14a5d3ca140c8294c5c03d1df425b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20S=C5=82abo=C5=84?= Date: Sat, 17 Aug 2024 21:22:10 +0200 Subject: [PATCH] arm: Use WFI instruction for arch_cpu_idle function MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit According to the ​ARMv7 Reference Manual, "Wait for Interrupt" is supported only through the WFI instruction on ARMv7. The currently used ARMv6 equivalent may not work on ARMv7 and newer CPUs. Fixes #18520 Change-Id: I69a136870654be33c0c789004e08bf610db3dd97 Reviewed-on: https://review.haiku-os.org/c/haiku/+/8044 Haiku-Format: Haiku-format Bot Reviewed-by: waddlesplash --- headers/private/kernel/arch/arm/arch_cpu.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/headers/private/kernel/arch/arm/arch_cpu.h b/headers/private/kernel/arch/arm/arch_cpu.h index a165f1ca09..3e557c008c 100644 --- a/headers/private/kernel/arch/arm/arch_cpu.h +++ b/headers/private/kernel/arch/arm/arch_cpu.h @@ -14,6 +14,7 @@ #define isb() __asm__ __volatile__("isb" : : : "memory") #define dsb() __asm__ __volatile__("dsb" : : : "memory") #define dmb() __asm__ __volatile__("dmb" : : : "memory") +#define wfi() __asm__ __volatile__("wfi" : : : "memory") #define set_ac() #define clear_ac() @@ -122,9 +123,7 @@ arch_cpu_pause(void) static inline void arch_cpu_idle(void) { - uint32 Rd = 0; - asm volatile("mcr p15, 0, %[c7format], c7, c0, 4" - : : [c7format] "r" (Rd) ); + wfi(); }