On a 64-bit CPU, any modification of a register by 32-bit or 16-bit code will destroy the invisible upper 32 bits of the corresponding 64-bit register. For example: a 32-bit "pushl %eax" followed by a "popl %eax" will zero the upper half of %rax. This differs from the treatment of upper halves of 32-bit registers by 16-bit code: a "pushw %ax" followed by a "popw %ax" will leave the upper 16 bits of %eax unmodified. Inline assembly generated using REAL_CODE() or PHYS_CODE() will therefore have to preserve the upper halves of all registers, to avoid clobbering registers that gcc expects to be preserved. Output operands from REAL_CODE() and PHYS_CODE() assembly may therefore contain undefined values in the upper 32 bits. Fix by using explicit variable widths (e.g. uint32_t) for non-discarded output operands, to ensure that undefined values in the upper 32 bits of 64-bit registers are ignored. Signed-off-by: Michael Brown <mcb30@ipxe.org>tags/v1.20.1
|
|
||
241 |
|
241 |
|
242 |
|
242 |
|
243 |
|
243 |
|
244 |
|
|
|
|
244 |
|
|
245 |
|
245 |
|
246 |
|
246 |
|
247 |
|
247 |
|
|
|
||
283 |
|
283 |
|
284 |
|
284 |
|
285 |
|
285 |
|
286 |
|
|
|
|
286 |
|
|
287 |
|
287 |
|
288 |
|
288 |
|
289 |
|
289 |
|
|
|
||
174 |
|
174 |
|
175 |
|
175 |
|
176 |
|
176 |
|
177 |
|
|
|
|
177 |
|
|
178 |
|
178 |
|
179 |
|
179 |
|
180 |
|
180 |
|
|
|
||
216 |
|
216 |
|
217 |
|
217 |
|
218 |
|
218 |
|
219 |
|
|
|
|
219 |
|
|
220 |
|
220 |
|
221 |
|
221 |
|
222 |
|
222 |
|
|
|
||
70 |
|
70 |
|
71 |
|
71 |
|
72 |
|
72 |
|
73 |
|
|
|
|
73 |
|
|
74 |
|
74 |
|
75 |
|
75 |
|
76 |
|
76 |
|
|
|
||
85 |
|
85 |
|
86 |
|
86 |
|
87 |
|
87 |
|
88 |
|
|
|
|
88 |
|
|
89 |
|
89 |
|
90 |
|
90 |
|
91 |
|
91 |
|
|
|
||
98 |
|
98 |
|
99 |
|
99 |
|
100 |
|
100 |
|
101 |
|
|
|
|
101 |
|
|
102 |
|
102 |
|
103 |
|
103 |
|
104 |
|
104 |
|
|
|
||
111 |
|
111 |
|
112 |
|
112 |
|
113 |
|
113 |
|
114 |
|
|
|
|
114 |
|
|
115 |
|
115 |
|
116 |
|
116 |
|
117 |
|
117 |
|
|
|
||
187 |
|
187 |
|
188 |
|
188 |
|
189 |
|
189 |
|
190 |
|
|
|
|
190 |
|
|
191 |
|
191 |
|
192 |
|
192 |
|
193 |
|
193 |
|
|
|
||
208 |
|
208 |
|
209 |
|
209 |
|
210 |
|
210 |
|
211 |
|
|
|
212 |
|
|
|
|
211 |
|
|
|
212 |
|
|
|
213 |
|
|
|
214 |
|
|
213 |
|
215 |
|
214 |
|
216 |
|
215 |
|
217 |
|
|
|
||
240 |
|
242 |
|
241 |
|
243 |
|
242 |
|
244 |
|
243 |
|
|
|
|
245 |
|
|
|
246 |
|
|
|
247 |
|
|
244 |
|
248 |
|
245 |
|
249 |
|
246 |
|
250 |
|
247 |
|
251 |
|
248 |
|
|
|
|
252 |
|
|
249 |
|
253 |
|
250 |
|
254 |
|
251 |
|
255 |
|