assem.defs 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331
  1. ; non-gc'd scratch regs (contents unchanged by reloc or gc)
  2. n0=: 0 ; scratch 1 (may not contain an address!)
  3. n1=: 1 ; scratch 2
  4. n2=: 2 ; scratch 3
  5. n3=: 3 ; scratch 4
  6. ; relocatable registers (rh relocatable but not gc'd)
  7. r0=: 4 ; reloc register 1
  8. r1=: 5 ; reloc register 2
  9. ; gc'd scratch regs (lh should have type code, rh should have reference)
  10. g0=: 6 ; gc scratch 1
  11. g1=: 7 ; gc scratch 2
  12. ; return object reg (a single gc'd ref)
  13. rr=: 10 ; must be a ref
  14. ; activation registers (all non-gc'd)
  15. br=: 11 ; blt register (both halves reloc)
  16. xr=: 12 ; x-fer register (rh reloc)
  17. er=: 13 ; environment register (rh reloc)
  18. lr=: 14 ; linkage register (rh reloc)
  19. pr=: 15 ; procedure register (rh reloc)
  20. mr=: 16 ; module register (rh reloc)
  21. ; stack pointer (stack frames are a basis of gc)
  22. sp=: 17 ; (rh reloc)
  23. ; Opcodes not supported by MIDAS
  24. jov=jfcl+(400) ; jump on fixed overflow
  25. jfov=jfcl+(040) ; jump on floating overflow
  26. ; interesting constants
  27. myvers==:1(1) ; current version number (format,,features)
  28. typgen==:0 ; gt means generate type codes
  29. tcflag==:typgen ; type checking flag for macros
  30. ttyicn==:1 ; tty input channel #
  31. ttyocn==:2 ; tty output channel #
  32. pgsize==:1024. ; size of memory page in words
  33. pglog2==:10. ; log2 of page size
  34. ; true xor false must equal true+false !!!
  35. true==: 777777
  36. false==: 0
  37. ; Interesting constant addresses in memory
  38. comadr==:100 ; common vectors address
  39. nulls$==:600 ; null string location
  40. syslo==:6*pgsize ; lowest system address (leave space for GC)
  41. userlo==:32.*pgsize ; lowest user address
  42. memlen==:2*pgsize ; initial space for the gc-able memory
  43. hipage==:254. ; start of funny pages (254 & 255 are funny)
  44. gchi==:hipage*pgsize-1 ; highest possible gc-address (ever)
  45. gclo==:gchi-memlen+1 ; lowest possible gc-address (intially)
  46. work$==:hipage*pgsize ; loader working area address (for 1 page)
  47. mover==:work$+pgsize ; moving area
  48. ones==:777777 ; halfword of ones (highest address)
  49. ; string stuff
  50. bpword==: 5 ; number of bytes per word
  51. chsize==: 7 ; bits per character
  52. bsize==: (chsize*100) ; mask for byte ptr for strings
  53. wsize==: (004400) ; mask for full-word byte ptr
  54. hichar==: 177 ; the highest char (must be 177, 377, or 777 !)
  55. ;;;; TYPES ;;;;
  56. typlo=:400
  57. refbit=:400000
  58. relbit=:200000
  59. repbit=:200000
  60. gcbit=: 100000
  61. typmsk=:(07777)
  62. ; offsets for blocks used in the CLU support system.
  63. ; arep,array_rep
  64. ar.cod==: 0 ; tarep+low_bound
  65. ar.rel==: 1 ; [rsb,,rel] -size,,rel to usable stuff in vector
  66. ar.vec==: 2 ; [rsb,,ref] predict,,ref to real vector
  67. ; crep,call_block_rep
  68. pc.cod==: 0 ; tcrep+size (in words)
  69. pc.set==: 1 ; [rsb] the setup for the procedure (pc.set=en.set !!)
  70. pc.num==: 2 ; [rsb] the number of arguments given in the call
  71. pc.str==: 3 ; [ref] the external name (or operation name)
  72. pc.typ==: 4 ; [ref] the cluster type (if an operation)
  73. pc.par==: 5 ; [ref] parms given for the procedure
  74. pc.dat==: 6 ; any more words are refs
  75. ; drep,descriptor_rep
  76. td.cod==: 0 ; [rsb] code for type desc & length
  77. td.fix==: 1 ; [ref] the fixed up value for the descriptor (init 0)
  78. td.opt==: 2 ; [rsb] the variety of type desc
  79. td.nam==: 3 ; [ref] string ref for external name (or 0)
  80. td.arg==: 4 ; [ref] to parms or arguments (td,sd,pt,it,ed,zd)
  81. ; [ref] to cluster desc (rt,xr)
  82. ; [0,,rsb] position of parm (pa)
  83. td.rtn==: 5 ; [ref] to return types (for pt,it)
  84. ; [ref] to proc parms (rt,xr)
  85. td.sig==: 6 ; [ref] to signal types (for pt,it)
  86. ; option codes in td.opt (must be single bits)
  87. tdc.td==:1 ; simple type desc
  88. tdc.sd==:2 ; selected type desc
  89. tdc.pa==:4 ; cluster/proc parm
  90. tdc.rt==:10 ; return type desc
  91. tdc.pt==:20 ; proc type desc
  92. tdc.it==:40 ; iterator type desc
  93. tdc.ed==:100 ; exception desc
  94. tdc.xr==:200 ; external proc desc
  95. tdc.pp==:400 ; proc parm dependent
  96. tdc.cp==:1000 ; cluster parm dependent
  97. tdc.zd==:2000 ; zdesc (for records/oneofs)
  98. ; erep,entry_rep
  99. en.cod==: 0 ; terep+size (in words)
  100. en.set==: 1 ; [rsb,,rel] the setup instruction to XCT (en.set=pc.set !!)
  101. en.lpr==: 2 ; [ref,,ref] the (lr,,pr) pair
  102. en.vi==: 3 ; [ref+1,,rsb] the variable init pair (ref+1,,len)
  103. en.par==: 4 ; [ref,,ref] the (proc parm,,cluster parm) pair
  104. en.tr==: 5 ; [rsb,,ref] the trace info (if any)
  105. en.typ==: 6 ; [ref] the type (or type desc) for this entry
  106. en.nxt==: 7 ; [ref] the chain of entry blocks (for parameters)
  107. en.dat==: 8. ; any more words are refs
  108. en.odv==: 8. ; [ref] optional vector to own data
  109. ; prep,pure_part_rep
  110. pr.cod==: 0 ; tprep+size (in words)
  111. pr.err==: 1 ; [rsb,,rsb] LH has prc codes, RH has disp to error info
  112. pr.cut==: 2 ; [rsb] stack cutback on exit
  113. pr.nam==: 3 ; [rsb] disp to names in pr block
  114. pr.go==: 4 ; [rsb] first word of code here
  115. ; further words are [rsb], except that
  116. ; [ref]'s start where pr.err is an offset to
  117. ; prc codes
  118. prc.ni==: 1 ; no interrupts while this proc is current
  119. prc.cp==: 2 ; this proc is dependent on cluster parms
  120. prc.na==: 4 ; no array chopping while in this procedure
  121. prc.pp==: 10 ; this proc is dependent on proc parms
  122. prc.it==: 20 ; this proc is really an iterator
  123. prc.ma==: 40 ; this proc is multi-argument (top one gives #)
  124. ; orep,oneof_rep
  125. on.cod==: 0 ; torep+tag
  126. on.ref==: 1 ; [ref] info part
  127. ; srep,string_rep
  128. st.cod==: 0 ; tsrep+number_of_chars
  129. st.dat==: 1 ; [rsb] characters immediately follow
  130. ; vec,vector
  131. ve.cod==: 0 ; tvec+size (in words)
  132. ve.dat==: 1 ; [ref] references follow
  133. ; wvec,word_vector
  134. wv.cod==: 0 ; twvec+size (in words)
  135. wv.dat==: 1 ; [rsb] words of raw seething bits follow
  136. ; xvec,ref_vector
  137. xv.cod==: 0 ; txvec+size (in words)
  138. xv.dat==: 1 ; [rsb,,ref] words in remainder
  139. fb.cod==0
  140. fb.dev==1
  141. fb.nm1==2
  142. fb.nm2==3
  143. fb.usr==4
  144. fb..==5
  145. ; Fake a vector for the type codes.
  146. loc typlo
  147. ; The most basic type codes to occur as LH of references
  148. typbit==refbit
  149. deft ref,ref
  150. deft xref,?ref
  151. typbit==refbit+relbit
  152. deft rel,rel
  153. deft xrel,?rel
  154. typrep==:.
  155. typbit==repbit
  156. ; The most basic type codes to appear as LH of 1st words
  157. deft arep,arep
  158. deft crep,crep
  159. deft drep,drep
  160. deft erep,erep
  161. deft prep,prep
  162. deft orep,orep
  163. deft srep,srep
  164. deft vec,vec
  165. deft wvec,wvec
  166. deft xrep,xvec
  167. typbit==0
  168. typrsb==:.
  169. deft int,int
  170. deft bool,bool
  171. deft char,char
  172. deft type,type
  173. deft mrtn,mrtn
  174. deft chan,chan
  175. typref==:.
  176. deft str,str
  177. deft real,real
  178. typbit==refbit
  179. deft pcb,pcb ; procedure call block
  180. deft td,tdesc ; normal-type descriptor
  181. deft ppd,ppdesc ; proc parm desc
  182. deft cpd,cpdesc ; cluster parm desc
  183. typbit==0
  184. deft null,null
  185. deft none,none ; type of return obj from procs that don't have any
  186. deft any,any ; type any
  187. typusr==:. ; User-defined types from here on
  188. %str=:refbit(tstr)
  189. ;;; COMMON ;;;
  190. loc comadr
  191. nullp==777700
  192. gcon $true,tbool+true ; boolean true
  193. gcon $false,tbool+false ; boolean false
  194. gcon $none,tnone+(refbit)+none$ ; the null return
  195. gcon $null,tnull+(refbit)+null$ ; the null object
  196. $nil=$null
  197. gcon $nulls,tstr+(refbit)+nulls$ ; the null string
  198. gcon $nullv,tref+nullv$ ; the unusable vector
  199. gcon $neg1,tint+777777 ; -1
  200. gcon $zero,tint+0 ; 0
  201. gcon $one,tint+1 ; 1
  202. gcon $two,tint+2 ; 2
  203. gcon $tyo,tchan+ttyocn ; default tty output
  204. gcon $tyi,tchan+ttyicn ; default tty input
  205. gcon $work,trel+work$ ; a page to work with
  206. gcon $ents,tref+ents$ ; the system entries
  207. comadx==.
  208. ; Can't $rtnc following stuff
  209. gconv $memhi,tref+gchi ; current high bound on free mem
  210. gconv $memlo,tref+gclo ; current low bound on free mem
  211. gconv $stkhi,tref+stktop ; upper bound on stack
  212. gconv $pure,tref+gchi+1 ; current pure stuff
  213. gconv $purtop,tref+gchi
  214. gconv $types,tref+types$ ; the types vector
  215. gconv $sigpr,0 ; signal printing flag
  216. gconv $mtab,0 ; the module table
  217. gconv $intlock,0 ; this locks up the world
  218. gconv intchk,skip ; this gets hit when we want to interrupt
  219. .i.==440000(bsize)
  220. .c==chsize*10000
  221. gconv $bptab,[(.i.-.c),(.i.-2*.c),(.i.-3*.c),(.i.-4*.c),(.i.-5*.c)]
  222. gconv $r.get,r.get ; get record component (get_*)
  223. gconv $r.put,r.put ; put record component (put_*)
  224. gconv $r.acc,r.acc ; general access entry
  225. gconv $o.new,o.new ; make a new oneof (make_*)
  226. gconv $typbp,[(221600+sp)]
  227. gconv $vtab,0 ; the vector table (for desc canon)
  228. gconv $o.is,o.is ; test for taggedness of oneof
  229. gconv $o.get,o.get ; force a get of a oneof component
  230. gconv $trace,0 ; the trace flag
  231. gconv $trxct,0
  232. gconv $trsav,0 ; trace request
  233. gconv $lflag,0 ; listen loop recovery flag
  234. gconv $bad,txrep+1 ; Bad thing
  235. tbad==tref+$bad
  236. ; jumps to internal routines
  237. jumplo==:.
  238. jumper setup
  239. jumper exiter
  240. jumper qsetup
  241. jumper yield
  242. jumper resume
  243. jumper exitc
  244. jumper qexit
  245. jumper notref
  246. jumper notrsb
  247. jumper badrep
  248. jumper frog
  249. jumper linker
  250. jumper buggy
  251. jumper mexit
  252. jumper badrtn
  253. jumper memout
  254. jumper framer
  255. jumper itpop
  256. jumper siggy
  257. jumper causer
  258. jumper notype
  259. jumper mxrout ; qproc return
  260. jumper vcopy ; copy a vector
  261. jumper rcopy ; copy a range
  262. jumper yldout
  263. jumper agnew
  264. jumper nixon
  265. jumper i.ofl ; overflow signal
  266. jumper myield
  267. jumper amake ; make an array
  268. jumper badtyp ; bad type code from force
  269. jumper safex ; jumper to safe exit
  270. jumper chkout ; check interrupts and jrst (xr)
  271. jumphi==.-1 ; highest jumper
  272. loc nulls$
  273. gconv nulls%,[tsrep+0,0]
  274. gconv none$,[tvec+1,0]
  275. gconv null$,[tvec+1,0]
  276. gconv nullv$,[tvec+1,0]
  277. gconv $sname,clusys
  278. gconv $bvec,tref+basvec ; vector of basic areas
  279. gconv $stack,trel+stack ; start of stack
  280. gconv $gcsav,tint ; # of words saved by last gc
  281. gconv $gcreq,0 ; # of GC requests
  282. gconv $ahack,0 ; # of hacked array arguments
  283. gconv $.greq,0 ; ^G request
  284. gconv $.sreq,0 ; ^S request
  285. gconv $ihand,0 ; inferior interrupt handler (procedure object)
  286. gconv $infer,0 ; 0,,lh of .ifpir user variable
  287. gconv $inreq,0 ; inferior interrupt requests
  288. gconv $safex,0 ; safex hacking flag
  289. gconv $indef,0 ; any interrupt request increments this
  290. gconv $otty,0 ; non-zero if tty is open
  291. gconv $start,start ; starting address
  292. gconv $cflag,0 ; arg checking flag (1 -> no check)
  293. gconv $snap,0 ; # of things snapped
  294. gconv $gcopt,0 ; GC options word
  295. gconv $fhand,0 ; 1 -> propagate failure
  296. gconv $hheap,0 ; hi heap marker
  297. gconv $styx,0 ; statistics-keeping flag