RE: a small doubt

Richard B. Johnson (root@chaos.analogic.com)
Fri, 8 Oct 1999 10:47:10 -0400 (EDT)


On Fri, 8 Oct 1999, Bret Indrelee wrote:

>
> What is wrong with just using the existing panic() from kernel.h?
>
> If there is information that panic() doesn't save which you would get with
> an OOPS message, then that is a problem with panic.
>
> -Bret

Check out panic. All it does (and all it's supposed to do) is
write a message and halt the machine. Panic doesn't 'save' anything. It
doesn't have any information to, as you say, save.

NORET_TYPE void panic(const char * fmt, ...)
{
static char buf[1024];
va_list args;

va_start(args, fmt);
vsprintf(buf, fmt, args);
va_end(args);
printk(KERN_EMERG "Kernel panic: %s\n",buf);
if (current == task[0])
printk(KERN_EMERG "In swapper task - not syncing\n");
else if (in_interrupt())
printk(KERN_EMERG "In interrupt handler - not syncing\n");
else
sys_sync();

unblank_console();

Then do auto-restart if enabled.

If you want a stack-trace and register dump, you have to get those
from the page-fault handler (for nonexistant pages). This is where
all the required information is available. This is why, to get this
information, a deliberate trap is set in the code. When reviewing
the resulting information, you ignore the page-fault of a nonexitant
page. You are, instead, interested in the code leading up to the
decision to deliberately crash.

Cheers,
Dick Johnson
**** FILE SYSTEM WAS MODIFIED ****
Penguin : Linux version 2.3.13 on an i686 machine (400.59 BogoMips).
Warning : It's hard to remain at the trailing edge of technology.

-
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/