void noted(Ureg*, ulong);
+static void debugexc(Ureg*, void*);
static void debugbpt(Ureg*, void*);
static void fault386(Ureg*, void*);
static void doublefault(Ureg*, void*);
irq, tbdf, name);
return;
}
-
if(tbdf != BUSUNKNOWN && (irq == 0xff || irq == 0)){
print("intrenable: got unassigned irq %d, tbdf 0x%uX for %s\n",
irq, tbdf, name);
irq = -1;
}
+ /*
+ * IRQ2 doesn't really exist, it's used to gang the interrupt
+ * controllers together. A device set to IRQ2 will appear on
+ * the second interrupt controller as IRQ9.
+ */
+ if(irq == 2)
+ irq = 9;
+
if((v = xalloc(sizeof(Vctl))) == nil)
panic("intrenable: out of memory");
v->isintr = 1;
Vctl **pv, *v;
int vno;
+ if(irq == 2)
+ irq = 9;
if(arch->intrvecno == nil || (tbdf != BUSUNKNOWN && (irq == 0xff || irq == 0))){
/*
* on APIC machine, irq is pretty meaningless
* Special traps.
* Syscall() is called directly without going through trap().
*/
+ trapenable(VectorDE, debugexc, 0, "debugexc");
trapenable(VectorBPT, debugbpt, 0, "debugpt");
trapenable(VectorPF, fault386, 0, "fault386");
trapenable(Vector2F, doublefault, 0, "doublefault");
if(0)print("cpu%d: spurious interrupt %d, last %d\n",
m->machno, vno, m->lastintr);
if(0)if(conf.nmach > 1){
- for(i = 0; i < 32; i++){
- if(!(active.machs & (1<<i)))
+ for(i = 0; i < MAXMACH; i++){
+ if(active.machs[i] == 0)
continue;
mach = MACHP(i);
if(m->machno == mach->machno)
callwithureg(_dumpstack);
}
+static void
+debugexc(Ureg *ureg, void *)
+{
+ u32int dr6, m;
+ char buf[ERRMAX];
+ char *p, *e;
+ int i;
+
+ dr6 = getdr6();
+ if(up == nil)
+ panic("kernel debug exception dr6=%#.8ux", dr6);
+ putdr6(up->dr[6]);
+ if(userureg(ureg))
+ qlock(&up->debug);
+ else if(!canqlock(&up->debug))
+ return;
+ m = up->dr[7];
+ m = (m >> 4 | m >> 3) & 8 | (m >> 3 | m >> 2) & 4 | (m >> 2 | m >> 1) & 2 | (m >> 1 | m) & 1;
+ m &= dr6;
+ if(m == 0){
+ sprint(buf, "sys: debug exception dr6=%#.8ux", dr6);
+ postnote(up, 0, buf, NDebug);
+ }else{
+ p = buf;
+ e = buf + sizeof(buf);
+ p = seprint(p, e, "sys: watchpoint ");
+ for(i = 0; i < 4; i++)
+ if((m & 1<<i) != 0)
+ p = seprint(p, e, "%d%s", i, (m >> i + 1 != 0) ? "," : "");
+ postnote(up, 0, buf, NDebug);
+ }
+ qunlock(&up->debug);
+}
+
static void
debugbpt(Ureg* ureg, void*)
{
return 0;
if(up->fpstate == FPactive){
- fpsave(&up->fpsave);
+ fpsave(up->fpsave);
up->fpstate = FPinactive;
}
up->fpstate |= FPillegal;