Commit | Line | Data |
---|---|---|
920dae64 AT |
1 | \ ========== Copyright Header Begin ========================================== |
2 | \ | |
3 | \ Hypervisor Software File: reboot.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: @(#)reboot.fth 1.7 07/01/22 | |
43 | purpose: | |
44 | copyright: Copyright 2007 Sun Microsystems, Inc. All rights reserved. | |
45 | copyright: Use is subject to license terms. | |
46 | ||
47 | \ Create the hash storage area. | |
48 | " reboot-info" create-nvhash create-config-hash ( acf ) | |
49 | headers | |
50 | create reboot-info token, does> token@ ; | |
51 | headerless | |
52 | ||
53 | \ Mark the area as non-volatile so garbage collection won't release | |
54 | \ its resources by assigning an acf other than 'crash'. | |
55 | ' reboot-info reboot-info >body token! | |
56 | ||
57 | d# 255 3 wa+ constant /reboot-info-buf | |
58 | /reboot-info-buf buffer: reboot-info-buf | |
59 | true value load-reboot-info? | |
60 | ||
61 | : (get-reboot-info ( -- bootpath,len line# column# ) | |
62 | options-open? if | |
63 | load-reboot-info? if ( ) | |
64 | reboot-info-buf /reboot-info-buf erase ( ) | |
65 | reboot-info dup get ( acf adr len ) | |
66 | /reboot-info-buf min reboot-info-buf swap ( acf adr dest len ) | |
67 | move ( acf ) | |
68 | 3 perform-action ( ) | |
69 | false to load-reboot-info? ( ) | |
70 | then ( ) | |
71 | then ( ) | |
72 | reboot-info-buf >r ( ) | |
73 | r@ 2 wa+ count ( adr len ) | |
74 | r@ w@ ( adr len line# ) | |
75 | r@ wa1+ w@ ( adr len line# column# ) | |
76 | r> drop ( ) | |
77 | ; | |
78 | ||
79 | : (save-reboot-info ( bootpath,len line# column# -- ) | |
80 | reboot-info-buf >r ( bootpath,len line# column# ) | |
81 | ||
82 | \ Save the terminal emulator cursor position | |
83 | r@ wa1+ w! ( bootpath,len line# ) | |
84 | r@ w! ( bootpath,len ) | |
85 | tuck ( len bootpath,len ) | |
86 | ||
87 | \ Remember the boot path | |
88 | d# 255 min r@ 2 wa+ place r> ( len buf-addr ) | |
89 | swap 3 wa+ ( buf-addr len' ) | |
90 | 2dup reboot-info-buf swap move ( buf-addr len' ) | |
91 | options-open? if ( buf-addr len' ) | |
92 | reboot-info set ( ) | |
93 | else ( buf-addr len' ) | |
94 | 2drop ( ) | |
95 | then ( ) | |
96 | ; | |
97 | ||
98 | ' (save-reboot-info is save-reboot-info | |
99 | ' (get-reboot-info is get-reboot-info |