From: Jorrit Herder Date: Fri, 10 Mar 2006 16:20:24 +0000 (+0000) Subject: *** empty log message *** X-Git-Tag: v3.1.2a~262 X-Git-Url: http://zhaoyanbai.com/repos/icons/valid-xhtml10.png?a=commitdiff_plain;h=376d8485d8ae9dc75c8a84a5dbf95278915f9e96;p=minix.git *** empty log message *** --- diff --git a/drivers/libdriver/driver.c b/drivers/libdriver/driver.c index 102acc21d..913322a9a 100644 --- a/drivers/libdriver/driver.c +++ b/drivers/libdriver/driver.c @@ -109,6 +109,7 @@ struct driver *dp; /* Device dependent entry points. */ (*dp->dr_hw_int)(dp, &mess); } continue; + case PROC_EVENT: case SYS_SIG: (*dp->dr_signal)(dp, &mess); continue; /* don't reply */ case SYN_ALARM: (*dp->dr_alarm)(dp, &mess); diff --git a/drivers/pci/main.c b/drivers/pci/main.c index 716835ae2..2bedb12e3 100644 --- a/drivers/pci/main.c +++ b/drivers/pci/main.c @@ -17,6 +17,7 @@ PRIVATE struct name } names[NR_DRIVERS]; FORWARD _PROTOTYPE( void do_init, (message *mp) ); +FORWARD _PROTOTYPE( void do_sig_handler, (void) ); FORWARD _PROTOTYPE( void do_first_dev, (message *mp) ); FORWARD _PROTOTYPE( void do_next_dev, (message *mp) ); FORWARD _PROTOTYPE( void do_find_dev, (message *mp) ); @@ -67,7 +68,7 @@ int main(void) case BUSC_PCI_ATTR_W16: do_attr_w16(&m); break; case BUSC_PCI_ATTR_W32: do_attr_w32(&m); break; case BUSC_PCI_RESCAN: do_rescan_bus(&m); break; - case SYS_SIG: /* system signal, ignore it */ break; + case PROC_EVENT: do_sig_handler(); break; default: printf("PCI: got message from %d, type %d\n", m.m_source, m.m_type); @@ -78,6 +79,23 @@ int main(void) return 0; } +/*===========================================================================* + * do_sig_handler * + *===========================================================================*/ +PRIVATE void do_sig_handler() +{ + sigset_t sigset; + int sig; + + /* Try to obtain signal set from PM. */ + if (getsigset(&sigset) != 0) return; + + /* Check for known signals. */ + if (sigismember(&sigset, SIGTERM)) { + exit(0); + } +} + PRIVATE void do_init(mp) message *mp; { diff --git a/drivers/rtl8139/rtl8139.c b/drivers/rtl8139/rtl8139.c index 7546ef62c..456369b75 100755 --- a/drivers/rtl8139/rtl8139.c +++ b/drivers/rtl8139/rtl8139.c @@ -10,8 +10,6 @@ * |------------+----------+---------+----------+---------+---------| * | HARD_INT | | | | | | * |------------|----------|---------|----------|---------|---------| - * | SYS_SIG | | | | | | - * |------------|----------|---------|----------|---------|---------| * | DL_WRITE | port nr | proc nr | count | mode | address | * |------------|----------|---------|----------|---------|---------| * | DL_WRITEV | port nr | proc nr | count | mode | address | @@ -228,6 +226,7 @@ static void my_outl(U16_t port, U32_t value) { #define rl_outw(port, offset, value) (my_outw((port) + (offset), (value))) #define rl_outl(port, offset, value) (my_outl((port) + (offset), (value))) +_PROTOTYPE( static void sig_handler, (void) ); _PROTOTYPE( static void rl_init, (message *mp) ); _PROTOTYPE( static void rl_pci_conf, (void) ); _PROTOTYPE( static int rl_probe, (re_t *rep) ); @@ -346,17 +345,35 @@ int main(int argc, char *argv[]) check_int_events(); break ; case FKEY_PRESSED: rtl8139_dump(&m); break; - case SYS_SIG: { - sigset_t sigset = m.NOTIFY_ARG; - if (sigismember(&sigset, SIGKSTOP)) rtl8139_stop(); + case PROC_EVENT: + sig_handler(); break; - } default: panic("rtl8139","illegal message", m.m_type); } } } +/*===========================================================================* + * sig_handler * + *===========================================================================*/ +PRIVATE void sig_handler() +{ + sigset_t sigset; + int sig; + + /* Try to obtain signal set from PM. */ + if (getsigset(&sigset) != 0) return; + + /* Check for known signals. */ + if (sigismember(&sigset, SIGTERM)) { + rtl8139_stop(); + } +} + +/*===========================================================================* + * check_int_events * + *===========================================================================*/ static void check_int_events(void) { int i; diff --git a/drivers/tty/keyboard.c b/drivers/tty/keyboard.c index 6e79eb928..74dbbe8ad 100644 --- a/drivers/tty/keyboard.c +++ b/drivers/tty/keyboard.c @@ -1178,48 +1178,6 @@ int *isauxp; #endif } -/*===========================================================================* - * do_panic_dumps * - *===========================================================================*/ -PUBLIC void do_panic_dumps(m) -message *m; /* request message to TTY */ -{ -/* Wait for keystrokes for printing debugging info and reboot. */ - unsigned char code; - int isaux; - - /* A panic! Allow debug dumps until user wants to shutdown. */ - printf("\nHit ESC to reboot, DEL to shutdown, F-keys for debug dumps\n"); - - (void) scan_keyboard(NULL, NULL); /* ack any old input */ - for (;;) { - tickdelay(10); - /* See if there are pending request for output, but don't block. - * Diagnostics can span multiple printf()s, so do it in a loop. - */ - while (nb_receive(ANY, m) == OK) { - switch(m->m_type) { - case FKEY_CONTROL: do_fkey_ctl(m); break; - case SYS_SIG: do_new_kmess(m); break; - case DIAGNOSTICS: do_diagnostics(m); break; - default: ; /* do nothing */ - } - tickdelay(1); /* allow more */ - } - if (!scan_keyboard(&code, &isaux)) - continue; - if (isaux) - continue; - - /* A key has been pressed. */ - switch (code) { /* possibly abort MINIX */ - case ESC_SCAN: sys_abort(RBT_REBOOT); return; - case DEL_SCAN: sys_abort(RBT_HALT); return; - } - (void) func_key(code); /* check for function key */ - } -} - static void micro_delay(unsigned long usecs) { tickdelay(MICROS_TO_TICKS(usecs)); diff --git a/drivers/tty/tty.c b/drivers/tty/tty.c index 3a0bc58bb..8549b1ef2 100644 --- a/drivers/tty/tty.c +++ b/drivers/tty/tty.c @@ -228,24 +228,22 @@ PUBLIC void main(void) expire_timers(); /* run watchdogs of expired timers */ continue; /* contine to check for events */ } + case PROC_EVENT: { + cons_stop(); /* switch to primary console */ + printf("TTY got PROC_EVENT, assuming SIGTERM\n"); +#if DEAD_CODE + if (irq_hook_id != -1) { + sys_irqdisable(&irq_hook_id); + sys_irqrmpolicy(KEYBOARD_IRQ, &irq_hook_id); + } +#endif + continue; + } case SYS_SIG: { /* system signal */ sigset_t sigset = (sigset_t) tty_mess.NOTIFY_ARG; - - if (sigismember(&sigset, SIGKSTOP)) { - cons_stop(); /* switch to primary console */ - if (irq_hook_id != -1) { - sys_irqdisable(&irq_hook_id); - sys_irqrmpolicy(KEYBOARD_IRQ, &irq_hook_id); - } - } - if (sigismember(&sigset, SIGTERM)) cons_stop(); if (sigismember(&sigset, SIGKMESS)) do_new_kmess(&tty_mess); continue; } - case PANIC_DUMPS: /* allow panic dumps */ - cons_stop(); /* switch to primary console */ - do_panic_dumps(&tty_mess); - continue; case DIAGNOSTICS: /* a server wants to print some */ do_diagnostics(&tty_mess); continue; diff --git a/lib/syscall/getsigset.s b/lib/syscall/getsigset.s new file mode 100644 index 000000000..59c5ffd42 --- /dev/null +++ b/lib/syscall/getsigset.s @@ -0,0 +1,7 @@ +.sect .text +.extern __getsigset +.define _getsigset +.align 2 + +_getsigset: + jmp __getsigset