| plan 9 kernel history: overview | file list | diff list |
1993/0226/gnot/clock.c (diff list | history)
| gnot/clock.c on 1990/03091 | ||
| 1990/03091 | #include "u.h" | |
| 1992/0321 | #include "../port/lib.h" | |
| 1990/03091 | #include "mem.h" #include "dat.h" #include "fns.h" #include "io.h" #include "ureg.h" void delay(int ms) { int i; ms *= 1000; /* experimentally determined */ for(i=0; i<ms; i++) ; } void clock(Ureg *ur) { Proc *p; | |
| 1991/1113 | int user, nrun = 0; | |
| 1990/03091 | ||
| 1991/1112 | user = (ur->sr&SUPER) == 0; | |
| 1992/0805 | if(user){ | |
| 1991/1112 | u->dbgreg = ur; | |
| 1992/0805 | u->p->pc = ur->pc; } | |
| 1991/1112 | ||
| 1990/03091 | SYNCREG[1] = 0x5F; /* clear interrupt */ m->ticks++; p = m->proc; | |
| 1990/0312 | if(p){ | |
| 1991/1113 | nrun = 1; | |
| 1990/0312 | p->pc = ur->pc; | |
| 1990/1004 | if (p->state==Running) p->time[p->insyscall]++; | |
| 1990/0312 | } | |
| 1991/1113 | nrun = (nrdy+nrun)*1000; MACHP(0)->load = (MACHP(0)->load*19+nrun)/20; | |
| 1990/1211 | checkalarms(); | |
| 1990/0321 | kbdclock(); | |
| 1991/1003 | duartclock(); | |
| 1993/0226 | mouseclock(); | |
| 1991/1007 | kproftimer(ur->pc); | |
| 1990/1004 | if((ur->sr&SPL(7)) == 0 && p && p->state==Running){ | |
| 1991/0614 | if(anyready()){ if(p->hasspin) p->hasspin = 0; else sched(); } | |
| 1991/1112 | if(user){ | |
| 1991/0710 | (*(ulong*)(USTKTOP-BY2WD)) += TK2MS(1); /* profiling clock */ | |
| 1991/1112 | notify(ur); | |
| 1991/0710 | } | |
| 1990/03091 | } } | |