1
0
mirror of https://github.com/DoctorWkt/pdp7-unix.git synced 2026-01-25 03:37:23 +00:00

more system comments

This commit is contained in:
phil 2019-10-30 00:53:48 -04:00
parent f9dbe7e946
commit 2b2e057f7f
4 changed files with 54 additions and 43 deletions

View File

@ -71,7 +71,7 @@ sysexit: " common system call exit code
jms chkint " pending user interrupt?
skp " no, return to user
jmp .save " yes: dump core
jms copy; u.rq+2; 10; 6 " restore auto-index locations 10-15
jms copy; u.rq+2; 10; 6 " restore auto-index locations 10-15 (use 8/9)
lac u.rq+1 " restore auto-index location 9
dac 9
lac u.rq " restore auto-index location 8
@ -122,14 +122,14 @@ swap: 0
jms dskswap; 06000 " read process in?
lac u.swapret " set our return addr
dac swap " to saved return addr
lac o20 " reset maxquant to 16 ticks
lac o20 " reset maxquant to 16 ticks (149.333ms)
dac maxquant
lac u.dspbuf
sza " using display?
"** 01-s1.pdf page 4
jms movdsp " yes. switch to user display bufferx
3:
dzm uquant " no. reset process tick count
dzm uquant " reset process tick count
iof
jmp swap i " return
t = t+1

View File

@ -300,7 +300,7 @@ open1: " common exit for open/creat
jmp 1f " no
iof " yes: disable interrupts
lac ii " get i number
tad swr " add to base instruction
tad swr " add to base (indirect jmp)
dac .+1
jmp .. i " dispatch to read routine
1:
@ -339,14 +339,14 @@ open1: " common exit for open/creat
jmp 1f " no
iof " yes, special: turn interrupts off
lac ii " get i number
tad sww " get write routine entry addr
tad sww " add to indirect jmp
dac .+1
jmp .. i " dispatch to write routine
1: " here with regular file
lac u.base " get base
dac 1f+1 " save as iwrite arg 1
lac u.count " get count
dac 1f+2 " save as iwrite 2
dac 1f+2 " save as iwrite arg 2
lac f.badd " get fd offset
1:
jms iwrite; ..; .. " write to file

View File

@ -93,7 +93,7 @@ badcal: " bad (unimplemented) system call
" fall into "save" system call
" Ken says save files could be resumed, and used for checkpointing!
.save: " "sys save" system call
lac d1 " get inode 1 (core file?)
lac d1 " get inode 1 (core file)
jms iget " load inode
cla
jms iwrite; 4096; 4096 " dump core
@ -160,15 +160,15 @@ t = t+1
dac 9f+t
dzm 9f+t i " clear ulist 3rd word (not waiting)
jms error
1: 0 " worker for searchu
1: 0 " worker routine for searchu
lac lu+1 " get process pid
sad u.ac " match?
skp " yes
jmp 1b i " no: return
lac lu+2 " get mailbox status
jmp 1b i " no: return to searchu
lac lu+2 " get dest process mailbox status
sad dm1 " -1?
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
dac u.ulistp i
law 2
@ -176,31 +176,33 @@ t = t+1
dac 9f+t
lac u.ac " get dest pid
dac 9f+t i " save in 3rd word of our ulist entry
jms swap
law 2 " where when swapped ready
jms swap " go to sleep
law 2 " here when ready (swapped back in)
tad u.ulistp
dac 9f+t
dzm 9f+t i " clear 3rd word of ulist entry
jmp .smes " restart smes
1:
dzm 9f+t i " clear 3rd word of our ulist entry
jmp .smes " restart smes (will fail if process gone)
1: " dest process found, and in rmes call
-3
tad 8
dac 9f+t " pointer to dest process ulist entry word 0
lac o700000 " decrement process status: marks ready
lac o700000 " decrement dest process status: marks ready
tad 9f+t i
dac 9f+t i
isz 9f+t
isz 9f+t " point to message status
lac u.pid " get our pid
cma " complement
dac 9f+t i " store in status
dac 9f+t i " store in dest process status
isz 9f+t " advance to next word
lac u.mq " get user MQ
dac 9f+t i " save as message
dac 9f+t i " save as dest process message
jmp okexit
t = t+1
" wake up all processes hanging on smes to current process
" called on process exit and rmes system call
awake: 0
jms searchu; 1f
jmp awake i
@ -208,7 +210,7 @@ awake: 0
lac u.pid " get caller pid
sad lu+2 " waiting to send to us?
skp " yes
jmp 1b i " no, return
jmp 1b i " no, return to searchu
-3
tad 8 " get pointer to process table entry
dac 9f+t " save in t0
@ -222,7 +224,7 @@ t = t+1
" device read/write switch
swr:
sww:
jmp .-4 i
jmp .-4 i " added to special device i-number
.halt; rttyi; rkbdi; rppti; .halt
.halt; wttyo; wdspo; wppto
@ -249,7 +251,7 @@ rttyi:
wttyo:
jms chkint1
jms forall
sna
sna " jmp fallr "returns" here
jmp fallr
lmq " save char in MQ
lac sfiles+1 " get sleep word
@ -317,7 +319,7 @@ rkbdi:
wdspo:
jms chkint1
jms forall
jms dspput " put char (fallr "returns" here)
jms dspput " put char (jmp fallr "returns" here)
jmp fallr " go back for next (continuation!)
jms sleep; sfiles+6
jms swap
@ -343,7 +345,7 @@ rppti:
" write routine (upper half) for paper tape punch special file
wppto:
jms forall
sna
sna " jmp fallr "returns" here
jmp fallr
lmq
lac sfiles+4 " get sleepers
@ -374,16 +376,21 @@ passone:
dac u.ac
jmp sysexit
" error return from a system call
" return address @error never used
" (perhaps saved as a kind of "errno"?)
error: 0
-1
dac u.ac
jmp sysexit
" here on tty & kbd/display read/write calls
" check for pending "interrupt" and terminate process
chkint1: 0
dzm .insys
jms chkint
skp
jmp .save
jmp .save " save core and exit
-1
dac .insys
jmp chkint1 i

View File

@ -88,40 +88,44 @@ fput: 0
jmp fput i
t = t+1
" helper for special device write routines
" return to caller with next character to write:
" when done return character count to user.
" helper for special device write routines to fetch
" returns next character from user buffer
" when done returns from system call w/ character count in AC.
forall: 0
lac u.base
sad u.limit
jmp 1f " done
lac u.base " get base pointer (again?)
lac u.base " get base pointer (again?? already in AC?!)
ral " rotate MSB into LINK
lac u.base i " fetch word via base pointer
snl " link set?
lrs 9 " no: get low 9 bits
snl " LINK set?
lrs 9 " no: shift high character down
and o777 " mask to 9 bits
jmp forall i " return char
fallr: " jump here for subsequent characters
fallr: " original caller jumps to here for subsequent characters
lac u.base " get base
add o400000 " advance pointer
dac u.base " start from top
jmp forall+1
add o400000 " advance character pointer
dac u.base
jmp forall+1 " start from top
1:
lac u.count
dac u.ac
jmp sysexit
" wait for a condition variable
" prepare to sleep on a (character) device
" word after call is pointer to per-device sleepers word
" (bit vector indexed by ulist entry number)
" bit zero (MSB) of sleepers word is special (device busy?)
" call:
" jmr sleep; sfiles+N
" jms sleep; sfiles+N
" jms swap
sleep: 0
law ulist-1 " pointer to process table
dac 8 " in index register
lac o200000
lmq " get 200000 in MQ
1:
lac u.ulistp i " get current process status word
lmq " get bit for process slot zero in MQ
1: " loop to get mask bit for our process in MQ
lac u.ulistp i " get our process status word (contains swap addr)
sad 8 i " compare to next process table entry
jmp 1f " match
isz 8 " no match: skip other 3 words of process table
@ -130,13 +134,13 @@ sleep: 0
cla; lrs 1 " shift MQ down one
jmp 1b " loop
1:
tad o100000 " mark process not ready
tad o100000 " increment our status to mark process not ready
dac u.ulistp i
lac sleep i " get sleep variable pointer
dac 9f+t
lac 9f+t i " get sleep variable contents
omq " or in MQ (bit vector of processes waiting)
dac 9f+t i " save
omq " or in MQ (set bit for our process)
dac 9f+t i " write sleep variable
isz sleep " skip sleep variable pointer
jmp sleep i
t = t+1