Re: 2.2.14pre5: kmem_grow: Called nonatomically from int ...

Petr Vandrovec Ing. VTEI (VANDROVE@vc.cvut.cz)
Fri, 19 Nov 1999 17:13:51 MET-1


On 19 Nov 99 at 07:32 Manfred wrote:
> > Hmm... nice! Is there a way to get a stacktrace without forcing an oops?
> Several architectures have a 'show_stack()' function (eg
> dik_show_trace() on alpha)
> Unfortunately, i386 doesn't have that function.
Hi,
I missed original posting, so I write it here to the list.
I'm using this patch for matroxfb debugging version - it prints
CPU registers and call stack at the time of call to printstate()
and as it does not invoke oops, code continues after this function
instead of exiting from kernel without unlocking spinlocks, enabling
interrupts and so on... I do not know, whether other archs have similar
function, so I choosed 'printstate()' name.
Patch is from 2.3.29-pre1, but should apply to anything above 2.1.100.
Best regards,
Petr Vandrovec
vandrove@vc.cvut.cz

diff -urdN linux/arch/i386/kernel/traps.c linux/arch/i386/kernel/traps.c
--- linux/arch/i386/kernel/traps.c Wed Oct 27 15:13:50 1999
+++ linux/arch/i386/kernel/traps.c Fri Nov 19 10:53:56 1999
@@ -200,6 +200,42 @@
printk("\n");
}

+void printstate(void) {
+ asm volatile (
+ "pushl %%ss\n\t"
+ "pushl %%esp\n\t"
+ "pushfl\n\t"
+ "pushl %%cs\n\t"
+ "call 1f\n"
+ "1:\n\t"
+ "pushl %%eax\n\t"
+ "pushl %%ds\n\t"
+ "pushl %%es\n\t"
+ "pushl %%eax\n\t"
+ "pushl %%ebp\n\t"
+ "pushl %%edi\n\t"
+ "pushl %%esi\n\t"
+ "pushl %%edx\n\t"
+ "pushl %%ecx\n\t"
+ "pushl %%ebx\n\t"
+ "movl %%esp,%%eax\n\t"
+ "pushl %%eax\n\t"
+ "call show_registers\n\t"
+ "addl $4,%%esp\n\t"
+ "popl %%ebx\n\t"
+ "popl %%ecx\n\t"
+ "popl %%edx\n\t"
+ "popl %%esi\n\t"
+ "popl %%edi\n\t"
+ "popl %%ebp\n\t"
+ "popl %%eax\n\t"
+ "popl %%es\n\t"
+ "popl %%ds\n\t"
+ "popl %%eax\n\t"
+ "addl $20,%%esp\n\t"
+ : : : "memory" );
+}
+
spinlock_t die_lock;

void die(const char * str, struct pt_regs * regs, long err)

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/