| plan 9 kernel history: overview | file list | diff list |
1992/1128/power/trap.c (diff list | history)
| 1992/1124/sys/src/9/power/trap.c:75,183 – 1992/1128/sys/src/9/power/trap.c:75,190 (short | long | prev | next) | ||
| 1990/0227 | trap(Ureg *ur) { int ecode; | |
| 1992/0802 |
| |
| 1992/1128 | int user, cop, x; | |
| 1992/0802 | ulong fcr31; | |
| 1992/0806 |
| |
| 1990/0227 | ||
| 1992/0802 |
| |
| 1992/1128 | char buf[2*ERRLEN], buf1[ERRLEN], *fpexcep; *LED=~1; | |
| 1990/0227 | ecode = EXCCODE(ur->cause); | |
| 1992/0527 | LEDON(ecode); | |
| 1990/0227 | user = ur->status&KUP; | |
| 1992/0805 | if(u) | |
| 1991/1110 | u->dbgreg = ur; | |
| 1992/1128 | *LED=~2; | |
| 1992/0805 | ||
| 1992/1128 | if(u && u->p->fpstate == FPactive) { savefpregs(&u->fpsave); u->p->fpstate = FPinactive; ur->status &= ~CU1; } *LED=~3; | |
| 1990/0227 | switch(ecode){ case CINT: | |
| 1992/0802 |
| |
| 1990/0227 |
| |
| 1992/0802 |
| |
| 1990/0227 |
| |
| 1992/1128 | *LED=~4; if(ur->cause&INTR3) { /* FP trap */ *LED=~5; if(u == 0 || u->p->fpstate != FPinactive) panic("fp intr3 no u or not inactive pc=%lux", ur->pc); fcr31 = clrfpintr(); if(user == 0) panic("kernel floating point trap pc=%lux", ur->pc); *LED=~6; ur->cause &= ~INTR3; if(!fptrap(ur, fcr31)) { intr(ur); spllo(); fpexcep = fpexcname(ur, fcr31, buf1); sprint(buf, "sys: fp: %s", fpexcep); postnote(u->p, 1, buf, NDebug); break; | |
| 1990/0227 | } | |
| 1992/1128 | *LED=~7; | |
| 1991/0209 | } intr(ur); | |
| 1992/1128 | *LED=~8; | |
| 1990/0227 | break; case CTLBM: case CTLBL: case CTLBS: | |
| 1992/1128 | *LED=~9; | |
| 1990/0227 | if(u == 0) | |
| 1990/0802 | panic("fault u==0 pc %lux addr %lux", ur->pc, ur->badvaddr); | |
| 1990/0227 |
| |
| 1992/1128 | *LED=~10; | |
| 1990/0227 | spllo(); x = u->p->insyscall; u->p->insyscall = 1; | |
| 1990/1212 | faultmips(ur, user, ecode); | |
| 1990/0227 | u->p->insyscall = x; | |
| 1992/1128 | *LED=~11; | |
| 1990/0227 | break; case CCPU: | |
| 1990/0722 |
| |
| 1991/0314 |
| |
| 1990/0227 |
| |
| 1992/1128 | *LED=~12; cop = (ur->cause>>28)&3; if(u && cop == 1) { if(u->p->fpstate == FPinit) { restfpregs(&initfp, u->fpsave.fpstatus); u->p->fpstate = FPactive; ur->status |= CU1; break; } if(u->p->fpstate == FPinactive) { restfpregs(&u->fpsave, u->fpsave.fpstatus); u->p->fpstate = FPactive; ur->status |= CU1; break; } | |
| 1990/0227 | } | |
| 1990/0722 |
| |
| 1991/0314 |
| |
| 1990/0227 |
| |
| 1990/0722 |
| |
| 1992/1128 | *LED=~13; /* Fallthrough */ | |
| 1990/0227 | default: | |
| 1990/0722 |
| |
| 1990/0227 |
| |
| 1992/0803 |
| |
| 1991/0705 |
| |
| 1990/0227 |
| |
| 1992/1128 | if(user) { | |
| 1990/0227 | spllo(); | |
| 1992/0806 |
| |
| 1990/0227 |
| |
| 1992/0102 |
| |
| 1991/0425 | ||
| 1992/1128 | sprint(buf, "sys: %s", excname[ecode]); | |
| 1990/0227 | postnote(u->p, 1, buf, NDebug); | |
| 1992/0806 |
| |
| 1990/0227 |
| |
| 1992/0813 |
| |
| 1990/0227 |
| |
| 1992/0813 |
| |
| 1992/1128 | break; | |
| 1990/0227 | } | |
| 1992/1128 | print("kernel %s pc=%lux\n", excname[ecode], ur->pc); dumpregs(ur); dumpstack(); if(m->machno == 0) spllo(); exit(1); | |
| 1990/0227 | } | |
| 1992/1128 | *LED=~14; | |
| 1991/0705 | ||
| 1990/0227 | splhi(); | |
| 1992/0802 |
| |
| 1991/1114 | if(user) { | |
| 1992/1128 | *LED=~15; | |
| 1991/1114 | notify(ur); | |
| 1992/1128 | *LED=~16; | |
| 1991/1114 | if(u->p->fpstate == FPinactive) { restfpregs(&u->fpsave, u->fpsave.fpstatus); u->p->fpstate = FPactive; ur->status |= CU1; } | |
| 1992/1128 | *LED=~17; | |
| 1990/0227 | } | |
| 1992/1128 | *LED=~0; | |
| 1992/0527 | LEDOFF(ecode); | |
| 1990/0227 | } | |
| 1992/1124/sys/src/9/power/trap.c:193,212 – 1992/1128/sys/src/9/power/trap.c:200,216 | ||
| 1990/0227 | ||
| 1991/0425 | m->intr++; | |
| 1991/0209 | cause = ur->cause&(INTR5|INTR4|INTR3|INTR2|INTR1); | |
| 1990/0227 |
| |
| 1992/0508 |
| |
| 1991/0209 |
| |
| 1992/0508 |
| |
| 1990/0227 |
| |
| 1992/1128 | ||
| 1990/0227 | if(cause & INTR1){ duartintr(); cause &= ~INTR1; } | |
| 1992/1128 | ||
| 1990/0227 | if(cause & INTR5){ | |
| 1991/0212 | any = 0; | |
| 1990/0227 | if(!(*MPBERR1 & (1<<8))){ | |
| 1990/0911 | print("MP bus error %lux %lux\n", *MPBERR0, *MPBERR1); | |
| 1992/1128 | print("PC %lux R31 %lux\n", ur->pc, ur->r31); | |
| 1990/0227 | *MPBERR0 = 0; i = *SBEADDR; | |
| 1990/1214 | USED(i); | |
| 1992/1124/sys/src/9/power/trap.c:258,265 – 1992/1128/sys/src/9/power/trap.c:262,269 | ||
| 1990/0227 | if(pend & 1) { v = INTVECREG->i[0].vec; | |
| 1990/0907 | if(!(v & (1<<12))){ | |
| 1992/1128 | print("ioberr %lux %lux\n", *MPBERR0, *MPBERR1); print("PC %lux R31 %lux\n", ur->pc, ur->r31); | |
| 1990/0907 | *MPBERR0 = 0; | |
| 1991/0212 | any = 1; | |
| 1990/0907 | } | |
| 1992/1124/sys/src/9/power/trap.c:315,320 – 1992/1128/sys/src/9/power/trap.c:319,332 | ||
| 1991/0212 | *IO2SETMASK = 0xff000000; | |
| 1990/0227 | cause &= ~INTR5; } | |
| 1992/1128 | if(cause & (INTR2|INTR4)){ LEDON(LEDclock); clock(ur); LEDOFF(LEDclock); cause &= ~(INTR2|INTR4); } | |
| 1990/0227 | if(cause) panic("cause %lux %lux\n", u, cause); } | |
| 1992/1124/sys/src/9/power/trap.c:408,455 – 1992/1128/sys/src/9/power/trap.c:420,476 | ||
| 1991/1218 | l = strlen(n->msg); if(l > ERRLEN-15) /* " pc=0x12345678\0" */ l = ERRLEN-15; | |
| 1992/1128 | ||
| 1992/0806 | sprint(n->msg+l, " pc=0x%lux", ur->pc); | |
| 1991/1218 | } | |
| 1992/1128 | ||
| 1991/1218 | if(n->flag!=NUser && (u->notified || u->notify==0)){ | |
| 1992/0714 | if(n->flag == NDebug) | |
| 1991/1218 | pprint("suicide: %s\n", n->msg); | |
| 1990/0227 |
| |
| 1992/1128 | ||
| 1991/1216 | qunlock(&u->p->debug); | |
| 1991/1218 | pexit(n->msg, n->flag!=NDebug); | |
| 1990/0227 | } | |
| 1992/0124 |
| |
| 1990/0227 |
| |
| 1992/0124 |
| |
| 1991/0503 |
| |
| 1990/0816 |
| |
| 1990/0227 |
| |
| 1992/0616 |
| |
| 1991/1216 |
| |
| 1991/0705 |
| |
| 1990/0227 |
| |
| 1991/0318 |
| |
| 1990/0227 |
| |
| 1991/0318 |
| |
| 1990/0227 |
| |
| 1992/0409 |
| |
| 1992/0102 |
| |
| 1990/0227 |
| |
| 1990/0816 |
| |
| 1990/0227 |
| |
| 1991/0717 |
| |
| 1991/0318 |
| |
| 1992/1128 | if(u->notified) { qunlock(&u->p->debug); splx(s); return 0; | |
| 1990/0227 | } | |
| 1992/1128 | if(!u->notify) { qunlock(&u->p->debug); pexit(n->msg, n->flag!=NDebug); } u->svstatus = ur->status; sp = ur->usp; sp -= sizeof(Ureg); if(sp&0x3 || !okaddr((ulong)u->notify, 1, 0) || !okaddr(sp-ERRLEN-3*BY2WD, sizeof(Ureg)+ERRLEN-3*BY2WD, 0)){ pprint("suicide: bad address or sp in notify\n"); qunlock(&u->p->debug); pexit("Suicide", 0); } u->ureg = (void*)sp; memmove((Ureg*)sp, ur, sizeof(Ureg)); sp -= ERRLEN; memmove((char*)sp, u->note[0].msg, ERRLEN); sp -= 3*BY2WD; *(ulong*)(sp+2*BY2WD) = sp+3*BY2WD; /* arg 2 is string */ u->svr1 = ur->r1; /* save away r1 */ ur->r1 = (ulong)u->ureg; /* arg 1 is ureg* */ *(ulong*)(sp+0*BY2WD) = 0; /* arg 0 is pc */ ur->usp = sp; ur->pc = (ulong)u->notify; u->notified = 1; u->nnote--; memmove(&u->lastnote, &u->note[0], sizeof(Note)); memmove(&u->note[0], &u->note[1], u->nnote*sizeof(Note)); | |
| 1991/1216 | qunlock(&u->p->debug); | |
| 1991/1114 | splx(s); | |
| 1992/0124 |
| |
| 1992/1128 | return 1; | |
| 1990/0227 | } /* | |
| 1992/1124/sys/src/9/power/trap.c:568,574 – 1992/1128/sys/src/9/power/trap.c:589,595 | ||
| 1991/0717 | noted(&aur, *(ulong*)(sp+BY2WD)); /* doesn't return */ | |
| 1991/1114 | splhi(); | |
| 1992/06271 | if(u->scallnr!=RFORK && (p->procctl || u->nnote)){ | |
| 1992/0409 |
| |
| 1992/1128 | ur->r1 = ret; /* load up for noted() */ | |
| 1992/0108 | if(notify(ur)) return ur->r1; | |
| 1990/0227 | } | |