| plan 9 kernel history: overview | file list | diff list |
1991/0808/pc/fault386.c (diff list | history)
| pc/fault386.c on 1991/0710 | ||
| 1991/0710 | #include "u.h" #include "lib.h" #include "mem.h" #include "dat.h" #include "fns.h" #include "ureg.h" | |
| 1991/0711 | #include "io.h" | |
| 1991/0710 | ||
| 1991/0719 | int faulting; | |
| 1991/0710 | void | |
| 1991/0718 | fault386(Ureg *ur) | |
| 1991/0710 | { | |
| 1991/0718 | ulong addr; int read; int user; | |
| 1991/0719 | int n; | |
| 1991/0720 | int insyscall; | |
| 1991/0718 | ||
| 1991/0720 | insyscall = u->p->insyscall; u->p->insyscall = 1; | |
| 1991/0718 | addr = getcr2(); | |
| 1991/0719 | if(faulting) panic("double fault\n"); faulting = 1; | |
| 1991/0718 | read = !(ur->ecode & 2); user = (ur->ecode & 4); | |
| 1991/0719 | n = fault(addr, read); if(n < 0){ | |
| 1991/0718 | if(user){ | |
| 1991/0720 | pprint("user %s error addr=0x%lux\n", read?"read":"write", addr); pprint("status=0x%lux pc=0x%lux sp=0x%lux\n", ur->flags, ur->pc, ur->usp); | |
| 1991/0718 | pexit("Suicide", 0); } u->p->state = MMUing; dumpregs(ur); | |
| 1991/0808 | panic("fault: 0x%lux", addr); | |
| 1991/0718 | } | |
| 1991/0719 | faulting = 0; | |
| 1991/0720 | u->p->insyscall = insyscall; | |
| 1991/0710 | } void | |
| 1991/0718 | faultinit(void) | |
| 1991/0710 | { | |
| 1991/0718 | setvec(Faultvec, fault386); | |
| 1991/0710 | } | |