mirror of
https://github.com/wichtounet/thor-os.git
synced 2025-09-12 14:10:36 -04:00
Add a way to get RFLAGS register value
This commit is contained in:
parent
b3f1b9bbcc
commit
64b2e8d77a
@ -9,4 +9,23 @@ namespace arch {
|
||||
|
||||
void enable_sse();
|
||||
|
||||
inline size_t get_rflags(){
|
||||
size_t rflags;
|
||||
asm volatile("pushfq; pop %0;" : "=g" (rflags));
|
||||
return rflags;
|
||||
}
|
||||
|
||||
inline void disable_hwint(size_t& rflags){
|
||||
asm volatile("pushfq; pop %0; cli;" : "=g" (rflags));
|
||||
}
|
||||
|
||||
inline void enable_hwint(size_t& rflags){
|
||||
asm volatile("push %0; popfq; " :: "g" (rflags));
|
||||
}
|
||||
|
||||
inline bool interrupts_enabled(){
|
||||
auto flags = get_rflags();
|
||||
return flags & 0x200;
|
||||
}
|
||||
|
||||
} //enf of arch namespace
|
||||
|
Loading…
x
Reference in New Issue
Block a user