diff options
Diffstat (limited to 'include/asm-x86_64/system.h')
-rw-r--r-- | include/asm-x86_64/system.h | 34 |
1 files changed, 29 insertions, 5 deletions
diff --git a/include/asm-x86_64/system.h b/include/asm-x86_64/system.h index 6313d33a0686..02175aa1d16a 100644 --- a/include/asm-x86_64/system.h +++ b/include/asm-x86_64/system.h | |||
@@ -75,19 +75,31 @@ static inline unsigned long read_cr0(void) | |||
75 | unsigned long cr0; | 75 | unsigned long cr0; |
76 | asm volatile("movq %%cr0,%0" : "=r" (cr0)); | 76 | asm volatile("movq %%cr0,%0" : "=r" (cr0)); |
77 | return cr0; | 77 | return cr0; |
78 | } | 78 | } |
79 | 79 | ||
80 | static inline void write_cr0(unsigned long val) | 80 | static inline void write_cr0(unsigned long val) |
81 | { | 81 | { |
82 | asm volatile("movq %0,%%cr0" :: "r" (val)); | 82 | asm volatile("movq %0,%%cr0" :: "r" (val)); |
83 | } | 83 | } |
84 | |||
85 | static inline unsigned long read_cr2(void) | ||
86 | { | ||
87 | unsigned long cr2; | ||
88 | asm("movq %%cr2,%0" : "=r" (cr2)); | ||
89 | return cr2; | ||
90 | } | ||
91 | |||
92 | static inline void write_cr2(unsigned long val) | ||
93 | { | ||
94 | asm volatile("movq %0,%%cr2" :: "r" (val)); | ||
95 | } | ||
84 | 96 | ||
85 | static inline unsigned long read_cr3(void) | 97 | static inline unsigned long read_cr3(void) |
86 | { | 98 | { |
87 | unsigned long cr3; | 99 | unsigned long cr3; |
88 | asm("movq %%cr3,%0" : "=r" (cr3)); | 100 | asm("movq %%cr3,%0" : "=r" (cr3)); |
89 | return cr3; | 101 | return cr3; |
90 | } | 102 | } |
91 | 103 | ||
92 | static inline void write_cr3(unsigned long val) | 104 | static inline void write_cr3(unsigned long val) |
93 | { | 105 | { |
@@ -99,12 +111,24 @@ static inline unsigned long read_cr4(void) | |||
99 | unsigned long cr4; | 111 | unsigned long cr4; |
100 | asm("movq %%cr4,%0" : "=r" (cr4)); | 112 | asm("movq %%cr4,%0" : "=r" (cr4)); |
101 | return cr4; | 113 | return cr4; |
102 | } | 114 | } |
103 | 115 | ||
104 | static inline void write_cr4(unsigned long val) | 116 | static inline void write_cr4(unsigned long val) |
105 | { | 117 | { |
106 | asm volatile("movq %0,%%cr4" :: "r" (val) : "memory"); | 118 | asm volatile("movq %0,%%cr4" :: "r" (val) : "memory"); |
107 | } | 119 | } |
120 | |||
121 | static inline unsigned long read_cr8(void) | ||
122 | { | ||
123 | unsigned long cr8; | ||
124 | asm("movq %%cr8,%0" : "=r" (cr8)); | ||
125 | return cr8; | ||
126 | } | ||
127 | |||
128 | static inline void write_cr8(unsigned long val) | ||
129 | { | ||
130 | asm volatile("movq %0,%%cr8" :: "r" (val) : "memory"); | ||
131 | } | ||
108 | 132 | ||
109 | #define stts() write_cr0(8 | read_cr0()) | 133 | #define stts() write_cr0(8 | read_cr0()) |
110 | 134 | ||