1
0
mirror of https://github.com/livingcomputermuseum/pdp7-unix.git synced 2026-02-11 02:40:46 +00:00

sys comments for rmes/smes calls, process table (user list) words

noticed "exit" call falls into "rmes" call!!!
This commit is contained in:
Phil Budne
2016-03-08 11:49:18 -05:00
parent 3e84f42637
commit 03d5e49ae9
5 changed files with 48 additions and 36 deletions

View File

@@ -86,7 +86,7 @@ swap: 0
jms lookfor; 1 " in/ready
skp
jmp 1b " loop until a process becomes ready
dzm maxquant " here with in/ready (self?)
dzm maxquant " in/ready (self?): come back next tick!
jmp 3f
1: " here with out/ready process
dac 9f+t " save process pointer (swapped out) in t0
@@ -97,7 +97,7 @@ swap: 0
jmp 2f
1:
lac swap
dac u.swapret " return to scheduler when swapped back
dac u.swapret " return to caller when swapped back
iof
lac o200000 " change status to swapped out
tad u.ulistp i
@@ -105,13 +105,13 @@ swap: 0
ion
jms dskswap; 07000 " swap process out
lac u.dspbuf
sna
jmp 2f
sna " process using display??
jmp 2f " no
law dspbuf
jms movdsp
2:
iof " disable interrupts
lac o600000 " change status (1->7?)
lac o600000 " change status (1->7?????)
tad 9f+t i
dac 9f+t i
ion " enable interrupts

View File

@@ -284,7 +284,7 @@ open1: " common exit for open/creat
jmp 1f " no
iof " yes: disable interrupts
lac ii " get i number
tad swr " get read routine table addr
tad swr " add to base instruction
dac .+1
jmp .. i " dispatch to read routine
1:

View File

@@ -1,7 +1,7 @@
"** 01-s1.pdf page 14
" s3
" search for user (process)
" search for user (process) table entry
" call:
" jms searchu; worker_routine_addr
" worker called with copy of a process table entry in "lu"
@@ -113,36 +113,44 @@ badcal: " bad (unimplemented) system call
isz u.ulistp
dzm u.ulistp i " clear pid in process table
jms swap " find a new process to run
" exit falls into "rmes" !!!
" rmes system call
" sys smes
" returns with message delivered, or error if process does not exit
" AC/ sending pid
" MQ/ message
.rmes:
jms awake
lac o100000
lac o100000 " mark this process to "not ready"
tad u.ulistp i
dac u.ulistp i
law 2
tad u.ulistp
dac 9f+t
dac 9f+t " pointer to msg status in proc table
-1
dac 9f+t i
jms swap
dac 9f+t i " set to -1 (waiting for message)
jms swap " switch processes
law 2
tad u.ulistp
dac 9f+t
lac 9f+t i
cma
dac u.ac
dzm 9f+t i
lac 9f+t i " get msg status word
cma " complement (get sender pid)
dac u.ac " return in user AC
dzm 9f+t i " clear status word
isz 9f+t
lac 9f+t i
dac u.mq
dzm 9f+t i
lac 9f+t i " get message
dac u.mq " return in user MQ
dzm 9f+t i " clear message
jmp sysexit
t = t+1
"** 01-s1.pdf page 16
" smes system call
" AC/ pid
" MQ/ message
" sys smes
" returns with message delivered, or error if process does not exit
.smes:
lac u.ac " get pid from user AC
sna spa " >0?
@@ -158,10 +166,10 @@ t = t+1
sad u.ac " match?
skp " yes
jmp 1b i " no
lac lu+2 " get mailbox
lac lu+2 " get mailbox status
sad dm1 " -1?
jmp 1f " yes
lac o100000 " no: increment process status
lac o100000 " no: bump our process status (to notready?)
tad u.ulistp i
dac u.ulistp i
law 2
@@ -178,35 +186,36 @@ t = t+1
1:
-3
tad 8
dac 9f+t
lac o700000
dac 9f+t " pointer to dest process ulist entry
lac o700000 " complement process status? marks ready??
tad 9f+t i
dac 9f+t i
isz 9f+t
isz 9f+t
lac u.pid
cma
dac 9f+t i
isz 9f+t
lac u.mq
dac 9f+t i
isz 9f+t " point to mailbox word?
lac u.pid " get our pid
cma " complement
dac 9f+t i " store in mailbox??
isz 9f+t " advance to next word
lac u.mq " get user MQ
dac 9f+t i " save as message
jmp okexit
t = t+1
" wake up process hanging on rmes for current process??
awake: 0
jms searchu; 1f
jmp awake i
1: 0 " searchu worker
lac u.pid " get caller pid
sad lu+2 " match process table entry?
sad lu+2 " match mailbox status?
skp " yes
jmp 1b i " no, return
-3
tad 8 " get pointer to pid in process table??
tad 8 " get pointer to process table entry
dac 9f+t " save in t0
"** 01-s1.pdf page 17
lac o700000 " set high bits
tad 9f+t i
lac o700000
tad 9f+t i " complement process status (mark ready)??
dac 9f+t i
jmp 1b i " return from worker
t = t+1

View File

@@ -330,7 +330,7 @@ putcr: 0
cla
jmp putcr i
intrp1: " here with keyboard interrupt
intrp1: " here with TTY interrupt character
lac d6 " get keyboard special device number
dac .int1 " save as interrupt source
lac d1

View File

@@ -175,8 +175,11 @@ sysdata: " system data 64 words saved to disk
" 4: out/notready??
" bits 3:17 -- disk swap address/8
" second word: process pid
" third word: used for smes/rmes
" fourth word: ??
" third word: smes/rmes status:
" 0: not waiting
" -1: this process waiting (rmes)
" other: complement of sender pid
" fourth word: smes message
ulist:
0131000;1;0;0
0031040;0;0;0