diff --git a/libexosphere/source/wdt/wdt_api.cpp b/libexosphere/source/wdt/wdt_api.cpp index cb26f5e0..ef9ad613 100644 --- a/libexosphere/source/wdt/wdt_api.cpp +++ b/libexosphere/source/wdt/wdt_api.cpp @@ -81,7 +81,8 @@ namespace ams::wdt { /* Enable the counters. */ reg::Write(registers + 0x188, 0x1); - while (true) { /* ... */ } + /* Wait forever until the reboot takes. */ + AMS_INFINITE_LOOP(); } #endif diff --git a/libmesosphere/include/mesosphere/kern_panic.hpp b/libmesosphere/include/mesosphere/kern_panic.hpp index 3e7eaf72..4f3b2384 100644 --- a/libmesosphere/include/mesosphere/kern_panic.hpp +++ b/libmesosphere/include/mesosphere/kern_panic.hpp @@ -69,7 +69,7 @@ namespace ams::kern { #define MESOSPHERE_UNIMPLEMENTED() MESOSPHERE_PANIC("%s: Unimplemented\n", __PRETTY_FUNCTION__) #define MESOSPHERE_ABORT() MESOSPHERE_PANIC("Abort()\n"); -#define MESOSPHERE_INIT_ABORT() do { /* ... */ } while (true) +#define MESOSPHERE_INIT_ABORT() AMS_INFINITE_LOOP() #define MESOSPHERE_ABORT_UNLESS(expr) \ ({ \ diff --git a/libmesosphere/source/board/nintendo/nx/kern_k_system_control.cpp b/libmesosphere/source/board/nintendo/nx/kern_k_system_control.cpp index ca6e0f58..3c73bc29 100644 --- a/libmesosphere/source/board/nintendo/nx/kern_k_system_control.cpp +++ b/libmesosphere/source/board/nintendo/nx/kern_k_system_control.cpp @@ -517,7 +517,7 @@ namespace ams::kern::board::nintendo::nx { } u32 dummy; smc::init::ReadWriteRegister(std::addressof(dummy), 0x7000E400, 0x10, 0x10); - while (true) { /* ... */ } + AMS_INFINITE_LOOP(); } /* User access. */ diff --git a/libmesosphere/source/board/nintendo/nx/kern_secure_monitor.cpp b/libmesosphere/source/board/nintendo/nx/kern_secure_monitor.cpp index 9405d8a6..8c7414c0 100644 --- a/libmesosphere/source/board/nintendo/nx/kern_secure_monitor.cpp +++ b/libmesosphere/source/board/nintendo/nx/kern_secure_monitor.cpp @@ -227,7 +227,7 @@ namespace ams::kern::board::nintendo::nx::smc { void NORETURN Panic(u32 color) { SecureMonitorArguments args = { FunctionId_Panic, color }; CallPrivilegedSecureMonitorFunction(args); - while (true) { /* ... */ } + AMS_INFINITE_LOOP(); } void CallSecureMonitorFromUser(ams::svc::lp64::SecureMonitorArguments *args) { diff --git a/libmesosphere/source/kern_main.cpp b/libmesosphere/source/kern_main.cpp index 063e6b30..ecf96e37 100644 --- a/libmesosphere/source/kern_main.cpp +++ b/libmesosphere/source/kern_main.cpp @@ -139,7 +139,7 @@ namespace ams::kern { /* Main() is done, and we should never get to this point. */ MESOSPHERE_PANIC("Main Thread continued after exit."); - while (true) { /* ... */ } + AMS_INFINITE_LOOP(); } } diff --git a/libstratosphere/source/result/result_on_assertion.cpp b/libstratosphere/source/result/result_on_assertion.cpp index 7d7d1372..7705c561 100644 --- a/libstratosphere/source/result/result_on_assertion.cpp +++ b/libstratosphere/source/result/result_on_assertion.cpp @@ -33,7 +33,7 @@ namespace ams::result::impl { /* TODO: ams::fatal:: */ fatalThrow(result.GetValue()); - while (true) { /* ... */ } + AMS_INFINITE_LOOP(); } NORETURN WEAK_SYMBOL void OnResultAbort(Result result) { @@ -50,7 +50,7 @@ namespace ams::result::impl { /* TODO: ams::fatal:: */ fatalThrow(result.GetValue()); - while (true) { /* ... */ } + AMS_INFINITE_LOOP(); } NORETURN WEAK_SYMBOL void OnResultAssertion(Result result) { diff --git a/libvapours/include/vapours/defines.hpp b/libvapours/include/vapours/defines.hpp index a4be456b..124508e3 100644 --- a/libvapours/include/vapours/defines.hpp +++ b/libvapours/include/vapours/defines.hpp @@ -65,3 +65,5 @@ #define AMS_ASSUME(expr) do { if (!static_cast((expr))) { __builtin_unreachable(); } } while (0) #define AMS_CURRENT_FUNCTION_NAME __FUNCTION__ + +#define AMS_INFINITE_LOOP() do { __asm__ __volatile__("" ::: "memory"); } while (1)