Procházet zdrojové kódy

[pcbios] Fetch INT 15,e820 entry directly into our e820 cache

Some BIOSes require us to pass in not only the continuation value (in
%ebx) as returned by the previous call to INT 15,e820 but also the
unmodified buffer (at %es:%di) as returned by the previous call to INT
15,e820.  Apparently, someone thought it would be a worthwhile
optimisation to fill in only the low dword of the "length" field and
the low byte of the "type field", assuming that the buffer would
remain unaltered from the previous call.

This problem was being triggered by the "peek ahead" logic in
get_mangled_e820(), which would read the next entry into a temporary
buffer in order to be able to guarantee terminating the map with
%ebx=0 rather than CF=1.  (Terminating with CF=1 upsets some Windows
flavours, despite being documented legal behaviour.)

Work around this problem by always fetching directly into our e820
cache; that way we can guarantee that the underlying call always sees
the previous buffer contents (and the same buffer address).
tags/v0.9.4
Michael Brown před 16 roky
rodič
revize
3392cfa7df
1 změnil soubory, kde provedl 9 přidání a 19 odebrání
  1. 9
    19
      src/arch/i386/firmware/pcbios/e820mangler.S

+ 9
- 19
src/arch/i386/firmware/pcbios/e820mangler.S Zobrazit soubor

@@ -245,10 +245,19 @@ get_underlying_e820:
245 245
 	pushl	%ebx
246 246
 	pushl	%ecx
247 247
 	pushl	%edx
248
+	pushw	%es
249
+	pushw	%di
250
+	pushw	%ds
251
+	popw	%es
252
+	movw	$underlying_e820_cache, %di
253
+	movl	$20, %ecx
248 254
 	movl	underlying_e820_ebx, %ebx
249 255
 	stc
250 256
 	pushfw
251 257
 	lcall	*%cs:int15_vector
258
+	popw	%di
259
+	popw	%es
260
+	/* Check for error return from underlying e820 call */
252 261
 	jc	1f /* CF set: error */
253 262
 	cmpl	$SMAP, %eax
254 263
 	je	2f /* 'SMAP' missing: error */
@@ -262,25 +271,6 @@ get_underlying_e820:
262 271
 	popl	%ecx
263 272
 	popl	%ebx
264 273
 	popl	%eax
265
-	/* Copy result to cache */
266
-	pushw	%es
267
-	pushw	%fs
268
-	pushw	%si
269
-	pushw	%di
270
-	pushw	%cx
271
-	pushw	%es
272
-	popw	%fs
273
-	movw	%di, %si
274
-	pushw	%ds
275
-	popw	%es
276
-	movw	$underlying_e820_cache, %di
277
-	movw	$20, %cx
278
-	fs rep movsb
279
-	popw	%cx
280
-	popw	%di
281
-	popw	%si
282
-	popw	%fs
283
-	popw	%es
284 274
 	/* Mark cache as containing this result */
285 275
 	incw	underlying_e820_index
286 276
 

Načítá se…
Zrušit
Uložit