]> bbs.cooldavid.org Git - net-next-2.6.git/commitdiff
[PATCH] x86: Cr4 is valid on some 486s
authorZachary Amsden <zach@vmware.com>
Fri, 6 Jan 2006 08:11:50 +0000 (00:11 -0800)
committerLinus Torvalds <torvalds@g5.osdl.org>
Fri, 6 Jan 2006 16:33:34 +0000 (08:33 -0800)
So some 486 processors do have CR4 register.  Allow them to present it in
register dumps by using the old fault technique rather than testing processor
family.

Thanks to Maciej for noticing this.

Signed-off-by: Zachary Amsden <zach@vmware.com>
Cc: "Seth, Rohit" <rohit.seth@intel.com>
Cc: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
arch/i386/kernel/process.c
include/asm-i386/system.h

index 2333aead0563a829b4bf7a4f26326657d2b19428..6081a10d34161098706928a6e97a5b604310f280 100644 (file)
@@ -308,9 +308,7 @@ void show_regs(struct pt_regs * regs)
        cr0 = read_cr0();
        cr2 = read_cr2();
        cr3 = read_cr3();
-       if (current_cpu_data.x86 > 4) {
-               cr4 = read_cr4();
-       }
+       cr4 = read_cr4_safe();
        printk("CR0: %08lx CR2: %08lx CR3: %08lx CR4: %08lx\n", cr0, cr2, cr3, cr4);
        show_trace(NULL, &regs->esp);
 }
index 772f85da1206af441de3d5df59892921931a8b51..88b4d5c6f37a76367b5bf3b4b51e98a04d3f5752 100644 (file)
@@ -140,6 +140,19 @@ static inline unsigned long _get_base(char * addr)
                :"=r" (__dummy)); \
        __dummy; \
 })
+
+#define read_cr4_safe() ({                           \
+       unsigned int __dummy;                         \
+       /* This could fault if %cr4 does not exist */ \
+       __asm__("1: movl %%cr4, %0              \n"   \
+               "2:                             \n"   \
+               ".section __ex_table,\"a\"      \n"   \
+               ".long 1b,2b                    \n"   \
+               ".previous                      \n"   \
+               : "=r" (__dummy): "0" (0));           \
+       __dummy;                                      \
+})
+
 #define write_cr4(x) \
        __asm__ __volatile__("movl %0,%%cr4": :"r" (x));
 #define stts() write_cr0(8 | read_cr0())