int splhigh(void) { int oldspl = curspl; sploff(); curspl = 15; return oldspl; }
void splx(int s) { curspl = s; if (curspl == 0) splon(); else sploff(); }
void clkstart(void) { unsigned char byte; unsigned long s; intpri[0] = SPLHI; form_pic_mask(); s = sploff(); /* disable interrupts */ /* Since we use only timer 0, we program that. * 8254 Manual specifically says you do not need to program * timers you do not use */ outb(pitctl_port, pit0_mode); clknumb = CLKNUM/hz; byte = clknumb; outb(pitctr0_port, byte); byte = clknumb>>8; outb(pitctr0_port, byte); splon(s); /* restore interrupt state */ }
/* * Common interrupt handler. */ void interrupt_handler(void) { uint32_t bits; int vector, old_ipl, new_ipl; /* Get interrupt source */ bits = ICU_IRQSTS; for (vector = 0; vector < NIRQS; vector++) { if (bits & (uint32_t)(1 << vector)) break; } if (vector == NIRQS) goto out; /* Adjust interrupt level */ old_ipl = irq_level; new_ipl = ipl_table[vector]; if (new_ipl > old_ipl) /* Ignore spurious interrupt */ irq_level = new_ipl; update_mask(); /* Allow another interrupt that has higher priority */ splon(); /* Dispatch interrupt */ irq_handler(vector); sploff(); /* Restore interrupt level */ irq_level = old_ipl; update_mask(); out: return; }