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
+3 -3
View File
@@ -71,7 +71,7 @@ sysexit: " common system call exit code
jms chkint " pending user interrupt? jms chkint " pending user interrupt?
skp " no, return to user skp " no, return to user
jmp .save " yes: dump core 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 lac u.rq+1 " restore auto-index location 9
dac 9 dac 9
lac u.rq " restore auto-index location 8 lac u.rq " restore auto-index location 8
@@ -122,14 +122,14 @@ swap: 0
jms dskswap; 06000 " read process in? jms dskswap; 06000 " read process in?
lac u.swapret " set our return addr lac u.swapret " set our return addr
dac swap " to saved 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 dac maxquant
lac u.dspbuf lac u.dspbuf
sza " using display? sza " using display?
"** 01-s1.pdf page 4 "** 01-s1.pdf page 4
jms movdsp " yes. switch to user display bufferx jms movdsp " yes. switch to user display bufferx
3: 3:
dzm uquant " no. reset process tick count dzm uquant " reset process tick count
iof iof
jmp swap i " return jmp swap i " return
t = t+1 t = t+1
+3 -3
View File
@@ -300,7 +300,7 @@ open1: " common exit for open/creat
jmp 1f " no jmp 1f " no
iof " yes: disable interrupts iof " yes: disable interrupts
lac ii " get i number lac ii " get i number
tad swr " add to base instruction tad swr " add to base (indirect jmp)
dac .+1 dac .+1
jmp .. i " dispatch to read routine jmp .. i " dispatch to read routine
1: 1:
@@ -339,14 +339,14 @@ open1: " common exit for open/creat
jmp 1f " no jmp 1f " no
iof " yes, special: turn interrupts off iof " yes, special: turn interrupts off
lac ii " get i number lac ii " get i number
tad sww " get write routine entry addr tad sww " add to indirect jmp
dac .+1 dac .+1
jmp .. i " dispatch to write routine jmp .. i " dispatch to write routine
1: " here with regular file 1: " here with regular file
lac u.base " get base lac u.base " get base
dac 1f+1 " save as iwrite arg 1 dac 1f+1 " save as iwrite arg 1
lac u.count " get count 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 lac f.badd " get fd offset
1: 1:
jms iwrite; ..; .. " write to file jms iwrite; ..; .. " write to file
+26 -19
View File
@@ -93,7 +93,7 @@ badcal: " bad (unimplemented) system call
" 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 " load inode jms iget " load inode
cla cla
jms iwrite; 4096; 4096 " dump core jms iwrite; 4096; 4096 " dump core
@@ -160,15 +160,15 @@ t = t+1
dac 9f+t dac 9f+t
dzm 9f+t i " clear ulist 3rd word (not waiting) dzm 9f+t i " clear ulist 3rd word (not waiting)
jms error jms error
1: 0 " worker for searchu 1: 0 " worker routine for searchu
lac lu+1 " get process pid lac lu+1 " get process pid
sad u.ac " match? sad u.ac " match?
skp " yes skp " yes
jmp 1b i " no: return jmp 1b i " no: return to searchu
lac lu+2 " get mailbox status lac lu+2 " get dest process mailbox status
sad dm1 " -1? sad dm1 " -1?
jmp 1f " yes: process in rmes: ok to send 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
@@ -176,31 +176,33 @@ t = t+1
dac 9f+t dac 9f+t
lac u.ac " get dest pid lac u.ac " get dest pid
dac 9f+t i " save in 3rd word of our ulist entry dac 9f+t i " save in 3rd word of our ulist entry
jms swap jms swap " go to sleep
law 2 " where when swapped ready law 2 " here when ready (swapped back in)
tad u.ulistp tad u.ulistp
dac 9f+t dac 9f+t
dzm 9f+t i " clear 3rd word of ulist entry dzm 9f+t i " clear 3rd word of our ulist entry
jmp .smes " restart smes jmp .smes " restart smes (will fail if process gone)
1:
1: " dest process found, and in rmes call
-3 -3
tad 8 tad 8
dac 9f+t " pointer to dest process ulist entry word 0 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 tad 9f+t i
dac 9f+t i dac 9f+t i
isz 9f+t isz 9f+t
isz 9f+t " point to message status 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 status dac 9f+t i " store in dest process 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 dest process message
jmp okexit jmp okexit
t = t+1 t = t+1
" wake up all processes hanging on smes to current process " wake up all processes hanging on smes to current process
" called on process exit and rmes system call
awake: 0 awake: 0
jms searchu; 1f jms searchu; 1f
jmp awake i jmp awake i
@@ -208,7 +210,7 @@ awake: 0
lac u.pid " get caller pid lac u.pid " get caller pid
sad lu+2 " waiting to send to us? sad lu+2 " waiting to send to us?
skp " yes skp " yes
jmp 1b i " no, return jmp 1b i " no, return to searchu
-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
@@ -222,7 +224,7 @@ t = t+1
" device read/write switch " device read/write switch
swr: swr:
sww: sww:
jmp .-4 i jmp .-4 i " added to special device i-number
.halt; rttyi; rkbdi; rppti; .halt .halt; rttyi; rkbdi; rppti; .halt
.halt; wttyo; wdspo; wppto .halt; wttyo; wdspo; wppto
@@ -249,7 +251,7 @@ rttyi:
wttyo: wttyo:
jms chkint1 jms chkint1
jms forall jms forall
sna sna " jmp fallr "returns" here
jmp fallr jmp fallr
lmq " save char in MQ lmq " save char in MQ
lac sfiles+1 " get sleep word lac sfiles+1 " get sleep word
@@ -317,7 +319,7 @@ rkbdi:
wdspo: wdspo:
jms chkint1 jms chkint1
jms forall jms forall
jms dspput " put char (fallr "returns" here) jms dspput " put char (jmp fallr "returns" here)
jmp fallr " go back for next (continuation!) jmp fallr " go back for next (continuation!)
jms sleep; sfiles+6 jms sleep; sfiles+6
jms swap jms swap
@@ -343,7 +345,7 @@ rppti:
" write routine (upper half) 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 "returns" here
jmp fallr jmp fallr
lmq lmq
lac sfiles+4 " get sleepers lac sfiles+4 " get sleepers
@@ -374,16 +376,21 @@ passone:
dac u.ac dac u.ac
jmp sysexit jmp sysexit
" error return from a system call
" return address @error never used
" (perhaps saved as a kind of "errno"?)
error: 0 error: 0
-1 -1
dac u.ac dac u.ac
jmp sysexit jmp sysexit
" here on tty & kbd/display read/write calls
" check for pending "interrupt" and terminate process
chkint1: 0 chkint1: 0
dzm .insys dzm .insys
jms chkint jms chkint
skp skp
jmp .save jmp .save " save core and exit
-1 -1
dac .insys dac .insys
jmp chkint1 i jmp chkint1 i
+22 -18
View File
@@ -88,40 +88,44 @@ fput: 0
jmp fput i jmp fput i
t = t+1 t = t+1
" helper for special device write routines " helper for special device write routines to fetch
" return to caller with next character to write: " returns next character from user buffer
" when done return character count to user. " when done returns from system call w/ character count in AC.
forall: 0 forall: 0
lac u.base lac u.base
sad u.limit sad u.limit
jmp 1f " done 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 ral " rotate MSB into LINK
lac u.base i " fetch word via base pointer lac u.base i " fetch word via base pointer
snl " link set? snl " LINK set?
lrs 9 " no: get low 9 bits lrs 9 " no: shift high character down
and o777 " mask to 9 bits and o777 " mask to 9 bits
jmp forall i " return char 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 lac u.base " get base
add o400000 " advance pointer add o400000 " advance character pointer
dac u.base " start from top dac u.base
jmp forall+1 jmp forall+1 " start from top
1: 1:
lac u.count lac u.count
dac u.ac dac u.ac
jmp sysexit 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: " call:
" jmr sleep; sfiles+N " jms sleep; sfiles+N
" jms swap
sleep: 0 sleep: 0
law ulist-1 " pointer to process table law ulist-1 " pointer to process table
dac 8 " in index register dac 8 " in index register
lac o200000 lac o200000
lmq " get 200000 in MQ lmq " get bit for process slot zero in MQ
1: 1: " loop to get mask bit for our process in MQ
lac u.ulistp i " get current process status word lac u.ulistp i " get our process status word (contains swap addr)
sad 8 i " compare to next process table entry sad 8 i " compare to next process table entry
jmp 1f " match jmp 1f " match
isz 8 " no match: skip other 3 words of process table isz 8 " no match: skip other 3 words of process table
@@ -130,13 +134,13 @@ sleep: 0
cla; lrs 1 " shift MQ down one cla; lrs 1 " shift MQ down one
jmp 1b " loop jmp 1b " loop
1: 1:
tad o100000 " mark process not ready tad o100000 " increment our status to mark process not ready
dac u.ulistp i dac u.ulistp i
lac sleep i " get sleep variable pointer lac sleep i " get sleep variable pointer
dac 9f+t dac 9f+t
lac 9f+t i " get sleep variable contents lac 9f+t i " get sleep variable contents
omq " or in MQ (bit vector of processes waiting) omq " or in MQ (set bit for our process)
dac 9f+t i " save dac 9f+t i " write sleep variable
isz sleep " skip sleep variable pointer isz sleep " skip sleep variable pointer
jmp sleep i jmp sleep i
t = t+1 t = t+1