Merge pull request #150 from philbudne/syssleep

system: annotations about sleeping (both devices and messages)
This commit is contained in:
Phil Budne
2019-10-23 01:25:46 -04:00
committed by GitHub
3 changed files with 60 additions and 58 deletions
+48 -47
View File
@@ -8,8 +8,8 @@
" can return directly (from caller of searchu) " can return directly (from caller of searchu)
" index location 8 points to next process table entry " index location 8 points to next process table entry
searchu: 0 searchu: 0
lac searchu i " fetch argument lac searchu i " fetch worker routine
dac 9f+t+1 " in t1 dac 9f+t+1 " save in t1
-mnproc " loop counter -mnproc " loop counter
dac 9f+t " in t0 dac 9f+t " in t0
law ulist-1 " ulist ptr law ulist-1 " ulist ptr
@@ -89,16 +89,16 @@ t= t+1
badcal: " bad (unimplemented) system call badcal: " bad (unimplemented) system call
clon " clear any pending clock interrupt? clon " clear any pending clock interrupt?
-1 -1
dac 7 " set location 7 to -1?! dac 7 " ask for new interrupt on next tick
" fall into "save" system call " fall into "save" system call
" Ken says save files could be resumed, and used for checkpointing! " Ken says save files could be resumed, and used for checkpointing!
.save: " "sys save" system call .save: " "sys save" system call
lac d1 " get inode 1 (core file?) lac d1 " get inode 1 (core file?)
jms iget jms iget " load inode
cla cla
jms iwrite; 4096; 4096 " dump core jms iwrite; 4096; 4096 " dump core
jms iwrite; userdata; 64 " and user area jms iwrite; userdata; 64 " and user area
jms iput jms iput " write inode
.exit: .exit:
lac u.dspbuf lac u.dspbuf
@@ -106,7 +106,7 @@ badcal: " bad (unimplemented) system call
jmp .+3 " no jmp .+3 " no
law dspbuf " yes: get default display buffer law dspbuf " yes: get default display buffer
jms movdsp " move display jms movdsp " move display
jms awake jms awake " wake waiting smes (will try & fail)
lac u.ulistp i lac u.ulistp i
and o77777 " mark process table entry free and o77777 " mark process table entry free
dac u.ulistp i dac u.ulistp i
@@ -120,7 +120,7 @@ badcal: " bad (unimplemented) system call
" AC/ sending pid " AC/ sending pid
" MQ/ message " MQ/ message
.rmes: .rmes:
jms awake jms awake " wake anyone waiting to send to us
lac o100000 " mark this process "not ready" lac o100000 " mark this process "not ready"
tad u.ulistp i " by incrementing status tad u.ulistp i " by incrementing status
dac u.ulistp i dac u.ulistp i
@@ -129,15 +129,15 @@ badcal: " bad (unimplemented) system call
dac 9f+t " pointer to msg status in proc table dac 9f+t " pointer to msg status in proc table
-1 -1
dac 9f+t i " set to -1 (waiting for message) dac 9f+t i " set to -1 (waiting for message)
jms swap " switch processes jms swap " swap out
law 2 law 2 " here when ready (with message)
tad u.ulistp tad u.ulistp
dac 9f+t dac 9f+t
lac 9f+t i " get msg status word lac 9f+t i " get msg status word
cma " complement (get sender pid) cma " complement (get sender pid)
dac u.ac " return in user AC dac u.ac " return in user AC
dzm 9f+t i " clear status word dzm 9f+t i " clear status word
isz 9f+t isz 9f+t " point to message
lac 9f+t i " get message lac 9f+t i " get message
dac u.mq " return in user MQ dac u.mq " return in user MQ
dzm 9f+t i " clear message dzm 9f+t i " clear message
@@ -152,73 +152,74 @@ t = t+1
" returns with message delivered, or error if process does not exist " returns with message delivered, or error if process does not exist
.smes: .smes:
lac u.ac " get pid from user AC lac u.ac " get pid from user AC
sna spa " >0? sna spa " non-zero?
jms error " no: error jms error " no: error
jms searchu; 1f " search for process jms searchu; 1f " search for process
law 2 law 2
tad u.ulistp tad u.ulistp
dac 9f+t dac 9f+t
dzm 9f+t i dzm 9f+t i " clear ulist 3rd word (not waiting)
jms error jms error
1: 0 " worker for searchu 1: 0 " worker for searchu
lac lu+1 " get pid lac lu+1 " get process pid
sad u.ac " match? sad u.ac " match?
skp " yes skp " yes
jmp 1b i " no jmp 1b i " no: return
lac lu+2 " get mailbox status lac lu+2 " get mailbox status
sad dm1 " -1? sad dm1 " -1?
jmp 1f " yes jmp 1f " yes: process in rmes: ok to send
lac o100000 " no: bump our process status (to notready?) lac o100000 " no: bump our process status (to notready?)
tad u.ulistp i tad u.ulistp i
dac u.ulistp i dac u.ulistp i
law 2 law 2
tad u.ulistp tad u.ulistp
dac 9f+t dac 9f+t
lac u.ac lac u.ac " get dest pid
dac 9f+t i dac 9f+t i " save in 3rd word of our ulist entry
jms swap jms swap
law 2 law 2 " where when swapped ready
tad u.ulistp tad u.ulistp
dac 9f+t dac 9f+t
dzm 9f+t i dzm 9f+t i " clear 3rd word of ulist entry
jmp .smes jmp .smes " restart smes
1: 1:
-3 -3
tad 8 tad 8
dac 9f+t " pointer to dest process ulist entry dac 9f+t " pointer to dest process ulist entry word 0
lac o700000 " complement process status? marks ready?? lac o700000 " decrement process status: marks ready
tad 9f+t i tad 9f+t i
dac 9f+t i dac 9f+t i
isz 9f+t isz 9f+t
isz 9f+t " point to mailbox word? isz 9f+t " point to message status
lac u.pid " get our pid lac u.pid " get our pid
cma " complement cma " complement
dac 9f+t i " store in mailbox?? dac 9f+t i " store in status
isz 9f+t " advance to next word isz 9f+t " advance to next word
lac u.mq " get user MQ lac u.mq " get user MQ
dac 9f+t i " save as message dac 9f+t i " save as message
jmp okexit jmp okexit
t = t+1 t = t+1
" wake up process hanging on rmes for current process?? " wake up all processes hanging on smes to current process
awake: 0 awake: 0
jms searchu; 1f jms searchu; 1f
jmp awake i jmp awake i
1: 0 " searchu worker 1: 0 " searchu worker
lac u.pid " get caller pid lac u.pid " get caller pid
sad lu+2 " match mailbox status? sad lu+2 " waiting to send to us?
skp " yes skp " yes
jmp 1b i " no, return jmp 1b i " no, return
-3 -3
tad 8 " get pointer to process table entry tad 8 " get pointer to process table entry
dac 9f+t " save in t0 dac 9f+t " save in t0
"** 01-s1.pdf page 17 "** 01-s1.pdf page 17
lac o700000 lac o700000 " decrement process status (mark ready)
tad 9f+t i " complement process status (mark ready)?? tad 9f+t i
dac 9f+t i dac 9f+t i
jmp 1b i " return from worker jmp 1b i " return from worker
t = t+1 t = t+1
" device read/write switch
swr: swr:
sww: sww:
jmp .-4 i jmp .-4 i
@@ -227,7 +228,7 @@ sww:
.halt: jms halt .halt: jms halt
" read routine for ttyin special file " read routine (upper half) for ttyin special file
rttyi: rttyi:
jms chkint1 jms chkint1
lac d1 " ** written d3 ttyin2 lac d1 " ** written d3 ttyin2
@@ -244,25 +245,25 @@ rttyi:
jms swap jms swap
jmp rttyi jmp rttyi
" write routine for ttyout special file " write (upper half) routine for ttyout special file
wttyo: wttyo:
jms chkint1 jms chkint1
jms forall jms forall
sna sna
jmp fallr jmp fallr
lmq lmq " save char in MQ
lac sfiles+1 lac sfiles+1 " get sleep word
spa spa " check if device busy
jmp 1f jmp 1f " yes
xor o400000 xor o400000 " mark as busy
dac sfiles+1 dac sfiles+1
lacq lacq " get saved char
tls " load output buffer tls " load output buffer
sad o12 " newline? sad o12 " newline?
jms putcr " yes, put CR as well jms putcr " yes, put CR as well
jmp fallr jmp fallr
1: 1:
lacq lacq " get saved char
dac char dac char
lac d2 "** written: d6 ttyout lac d2 "** written: d6 ttyout
jms putchar jms putchar
@@ -272,7 +273,7 @@ wttyo:
jms swap jms swap
jmp wttyo jmp wttyo
" read routine for (display) "keyboard" special file " read routine (upper half) for (display) "keyboard" special file
rkbdi: rkbdi:
jms chkint1 jms chkint1
lac d3 lac d3
@@ -323,7 +324,7 @@ wdspo:
jmp wdspo jmp wdspo
" read routine for paper tape reader special file " read routine (upper half) for paper tape reader special file
rppti: rppti:
lac d4 lac d4
jms getchar jms getchar
@@ -331,7 +332,7 @@ rppti:
alss 9 alss 9
jmp passone jmp passone
lac sfiles+3 " get sleep word lac sfiles+3 " get sleep word
sma " high bit set? sma " device busy?
rsa " no: reader select alphanumeric mode rsa " no: reader select alphanumeric mode
1: 1:
jms sleep; sfiles+3 jms sleep; sfiles+3
@@ -339,19 +340,19 @@ rppti:
jmp rppti jmp rppti
"** 01-s1.pdf page 19 "** 01-s1.pdf page 19
" write routine for paper tape punch special file " write routine (upper half) for paper tape punch special file
wppto: wppto:
jms forall jms forall
sna sna
jmp fallr jmp fallr
lmq lmq
lac sfiles+4 lac sfiles+4 " get sleepers
spa spa " busy?
jmp 1f jmp 1f " yes
xor o400000 xor o400000 " mark busy
dac sfiles+4 dac sfiles+4
lacq lacq " get character
psa psa " start output
jmp fallr jmp fallr
1: 1:
lacq lacq
+7 -7
View File
@@ -129,8 +129,8 @@ dsprestart:
skp " yes skp " yes
jmp piret " no: done jmp piret " no: done
lac sfiles+1 " get ttyout sleep word lac sfiles+1 " get ttyout sleep word
sma " highest bit set? sma " busy?
xor o400000 " no, make it so xor o400000 " no, mark as busy now!
dac sfiles+1 " save back dac sfiles+1 " save back
"** 01-s1.pdf page 43 "** 01-s1.pdf page 43
@@ -204,7 +204,7 @@ ttyrestart: 0
sna " have saved char? sna " have saved char?
jmp .+5 " no: jump to second rrb jmp .+5 " no: jump to second rrb
dac char " yes: save as current char dac char " yes: save as current char
rrb " clear flag, read reader buffer rrb " clear flag, read ptr buffer
dac npptchar " save as saved char dac npptchar " save as saved char
jmp .+3 jmp .+3
rrb " here without saved char: read new rrb " here without saved char: read new
@@ -222,14 +222,14 @@ ttyrestart: 0
2: 2:
lac npptchar " get saved char (if any) lac npptchar " get saved char (if any)
sna " had saved char? sna " had saved char?
jmp .+4 " no: wake up writer jmp .+4 " no
dac char " yes: save as char to send dac char " yes: save as char to send
dzm npptchar " clear saved char dzm npptchar " clear saved char
jmp 3b jmp 3b
rsa " reader select alphanumeric mode rsa " reader select alphanumeric mode
lac sfiles+3 lac sfiles+3
jms wakeup " wake sleepers; returns zero jms wakeup " wake sleepers; returns zero
xor o400000 " set high bit (rsa before sleep) xor o400000 " mark busy (rsa before sleep @ rppti)
dac sfiles+3 dac sfiles+3
jmp piret jmp piret
3: 3:
@@ -285,7 +285,7 @@ ttyrestart: 0
dac crread dac crread
jmp piret jmp piret
1: crrb " read card reader buffer?? 1: crrb " clear CR flag for good measure???
piret: " return from priority interrupt piret: " return from priority interrupt
lac 0 " get LINK (in bit 0) lac 0 " get LINK (in bit 0)
@@ -314,7 +314,7 @@ wakeup: 0
dac 9f+t dac 9f+t
sma " high bit set? sma " high bit set?
jmp 2f+2 " no: skip the fun jmp 2f+2 " no: skip the fun
lac o700000 " yes: decrement process status (wake) lac o700000 " yes: decrement process status (mark ready)
2: tad .. " (avoiding indirect) 2: tad .. " (avoiding indirect)
dac .. dac ..
lac 2b " advance tad operand by 4 words lac 2b " advance tad operand by 4 words
+5 -4
View File
@@ -159,7 +159,7 @@ uniqpid: 1 " pid generator
lu: .=.+4 " user (process) table entry copy lu: .=.+4 " user (process) table entry copy
sfiles: .=.+10 " wait addresses for special files sfiles: .=.+10 " wait addresses for special files
" (bit vectors of waiting processes?) " (bit vectors of waiting processes?)
" bit zero (MSB) is special, bit 1 first ulist entry, .... " bit zero (MSB) means busy?, bit 1 first ulist entry, ....
" offsets: 0: ttyin, 1: ttyout, 2: keyboard, " offsets: 0: ttyin, 1: ttyout, 2: keyboard,
" 3: ptr, 4: ptp, 6: display " 3: ptr, 4: ptp, 6: display
dpdata: " dataphone data dpdata: " dataphone data
@@ -191,8 +191,9 @@ sysdata: " system data 64 words saved to disk
" second word: process pid " second word: process pid
" third word: smes/rmes status: " third word: smes/rmes status:
" 0: not waiting " 0: not waiting
" -1: this process waiting (rmes) " rmes: -1 (waiting for message)
" other: complement of sender pid " smes: pid of process we're waiting to send to
" complement sender pid in dest process
" fourth word: smes message " fourth word: smes message
ulist: ulist:
0131000;1;0;0 0131000;1;0;0
@@ -211,7 +212,7 @@ userdata: " "ustruct" (swappable)
u.rq: .=.+9 " user 010-017, user PC u.rq: .=.+9 " user 010-017, user PC
u.uid: -1 " user id u.uid: -1 " user id
u.pid: 1 " process id u.pid: 1 " process id
u.cdir: 3 " connected directory (inode number?) u.cdir: 3 " current directory (i-num?)
u.ulistp: ulist " pointer to process table entry u.ulistp: ulist " pointer to process table entry
u.swapret: 0 " kernel routine to resume at after swap in u.swapret: 0 " kernel routine to resume at after swap in
u.base: 0 " start of user buffer u.base: 0 " start of user buffer