| plan 9 kernel history: overview | file list | diff list |
1991/1003/ss/clock.c (diff list | history)
| ss/clock.c on 1990/1223 | ||
| 1990/1223 | #include "u.h" #include "lib.h" #include "mem.h" #include "dat.h" #include "fns.h" #include "io.h" #include "ureg.h" void delay(int ms) { ulong t, *p; int i; | |
| 1990/1226 | ms *= 2000; /* experimentally determined */ | |
| 1990/1223 | for(i=0; i<ms; i++) ; } | |
| 1990/1227 | typedef struct Ctr Ctr; struct Ctr { ulong ctr0; ulong lim0; ulong ctr1; ulong lim1; }; Ctr *ctr; | |
| 1990/1223 | void | |
| 1990/1227 | clockinit(void) { KMap *k; k = kmappa(CLOCK, PTENOCACHE|PTEIO); ctr = (Ctr*)k->va; ctr->lim1 = (CLOCKFREQ/HZ)<<10; } void | |
| 1990/1223 | clock(Ureg *ur) { Proc *p; | |
| 1990/1227 | ulong i; | |
| 1990/1223 | ||
| 1990/1227 | i = ctr->lim1; /* clear interrupt */ USED(i); | |
| 1990/1223 | m->ticks++; p = m->proc; if(p){ p->pc = ur->pc; if (p->state==Running) p->time[p->insyscall]++; } checkalarms(); kbdclock(); mouseclock(); | |
| 1991/1003 | sccclock(); | |
| 1990/1227 | if((ur->psr&SPL(0xF))==0 && p && p->state==Running){ | |
| 1991/0821 | if(anyready()){ if(p->hasspin) p->hasspin = 0; else sched(); } | |
| 1991/0711 | if((ur->psr&PSRPSUPER) == 0){ | |
| 1991/0723 | /* *(ulong*)(USTKTOP-BY2WD) += TK2MS(1); /**/ | |
| 1991/0711 | if(u->nnote) notify(ur); } | |
| 1990/1223 | } } | |