Int 0x15, AX=e820 doesn't return the length of the buffer in EDX. That's 
actually returned in ECX. So I think the patch below is needed.

For reference see:
http://www.ctyme.com/intr/rb-1741.htm

Tested on amd64.


Index: amd64/stand/libsa/memprobe.c
===================================================================
RCS file: /usr/cvs/src/sys/arch/amd64/stand/libsa/memprobe.c,v
retrieving revision 1.6
diff -u -r1.6 memprobe.c
--- amd64/stand/libsa/memprobe.c        30 Nov 2009 16:33:20 -0000      1.6
+++ amd64/stand/libsa/memprobe.c        24 Jun 2010 00:04:47 -0000
@@ -72,9 +72,9 @@
        do {
                BIOS_regs.biosr_es = ((u_int)(mp) >> 4);
                __asm __volatile(DOINT(0x15) "; setc %b1"
-                               : "=a" (sig), "=d" (rc), "=b" (off)
-                               : "0" (0xE820), "1" (0x534d4150), "b" (off),
-                                 "c" (sizeof(*mp)), "D" (((u_int)mp) & 0xF)
+                               : "=a" (sig), "=c" (rc), "=b" (off)
+                               : "0" (0xE820), "d" (0x534d4150), "b" (off),
+                                 "1" (sizeof(*mp)), "D" (((u_int)mp) & 0xF)
                                : "cc", "memory");
                        off = BIOS_regs.biosr_bx;
 
Index: i386/stand/libsa/memprobe.c
===================================================================
RCS file: /usr/cvs/src/sys/arch/i386/stand/libsa/memprobe.c,v
retrieving revision 1.46
diff -u -r1.46 memprobe.c
--- i386/stand/libsa/memprobe.c 30 Nov 2009 16:33:20 -0000      1.46
+++ i386/stand/libsa/memprobe.c 23 Jun 2010 05:00:40 -0000
@@ -73,9 +73,9 @@
                BIOS_regs.biosr_es = ((u_int)(mp) >> 4);
 
                __asm __volatile(DOINT(0x15) "; setc %b1"
-                   : "=a" (sig), "=d" (rc), "=b" (off)
-                   : "0" (0xE820), "1" (0x534d4150), "b" (off),
-                     "c" (sizeof(*mp)), "D" (((u_int)mp) & 0xF)
+                   : "=a" (sig), "=c" (rc), "=b" (off)
+                   : "0" (0xE820), "d" (0x534d4150), "b" (off),
+                     "1" (sizeof(*mp)), "D" (((u_int)mp) & 0xF)
                    : "cc", "memory");
                off = BIOS_regs.biosr_bx;

Reply via email to