Commit | Line | Data |
---|---|---|
920dae64 AT |
1 | \ ========== Copyright Header Begin ========================================== |
2 | \ | |
3 | \ Hypervisor Software File: reset-dropin.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: @(#)reset-dropin.fth 1.2 03/08/20 | |
43 | purpose: | |
44 | copyright: Copyright 2001-2003 Sun Microsystems, Inc. All Rights Reserved | |
45 | copyright: Use is subject to license terms. | |
46 | ||
47 | [ifnexist] trace-me | |
48 | alias trace-me drop | |
49 | [then] | |
50 | ||
51 | \ In | |
52 | \ %o0 = ptr to name | |
53 | \ %o1 = base-addr to start search | |
54 | \ %o2 = destination | |
55 | \ %o3 = 0 = dont copy before decompress, else copy data here first | |
56 | \ %o4 != 0 verify dropin checksum | |
57 | \ Out: | |
58 | \ %o0 = 0 for not found, otherwise it is the #bytes copied (rounded to 8 byte | |
59 | \ alignment. | |
60 | \ | |
61 | ||
62 | label find©-dropin | |
63 | %g0 %g0 %g0 save | |
64 | ||
65 | %i0 %o0 move | |
66 | find-drop-in call | |
67 | %i1 %o1 move | |
68 | %o0 %g0 %g0 subcc | |
69 | 0= if | |
70 | %o0 %g0 %l7 add \ (delay) | |
71 | print" Can't start: No image found" | |
72 | %g0 %g0 %i0 add \ failed. | |
73 | %i7 8 return | |
74 | nop | |
75 | then | |
76 | ||
77 | [ifdef] dropin-checksum? | |
78 | %i4 %g0 %g0 subcc \ Checksum? | |
79 | 0<> if | |
80 | %l7 0 %l0 add \ data | |
81 | diag-print" "r"nDropin checksum: " | |
82 | %l7 0 >di-sum %l1 ld \ SUM | |
83 | %l7 0 >di-size %l2 ld \ size | |
84 | %l2 /lvl1-hdr %l2 add \ include the header | |
85 | %g0 %l1 %l3 sub \ check | |
86 | begin | |
87 | %l2 2 %l2 subcc | |
88 | %l0 %l2 %l4 lduh | |
89 | 0= until | |
90 | %l4 %l3 %l3 add | |
91 | ||
92 | h# ffff %l4 set | |
93 | begin | |
94 | %l3 %l4 %l5 and \ low bits | |
95 | %l3 d# 16 %l6 srl | |
96 | %l6 %g0 %g0 subcc | |
97 | 0= until | |
98 | %l6 %l5 %l3 add \ (delay) fold sum | |
99 | ||
100 | %l3 %l4 %g0 subcc \ sum = 0xffff? | |
101 | 0= if | |
102 | %l3 %l4 %l3 xor \ (delay) invert | |
103 | %l4 %g0 %l3 add \ sum = 0xffff | |
104 | then | |
105 | %l3 %l1 %g0 subcc | |
106 | 0<> if | |
107 | nop | |
108 | diag-print" failed" | |
109 | print" "r"nCan't start: image is corrupted"r"n" | |
110 | %g0 %g0 %g0 add | |
111 | %i7 8 return | |
112 | nop | |
113 | then | |
114 | diag-print" OK" | |
115 | then | |
116 | [then] | |
117 | ||
118 | [ifdef] dropin-debug? | |
119 | print" "r"nFind dropin: " | |
120 | %i0 print-reg | |
121 | %i1 print-reg | |
122 | %i2 print-reg | |
123 | %i3 print-reg | |
124 | %i4 print-reg | |
125 | %l7 print-reg | |
126 | ||
127 | [then] | |
128 | ||
129 | diag-print" "r"nFind dropin" | |
130 | ||
131 | %l7 0 >di-image %l0 add \ addr of first data word | |
132 | %l0 0 %o0 ld \ get magic | |
133 | h# 434f4d50 %o1 set \ COMP magic | |
134 | %o0 %o1 %g0 subcc | |
135 | 0= if | |
136 | %i3 %g0 %g0 subcc \ (delay) relocate? | |
137 | 0<> if | |
138 | %l0 4 %l1 ld \ (delay) get comp size | |
139 | %l1 h# 10 %l2 add \ copy size | |
140 | %l2 3 %l2 add | |
141 | %l2 3 %l2 andn \ round-up | |
142 | begin | |
143 | %l2 4 %l2 subcc | |
144 | %l0 %l2 %l3 ld | |
145 | 0= until | |
146 | %l3 %i3 %l2 st | |
147 | %i3 %g0 %l0 add \ Use copy as SRC | |
148 | diag-print" , (copied)" | |
149 | then | |
150 | diag-print" , Decompressing " | |
151 | %l0 h# 10 %o0 add \ Skip to Data | |
152 | %l1 0 %o1 add \ get size | |
153 | " decompress" $acall | |
154 | %i2 0 %o2 add \ (delay) | |
155 | ||
156 | " output" %o0 $set-external | |
157 | %o0 %g0 %l0 lduw | |
158 | %l0 %i2 %i0 sub | |
159 | else | |
160 | nop | |
161 | diag-print" , Copying " | |
162 | %l0 0 %o0 add \ Skip to Data | |
163 | %l7 0 >di-size %l5 ld \ get size | |
164 | %l5 d# 15 %l3 add \ Size | |
165 | %l3 d# 15 %l3 andn \ Size rounded Up. | |
166 | %l3 /lvl1-hdr %o2 add \ Add header size. | |
167 | %i2 %g0 %o1 add \ dest | |
168 | begin | |
169 | %o2 /l %o2 subcc | |
170 | %o0 %o2 %o3 ld | |
171 | 0= until | |
172 | %o3 %o1 %o2 st | |
173 | %l3 0 %i0 add \ data size for printing | |
174 | ||
175 | [ifdef] verify-dropin-copy? | |
176 | diag-print" (verify) " | |
177 | %l7 /lvl1-hdr %l0 add \ src data | |
178 | %i2 /lvl1-hdr %l1 add | |
179 | %l7 0 >di-size %l5 ld \ size | |
180 | %g0 1 %l6 add | |
181 | %l5 4 %l5 sub | |
182 | begin | |
183 | %l0 %l5 %l3 ld | |
184 | %l1 %l5 %l4 ld | |
185 | %l3 %l4 %g0 subcc | |
186 | 0<> if | |
187 | %l5 %g0 %g0 subcc | |
188 | %l6 1 %g0 subcc \ exit | |
189 | then | |
190 | 0= until | |
191 | %l5 4 %l5 sub | |
192 | %l6 %g0 %g0 subcc | |
193 | 0= if | |
194 | nop | |
195 | print" failed: @ " | |
196 | %l5 print-reg | |
197 | %l3 print-reg | |
198 | %l4 print-reg | |
199 | then | |
200 | [then] | |
201 | ||
202 | then | |
203 | diag-print" Done, Size " | |
204 | %i0 diag-print-reg | |
205 | ||
206 | %i7 8 return | |
207 | nop | |
208 | end-code |