mirror of
https://github.com/Fennix-Project/Kernel.git
synced 2025-05-28 15:34:33 +00:00
Improved CPU functions
This commit is contained in:
parent
9d6a4f530a
commit
8fd53ea9b2
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user