| 1 | \ ========== Copyright Header Begin ========================================== |
| 2 | \ |
| 3 | \ Hypervisor Software File: sysprims.fth |
| 4 | \ |
| 5 | \ Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved. |
| 6 | \ |
| 7 | \ - Do no alter or remove copyright notices |
| 8 | \ |
| 9 | \ - Redistribution and use of this software in source and binary forms, with |
| 10 | \ or without modification, are permitted provided that the following |
| 11 | \ conditions are met: |
| 12 | \ |
| 13 | \ - Redistribution of source code must retain the above copyright notice, |
| 14 | \ this list of conditions and the following disclaimer. |
| 15 | \ |
| 16 | \ - Redistribution in binary form must reproduce the above copyright notice, |
| 17 | \ this list of conditions and the following disclaimer in the |
| 18 | \ documentation and/or other materials provided with the distribution. |
| 19 | \ |
| 20 | \ Neither the name of Sun Microsystems, Inc. or the names of contributors |
| 21 | \ may be used to endorse or promote products derived from this software |
| 22 | \ without specific prior written permission. |
| 23 | \ |
| 24 | \ This software is provided "AS IS," without a warranty of any kind. |
| 25 | \ ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, |
| 26 | \ INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A |
| 27 | \ PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN |
| 28 | \ MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR |
| 29 | \ ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR |
| 30 | \ DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN |
| 31 | \ OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR |
| 32 | \ FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE |
| 33 | \ DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, |
| 34 | \ ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF |
| 35 | \ SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. |
| 36 | \ |
| 37 | \ You acknowledge that this software is not designed, licensed or |
| 38 | \ intended for use in the design, construction, operation or maintenance of |
| 39 | \ any nuclear facility. |
| 40 | \ |
| 41 | \ ========== Copyright Header End ============================================ |
| 42 | id: @(#)sysprims.fth 2.34 96/04/09 |
| 43 | purpose: FCode token number definitions for system (2-byte) FCodes |
| 44 | copyright: Copyright 1990 Sun Microsystems, Inc. All Rights Reserved |
| 45 | |
| 46 | hex |
| 47 | \ --- Memory allocation and mapping -------------------------------------- |
| 48 | \ v1 v2 000 1 (reserved - because alocated by single byte fcodes) |
| 49 | |
| 50 | v1 v2 001 1 byte-code: obsolete-fcode \ Was dma-alloc ( #bytes -- virtual ) |
| 51 | v1 v2 002 1 byte-code: my-address ( -- physical ) |
| 52 | v1 v2 003 1 byte-code: my-space ( -- space ) |
| 53 | v1 v2 004 1 byte-code: obsolete-fcode \ Was memmap ( physical space size -- virtual ) |
| 54 | v1 v2 005 1 byte-code: free-virtual ( virtual len -- ) |
| 55 | v1 v2 006 1 byte-code: obsolete-fcode \ Was >physical ( virtual -- physical space ) |
| 56 | |
| 57 | \ 007 1 |
| 58 | \ 008 1 |
| 59 | \ 009 1 |
| 60 | \ 00a 1 |
| 61 | \ 00b 1 |
| 62 | \ 00c 1 |
| 63 | \ 00d 1 |
| 64 | \ 00e 1 |
| 65 | |
| 66 | v1 v2 00f 1 byte-code: obsolete-fcode \ Was my-params ( -- addr len ) |
| 67 | v1 v2 010 1 byte-code: property ( val-adr val-len name-adr name-len -- ) |
| 68 | \ Was attribute |
| 69 | v1 v2 011 1 byte-code: encode-int ( n1 -- adr len ) |
| 70 | \ Was xdrint |
| 71 | v1 v2 012 1 byte-code: encode+ ( adr len1 adr len2-- adr len1+2 ) |
| 72 | \ Was xdr+ |
| 73 | v1 v2 013 1 byte-code: encode-phys ( paddr space -- adr len ) |
| 74 | \ Was xdrphys |
| 75 | v1 v2 014 1 byte-code: encode-string ( adr len -- adr' len+1 ) |
| 76 | \ Was xdrstring |
| 77 | v2.1 015 1 byte-code: encode-bytes ( adr len -- adr' len+1 ) |
| 78 | \ Was xdrbytes |
| 79 | |
| 80 | \ --- Shorthand Property Creation -------------------------------------- |
| 81 | v1 v2 016 1 byte-code: reg ( physical space size -- ) |
| 82 | v1 v2 017 1 byte-code: obsolete-fcode \ Was intr ( int-level vector -- ) |
| 83 | v1 018 1 byte-code: obsolete-fcode \ driver ( adr len -- ) |
| 84 | v1 v2 019 1 byte-code: model ( adr len -- ) |
| 85 | v1 v2 01a 1 byte-code: device-type ( adr len -- ) |
| 86 | v2 01b 1 byte-code: parse-2int ( adr len -- address space ) |
| 87 | \ Was decode-2int |
| 88 | |
| 89 | \ --- Driver Installation ------------------------------------------------ |
| 90 | v1 v2 01c 1 byte-code: is-install ( acf -- ) |
| 91 | v1 v2 01d 1 byte-code: is-remove ( acf -- ) |
| 92 | v1 v2 01e 1 byte-code: is-selftest ( acf -- ) |
| 93 | v1 v2 01f 1 byte-code: new-device ( -- ) |
| 94 | |
| 95 | \ --- Selftest ----------------------------------------------------------- |
| 96 | v1 v2 020 1 byte-code: diagnostic-mode? ( -- flag ) |
| 97 | |
| 98 | v1 v2 021 1 byte-code: obsolete-fcode \ Was display-status ( n -- ) |
| 99 | v1 v2 022 1 byte-code: memory-test-suite ( adr len -- status) |
| 100 | v1 v2 023 1 byte-code: obsolete-fcode \ Was group-code ( -- adr ) |
| 101 | v1 v2 024 1 byte-code: mask ( -- adr ) |
| 102 | |
| 103 | v1 v2 025 1 byte-code: get-msecs ( -- ms ) |
| 104 | v1 v2 026 1 byte-code: ms ( n -- ) |
| 105 | v1 v2 027 1 byte-code: finish-device ( -- ) |
| 106 | |
| 107 | v3 028 1 byte-code: decode-phys ( adr1 len2 -- adr2 len2 phys.lo..hi ) |
| 108 | v3 029 1 byte-code: push-package ( phandle -- ) |
| 109 | v3 02a 1 byte-code: pop-package ( -- ) |
| 110 | v3 02b 1 byte-code: interpose ( adr len phandle -- ) |
| 111 | \ 02c |
| 112 | \ 02d |
| 113 | \ 02e |
| 114 | \ 02f |
| 115 | |
| 116 | v1 v2 030 1 byte-code: map-low ( phys size -- virt ) \ Was map-sbus |
| 117 | |
| 118 | \ --- Sbus Support - now obsolescent |
| 119 | v1 v2 031 1 byte-code: sbus-intr>cpu ( sbus-intr# -- cpu-intr# ) |
| 120 | \ v1 v2 037 1 -- [S-Bus support] |
| 121 | |
| 122 | \ --- P4 Bus address spaces - (these moved to /dev/p4bus/fcodeprims.fth) - |
| 123 | \ v1 038 1 -- [P4 Bus support] obsolete |
| 124 | \ v1 ... -- [P4 Bus support] obsolete |
| 125 | \ v1 03f 1 -- [P4 Bus support] obsolete |
| 126 | |
| 127 | \ --- Interrupts (Think about this!) ------------------------------------- |
| 128 | \ 040 1 byte-code: catch-interrupt ( level vector -- ) |
| 129 | \ 041 1 byte-code: restore-interrupt ( level -- ) |
| 130 | \ 042 1 byte-code: interrupt-occurred? ( -- flag ) |
| 131 | \ 043 1 byte-code: enable-interrupt ( level -- ) |
| 132 | \ 044 1 byte-code: disable-interrupt ( level -- ) |
| 133 | \ 045 1 |
| 134 | \ 046 1 |
| 135 | \ 047 1 |
| 136 | \ 048 1 |
| 137 | \ 049 1 |
| 138 | \ 04a 1 |
| 139 | \ 04b 1 |
| 140 | \ 04c 1 |
| 141 | \ 04d 1 |
| 142 | \ 04e 1 |
| 143 | \ 04f 1 |
| 144 | |
| 145 | \ TERMINAL/FRAMEBUFFER OPERATIONS (DISPLAY DEVICE FCODES) |
| 146 | \ --- Terminal emulator values ------------------------------------------- |
| 147 | v1 v2 050 1 byte-code: #lines ( -- n ) |
| 148 | v1 v2 051 1 byte-code: #columns ( -- n ) |
| 149 | v1 v2 052 1 byte-code: line# ( -- n ) |
| 150 | v1 v2 053 1 byte-code: column# ( -- n ) |
| 151 | v1 v2 054 1 byte-code: inverse? ( -- flag ) |
| 152 | v1 v2 055 1 byte-code: inverse-screen? ( -- flag ) |
| 153 | \ v1 056 1 byte-code: frame-buffer-busy? ( -- flag ) \ Obsolete |
| 154 | |
| 155 | \ --- Terminal emulation low-level operations ---------------------------- |
| 156 | v1 v2 057 1 byte-code: draw-character ( char -- ) |
| 157 | v1 v2 058 1 byte-code: reset-screen ( -- ) |
| 158 | v1 v2 059 1 byte-code: toggle-cursor ( -- ) |
| 159 | v1 v2 05a 1 byte-code: erase-screen ( -- ) |
| 160 | v1 v2 05b 1 byte-code: blink-screen ( -- ) |
| 161 | v1 v2 05c 1 byte-code: invert-screen ( -- ) |
| 162 | v1 v2 05d 1 byte-code: insert-characters ( n -- ) |
| 163 | v1 v2 05e 1 byte-code: delete-characters ( n -- ) |
| 164 | v1 v2 05f 1 byte-code: insert-lines ( n -- ) |
| 165 | v1 v2 060 1 byte-code: delete-lines ( n -- ) |
| 166 | v1 v2 061 1 byte-code: draw-logo ( line# laddr lwidth lheight -- ) |
| 167 | |
| 168 | \ --- Frame Buffer Text routines ----------------------------------------- |
| 169 | v1 v2 062 1 byte-code: frame-buffer-adr ( -- addr ) |
| 170 | v1 v2 063 1 byte-code: screen-height ( -- n ) |
| 171 | v1 v2 064 1 byte-code: screen-width ( -- n ) |
| 172 | v1 v2 065 1 byte-code: window-top ( -- n ) |
| 173 | v1 v2 066 1 byte-code: window-left ( -- n ) |
| 174 | |
| 175 | \ 067 1 |
| 176 | \ 068 1 |
| 177 | \ 069 1 |
| 178 | |
| 179 | \ --- Font --------------------------------------------------------------- |
| 180 | v1 v2 06a 1 byte-code: default-font ( -- fntbase chrwidth chrheight fntbytes #1stchr #chrs ) |
| 181 | v1 v2 06b 1 byte-code: set-font ( fntbase chrwidth chrheight fntbytes #1stchr #chrs -- ) |
| 182 | v1 v2 06c 1 byte-code: char-height ( -- n ) |
| 183 | v1 v2 06d 1 byte-code: char-width ( -- n ) |
| 184 | v1 v2 06e 1 byte-code: >font ( char -- adr ) |
| 185 | v1 v2 06f 1 byte-code: fontbytes ( -- n ) \ Bytes/scan line, usu. 2 |
| 186 | |
| 187 | \ --- 1-bit frame buffer routines ---------------------------------------- |
| 188 | \ The FB1 support package is obsolete in IEEE 1275 |
| 189 | |
| 190 | v1 v2 070 1 byte-code: obsolete-fcode \ Was fb1-draw-character ( char -- ) |
| 191 | v1 v2 071 1 byte-code: obsolete-fcode \ Was fb1-reset-screen ( -- ) |
| 192 | v1 v2 072 1 byte-code: obsolete-fcode \ Was fb1-toggle-cursor ( -- ) |
| 193 | v1 v2 073 1 byte-code: obsolete-fcode \ Was fb1-erase-screen ( -- ) |
| 194 | v1 v2 074 1 byte-code: obsolete-fcode \ Was fb1-blink-screen ( -- ) |
| 195 | v1 v2 075 1 byte-code: obsolete-fcode \ Was fb1-invert-screen ( -- ) |
| 196 | v1 v2 076 1 byte-code: obsolete-fcode \ Was fb1-insert-characters ( #chars -- ) |
| 197 | v1 v2 077 1 byte-code: obsolete-fcode \ Was fb1-delete-characters ( #chars -- ) |
| 198 | v1 v2 078 1 byte-code: obsolete-fcode \ Was fb1-insert-lines ( #lines -- ) |
| 199 | v1 v2 079 1 byte-code: obsolete-fcode \ Was fb1-delete-lines ( #lines -- ) |
| 200 | v1 v2 07a 1 byte-code: obsolete-fcode \ Was fb1-draw-logo ( line# logoadr lwidth lheight -- ) |
| 201 | v1 v2 07b 1 byte-code: obsolete-fcode \ Was fb1-install ( width height #cols #lines -- ) |
| 202 | v1 v2 07c 1 byte-code: obsolete-fcode \ Was fb1-slide-up ( #lines -- ) |
| 203 | |
| 204 | \ 07d 1 |
| 205 | \ 07e 1 |
| 206 | \ 07f 1 |
| 207 | |
| 208 | \ --- 8-bit frame buffer routines ---------------------------------------- |
| 209 | v1 v2 080 1 byte-code: fb8-draw-character ( char -- ) |
| 210 | v1 v2 081 1 byte-code: fb8-reset-screen ( -- ) |
| 211 | v1 v2 082 1 byte-code: fb8-toggle-cursor ( -- ) |
| 212 | v1 v2 083 1 byte-code: fb8-erase-screen ( -- ) |
| 213 | v1 v2 084 1 byte-code: fb8-blink-screen ( -- ) |
| 214 | v1 v2 085 1 byte-code: fb8-invert-screen ( -- ) |
| 215 | v1 v2 086 1 byte-code: fb8-insert-characters ( #chars -- ) |
| 216 | v1 v2 087 1 byte-code: fb8-delete-characters ( #chars -- ) |
| 217 | v1 v2 088 1 byte-code: fb8-insert-lines ( #lines -- ) |
| 218 | v1 v2 089 1 byte-code: fb8-delete-lines ( #lines -- ) |
| 219 | v1 v2 08a 1 byte-code: fb8-draw-logo ( line# ladr lwidth lheight -- ) |
| 220 | v1 v2 08b 1 byte-code: fb8-install ( width height #cols #lines -- ) |
| 221 | |
| 222 | \ 08c 1 |
| 223 | \ 08d 1 |
| 224 | \ 08e 1 |
| 225 | \ 08f 1 |
| 226 | |
| 227 | \ --- VME Bus address spaces - (these moved to /dev/vmebus/fcodeprims.fth) |
| 228 | \ v1 v2 090 1 -- [VME Bus support] |
| 229 | \ v1 v2 ... -- [VME Bus support] |
| 230 | \ v1 v2 096 1 -- [VME Bus support] |
| 231 | |
| 232 | \ --- NET OPERATIONS ----------------------------------------------------- |
| 233 | \ v1 0a0 1 byte-code: return-buffer |
| 234 | \ v1 obs 0a1 1 byte-code: xmit-packet ( bufadr #bytes -- #sent ) |
| 235 | \ v1 obs 0a2 1 byte-code: poll-packet ( bufadr #bytes -- #received ) |
| 236 | \ v1 0a3 1 byte-code: local-mac-address ( adr len -- ) \ Driver sets this |
| 237 | v1 v2 0a4 1 byte-code: mac-address ( -- adr len ) \ System sets this |
| 238 | |
| 239 | \ 0a5 1 |
| 240 | \ 0a6 1 |
| 241 | \ 0a7 1 |
| 242 | \ 0a8 1 |
| 243 | \ 0a9 1 |
| 244 | \ 0aa 1 |
| 245 | \ 0ab 1 |
| 246 | \ 0ac 1 |
| 247 | \ 0ad 1 |
| 248 | \ 0ae 1 |
| 249 | \ 0af 1 |
| 250 | |
| 251 | \ 0b0 1 |
| 252 | \ ... |
| 253 | \ 0ff 1 |
| 254 | |
| 255 | \ --- Package and device handling ---------------------------------------- |
| 256 | \ 000 2 (reserved - because alocated by single byte fcodes) |
| 257 | v2 001 2 byte-code: device-name ( addr len -- ) |
| 258 | v2 002 2 byte-code: my-args ( -- addr len ) |
| 259 | v2 003 2 byte-code: my-self ( -- ihandle ) |
| 260 | v2 004 2 byte-code: find-package ( adr len -- [phandle] ok? ) |
| 261 | v2 005 2 byte-code: open-package ( adr len phandle -- ihandle | 0 ) |
| 262 | v2 006 2 byte-code: close-package ( ihandle -- ) |
| 263 | v2 007 2 byte-code: find-method ( adr len phandle -- [acf] ok? ) |
| 264 | v2 008 2 byte-code: call-package ( acf ihandle -- ) |
| 265 | v2 009 2 byte-code: $call-parent ( adr len -- ) |
| 266 | v2 00a 2 byte-code: my-parent ( -- ihandle ) |
| 267 | v2 00b 2 byte-code: ihandle>phandle ( ihandle -- phandle ) |
| 268 | |
| 269 | \ 00c 2 |
| 270 | |
| 271 | v2 00d 2 byte-code: my-unit ( -- offset space ) |
| 272 | v2 00e 2 byte-code: $call-method ( adr len ihandle -- ) |
| 273 | v2 00f 2 byte-code: $open-package ( arg-adr,len name-adr,len -- ihandle | 0 ) |
| 274 | |
| 275 | \ --- CPU information ---------------------------------------------------- |
| 276 | \ Obs v2 010 2 byte-code: processor-type ( -- processor-type ) |
| 277 | v2 011 2 byte-code: obsolete-fcode \ Was firmware-version ( -- n ) |
| 278 | v2 012 2 byte-code: obsolete-fcode \ Was fcode-version ( -- n ) |
| 279 | |
| 280 | \ --- Asyncronous support ------------------------------------------------ |
| 281 | v2 013 2 byte-code: alarm ( acf n -- ) |
| 282 | |
| 283 | \ --- User interface ----------------------------------------------------- |
| 284 | v2 014 2 byte-code: (is-user-word) ( adr len acf -- ) |
| 285 | |
| 286 | \ --- Interpretation ----------------------------------------------------- |
| 287 | v2 015 2 byte-code: suspend-fcode ( -- ) |
| 288 | |
| 289 | \ --- Error handling ----------------------------------------------------- |
| 290 | v2 016 2 byte-code: abort ( -- ) |
| 291 | v2 017 2 byte-code: catch ( acf -- error-code ) |
| 292 | v2 018 2 byte-code: throw ( error-code -- ) |
| 293 | v2.1 019 2 byte-code: user-abort ( -- ) |
| 294 | |
| 295 | \ --- Package attributes ------------------------------------------------- |
| 296 | v2 01a 2 byte-code: get-my-property ( nam-adr nam-len -- [val-adr val-len] failed? ) |
| 297 | \ Was get-my-attribute |
| 298 | v2 01b 2 byte-code: decode-int ( val-adr val-len -- n ) |
| 299 | \ Was xdrtoint |
| 300 | v2 01c 2 byte-code: decode-string ( val-adr val-len -- adr len ) |
| 301 | \ Was xdrtostring |
| 302 | v2 01d 2 byte-code: get-inherited-property ( nam-adr nam-len -- [val-adr val-len] failed? ) |
| 303 | \ Was get-inherited-attribute |
| 304 | v2 01e 2 byte-code: delete-property ( nam-adr nam-len -- ) |
| 305 | \ Was delete-attribute |
| 306 | v2 01f 2 byte-code: get-package-property ( adr len phandle -- [val-adr val-len] failed? ) |
| 307 | \ Was get-package-attribute |
| 308 | |
| 309 | \ --- aligned, atomic access --------------------------------------------- |
| 310 | v2 020 2 byte-code: cpeek ( adr -- { byte true } | false ) |
| 311 | v2 021 2 byte-code: wpeek ( adr -- { word true } | false ) |
| 312 | v2 022 2 byte-code: lpeek ( adr -- { long true } | false ) |
| 313 | |
| 314 | v2 023 2 byte-code: cpoke ( byte adr -- ok? ) |
| 315 | v2 024 2 byte-code: wpoke ( word adr -- ok? ) |
| 316 | v2 025 2 byte-code: lpoke ( long adr -- ok? ) |
| 317 | |
| 318 | v3 026 2 byte-code: lwflip ( l1 -- l2 ) |
| 319 | v3 027 2 byte-code: lbflip ( l1 -- l2 ) |
| 320 | v3 028 2 byte-code: lbflips ( adr len -- ) |
| 321 | |
| 322 | \ v2 029 2 byte-code: adr-mask ( n -- ) |
| 323 | \ 02a 2 |
| 324 | \ 02b 2 |
| 325 | \ 02c 2 |
| 326 | \ 02d 2 |
| 327 | |
| 328 | 64\ v3 02e 2 byte-code: rx@ ( xaddr -- o ) |
| 329 | 64\ v3 02f 2 byte-code: rx! ( o xaddr -- ) |
| 330 | |
| 331 | [ifdef] notdef |
| 332 | \ These FCode Functions are installed in the token tables later, after their |
| 333 | \ system-dependent implementations are defined. See ./regcodes.fth |
| 334 | v2 030 2 byte-code: rb@ ( adr -- byte ) |
| 335 | v2 031 2 byte-code: rb! ( byte adr -- ) |
| 336 | v2 032 2 byte-code: rw@ ( adr -- word ) |
| 337 | v2 033 2 byte-code: rw! ( word adr -- ) |
| 338 | v2 034 2 byte-code: rl@ ( adr -- long ) |
| 339 | v2 035 2 byte-code: rl! ( long adr -- ) |
| 340 | [then] |
| 341 | |
| 342 | fload ${BP}/pkg/fcode/regcodes.fth |
| 343 | |
| 344 | v2 036 2 byte-code: wbflips ( adr len -- ) \ Was wflips |
| 345 | v2 037 2 byte-code: lwflips ( adr len -- ) \ Was lflips |
| 346 | |
| 347 | \ --- probing of subordinate devices |
| 348 | v2.2 038 2 byte-code: obsolete-fcode \ Was probe ( arg-str reg-str fcode-str -- ) |
| 349 | v2.2 039 2 byte-code: obsolete-fcode \ Was probe-virtual ( arg-str reg-str fcode-adr -- ) |
| 350 | |
| 351 | \ 03a 2 |
| 352 | v2.3 03b 2 byte-code: child ( phandle -- phandle' ) |
| 353 | v2.3 03c 2 byte-code: peer ( phandle -- phandle' ) |
| 354 | v3 03d 2 byte-code: next-property |
| 355 | \ ( adr1 len1 phandle -- false | adr2 len2 true ) |
| 356 | v3 03e 2 byte-code: byte-load ( adr xt -- ) |
| 357 | v3 03f 2 byte-code: set-args ( arg-str unit-str -- ) |
| 358 | |
| 359 | \ --- parsing argument strings |
| 360 | v2 040 2 byte-code: left-parse-string ( adr len char -- adrR lenR adrL lenL ) |