| plan 9 kernel history: overview | file list | diff list |
1995/0202/pc/trap.c (diff list | history)
| 1995/0115/sys/src/9/pc/trap.c:482,488 – 1995/0202/sys/src/9/pc/trap.c:482,488 (short | long | prev | next) | ||
| 1992/0108 | int | |
| 1991/0720 | notify(Ureg *ur) | |
| 1991/0710 | { | |
| 1992/0124 |
| |
| 1995/0202 | int l; | |
| 1991/1114 | ulong s, sp; | |
| 1991/1218 | Note *n; | |
| 1991/0720 | ||
| 1995/0115/sys/src/9/pc/trap.c:501,506 – 1995/0202/sys/src/9/pc/trap.c:501,507 | ||
| 1991/1218 | l = ERRLEN-15; sprint(n->msg+l, " pc=0x%.8lux", ur->pc); } | |
| 1995/0202 | ||
| 1993/0915 | if(n->flag!=NUser && (up->notified || up->notify==0)){ qunlock(&up->debug); | |
| 1992/0714 | if(n->flag == NDebug) | |
| 1995/0115/sys/src/9/pc/trap.c:507,548 – 1995/0202/sys/src/9/pc/trap.c:508,554 | ||
| 1991/1218 | pprint("suicide: %s\n", n->msg); pexit(n->msg, n->flag!=NDebug); | |
| 1991/0720 | } | |
| 1992/0124 |
| |
| 1993/0915 |
| |
| 1992/1203 |
| |
| 1992/0124 |
| |
| 1993/0915 |
| |
| 1991/0720 |
| |
| 1993/0915 |
| |
| 1992/0616 |
| |
| 1993/0915 |
| |
| 1992/0616 |
| |
| 1991/0722 |
| |
| 1993/0915 |
| |
| 1991/0720 |
| |
| 1993/0915 |
| |
| 1991/0720 |
| |
| 1993/0915 |
| |
| 1991/0720 |
| |
| 1993/0915 |
| |
| 1995/0202 | if(up->notified) { qunlock(&up->debug); splhi(); return 0; | |
| 1991/0720 | } | |
| 1995/0202 | if(!up->notify){ qunlock(&up->debug); pexit(n->msg, n->flag!=NDebug); } sp = ur->usp; sp -= sizeof(Ureg); if(!okaddr((ulong)up->notify, 1, 0) || !okaddr(sp-ERRLEN-3*BY2WD, sizeof(Ureg)+ERRLEN-3*BY2WD, 0)){ pprint("suicide: bad address in notify\n"); qunlock(&up->debug); pexit("Suicide", 0); } up->ureg = (void*)sp; memmove((Ureg*)sp, ur, sizeof(Ureg)); *(Ureg**)(sp-BY2WD) = up->ureg; /* word under Ureg is old up->ureg */ up->ureg = (void*)sp; sp -= BY2WD+ERRLEN; memmove((char*)sp, up->note[0].msg, ERRLEN); sp -= 3*BY2WD; *(ulong*)(sp+2*BY2WD) = sp+3*BY2WD; /* arg 2 is string */ *(ulong*)(sp+1*BY2WD) = (ulong)up->ureg; /* arg 1 is ureg* */ *(ulong*)(sp+0*BY2WD) = 0; /* arg 0 is pc */ ur->usp = sp; ur->pc = (ulong)up->notify; up->notified = 1; up->nnote--; memmove(&up->lastnote, &up->note[0], sizeof(Note)); memmove(&up->note[0], &up->note[1], up->nnote*sizeof(Note)); | |
| 1993/0915 | qunlock(&up->debug); | |
| 1991/1114 | splx(s); | |
| 1992/0124 |
| |
| 1995/0202 | return 1; | |
| 1991/0710 | } | |
| 1991/0720 | /* | |
| 1995/0115/sys/src/9/pc/trap.c:552,560 – 1995/0202/sys/src/9/pc/trap.c:558,567 | ||
| 1991/0720 | noted(Ureg *ur, ulong arg0) | |
| 1991/0710 | { | |
| 1991/0720 | Ureg *nur; | |
| 1995/0202 | ulong oureg, sp; | |
| 1991/0720 | ||
| 1993/0915 | qlock(&up->debug); | |
| 1994/0513 |
| |
| 1995/0202 | if(arg0!=NRSTR && !up->notified) { | |
| 1993/0915 | qunlock(&up->debug); | |
| 1994/0513 | pprint("call to noted() when not notified\n"); | |
| 1995/0105 | pexit("Suicide", 0); | |
| 1995/0115/sys/src/9/pc/trap.c:562,587 – 1995/0202/sys/src/9/pc/trap.c:569,619 | ||
| 1993/0915 | up->notified = 0; | |
| 1994/0513 | nur = up->ureg; /* pointer to user returned Ureg struct */ | |
| 1995/0202 | /* sanity clause */ oureg = (ulong)nur; if(oureg>=USTKTOP || oureg<USTKTOP-USTKSIZE || !okaddr((ulong)oureg-BY2WD, BY2WD+sizeof(Ureg), 0)){ pprint("bad ureg in noted or call to noted() when not notified\n"); | |
| 1994/0513 | qunlock(&up->debug); | |
| 1995/0202 | pexit("Suicide", 0); | |
| 1994/0513 | } | |
| 1993/0915 |
| |
| 1995/0202 | /* don't let user change text or stack segments */ nur->cs = ur->cs; nur->ss = ur->ss; /* don't let user change system flags */ nur->flags = (ur->flags & ~0xCD5) | (nur->flags & 0xCD5); | |
| 1992/0609 | memmove(ur, nur, sizeof(Ureg)); | |
| 1995/0105 |
| |
| 1991/0720 | switch(arg0){ case NCONT: | |
| 1995/0202 | case NRSTR: | |
| 1992/0616 | if(!okaddr(nur->pc, 1, 0) || !okaddr(nur->usp, BY2WD, 0)){ | |
| 1991/0814 | pprint("suicide: trap in noted\n"); | |
| 1995/0202 | qunlock(&up->debug); | |
| 1994/0513 | pexit("Suicide", 0); | |
| 1991/0814 | } | |
| 1995/0202 | up->ureg = (Ureg*)(*(ulong*)(oureg-BY2WD)); qunlock(&up->debug); | |
| 1995/0105 | break; | |
| 1991/0720 | ||
| 1995/0202 | case NSAVE: if(!okaddr(nur->pc, BY2WD, 0) || !okaddr(nur->usp, BY2WD, 0)){ pprint("suicide: trap in noted\n"); qunlock(&up->debug); pexit("Suicide", 0); } qunlock(&up->debug); sp = oureg-4*BY2WD-ERRLEN; splhi(); ur->sp = sp; ((ulong*)sp)[1] = oureg; /* arg 1 0(FP) is ureg* */ ((ulong*)sp)[0] = 0; /* arg 0 is pc */ break; | |
| 1991/0720 | default: pprint("unknown noted arg 0x%lux\n", arg0); | |
| 1993/0915 | up->lastnote.flag = NDebug; | |
| 1995/0115/sys/src/9/pc/trap.c:590,595 – 1995/0202/sys/src/9/pc/trap.c:622,628 | ||
| 1991/0720 | case NDFLT: | |
| 1993/0915 | if(up->lastnote.flag == NDebug) pprint("suicide: %s\n", up->lastnote.msg); | |
| 1995/0202 | qunlock(&up->debug); | |
| 1993/0915 | pexit(up->lastnote.msg, up->lastnote.flag!=NDebug); | |
| 1991/0720 | } | |
| 1991/1112 | } | |