From: Tomas Hruby Date: Sat, 20 Mar 2010 14:59:18 +0000 (+0000) Subject: Kernel dumps its registers when exception X-Git-Tag: v3.1.7~218 X-Git-Url: http://zhaoyanbai.com/repos/?a=commitdiff_plain;h=a5094f7d7f662e20a37b6c94a46cab86586d734a;p=minix.git Kernel dumps its registers when exception - if an exception occurs in kernel and this exception is not handled in an sane way and the kernel crashes, it also dumps what was loaded in the general purpose registers exactly at the time of the exception to help to debug the problem --- diff --git a/kernel/arch/i386/exception.c b/kernel/arch/i386/exception.c index b1e22a85c..23031c17c 100644 --- a/kernel/arch/i386/exception.c +++ b/kernel/arch/i386/exception.c @@ -207,8 +207,25 @@ PUBLIC void exception_handler(int is_nested, struct exception_frame * frame) printf("\n%s\n", ep->msg); printf("is_nested = %d ", is_nested); - printf("vec_nr= %d, trap_errno= 0x%x, eip= 0x%x, cs= 0x%x, eflags= 0x%x trap_esp 0x%08x\n", - frame->vector, frame->errcode, frame->eip, frame->cs, frame->eflags, frame); + printf("vec_nr= %d, trap_errno= 0x%x, eip= 0x%x, " + "cs= 0x%x, eflags= 0x%x trap_esp 0x%08x\n", + frame->vector, frame->errcode, frame->eip, + frame->cs, frame->eflags, frame); + printf("KERNEL registers :\n"); + printf( + "\t%%eax 0x%08x %%ebx 0x%08x %%ecx 0x%08x %%edx 0x%08x\n" + "\t%%esp 0x%08x %%ebp 0x%08x %%esi 0x%08x %%edi 0x%08x\n", + ((u32_t *)frame)[-1], + ((u32_t *)frame)[-2], + ((u32_t *)frame)[-3], + ((u32_t *)frame)[-4], + ((u32_t *)frame)[-5], + ((u32_t *)frame)[-6], + ((u32_t *)frame)[-7], + ((u32_t *)frame)[-8] + ); + printseg("ker cs: ", 1, NULL, frame->cs); + printseg("ker ds: ", 0, NULL, DS_SELECTOR); /* TODO should we enable this only when compiled for some debug mode? */ if (saved_proc) { printf("scheduled was: process %d (%s), ", proc_nr(saved_proc), saved_proc->p_name);