Improved CPU functions

This commit is contained in:
Alex 2022-10-27 03:18:24 +03:00
parent 9d6a4f530a
commit 8fd53ea9b2
Signed by untrusted user who does not match committer: enderice2
GPG Key ID: EACC3AD603BAB4DD

View File

@ -136,13 +136,16 @@ namespace CPU
/**
* @brief Pause the CPU
*/
__attribute__((no_stack_protector)) static inline void Pause()
__attribute__((no_stack_protector)) static inline void Pause(bool Loop = false)
{
do
{
#if defined(__amd64__) || defined(__i386__)
asmv("pause");
#elif defined(__aarch64__)
asmv("yield");
#endif
} while (Loop);
}
/**
@ -167,13 +170,16 @@ namespace CPU
/**
* @brief Halt the CPU
*/
__attribute__((no_stack_protector)) static inline void Halt()
__attribute__((no_stack_protector)) static inline void Halt(bool Loop = false)
{
do
{
#if defined(__amd64__) || defined(__i386__)
asmv("hlt");
#elif defined(__aarch64__)
asmv("wfe");
#endif
} while (Loop);
}
/**