Commit e2ce07c8 authored by Pekka Enberg's avatar Pekka Enberg Committed by Ingo Molnar

x86: __show_registers() and __show_regs() API unification

Currently the low-level function to dump user-passed registers on i386 is
called __show_registers() whereas on x86-64 it's called __show_regs(). Unify
the API to simplify porting of kmemcheck to x86-64.
Signed-off-by: default avatarPekka Enberg <penberg@cs.helsinki.fi>
Acked-by: default avatarVegard Nossum <vegard.nossum@gmail.com>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent 1e0b5d00
...@@ -123,7 +123,7 @@ void cpu_idle(void) ...@@ -123,7 +123,7 @@ void cpu_idle(void)
} }
} }
void __show_registers(struct pt_regs *regs, int all) void __show_regs(struct pt_regs *regs, int all)
{ {
unsigned long cr0 = 0L, cr2 = 0L, cr3 = 0L, cr4 = 0L; unsigned long cr0 = 0L, cr2 = 0L, cr3 = 0L, cr4 = 0L;
unsigned long d0, d1, d2, d3, d6, d7; unsigned long d0, d1, d2, d3, d6, d7;
...@@ -189,7 +189,7 @@ void __show_registers(struct pt_regs *regs, int all) ...@@ -189,7 +189,7 @@ void __show_registers(struct pt_regs *regs, int all)
void show_regs(struct pt_regs *regs) void show_regs(struct pt_regs *regs)
{ {
__show_registers(regs, 1); __show_regs(regs, 1);
show_trace(NULL, regs, &regs->sp, regs->bp); show_trace(NULL, regs, &regs->sp, regs->bp);
} }
......
...@@ -136,7 +136,7 @@ void cpu_idle(void) ...@@ -136,7 +136,7 @@ void cpu_idle(void)
} }
/* Prints also some state that isn't saved in the pt_regs */ /* Prints also some state that isn't saved in the pt_regs */
void __show_regs(struct pt_regs *regs) void __show_regs(struct pt_regs *regs, int all)
{ {
unsigned long cr0 = 0L, cr2 = 0L, cr3 = 0L, cr4 = 0L, fs, gs, shadowgs; unsigned long cr0 = 0L, cr2 = 0L, cr3 = 0L, cr4 = 0L, fs, gs, shadowgs;
unsigned long d0, d1, d2, d3, d6, d7; unsigned long d0, d1, d2, d3, d6, d7;
...@@ -175,6 +175,9 @@ void __show_regs(struct pt_regs *regs) ...@@ -175,6 +175,9 @@ void __show_regs(struct pt_regs *regs)
rdmsrl(MSR_GS_BASE, gs); rdmsrl(MSR_GS_BASE, gs);
rdmsrl(MSR_KERNEL_GS_BASE, shadowgs); rdmsrl(MSR_KERNEL_GS_BASE, shadowgs);
if (!all)
return;
cr0 = read_cr0(); cr0 = read_cr0();
cr2 = read_cr2(); cr2 = read_cr2();
cr3 = read_cr3(); cr3 = read_cr3();
...@@ -200,7 +203,7 @@ void __show_regs(struct pt_regs *regs) ...@@ -200,7 +203,7 @@ void __show_regs(struct pt_regs *regs)
void show_regs(struct pt_regs *regs) void show_regs(struct pt_regs *regs)
{ {
printk(KERN_INFO "CPU %d:", smp_processor_id()); printk(KERN_INFO "CPU %d:", smp_processor_id());
__show_regs(regs); __show_regs(regs, 1);
show_trace(NULL, regs, (void *)(regs + 1), regs->bp); show_trace(NULL, regs, (void *)(regs + 1), regs->bp);
} }
......
...@@ -319,7 +319,7 @@ void show_registers(struct pt_regs *regs) ...@@ -319,7 +319,7 @@ void show_registers(struct pt_regs *regs)
int i; int i;
print_modules(); print_modules();
__show_registers(regs, 0); __show_regs(regs, 0);
printk(KERN_EMERG "Process %.*s (pid: %d, ti=%p task=%p task.ti=%p)", printk(KERN_EMERG "Process %.*s (pid: %d, ti=%p task=%p task.ti=%p)",
TASK_COMM_LEN, current->comm, task_pid_nr(current), TASK_COMM_LEN, current->comm, task_pid_nr(current),
......
...@@ -430,7 +430,7 @@ void show_registers(struct pt_regs *regs) ...@@ -430,7 +430,7 @@ void show_registers(struct pt_regs *regs)
sp = regs->sp; sp = regs->sp;
printk("CPU %d ", cpu); printk("CPU %d ", cpu);
__show_regs(regs); __show_regs(regs, 1);
printk("Process %s (pid: %d, threadinfo %p, task %p)\n", printk("Process %s (pid: %d, threadinfo %p, task %p)\n",
cur->comm, cur->pid, task_thread_info(cur), cur); cur->comm, cur->pid, task_thread_info(cur), cur);
......
...@@ -27,10 +27,9 @@ extern void printk_address(unsigned long address, int reliable); ...@@ -27,10 +27,9 @@ extern void printk_address(unsigned long address, int reliable);
extern void die(const char *, struct pt_regs *,long); extern void die(const char *, struct pt_regs *,long);
extern int __must_check __die(const char *, struct pt_regs *, long); extern int __must_check __die(const char *, struct pt_regs *, long);
extern void show_registers(struct pt_regs *regs); extern void show_registers(struct pt_regs *regs);
extern void __show_registers(struct pt_regs *, int all);
extern void show_trace(struct task_struct *t, struct pt_regs *regs, extern void show_trace(struct task_struct *t, struct pt_regs *regs,
unsigned long *sp, unsigned long bp); unsigned long *sp, unsigned long bp);
extern void __show_regs(struct pt_regs *regs); extern void __show_regs(struct pt_regs *regs, int all);
extern void show_regs(struct pt_regs *regs); extern void show_regs(struct pt_regs *regs);
extern unsigned long oops_begin(void); extern unsigned long oops_begin(void);
extern void oops_end(unsigned long, struct pt_regs *, int signr); extern void oops_end(unsigned long, struct pt_regs *, int signr);
......
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