Subject: Potential fix for i386 Compaq/EISA machines' memory detection
To: None <>
From: Jaromir Dolecek <>
List: current-users
Date: 01/12/2003 17:24:03
Content-Transfer-Encoding: 7bit
Content-Type: text/plain; charset=US-ASCII

with help of Pavel Cahyna, we might have found a reason why the memory
detection was wrong on those machines. It's just a guess, but
worth try.

It seems some BIOSes have sligtly unstandard int15, function 0xE801
(which is used to get information of amount of memory in the machine),
which returns registers AX & BX zeroed. Our current bootblock
memory detection routine would then ignore the information, and
thus 'see' only first 16MB, as returned by another memory
detection function (int15, function 0x88).

So, if anyone ever had machine with >16MB RAM, where NetBSD detected
only first 16MB of memory, I'd be interested to know if the attached
change fixes the detection. Please report the amount of memory
printed by bootblocks; you don't need to remove the REALEXTMEM
option nor recompile kernel to test this, just update bootblocks.
Since the change is not particularily well tested, it would be best
to try this with floppy boot, as in:

> newfs -t floppy /dev/rfd0a
> /usr/mdec/installboot path_to_new_bootblocks/biosboot.sym /dev/rfd0a
> ... reboot and attempt to boot from floppy

Compiled bootblocks with this change are available at


Jaromir Dolecek <>  
-=- We should be mindful of the potential goal, but as the tantric    -=-
-=- Buddhist masters say, ``You may notice during meditation that you -=-
-=- sometimes levitate or glow.   Do not let this distract you.''     -=-

Content-Transfer-Encoding: 7bit
Content-Type: text/plain; charset=ISO-8859-2
Content-Disposition: attachment; filename=extmem.patch

Index: biosmemx.S
RCS file: /cvsroot/src/sys/arch/i386/stand/lib/biosmemx.S,v
retrieving revision 1.2
diff -u -p -r1.2 biosmemx.S
--- biosmemx.S	1999/03/08 21:38:28	1.2
+++ biosmemx.S	2003/01/12 16:12:10
@@ -59,6 +59,19 @@ ENTRY(getextmem2)
 	int	$0x15
 	jc	err2
+/* some BIOSes return AX=BX=0; we must use CX, DX instead in that case */
+	test	%ax, %ax
+	jz	afterquirk
+	test	%bx, %bx
+	jz	afterquirk
+/* copy CX, DX to AX, BX respectively, so that rest of code DTRT */
+	data32
+	movl	%ecx, %eax
+	data32
+	movl	%edx, %ebx
 	movl	$0, %ecx
 	jmp ok2