* clock is called straight from
* the real time clock interrupt.
* copy *switches to display
* maintain user/system times
* tout wakeup (sys sleep)
* lightning bolt wakeup (every 4 sec)
clock(dev
, sp
, r1
, nps
, r0
, pc
, ps
)
register struct callo
*p1
, *p2
;
register struct proc
*pp
;
* else update first non-zero time
if(callout
[0].c_func
== 0)
while(p2
->c_time
<=0 && p2
->c_func
!=0)
* if ps is high, just return
if(callout
[0].c_time
<= 0) {
while(p1
->c_func
!= 0 && p1
->c_time
<= 0) {
(*p1
->c_func
)(p1
->c_arg
);
while(p2
->c_func
= p1
->c_func
) {
* lightning bolt time-out
if((ps
&UMODE
) == UMODE
) {
if(time
[1]==tout
[1] && time
[0]==tout
[0])
for(pp
= &proc
[0]; pp
< &proc
[NPROC
]; pp
++)
if((pp
->p_cpu
& 0377) > SCHMAG
)
pp
->p_cpu
=- SCHMAG
; else
if((ps
&UMODE
) == UMODE
) {
* timeout is called to arrange that
* fun(arg) is called in tim/HZ seconds.
* An entry is sorted into the callout
* structure. The time in each structure
* entry is the number of HZ's more
* than the previous entry.
* In this way, decrementing the
* first entry has the effect of
register struct callo
*p1
, *p2
;
while(p1
->c_func
!= 0 && p1
->c_time
<= t
) {
(p2
+1)->c_time
= p2
->c_time
;
(p2
+1)->c_func
= p2
->c_func
;
(p2
+1)->c_arg
= p2
->c_arg
;