summaryrefslogtreecommitdiff
path: root/x86.h
diff options
context:
space:
mode:
Diffstat (limited to 'x86.h')
-rw-r--r--x86.h55
1 files changed, 55 insertions, 0 deletions
diff --git a/x86.h b/x86.h
index fcd3062..986e1b0 100644
--- a/x86.h
+++ b/x86.h
@@ -121,6 +121,61 @@ sti(void)
asm volatile("sti");
}
+static inline void lcr0(uint val)
+{
+ asm volatile("movl %0,%%cr0" : : "r" (val));
+}
+
+static inline uint rcr0(void)
+{
+ uint val;
+ asm volatile("movl %%cr0,%0" : "=r" (val));
+ return val;
+}
+
+static inline uint rcr2(void)
+{
+ uint val;
+ asm volatile("movl %%cr2,%0" : "=r" (val));
+ return val;
+}
+
+static inline void lcr3(uint val)
+{
+ asm volatile("movl %0,%%cr3" : : "r" (val));
+}
+
+static inline uint rcr3(void)
+{
+ uint val;
+ asm volatile("movl %%cr3,%0" : "=r" (val));
+ return val;
+}
+
+static inline void lebp(uint val)
+{
+ asm volatile("movl %0,%%ebp" : : "r" (val));
+}
+
+static inline uint rebp(void)
+{
+ uint val;
+ asm volatile("movl %%ebp,%0" : "=r" (val));
+ return val;
+}
+
+static inline void lesp(uint val)
+{
+ asm volatile("movl %0,%%esp" : : "r" (val));
+}
+
+static inline uint resp(void)
+{
+ uint val;
+ asm volatile("movl %%esp,%0" : "=r" (val));
+ return val;
+}
+
//PAGEBREAK: 36
// Layout of the trap frame built on the stack by the
// hardware and by trapasm.S, and passed to trap().