Commit ff6e8c0d authored by Zachary Amsden's avatar Zachary Amsden Committed by Linus Torvalds

[PATCH] x86: Cr4 is valid on some 486s

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: default avatarZachary Amsden <zach@vmware.com>
Cc: "Seth, Rohit" <rohit.seth@intel.com>
Cc: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent eb05c324
...@@ -308,9 +308,7 @@ void show_regs(struct pt_regs * regs) ...@@ -308,9 +308,7 @@ void show_regs(struct pt_regs * regs)
cr0 = read_cr0(); cr0 = read_cr0();
cr2 = read_cr2(); cr2 = read_cr2();
cr3 = read_cr3(); cr3 = read_cr3();
if (current_cpu_data.x86 > 4) { cr4 = read_cr4_safe();
cr4 = read_cr4();
}
printk("CR0: %08lx CR2: %08lx CR3: %08lx CR4: %08lx\n", cr0, cr2, cr3, cr4); printk("CR0: %08lx CR2: %08lx CR3: %08lx CR4: %08lx\n", cr0, cr2, cr3, cr4);
show_trace(NULL, &regs->esp); show_trace(NULL, &regs->esp);
} }
......
...@@ -140,6 +140,19 @@ static inline unsigned long _get_base(char * addr) ...@@ -140,6 +140,19 @@ static inline unsigned long _get_base(char * addr)
:"=r" (__dummy)); \ :"=r" (__dummy)); \
__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) \ #define write_cr4(x) \
__asm__ __volatile__("movl %0,%%cr4": :"r" (x)); __asm__ __volatile__("movl %0,%%cr4": :"r" (x));
#define stts() write_cr0(8 | read_cr0()) #define stts() write_cr0(8 | read_cr0())
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment