--- xinu/sys/clkint.s 2018/04/24 17:39:04 1.1 +++ xinu/sys/clkint.s 2018/04/24 17:39:46 1.1.1.2 @@ -1,53 +1,49 @@ -/* clkint.s - clkint */ - -#include -#include - -/*------------------------------------------------------------------------ - * clkint -- real-time clock interrupt service routine - *------------------------------------------------------------------------ -*/ - - /* define constants */ -#define CLEARINT 0xc1 /* value to clear ICCS INT bit */ +|* clkint.s - clkint +|*------------------------------------------------------------------------ +|* clkint -- real-time clock interrupt service routine +|*------------------------------------------------------------------------ .text - .align 2 /* align on longword boundary */ .globl _clkint + .globl _tstat _clkint: - mtpr $DISABLE, $IPL /* disable interrupts */ -#if !defined(UVAX) - mtpr $CLEARINT, $ICCS /* clr interrupt bit in interval*/ - /* clock control reg */ -#else /* Microvax has a 10ms rt clock */ - decl _count10 /* Is this the 10th interrupt? */ - jnequ clret /* no => return */ - movl $10, _count10 /* yes=> reset counter&continue*/ + movl a0,sp@- | save a0 + movl _tstat,a0 | address of hardware reg to ack tick +#ifdef ATT7300 +| clock owns one bit of miscellaneous control reg--maintain other bits-- + movl d0,sp@- + movw _soft_mcr7300,d0 | normal value for MCR + andw #0x7fff,d0 | clear high bit + movw d0,a0@ | acknowledge clock tick + movw _soft_mcr7300,a0@ | with low-high on high bit of MCR + movl sp@+,d0 +#else + movb #1,a0@ | acknowledge clock tick #endif - decl _tickctr /* Is this the 10th tick? */ - jnequ clckdef /* no => process tick */ - movl $10, _tickctr /* yes=> reset counter&continue*/ - incl _clktime /* increment time-of-day clock */ -clckdef: - tstl _defclk /* Are clock ticks deferred? */ - jeqlu notdef /* no => go process this tick */ - incl _clkdiff /* yes=> count in clkdiff and */ - rei /* return quickly */ -notdef: - tstl _slnempty /* Is sleep queue nonempty? */ - jeqlu clpreem /* no => go process preemption */ - decw *_sltop /* yes=> decrement delta key */ - jnequ clpreem /* on first process, */ - /* calling wakeup if 0 */ - pushr $LOWREGS /* save low registers */ - calls $0, _wakeup /* wakeup sleeping process */ - popr $LOWREGS /* restore low registers */ + movl sp@+,a0 | restore a0 + subql #1,_count6 | Is this the 6th interrupt? + bpl clret | no => return + movl #6,_count6 | yes=> reset counter&continue + tstl _defclk | Are clock ticks deferred? + beq notdef | no => skip down + addql #1,_clkdiff | yes=> count in clkdiff and + rte | return quickly +notdef: + tstl _slnempty | Is sleep queue empty? + beq clpreem | yes=> skip down + movl a0,sp@- | save a0 + movl _sltop,a0 | no => decrement delta key + subql #1,a0@ | of first process + movl sp@+,a0 | restore a0, cc's unaffected + bpl clpreem | ck if ready to wake up + moveml #0xc0c0,sp@- | Save d0,d1,a0,a1 - C scratch regs + jsr _wakeup | + moveml sp@+,#0x0303 | Restore d0,d1,a0,a1 clpreem: - decl _preempt /* decrement preemption counter */ - jnequ clret /* and call resched if it is 0 */ - pushr $LOWREGS /* save low registers */ - calls $0, _resched /* reschedule */ - popr $LOWREGS /* restore low registers */ + subql #1,_preempt | Decrement preemption counter + bpl clret | and call resched if it + moveml #0xc0c0,sp@- + jsr _resched + moveml sp@+,#0x0303 clret: - rei /* restore pre-interrupt IPL & */ - /* return from interrupt */ + rte | Return from interrupt