Memory on boot via int 0x15

From: Richard B. Johnson (
Date: Thu May 25 2000 - 21:04:08 EST

Does anybody really know what BIOS function 0xe801, interrupt
0x15 is supposed to return? I mean, by specification, not conjecture.
None of my BIOS books show a spec for this function number.

Relevant Linux boot code follows. It implies that register ax is
supposed to contain so-called "base-memory", i.e., 640k (in kilobytes)
and register bx is supposed to contain so-called "extended-memory", i.e.,
memory above 1 megabyte (in 64 kilobyte chunks).

This works on most systems, I am sure. However, I have two motherboards
which contain a BIOS that confuses Linux, requiring a "MEM=" entry
to boot. Otherwise I get a seg-fault in the kernel while memory is being

This is from the so-called "stable" kernels, ../boot/setup.S. This has
been changed on later kernels to use GAS, but the logic is the same.

! Get memory size (extended mem, kB)

        push ebx

        xor ebx,ebx ! preload new memory slot with 0k
        mov [0x1e0], ebx

        mov ax,#0xe801
        int 0x15
        jc oldstylemem

! Memory size is in 1 k chunksizes, to avoid confusing loadlin.
! We store the 0xe801 memory size in a completely different place,
! because it will most likely be longer than 16 bits.
! (use 1e0 because that's what Larry Augustine uses in his
! alternative new memory detection scheme, and it's sensible
! to write everything into the same place.)

        and ebx, #0xffff ! clear sign extend
        shl ebx, 6 ! and go from 64k to 1k chunks
        mov [0x1e0],ebx ! store extended memory size

        and eax, #0xffff ! clear sign extend
         add [0x1e0],eax ! and add lower memory into total size.
        ! and fall into the old memory detection code to populate the
        ! compatibility slot.

        pop ebx
        mov dword ptr [0x1e0], #0
        mov ah,#0x88
        int 0x15
        mov [2],ax

With the subject BIOS, I have 64 megabytes of memory. The BIOS returns
0x30F in register bx. If I artifically reduce it to 0x300 by un-write
protecting the shadowed BIOS and returning a hard-coded value, the
kernel boots fine.

Dick Johnson

Penguin : Linux version 2.3.41 on an i686 machine (800.63 BogoMips).

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
Please read the FAQ at

This archive was generated by hypermail 2b29 : Wed May 31 2000 - 21:00:15 EST