[SeaBIOS] ram_probe() displays wrong size for RamSizeOver4G

Kevin O'Connor kevin at koconnor.net
Wed Jan 6 01:49:57 CET 2010


On Tue, Jan 05, 2010 at 10:51:02PM +0100, Sebastian Herbszt wrote:
> I have modified Bochs to support the needed cmos bytes for specifying
> memory above pci hole. If i set it up to 5120 MB i get the following:
> 00000271154i[BIOS ] Ram Size=0xc0000000 (0xffffffff80000000 high)
> The "high" value looks odd (upper 32 bit should be 0).

Interesting - for some reason the u8 gets promoted to a signed int.
Thanks for reporting - the patch below fixes it for me.

-Kevin


--- a/src/post.c
+++ b/src/post.c
@@ -117,7 +117,7 @@ ram_probe(void)
 
         // Check for memory over 4Gig
         u64 high = ((inb_cmos(CMOS_MEM_HIGHMEM_LOW) << 16)
-                    | (inb_cmos(CMOS_MEM_HIGHMEM_MID) << 24)
+                    | ((u32)inb_cmos(CMOS_MEM_HIGHMEM_MID) << 24)
                     | ((u64)inb_cmos(CMOS_MEM_HIGHMEM_HIGH) << 32));
         RamSizeOver4G = high;
         add_e820(0x100000000ull, high, E820_RAM);



More information about the SeaBIOS mailing list