git://scm.lunaixsky.com
/
lunaix-os.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
feat: No more kernel page table switching upon interrupt.
[lunaix-os.git]
/
lunaix-os
/
includes
/
hal
/
cpu.h
diff --git
a/lunaix-os/includes/hal/cpu.h
b/lunaix-os/includes/hal/cpu.h
index bdb07c467267c56aa911bf3f37795b10b0747fc1..b155d4b57496e67a93b99e6ddd7a58432b599789 100644
(file)
--- a/
lunaix-os/includes/hal/cpu.h
+++ b/
lunaix-os/includes/hal/cpu.h
@@
-39,19
+39,36
@@
cpu_has_apic();
static inline reg32
cpu_rcr0()
{
static inline reg32
cpu_rcr0()
{
- asm("mov %cr0, %eax");
+ uintptr_t val;
+ asm volatile("movl %%cr0,%0" : "=r" (val));
+ return val;
}
static inline reg32
cpu_rcr2()
{
}
static inline reg32
cpu_rcr2()
{
- asm("mov %cr2, %eax");
+ uintptr_t val;
+ asm volatile("movl %%cr2,%0" : "=r" (val));
+ return val;
}
static inline reg32
cpu_rcr3()
{
}
static inline reg32
cpu_rcr3()
{
- asm("mov %cr3, %eax");
+ uintptr_t val;
+ asm volatile("movl %%cr3,%0" : "=r" (val));
+ return val;
+}
+
+static inline reg32
+cpu_reflags()
+{
+ uintptr_t val;
+ asm volatile(
+ "pushf\n"
+ "popl %0\n"
+ :"=r"(val)::);
+ return val;
}
#pragma GCC diagnostic pop
}
#pragma GCC diagnostic pop