Commit | Line | Data |
---|---|---|
920dae64 AT |
1 | \ ========== Copyright Header Begin ========================================== |
2 | \ | |
3 | \ Hypervisor Software File: help.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: @(#)help.fth 1.10 06/02/08 | |
43 | purpose: implements OBP command line interface help | |
44 | copyright: Copyright 2006 Sun Microsystems, Inc. All Rights Reserved | |
45 | copyright: Use is subject to license terms. | |
46 | ||
47 | headerless | |
48 | also hidden definitions | |
49 | vocabulary help-category erase-voc-link | |
50 | also help-category definitions | |
51 | headers | |
52 | : nvramrc ." nvramrc (making new commands permanent)" ; | |
53 | : file ." File download and boot " ; | |
54 | : resume ." Resume execution" ; | |
55 | : diag ." Diag (diagnostic routines)" ; | |
56 | : power ." Power on reset" ; | |
57 | : eject ." eject devices" ; | |
58 | : select ." Select I/O devices" ; | |
59 | : system ." System and boot configuration parameters" ; | |
60 | : line ." Line editor" ; | |
61 | : memory ." Memory access" ; | |
62 | : arithmetic ." Arithmetic" ; | |
63 | : radix ." Radix (number base conversions)" ; | |
64 | : numeric ." Numeric output" ; | |
65 | : defining ." Defining new commands" ; | |
66 | : repeated ." Repeated loops" ; | |
67 | : breakpoints ." Breakpoints (debugging)" ; | |
68 | ||
69 | previous definitions | |
70 | ||
71 | headerless | |
72 | vocabulary help-voc erase-voc-link | |
73 | also help-voc definitions | |
74 | headers | |
75 | ||
76 | : nvramrc ( -- ) | |
77 | ??cr ." nvedit Start nvramrc line editor using a temporary edit buffer" | |
78 | ??cr ." use-nvramrc? If this variable is true , Contents of nvramrc " | |
79 | ??cr ." is executed automatically. Set using setenv command" | |
80 | ??cr ." nvrun Execute the contents of nvedit edit buffer" | |
81 | ??cr ." nvstore Save the contents of the nvedit buffer into NVRAM" | |
82 | ??cr ." nvrecover Recover nvramrc after a set-defaults" | |
83 | ??cr ." nvalias <name> <path> Edit nvramrc to include devalias called 'name'" | |
84 | ??cr ." nvunalias <name> Edit nvramrc to remove devalias called 'name'" | |
85 | ; | |
86 | ||
87 | alias nvedit nvramrc | |
88 | alias use-nvramrc? nvramrc | |
89 | alias nvrun nvramrc | |
90 | alias nvstore nvramrc | |
91 | alias nvrecover nvramrc | |
92 | alias nvalias nvramrc | |
93 | alias nvunalias nvramrc | |
94 | ||
95 | : file | |
96 | ??cr ." boot <specifier> ( -- ) boot kernel ( default ) or other file" | |
97 | ??cr ." Examples:" | |
98 | ??cr ." boot - boot kernel from default device." | |
99 | ??cr ." Factory default is to boot" | |
100 | ??cr ." from DISK if present, otherwise from NET." | |
101 | ??cr ." boot net - boot kernel from network" | |
102 | ??cr ." boot cdrom - boot kernel from CD-ROM" | |
103 | ??cr ." boot disk1:h - boot from disk1 partition h" | |
104 | ??cr ." boot tape - boot default file from tape" | |
105 | ??cr ." boot disk myunix -as - boot myunix from disk with flags ""-as"" " | |
106 | ??cr ." dload <filename> ( addr -- ) debug load of file over network at address" | |
107 | ??cr ." Examples:" | |
108 | ??cr ." 4000 dload /export/root/foo/test" | |
109 | ??cr ." ?go - if executable program, execute it" | |
110 | ??cr ." or if Forth program, compile it" | |
111 | ; | |
112 | ||
113 | alias boot file | |
114 | alias dload file | |
115 | ||
116 | : resume | |
117 | ??cr ." go Start or continue execution of program" | |
118 | ; | |
119 | ||
120 | : diag | |
121 | ??cr ." test <device-specifier> Run selftest method for specified device" | |
122 | ??cr ." Examples:" | |
123 | ??cr ." test floppy - test floppy disk drive" | |
124 | ??cr ." test net - test net" | |
125 | ??cr ." test scsi - test scsi" | |
126 | ??cr ." test-all Execute test for all devices with selftest method" | |
127 | [ifexist] post \ FWARC 2003/703 'post' command | |
128 | ??cr ." post Invoke platform POST (will cause a reset) | |
129 | ??cr ." Syntax: post [ <diag-level> [ <verbosity> ] ]" | |
130 | [then] | |
131 | ??cr ." watch-clock Show ticks of real-time clock" | |
132 | ??cr ." watch-net Monitor network broadcast packets " | |
133 | ??cr ." watch-net-all Monitor broadcast packets on all net interfaces" | |
134 | [ifndef] no-onboard-scsi | |
135 | ??cr ." probe-scsi Show attached SCSI devices" | |
136 | [then] | |
137 | ??cr ." probe-scsi-all Show attached SCSI devices for all host adapters" | |
138 | ; | |
139 | ||
140 | alias test diag | |
141 | alias test-all diag | |
142 | alias watch-clock diag | |
143 | alias watch-net diag | |
144 | alias watch-net-all diag | |
145 | [ifndef] no-onboard-scsi | |
146 | alias probe-scsi diag | |
147 | [then] | |
148 | alias probe-scsi-all diag | |
149 | [ifexist] post | |
150 | alias post diag | |
151 | [then] | |
152 | ||
153 | : power | |
154 | ??cr ." reset-all reset machine, ( simulates power cycling )" | |
155 | ??cr ." power-off Power Off" | |
156 | ; | |
157 | ||
158 | alias reset-all power | |
159 | alias power-off power | |
160 | ||
161 | : eject | |
162 | ??cr ." eject <device> Eject <device> from drive" | |
163 | ??cr ." floppy eject the floppy" | |
164 | ??cr ." cdrom eject the cdrom" | |
165 | ; | |
166 | ||
167 | : select | |
168 | ??cr ." input Select input source ( ttya or ttyb or keyboard )" | |
169 | ??cr ." Examples:" | |
170 | ??cr ." ttya input - use ttya for subsequent input" | |
171 | ??cr ." keyboard input - use Sun keyboard for subsequent input" | |
172 | ??cr ." output Select output source ( ttya or ttyb or screen )" | |
173 | ??cr ." Examples:" | |
174 | ??cr ." screen output - use Sun screen for subsequent output" | |
175 | ??cr ." io Select input and output ( ttya or ttyb)" | |
176 | ??cr ." Examples:" | |
177 | ??cr ." ttya io - use ttya for subsequent input and output" | |
178 | ; | |
179 | ||
180 | alias input select | |
181 | alias output select | |
182 | alias io select | |
183 | ||
184 | : system | |
185 | ??cr ." devalias - Display all device aliases" | |
186 | ??cr ." devalias <name> <value> - Create or change a device alias" | |
187 | ??cr ." printenv Show all configuration parameters" | |
188 | ??cr ." numbers are shown in decimal" | |
189 | ??cr ." setenv <name> <value> Change a configuration parameter" | |
190 | ??cr ." changes are permanent but only take effect after a reset" | |
191 | ??cr ." Examples:" | |
192 | ??cr ." setenv input-device ttya - use ttya input next time" | |
193 | ??cr ." setenv screen-#rows 0x1e - use 30 rows of display ( hex 1e )" | |
194 | ??cr ." setenv boot-device net - specify network as boot device" | |
195 | ??cr ." setenv auto-boot? false - disable automatic boot" | |
196 | [ifexist] auto-boot-on-error? | |
197 | ??cr ." setenv auto-boot-on-error? false - disable automatic boot only on" | |
198 | ??cr ." system/hardware error" | |
199 | [then] \ End auto-boot-on-error? | |
200 | ??cr ." set-defaults Revert to factory configuration" | |
201 | ??cr ." See also: nvramrc" | |
202 | ; | |
203 | ||
204 | : register | |
205 | ??cr ." %pc %npc %tba ..." | |
206 | ??cr ." %i0 ... %i7" | |
207 | ??cr ." %l0 ... %l7" | |
208 | ??cr ." %o0 ... %o7" | |
209 | ??cr ." %g0 ... %g7 ( -- n ) Place the saved register value on the stack" | |
210 | ??cr ." to regname ( n -- ) Change saved register value" | |
211 | ??cr ." Example:" | |
212 | ??cr ." 1234 to %i3" | |
213 | ??cr ." set-pc ( pc -- ) Set %pc to value and %npc to value+4" | |
214 | ??cr ." Example:" | |
215 | ??cr ." 5000 set-pc" | |
216 | ??cr ." w ( n -- ) Select a set of window registers" | |
217 | ??cr ." Example:" | |
218 | ??cr ." 5 w" | |
219 | ??cr ." ctrace C subroutine call trace" | |
220 | ??cr ." .locals Show the saved %ix %lx and %ox registers" | |
221 | ??cr ." .registers Show the saved registers %gx and %pc thru %tba" | |
222 | ??cr ." .window ( n -- ) Same as ""w .locals"" " | |
223 | ??cr ." .pstate Show fields of %pstate" | |
224 | ; | |
225 | ||
226 | alias ctrace register | |
227 | alias .locals register | |
228 | alias .registers register | |
229 | alias .window register | |
230 | ||
231 | : sync | |
232 | ??cr ." sync Reenter Operating System to sync the disks" | |
233 | ; | |
234 | ||
235 | : breakpoints | |
236 | ??cr ." go Begin or continue execution" | |
237 | ??cr ." .bp Show all current breakpoints" | |
238 | ??cr ." +bp ( adr -- ) Add a breakpoint at the given address" | |
239 | ??cr ." -bp ( adr -- ) Remove the breakpoint at the given address" | |
240 | ??cr ." --bp Remove the most recently set breakpoint" | |
241 | ??cr ." bpoff Remove all breakpoints" | |
242 | ??cr ." step Single-step one instruction" | |
243 | ??cr ." steps ( n -- ) Do n step's" | |
244 | ??cr ." hop Like step; doesn't descend into subroutines" | |
245 | ??cr ." hops ( n -- ) Do n hop's" | |
246 | ??cr ." skip Skip over the current instruction" | |
247 | ??cr ." till ( adr -- ) Execute until the given address ( like '+bp go' )" | |
248 | ??cr ." return Execute until the end of this subroutine" | |
249 | ??cr ." returnl Execute until the end of this leaf subroutine" | |
250 | ??cr ." finish-loop Execute until the end of this loop" | |
251 | ??cr ." .instruction Show address and opcode for last encountered breakpoint" | |
252 | ??cr ." .breakpoint Executed after every encountered breakpoint" | |
253 | ??cr ." Default behavior is .instruction" | |
254 | ??cr ." Examples:" | |
255 | ??cr ." ' .registers is .breakpoint" | |
256 | ??cr ." ' .instruction is .breakpoint" | |
257 | ; | |
258 | ||
259 | : line | |
260 | ??cr ." ^P Recall previous line" | |
261 | ??cr ." ^N Recall subsequent line" | |
262 | ??cr ." ^A Beginning of line" | |
263 | ??cr ." ^E End of line" | |
264 | ??cr ." ^B Backward one character" | |
265 | ??cr ." ESC-B Backward one word" | |
266 | ??cr ." ^F Forward one character" | |
267 | ??cr ." ESC-F Forward one word" | |
268 | ??cr ." ^D Erase this character" | |
269 | ??cr ." ESC-D Erase here to end of this word" | |
270 | ??cr ." ^K Erase here to end of line" | |
271 | ??cr ." ^H Erase previous character ( also backspace, delete )" | |
272 | ??cr ." ESC-H , ^W Erase previous word" | |
273 | ??cr ." ^U Erase entire line" | |
274 | ??cr ." ^R Retype line" | |
275 | ??cr ." ^L Display command history" | |
276 | ??cr ." ^` , ^SPACE Commmand completion" | |
277 | ??cr ." ^} , ^? Show possible completions" | |
278 | ??cr ." ^Q Enter next character as-is" | |
279 | ; | |
280 | ||
281 | : memory | |
282 | ??cr ." dump ( addr length -- ) Display memory at addr for length bytes" | |
283 | ??cr ." fill ( addr length byte -- ) Fill memory starting at addr with byte" | |
284 | ??cr ." move ( src dest length -- ) Copy length bytes from src to dest address" | |
285 | ??cr ." map? ( vaddr -- ) Show memory map information for the virtual address" | |
286 | ??cr ." x? ( addr -- ) Display the 64-bit number from location addr" | |
287 | ??cr ." l? ( addr -- ) Display the 32-bit number from location addr" | |
288 | ??cr ." w? ( addr -- ) Display the 16-bit number from location addr" | |
289 | ??cr ." c? ( addr -- ) Display the 8-bit number from location addr" | |
290 | ??cr ." x@ ( addr -- n ) Place on the stack the 64-bit data at location addr" | |
291 | ??cr ." l@ ( addr -- n ) Place on the stack the 32-bit data at location addr" | |
292 | ??cr ." w@ ( addr -- n ) Place on the stack the 16-bit data at location addr" | |
293 | ??cr ." c@ ( addr -- n ) Place on the stack the 8-bit data at location addr" | |
294 | ??cr ." x! ( n addr -- ) Store the 64-bit value n at location addr" | |
295 | ??cr ." l! ( n addr -- ) Store the 32-bit value n at location addr" | |
296 | ??cr ." w! ( n addr -- ) Store the 16-bit value n at location addr" | |
297 | ??cr ." c! ( n addr -- ) Store the 8-bit value n at location addr" | |
298 | ; | |
299 | ||
300 | : arithmetic | |
301 | ??cr ." + ( n1 n2 -- n3 ) Add n1+n2 and place on the stack" | |
302 | ??cr ." - ( n1 n2 -- n3 ) Subtract n1-n2 and place on the stack" | |
303 | ??cr ." * ( n1 n2 -- n3 ) Multiply n1*n2 and place on the stack" | |
304 | ??cr ." / ( n1 n2 -- n3 ) Divide n1/n2 truncated and place on the stack" | |
305 | ??cr ." mod ( n1 n2 -- n3 ) Place on the stack remainder of n1/n2" | |
306 | ??cr ." lshift ( n1 count -- n2 ) Left shift n1 by count places" | |
307 | ??cr ." rshift ( n1 count -- n2 ) Right shift n1 by count places" | |
308 | ; | |
309 | ||
310 | : radix | |
311 | ??cr ." decimal Subsequent numeric I/O is performed in base 10" | |
312 | ??cr ." hex Subsequent numeric I/O is performed in base 16" | |
313 | ??cr ." d# <number> Interpret number in base 10 and place on the stack" | |
314 | ??cr ." Example:" | |
315 | ??cr ." ( in base 16 ) d# 12 . - prints out 'c'" | |
316 | ??cr ." h# <number> Interpret number in base 16 and place on the stack" | |
317 | ??cr ." Example:" | |
318 | ??cr ." ( in base 10 ) h# 12 . - prints out '18'" | |
319 | ; | |
320 | ||
321 | : numeric | |
322 | ??cr ." . ( n -- ) Show the number in the current base" | |
323 | ??cr ." .d ( n -- ) Show the number in base 10" | |
324 | ??cr ." .h ( n -- ) Show the number in base 16" | |
325 | ??cr ." .s ( ?? -- ?? ) Show the stack without altering it" | |
326 | ??cr ." showstack Show stack contents before each 'ok' prompt" | |
327 | ; | |
328 | ||
329 | : repeated | |
330 | ??cr ." begin ( -- ) Start a loop" | |
331 | ??cr ." until ( flag -- ) Repeat 'begin' loop until flag is true" | |
332 | ??cr ." Examples:" | |
333 | ??cr ." begin 4000 c@ 55 = until" | |
334 | ??cr ." begin 0 2005 c! key? until" | |
335 | ??cr ." do ( end+1 start -- ) Start a counted loop" | |
336 | ??cr ." loop ( -- ) End a 'do' loop" | |
337 | ??cr ." +loop ( n -- ) End a 'do' loop" | |
338 | ??cr ." i (-- n ) Place on the stack the current 'do' loop index" | |
339 | ??cr ." Examples:" | |
340 | ??cr ." 7 0 do i . loop - prints 0 1 2 3 4 5 6" | |
341 | ??cr ." 7 0 do i . 3 +loop - prints 0 3 6" | |
342 | ; | |
343 | ||
344 | : defining | |
345 | ??cr ." : <name> Begin creation of a new command called 'name'" | |
346 | ??cr ." Examples:" | |
347 | ??cr ." : mycalc ( n1 -- n2 ) 10000 * 11 + ;" | |
348 | ??cr ." : target ( -- addr ) 26 mycalc ;" | |
349 | ??cr ." ; End creation of a new ':' command" | |
350 | ??cr ." ' <name> ( -- acf ) Place on the stack the compilation address of 'name'" | |
351 | ??cr ." words Show the names of all commands" | |
352 | ??cr ." see name Decompile or disassemble the command 'name'" | |
353 | ; | |
354 | ||
355 | previous previous definitions | |
356 | ||
357 | headerless | |
358 | : do-help ( -- ) | |
359 | ??cr ." Enter 'help command-name' or 'help category-name' for more help" | |
360 | ??cr ." (Use ONLY the first word of a category description) " | |
361 | ??cr ." Examples: help select -or- help line" | |
362 | ??cr ." Main categories are: " | |
363 | 0 [ hidden ] ['] help-category [ previous ] | |
364 | begin another-word? while ( alf' voc nfa ) | |
365 | ??cr name> execute | |
366 | repeat | |
367 | ; | |
368 | ||
369 | : $do-help ( adr,len -- found? ) | |
370 | 2>r 0 [ also hidden ] ['] help-voc [ previous ] ( alf voc-acf ) ( r: adr,len ) | |
371 | begin another-word? while ( alf' voc-acf nfa ) ( r: adr,len ) | |
372 | dup 2r@ rot name>string sindex ( alf' voc nfa index|-1 ) ( r: adr,len ) | |
373 | 0>= if ( alf' voc nfa ) ( r: adr,len ) | |
374 | nip nip 2r> 2drop ( anf ) | |
375 | dup name> swap n>flags c@ h# 20 and if token@ then | |
376 | execute true exit | |
377 | then ( alf' voc nfa ) ( r: adr,len ) | |
378 | drop ( alf' voc ) ( r: adr,len ) | |
379 | repeat 2r> 2drop false ( ) | |
380 | ; | |
381 | ||
382 | : (help-msg ( -- ) ??cr ." Type help for more information" cr ; | |
383 | ' (help-msg is help-msg | |
384 | ||
385 | headers | |
386 | : help ( -- ) | |
387 | optional-arg$ ( adr,len ) | |
388 | 2dup lower | |
389 | bl left-parse-string 2swap 2drop ( adr,len' ) | |
390 | ?dup if | |
391 | 2dup $do-help if 2drop exit then | |
392 | ." No help available for " type exit | |
393 | then drop | |
394 | do-help | |
395 | ; | |
396 | ||
397 | headers | |
398 |