Markus Armbruster email@example.com writes:
"Kevin O'Connor" firstname.lastname@example.org writes:
On Fri, Aug 10, 2012 at 04:54:06PM +0200, Markus Armbruster wrote:
Peter Stuge email@example.com writes:
Markus Armbruster wrote:
Could SeaBIOS fail more cleanly when it detects insufficient RAM?
What would you propose?
Fail POST with panic("Not enough RAM")?
The amount of memory is communicated from QEMU to SeaBIOS via nvram variables. As far as I know, those variables can only communicate ram sizes in 1meg chunks - so there is no way to communicate (and/or detect) a ramsize of under 1 meg.
Not true, the variables *can* communicate more.
Here's what QEMU stores in the RTC's NVRAM ("CMOS memory") on RAM:
addr size meaning [unit] 0x15 2 base memory (below 1MiB) [KiB] 0x17 2 extended memory (between 1MiB and 64MiB) [KiB] 0x30 2 copy of 0x17/0x18 0x34 2 memory between 16MiB and 4GiB [64KiB] 0x5b 3 memory above 4GiB [64KiB]
Thus, memory sizes up to 16MiB can be declared with 1KiB granularity, and up to 1TiB with 64KiB granularity.
Note that RAM 0xa0000..0xfffff is inaccessible.
However, the values QEMU *currently* stores are buggy for RAM sizes under 640KiB: base memory is set to 640KiB, and extended memory underflows. Code is pc_cmos_init() in hw/pc.c. I'll try to get that fixed, either by storing correct values, or by enforcing a 1MiB minimum.
1MiB minimum was rejected. Instead, QEMU 1.2 got this fix:
commit e89001f72edde37fb36fa7c964daa1bbeb2eca26 Author: Markus Armbruster firstname.lastname@example.org Date: Wed Aug 15 13:12:20 2012 +0200
pc: Fix RTC CMOS info on RAM for ram_size < 1MiB
pc_cmos_init() always claims 640KiB base memory, and ram_size - 1MiB extended memory. The latter can underflow to "lots of extended memory". Fix both, and clean up some.
Note: SeaBIOS currently requires 1MiB of RAM, and doesn't check whether it got enough.