Author: wmb Date: 2007-07-05 19:26:58 +0200 (Thu, 05 Jul 2007) New Revision: 463
Added: forth/lib/binhdr.fth ofw/core/clntmap.fth ofw/core/startup.fth Log: Added some common files needed by the PowerPC version.
Added: forth/lib/binhdr.fth =================================================================== --- forth/lib/binhdr.fth (rev 0) +++ forth/lib/binhdr.fth 2007-07-05 17:26:58 UTC (rev 463) @@ -0,0 +1,58 @@ +purpose: Header for Forth ".exe" file to be executed by the C wrapper program. +\ See license at end of file + +hex + +only forth also hidden also +forth definitions +headerless + +hidden definitions +th 20 buffer: bin-header +: hfield \ name ( offset size -- offset' ) + create + over , + + does> ( struct-base -- field-addr ) + @ bin-header + +; +: long 4 hfield ; + +struct ( Binary header) + long h_magic ( 0) \ Magic Number + long h_tlen ( 4) \ length of text (code) + long h_dlen ( 8) \ length of initialized data + long h_blen ( c) \ length of BSS unitialized data + long h_slen ( 10) \ length of symbol table + long h_entry ( 14) \ Entry address + long h_trlen ( 18) \ Text Relocation Table length + long h_drlen ( 1c) \ Data Relocation Table length +constant /bin-header ( 20) + +: text-size ( -- size-of-dictionary ) dictionary-size aligned ; +headers + +only forth also definitions + +\ LICENSE_BEGIN +\ Copyright (c) 2007 FirmWorks +\ +\ Permission is hereby granted, free of charge, to any person obtaining +\ a copy of this software and associated documentation files (the +\ "Software"), to deal in the Software without restriction, including +\ without limitation the rights to use, copy, modify, merge, publish, +\ distribute, sublicense, and/or sell copies of the Software, and to +\ permit persons to whom the Software is furnished to do so, subject to +\ the following conditions: +\ +\ The above copyright notice and this permission notice shall be +\ included in all copies or substantial portions of the Software. +\ +\ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +\ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +\ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +\ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +\ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +\ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +\ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +\ +\ LICENSE_END
Added: ofw/core/clntmap.fth =================================================================== --- ofw/core/clntmap.fth (rev 0) +++ ofw/core/clntmap.fth 2007-07-05 17:26:58 UTC (rev 463) @@ -0,0 +1,62 @@ +purpose: Use client callbacks, if installed, for address translation +\ See license at end of file + +warning off +: map ( phys.. virtual size mode -- ) + vector @ 0= if map exit then +[ifdef] 2-address-cells + \ ??? is the operand order correct? Other possibilities are: + \ dup 2 pick 4 pick 6 pick 8 pick + \ 4 pick 4 pick 4 pick 4 pick 4 pick + dup 2 pick 4 pick 7 pick 7 pick 5 " map" ['] $callback catch if + 3drop 3drop 2drop map + else ( phys.lo phys.hi virtual size mode 0 ) + 3drop 3drop + then +[else] + dup 2 pick 4 pick 6 pick 4 " map" ['] $callback catch if + 3drop 3drop drop map + else ( phys virtual size mode 0 ) + 3drop 2drop + then +[then] +; +: translate ( virtual -- false | physical mode true ) + vector @ 0= if translate exit then + dup 1 " translate" ['] $callback catch if ( virtual x x x x ) + 2drop 2drop translate exit + then ( false 1 | phys.. mode true n ) + drop +; +: unmap ( virtual len -- ) + vector @ 0= if unmap exit then + dup 2 pick 2 " unmap" ['] $callback catch if ( virt len x x x x x ) + 2drop 3drop unmap exit + then ( virt len #returns ) + 3drop +; +warning on + +\ LICENSE_BEGIN +\ Copyright (c) 2007 FirmWorks +\ +\ Permission is hereby granted, free of charge, to any person obtaining +\ a copy of this software and associated documentation files (the +\ "Software"), to deal in the Software without restriction, including +\ without limitation the rights to use, copy, modify, merge, publish, +\ distribute, sublicense, and/or sell copies of the Software, and to +\ permit persons to whom the Software is furnished to do so, subject to +\ the following conditions: +\ +\ The above copyright notice and this permission notice shall be +\ included in all copies or substantial portions of the Software. +\ +\ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +\ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +\ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +\ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +\ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +\ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +\ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +\ +\ LICENSE_END
Added: ofw/core/startup.fth =================================================================== --- ofw/core/startup.fth (rev 0) +++ ofw/core/startup.fth 2007-07-05 17:26:58 UTC (rev 463) @@ -0,0 +1,48 @@ +purpose: Standard last-phase startup sequence +copyright: Copyright 1997 Firmworks All Rights Reserved + +: restore-stdout ( -- ) + " restore" stdout @ ['] $call-method catch if 3drop then +; + +defer secondary-diagnostics ' noop to secondary-diagnostics + +defer kbd-extras \ for fan, key-chord +' noop to kbd-extras + +: startup ( -- ) + standalone? 0= if exit then + + copy-reboot-info + + \ Ensure a clean startup state regardless of the development + \ environment's use of these variables + 0 stdin ! 0 stdout ! 0 to my-self + + " nvramrc" ?type + use-nvramrc? if nvramrc safe-evaluate then + + install-alarm + + auto-banner? if + " Probing" ?type probe-all + " Install console" ?type install-console + banner + then + + hex + warning on + only forth also definitions + +\ install-alarm + + #line off + + secondary-diagnostics + + kbd-extras + auto-boot + restore-stdout + + user-interface +;