# HG changeset patch # User boisy # Date 1141412514 0 # Node ID 31ca1a8e9a3a3e699d8006f99ef25e9d66ca8b66 # Parent 82198f9cd00442e6191c30c2539c6b48c4b2ac50 Added comments diff -r 82198f9cd004 -r 31ca1a8e9a3a level1/modules/kernel/krn.asm --- a/level1/modules/kernel/krn.asm Fri Mar 03 18:09:29 2006 +0000 +++ b/level1/modules/kernel/krn.asm Fri Mar 03 19:01:54 2006 +0000 @@ -391,30 +391,82 @@ L0212 leay >L0255,pcr bra URtoSs -* X = proc desc -FAProc ldx R$X,u -L021A pshs u,y - ldu #$003F + +*FAProc ldx R$X,u Get ptr to process to activate +*L0D11 clrb +* pshs cc,b,x,y,u +* lda P$Prior,x Get process priority +* sta P$Age,x Save it as age (How long it's been around) +* orcc #IntMasks Shut down IRQ's +* ldu #(D.AProcQ-P$Queue) Get ptr to active process queue +* bra L0D29 Go through the chain +** Update active process queue +** X=Process to activate +** U=Current process in queue links +*L0D1F inc P$Age,u update current process age +* bne L0D25 wrap? +* dec P$Age,u yes, reset it to max. +*L0D25 cmpa P$Age,u match process ages?? +* bhi L0D2B no, skip update +*L0D29 leay ,u point Y to current process +*L0D2B ldu P$Queue,u get pointer to next process in chain +* bne L0D1F Still more in chain, keep going +* ldd P$Queue,y +* stx P$Queue,y save new process to chain +* std P$Queue,x +* puls cc,b,x,y,u,pc + + +************************************************** +* System Call: F$AProc +* +* Function: Insert process into active process queue +* +* Input: X = Address of process descriptor +* +* Output: None (U and Y are preserved) +* +* Error: CC = C bit set; B = error code +* +* "An Ode to Dr. Lee" +* (1:27PM, Feb 23, 2006) +* +* Sitting in CMPS 455, I listen to Dr. Lee, +* His teaching style is as awful as any can be. +* Operating System Principles I have seen many times before, +* And as a result, this class is a major bore. +* As he talks about file systems, I work on NitrOS-9, +* even though I pay no attention, I do not fall behind. +* +* - Anonymous Student who returned +* to university to complete his +* computer science degree while working +* on The NitrOS-9 Project. +* +FAProc ldx R$X,u get ptr to process to activate +L021A pshs u,y save U/Y on stack + ldu #(D.AProcQ-P$Queue) bra L0228 -L0221 ldb P$Age,u - incb - beq L0228 - stb P$Age,u -L0228 ldu P$Queue,u U = proc desc - bne L0221 - ldu #$003F - lda P$Prior,x - sta P$Age,x - orcc #IntMasks -L0235 leay ,u - ldu P$Queue,u +L0221 ldb P$Age,u get process age + incb update it + beq L0228 branch if wrap + stb P$Age,u save it back to proc desc +L0228 ldu P$Queue,u get pointer to queue this process queue + bne L0221 branch if process is in active queue + ldu #(D.AProcQ-P$Queue) + lda P$Prior,x get process priority + sta P$Age,x save it as age (How long its been around) + orcc #IntMasks mask interrupts +L0235 leay ,u point Y to current process + ldu P$Queue,u get pointer to queue beq L023F - cmpa P$Age,u - bls L0235 + cmpa P$Age,u match process ages? + bls L0235 no, skip update L023F stu P$Queue,x stx P$Queue,y clrb - puls pc,u,y + puls pc,u,y restore U/Y and return + UsrSvc leay