Commit | Line | Data |
---|---|---|
920dae64 AT |
1 | \ ========== Copyright Header Begin ========================================== |
2 | \ | |
3 | \ Hypervisor Software File: cleanup.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: @(#)cleanup.fth 1.2 06/05/10 | |
43 | purpose: | |
44 | copyright: Copyright 2006 Sun Microsystems, Inc. All Rights Reserved | |
45 | copyright: Use is subject to license terms. | |
46 | ||
47 | headers | |
48 | ||
49 | [ifdef] trace-errors | |
50 | : xbp | |
51 | [ also hidden ] | |
52 | .registers cr | |
53 | ftrace cr | |
54 | hex | |
55 | (handle-breakpoint | |
56 | ; | |
57 | ' xbp is handle-breakpoint | |
58 | : real-bp ( -- ) | |
59 | [ also hidden ] ['] (handle-breakpoint is handle-breakpoint [ previous ] | |
60 | ; | |
61 | [then] | |
62 | ||
63 | ' (cold-hook is cold-hook | |
64 | ||
65 | \ This stand-init-io has a header, in case the previous one does not. | |
66 | chain: finalize-chain ( -- ) here fence a! ; | |
67 | overload: execute-buffer ( adr,len -- ) execute-buffer ; | |
68 | overload: stand-init ( -- ) | |
69 | stand-init finalize-chain | |
70 | ['] startup catch ?dup if .error then | |
71 | ; | |
72 | overload: stand-init-io ( -- ) stand-init-io ; | |
73 | overload: unix-init ( -- ) unix-init ; | |
74 | overload: unix-init-io ( -- ) unix-init-io ; | |
75 | overload: init ( -- ) init ; | |
76 | ||
77 | \ Make sure these words are available at the ok prompt | |
78 | \ Unfortunately, wanboot ramdisk depends on them. | |
79 | overload: headers ; | |
80 | overload: headerless ; | |
81 | overload: external ; | |
82 | ||
83 | \ Install the various boot chains | |
84 | ' check-machine-state is check-machine-chain | |
85 | ' don't-boot? is interrupt-auto-boot? | |
86 | ' client-starting is client-starting-chain | |
87 | ' client-exited is client-exited-chain | |
88 | ||
89 | \ Install the entry/exit/reset chains now | |
90 | ' enterforth-chain is enterforth-hook | |
91 | ' go-chain is go-hook | |
92 | ||
93 | origin " origin" $export-procedure | |
94 | ||
95 | hidden definitions | |
96 | : voc-unlink ( acf -- ) | |
97 | >r voc-link begin dup another-link? while ( prev next ) | |
98 | dup r@ = if ( prev next ) | |
99 | >voc-link link@ swap link! r> drop exit | |
100 | else ( prev next ) | |
101 | nip ( next ) | |
102 | then >voc-link ( next-voc ) | |
103 | repeat r> drop ( ) | |
104 | ; | |
105 | previous definitions | |
106 | ||
107 | [ifndef] assembler? | |
108 | also hidden | |
109 | \ Turn off the assembler; it is about to be disposed | |
110 | ' noop is do-entercode | |
111 | ' noop is do-exitcode | |
112 | ' noop is do-label-hook | |
113 | ' nulldis is disassemble | |
114 | previous | |
115 | [then] | |
116 | resident | |
117 | ||
118 | \ Align dp to 16 bytes . | |
119 | here h# 10 round-up here - 0 ?do h# ff c, loop | |
120 | \ Align the User Area size to 16 bytes | |
121 | #user @ h# 10 round-up #user ! | |
122 | ||
123 | dictionary-size to ROM-dictionary-size | |
124 | ROMbase ROM-dictionary-size + to text-end | |
125 | warning on | |
126 | ||
127 | \ Supress file notification warnings for dup defs for runtime. | |
128 | patch noop where duplicate-notification | |
129 | ||
130 | \ remove the forth->system error interface | |
131 | patch 2drop fsyscall (compile-time-error) | |
132 | patch 2drop fsyscall (compile-time-warning) | |
133 | ||
134 | dispose 0 0 set-transize | |
135 | ||
136 | also hidden also forth | |
137 | ' boolean-voc voc-unlink | |
138 | ' recovery-types voc-unlink | |
139 | ' security-mode-voc voc-unlink | |
140 | ' hidden voc-unlink | |
141 | ' trap-types voc-unlink | |
142 | ' keys-forth voc-unlink | |
143 | ' disassembler voc-unlink | |
144 | ' command-completion voc-unlink | |
145 | ' allocator voc-unlink | |
146 | ' bug voc-unlink | |
147 | ' aliases voc-unlink | |
148 | ' options voc-unlink | |
149 | forth | |
150 | ||
151 | ' noop is title \ Turn off the Bradley Forthware copyright message | |
152 | ||
153 | \ XREF does not generate a stand.dic, this magic takes care of it. | |
154 | \ If SAVEFILE is not [define]'d then we dont save an image. | |
155 | \ | |
156 | " SAVEFILE" d# 55 d# 45 fsyscall dup 0= if 2drop else | |
157 | "" stand.dic save-forth | |
158 | patchboot | |
159 | #user @ origin h# 10 + x! | |
160 | here origin- origin h# 18 + x! | |
161 | text-end origin h# 20 + x! | |
162 | " stand-init-io" $find-name is init-io | |
163 | " stand-init" init-save | |
164 | up@ #user @ 2swap ( up,len file$ ) | |
165 | origin here over - 2swap ( up,len dic,len file$ ) | |
166 | d# 45 d# 45 fsyscall ( ) | |
167 | then | |
168 | ||
169 | warning off | |
170 | ||
171 | fload ${BP}/pkg/fcode/chkfcod.fth |