memory size detection problem on 2.3.16+ and 2.4.x
Hi,
summary: e801 memory size detection call failure, but bios doesnt set carry flag on error and hence get an incorrect memory size.
Since the 2.3.16 kernel, my PC has been unable
to run any newer kernels (>2.3.16 or 2.4.x) without using the mem=64M command line parameter. This was when the new bigmem support was added which changed the memory detection routines somewhat.
I have traced this down to a problem with the way in which the kernel calls the e801 memory size detection bios call. The kernel assumes that the bios will set the carry flag on the return from the call should there be an error. However, the BIOS on my PC doesnt do this- infact it seems to simply return from the call without changing any registers.
As a result, my memory size being used is approx 1GB which is derived from the values in the CX and DX registers before the call. My BIOS does not clear them (CX or DX) nor does it set the carry flag.
I have included a pretty harmless patch below (taken against 2.4.2) for
arch/i386/boot/setup.S
which works around this buggy BIOS issue.
The patch clears CX and DX before the call to the e801 routine. This should be harmless for any machines which currently work correctly.
Please could this patch be included in the next 2.4.x kernel source tree, as I would guess that it is not only me affected by this...
Many thanks.
Michael Miller
arch/i386/boot/setup.S +9 -0
@@ -32,6 +32,10 @@ * * Transcribed from Intel (as86) -> AT&T (gas) by Chris Noe, May 1999. * <[email protected]> + * + * Workaround flakey BIOSes for e801 call - which don't use carry flag + * on errors. Michael Miller ([email protected]), April 2001 + * */ #define __ASSEMBLY__
@@ -341,6 +345,11 @@ # to write everything into the same place.) meme801: + xorl %edx, %edx # Clear regs to work around + xorl %ecx, %ecx # flakey BIOSes which don't + # use carry bit correctly + # This way we get 0MB ram on + # call failure movw $0xe801, %ax int $0x15 jc mem88
Quoted 3 lines
the bios will set the carry flag on the return from the call should there be an error. However, the BIOS on my PC doesnt do this- infact it seems to simply return from the call without changing any registers.
Your BIOS is faulty. No new suprises.
arch/i386/boot/setup.S line 352
Quoted 6 lines
meme801:
arch/i386/boot/setup.S +5
-0+ xorl %edx, %edx # Clear regs to work around + xorl %ecx, %ecx # flakey BIOSes which don't + # use carry bit correctly + # This way we get 0MB ram on + # call failure
Wouldn't setting the carry flag be clearer ?