(*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);
} 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) );
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);
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;
{
* |------------+----------+---------+----------+---------+---------|
* | HARD_INT | | | | | |
* |------------|----------|---------|----------|---------|---------|
- * | SYS_SIG | | | | | |
- * |------------|----------|---------|----------|---------|---------|
* | DL_WRITE | port nr | proc nr | count | mode | address |
* |------------|----------|---------|----------|---------|---------|
* | DL_WRITEV | port nr | proc nr | count | mode | address |
#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) );
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;
#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));
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;
--- /dev/null
+.sect .text
+.extern __getsigset
+.define _getsigset
+.align 2
+
+_getsigset:
+ jmp __getsigset