diff options
author | Frans Kaashoek <[email protected]> | 2010-07-02 14:51:53 -0400 |
---|---|---|
committer | Frans Kaashoek <[email protected]> | 2010-07-02 14:51:53 -0400 |
commit | 40889627ba50db29a64bc6a1553c2b21e6a99b78 (patch) | |
tree | 7cb8f51492af706cafdcaf1b01a5cac8073d5a38 /x86.h | |
parent | b7a517f2277670e156f150ee2cb7aae6426c6aef (diff) | |
download | xv6-labs-40889627ba50db29a64bc6a1553c2b21e6a99b78.tar.gz xv6-labs-40889627ba50db29a64bc6a1553c2b21e6a99b78.tar.bz2 xv6-labs-40889627ba50db29a64bc6a1553c2b21e6a99b78.zip |
Initial version of single-cpu xv6 with page tables
Diffstat (limited to 'x86.h')
-rw-r--r-- | x86.h | 55 |
1 files changed, 55 insertions, 0 deletions
@@ -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(). |