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

View File

@ -45,6 +45,9 @@
static int varname = 0; \ static int varname = 0; \
int mustunlock = 0; \ int mustunlock = 0; \
if(!intr_disabled()) { lock; mustunlock = 1; } \ if(!intr_disabled()) { lock; mustunlock = 1; } \
if(magictest != MAGICTEST) { \
minix_panic(#varname " magictest failed", __LINE__); \
} \
if(varname) { \ if(varname) { \
minix_panic(#varname " recursive enter", __LINE__); \ 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 char params_buffer[512]; /* boot monitor parameters */
EXTERN int minix_panicing; EXTERN int minix_panicing;
EXTERN int locklevel; EXTERN int locklevel;
#define MAGICTEST 0xC0FFEE23
EXTERN u32_t magictest; /* global magic number */
#if DEBUG_TRACE #if DEBUG_TRACE
EXTERN int verboseflags; EXTERN int verboseflags;

View File

@ -40,6 +40,9 @@ PUBLIC void main()
/* Architecture-dependent initialization. */ /* Architecture-dependent initialization. */
arch_init(); arch_init();
/* Global value to test segment sanity. */
magictest = MAGICTEST;
/* Clear the process table. Anounce each slot as empty and set up mappings /* 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 * 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 */ bill_ptr = rp; /* bill for system time */
NOREC_RETURN(pick, ); 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 arch_init, (void) );
_PROTOTYPE( void ser_putc, (char) ); _PROTOTYPE( void ser_putc, (char) );
_PROTOTYPE( void arch_shutdown, (int) ); _PROTOTYPE( void arch_shutdown, (int) );
_PROTOTYPE( void arch_monitor, (void) );
_PROTOTYPE( void arch_get_aout_headers, (int i, struct exec *h) ); _PROTOTYPE( void arch_get_aout_headers, (int i, struct exec *h) );
_PROTOTYPE( void restart, (void) ); _PROTOTYPE( void restart, (void) );
_PROTOTYPE( void read_tsc, (unsigned long *high, unsigned long *low) ); _PROTOTYPE( void read_tsc, (unsigned long *high, unsigned long *low) );

View File

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