Browse Source

[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 16 years ago
parent
commit
3392cfa7df
1 changed files with 9 additions and 19 deletions
  1. 9
    19
      src/arch/i386/firmware/pcbios/e820mangler.S

+ 9
- 19
src/arch/i386/firmware/pcbios/e820mangler.S View File

245
 	pushl	%ebx
245
 	pushl	%ebx
246
 	pushl	%ecx
246
 	pushl	%ecx
247
 	pushl	%edx
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
 	movl	underlying_e820_ebx, %ebx
254
 	movl	underlying_e820_ebx, %ebx
249
 	stc
255
 	stc
250
 	pushfw
256
 	pushfw
251
 	lcall	*%cs:int15_vector
257
 	lcall	*%cs:int15_vector
258
+	popw	%di
259
+	popw	%es
260
+	/* Check for error return from underlying e820 call */
252
 	jc	1f /* CF set: error */
261
 	jc	1f /* CF set: error */
253
 	cmpl	$SMAP, %eax
262
 	cmpl	$SMAP, %eax
254
 	je	2f /* 'SMAP' missing: error */
263
 	je	2f /* 'SMAP' missing: error */
262
 	popl	%ecx
271
 	popl	%ecx
263
 	popl	%ebx
272
 	popl	%ebx
264
 	popl	%eax
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
 	/* Mark cache as containing this result */
274
 	/* Mark cache as containing this result */
285
 	incw	underlying_e820_index
275
 	incw	underlying_e820_index
286
 
276
 

Loading…
Cancel
Save