- panic if there's no runnable process

- more basic sanity check before recursive enter check (data segment)
 - try to jump to boot monitor instantly on recursive panic
This commit is contained in:
Ben Gras 2009-10-03 11:30:35 +00:00
parent e716fae585
commit fe35879325
7 changed files with 19 additions and 3 deletions

View file

@ -20,6 +20,11 @@
FORWARD _PROTOTYPE( void ser_debug, (int c));
PUBLIC void arch_monitor(void)
{
level0(monitor);
}
PUBLIC void arch_shutdown(int how)
{
/* Mask all interrupts, including the clock. */
@ -68,7 +73,7 @@ PUBLIC void arch_shutdown(int how)
arch_set_params(mybuffer, strlen(mybuffer)+1);
}
level0(monitor);
arch_monitor();
} else {
/* Reset the system by forcing a processor shutdown. First stop
* the BIOS memory test by setting a soft reset flag.

View file

@ -45,6 +45,9 @@
static int varname = 0; \
int mustunlock = 0; \
if(!intr_disabled()) { lock; mustunlock = 1; } \
if(magictest != MAGICTEST) { \
minix_panic(#varname " magictest failed", __LINE__); \
} \
if(varname) { \
minix_panic(#varname " recursive enter", __LINE__); \
} \

View file

@ -58,6 +58,8 @@ EXTERN time_t boottime;
EXTERN char params_buffer[512]; /* boot monitor parameters */
EXTERN int minix_panicing;
EXTERN int locklevel;
#define MAGICTEST 0xC0FFEE23
EXTERN u32_t magictest; /* global magic number */
#if DEBUG_TRACE
EXTERN int verboseflags;

View file

@ -40,6 +40,9 @@ PUBLIC void main()
/* Architecture-dependent initialization. */
arch_init();
/* Global value to test segment sanity. */
magictest = MAGICTEST;
/* Clear the process table. Anounce each slot as empty and set up mappings
* for proc_addr() and proc_nr() macros. Do the same for the table with

View file

@ -1327,6 +1327,7 @@ PRIVATE void pick_proc()
bill_ptr = rp; /* bill for system time */
NOREC_RETURN(pick, );
}
minix_panic("no runnable processes", NO_NUM);
}
/*===========================================================================*

View file

@ -149,6 +149,7 @@ _PROTOTYPE( void idle_task, (void) );
_PROTOTYPE( void arch_init, (void) );
_PROTOTYPE( void ser_putc, (char) );
_PROTOTYPE( void arch_shutdown, (int) );
_PROTOTYPE( void arch_monitor, (void) );
_PROTOTYPE( void arch_get_aout_headers, (int i, struct exec *h) );
_PROTOTYPE( void restart, (void) );
_PROTOTYPE( void read_tsc, (unsigned long *high, unsigned long *low) );

View file

@ -37,7 +37,9 @@ char *mess;
int nr;
{
/* The system has run aground of a fatal kernel error. Terminate execution. */
if (!minix_panicing++) {
if (minix_panicing++) {
arch_monitor();
}
if (mess != NULL) {
kprintf("kernel panic: %s", mess);
@ -48,7 +50,6 @@ if (!minix_panicing++) {
kprintf("kernel: ");
util_stacktrace();
}
/* Abort MINIX. */
minix_shutdown(NULL);