unnecessary show_regs cleanup

Pavel Machek (pavel@Elf.mj.gts.cz)
Mon, 25 Aug 1997 22:52:55 +0200


Hi!

I found two nearly-equivalent functions in arch/i386 kernel tree:
show_registers() and show_regs(). The second is rarely used (on user
request only), and prints much less data than first one (used by Oops
etc -> quite frequently ;-). I _think_ that it does no harm to replace
show_regs() with show_registers(). If confirmed, please include in std
kernel (makes it shorter, prints more info -> more usefull).

Diff is against 2.1.51.

Pavel

Index: kernel/process.c
===================================================================
RCS file: /home/pavel/cvsroot/linux/arch/i386/kernel/process.c,v
retrieving revision 1.3
diff -u -r1.3 process.c
--- process.c 1997/08/22 12:48:07 1.3
+++ process.c 1997/08/25 20:47:53
@@ -403,17 +403,7 @@

void show_regs(struct pt_regs * regs)
{
- printk("\n");
- printk("EIP: %04x:[<%08lx>]",0xffff & regs->xcs,regs->eip);
- if (regs->xcs & 3)
- printk(" ESP: %04x:%08lx",0xffff & regs->xss,regs->esp);
- printk(" EFLAGS: %08lx\n",regs->eflags);
- printk("EAX: %08lx EBX: %08lx ECX: %08lx EDX: %08lx\n",
- regs->eax,regs->ebx,regs->ecx,regs->edx);
- printk("ESI: %08lx EDI: %08lx EBP: %08lx",
- regs->esi, regs->edi, regs->ebp);
- printk(" DS: %04x ES: %04x\n",
- 0xffff & regs->xds,0xffff & regs->xes);
+show_registers( regs );
}

/*
Index: kernel/traps.c
===================================================================
RCS file: /home/pavel/cvsroot/linux/arch/i386/kernel/traps.c,v
retrieving revision 1.2
diff -u -r1.2 traps.c
--- traps.c 1997/07/08 12:12:58 1.2
+++ traps.c 1997/08/25 20:47:53
@@ -117,7 +117,7 @@
#define VMALLOC_OFFSET (8*1024*1024)
#define MODULE_RANGE (8*1024*1024)

-static void show_registers(struct pt_regs *regs)
+/*static*/ void show_registers(struct pt_regs *regs)
{
int i;
unsigned long esp;
@@ -125,6 +125,10 @@
unsigned long *stack, addr, module_start, module_end;
extern char _stext, _etext;

+ if (!regs) {
+ printk("CPU: %d\nRegister dump not available.\n", smp_processor_id());
+ return;
+ }
esp = (unsigned long) &regs->esp;
ss = KERNEL_DS;
if (regs->xcs & 3) {

-- 
I'm really pavel@atrey.karlin.mff.cuni.cz. 	   Pavel
Look at http://atrey.karlin.mff.cuni.cz/~pavel/ ;-).