Browse Source

Ensure that empty e820 regions are skipped even at the end of the

memory map.  (We achieve this by setting CF on the last entry if it is
zero-length; this avoids the need to look ahead to see at each entry
if the *next* entry would be both the last entry and zero-length).

This fixes the "0kB base memory" error message upon starting Windows
2003 on a SunFire X2100.
tags/v0.9.3
Michael Brown 17 years ago
parent
commit
e445c2c07c
1 changed files with 18 additions and 11 deletions
  1. 18
    11
      src/arch/i386/firmware/pcbios/e820mangler.S

+ 18
- 11
src/arch/i386/firmware/pcbios/e820mangler.S View File

@@ -361,26 +361,33 @@ int15_e820:
361 361
 	pushl	%edx	
362 362
 	call	split_e820
363 363
 	pushfw
364
-	/* Skip empty region checking if we've reached the end of the
365
-	 * map or hit an error, to avoid a potential endless loop.
366
-	 */
367
-	jc	1f
368
-	testl	%ebx, %ebx
369
-	jz	1f
370
-	/* Check for an empty region */
364
+	/* If we've hit an error, exit immediately */
365
+	jc	99f
366
+	/* If region is non-empty, return this region */
371 367
 	pushl	%eax
372 368
 	movl	%es:8(%di), %eax
373 369
 	orl	%es:12(%di), %eax
374 370
 	popl	%eax
375
-	jnz	1f
376
-	/* Strip empty regions out of the returned map */
371
+	jnz	99f
372
+	/* Region is empty.  If this is not the end of the map,
373
+	 * skip over this region.
374
+	 */
375
+	testl	%ebx, %ebx
376
+	jz	1f
377 377
 	popfw
378 378
 	popl	%edx
379 379
 	popl	%ecx
380 380
 	popl	%eax
381 381
 	jmp	int15_e820
382
-	/* Restore flags from original INT 15,e820 call and return */
383
-1:	popfw
382
+1:	/* Region is empty and this is the end of the map.  Return
383
+	 * with CF set to avoid placing an empty region at the end of
384
+	 * the map.
385
+	 */
386
+	popfw
387
+	stc
388
+	pushfw
389
+99:	/* Restore flags from original INT 15,e820 call and return */
390
+	popfw
384 391
 	addr32 leal	12(%esp), %esp /* avoid changing flags */
385 392
 	lret	$2
386 393
 	.size int15_e820, . - int15_e820

Loading…
Cancel
Save