diff options
-rw-r--r-- | arch/i386/kernel/process.c | 4 | ||||
-rw-r--r-- | include/asm-i386/system.h | 13 |
2 files changed, 14 insertions, 3 deletions
diff --git a/arch/i386/kernel/process.c b/arch/i386/kernel/process.c index 2333aead0563..6081a10d3416 100644 --- a/arch/i386/kernel/process.c +++ b/arch/i386/kernel/process.c | |||
@@ -308,9 +308,7 @@ void show_regs(struct pt_regs * regs) | |||
308 | cr0 = read_cr0(); | 308 | cr0 = read_cr0(); |
309 | cr2 = read_cr2(); | 309 | cr2 = read_cr2(); |
310 | cr3 = read_cr3(); | 310 | cr3 = read_cr3(); |
311 | if (current_cpu_data.x86 > 4) { | 311 | cr4 = read_cr4_safe(); |
312 | cr4 = read_cr4(); | ||
313 | } | ||
314 | printk("CR0: %08lx CR2: %08lx CR3: %08lx CR4: %08lx\n", cr0, cr2, cr3, cr4); | 312 | printk("CR0: %08lx CR2: %08lx CR3: %08lx CR4: %08lx\n", cr0, cr2, cr3, cr4); |
315 | show_trace(NULL, ®s->esp); | 313 | show_trace(NULL, ®s->esp); |
316 | } | 314 | } |
diff --git a/include/asm-i386/system.h b/include/asm-i386/system.h index 772f85da1206..88b4d5c6f37a 100644 --- a/include/asm-i386/system.h +++ b/include/asm-i386/system.h | |||
@@ -140,6 +140,19 @@ static inline unsigned long _get_base(char * addr) | |||
140 | :"=r" (__dummy)); \ | 140 | :"=r" (__dummy)); \ |
141 | __dummy; \ | 141 | __dummy; \ |
142 | }) | 142 | }) |
143 | |||
144 | #define read_cr4_safe() ({ \ | ||
145 | unsigned int __dummy; \ | ||
146 | /* This could fault if %cr4 does not exist */ \ | ||
147 | __asm__("1: movl %%cr4, %0 \n" \ | ||
148 | "2: \n" \ | ||
149 | ".section __ex_table,\"a\" \n" \ | ||
150 | ".long 1b,2b \n" \ | ||
151 | ".previous \n" \ | ||
152 | : "=r" (__dummy): "0" (0)); \ | ||
153 | __dummy; \ | ||
154 | }) | ||
155 | |||
143 | #define write_cr4(x) \ | 156 | #define write_cr4(x) \ |
144 | __asm__ __volatile__("movl %0,%%cr4": :"r" (x)); | 157 | __asm__ __volatile__("movl %0,%%cr4": :"r" (x)); |
145 | #define stts() write_cr0(8 | read_cr0()) | 158 | #define stts() write_cr0(8 | read_cr0()) |