]> git.lizzy.rs Git - plan9front.git/blobdiff - sys/src/9/pc/trap.c
kernel: cleanup the software mouse cursor mess
[plan9front.git] / sys / src / 9 / pc / trap.c
index fbc80024d720ae1b1eee3af270011fddb0bcaf07..fadb64f42cb14df93a6a5bb59ad40270e1e03fd5 100644 (file)
@@ -40,12 +40,16 @@ intrenable(int irq, void (*f)(Ureg*, void*), void* a, int tbdf, char *name)
                        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);
+       if(tbdf != BUSUNKNOWN && (irq == 0xff || irq == 0))
                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");
@@ -83,6 +87,8 @@ intrdisable(int irq, void (*f)(Ureg *, void *), void *a, int tbdf, char *name)
        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
@@ -441,6 +447,7 @@ trap(Ureg* ureg)
                        extern void _forkretiret(void);
                        extern void _rdmsrinst(void);
                        extern void _wrmsrinst(void);
+                       extern void _peekinst(void);
 
                        extern void load_fs(ulong);
                        extern void load_gs(ulong);
@@ -469,6 +476,11 @@ trap(Ureg* ureg)
                                        ureg->pc += 2;
                                        return;
                                }
+                       } else if(pc == _peekinst){
+                               if(vno == VectorGPF){
+                                       ureg->pc += 2;
+                                       return;
+                               }
                        }
                }
 
@@ -703,6 +715,13 @@ fault386(Ureg* ureg, void*)
        if(!user){
                if(vmapsync(addr))
                        return;
+               {
+                       extern void _peekinst(void);
+                       if((void(*)(void))ureg->pc == _peekinst){
+                               ureg->pc += 2;
+                               return;
+                       }
+               }
                if(addr >= USTKTOP)
                        panic("kernel fault: bad address pc=0x%.8lux addr=0x%.8lux", ureg->pc, addr);
                if(up == nil)
@@ -713,7 +732,7 @@ fault386(Ureg* ureg, void*)
 
        insyscall = up->insyscall;
        up->insyscall = 1;
-       n = fault(addr, read);
+       n = fault(addr, ureg->pc, read);
        if(n < 0){
                if(!user){
                        dumpregs(ureg);
@@ -854,7 +873,7 @@ notify(Ureg* ureg)
                return 0;
 
        if(up->fpstate == FPactive){
-               fpsave(&up->fpsave);
+               fpsave(up->fpsave);
                up->fpstate = FPinactive;
        }
        up->fpstate |= FPillegal;
@@ -1085,10 +1104,6 @@ forkchild(Proc *p, Ureg *ureg)
        memmove(cureg, ureg, sizeof(Ureg));
        /* return value of syscall in child */
        cureg->ax = 0;
-
-       /* Things from bottom of syscall which were never executed */
-       p->psstate = 0;
-       p->insyscall = 0;
 }
 
 /* Give enough context in the ureg to produce a kernel stack for