From 9f45c30789b6133d4b5fb4ef07f0818a3ea4de48 Mon Sep 17 00:00:00 2001 From: Richard Qin Date: Mon, 9 Nov 2026 23:49:35 +0800 Subject: [mubios] Derive the E820 map from the CMOS memory size The E820 map ended the usable region at a hardcoded 0x08000000, so a guest with more RAM had the extra memory reported as reserved and ran out of memory during initramfs unpacking. Add cmos_read8() and size the extended memory entry from CMOS registers 0x34 and 0x35, falling back to the 16 MiB units in 0x30 and 0x31 and then to the previous 128 MiB end when neither is programmed. --- mubios/drivers/cmos.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 mubios/drivers/cmos.c (limited to 'mubios/drivers') diff --git a/mubios/drivers/cmos.c b/mubios/drivers/cmos.c new file mode 100644 index 0000000..35148d8 --- /dev/null +++ b/mubios/drivers/cmos.c @@ -0,0 +1,20 @@ +/* + RCC-Project + + Copyright (C) 2026 Richard Qin + + This file is part of RCC-Project. + */ + +#include "bios.h" +#include "io.h" + +#define CMOS_INDEX_PORT 0x0070u +#define CMOS_DATA_PORT 0x0071u + +u8 +cmos_read8 (u8 index) +{ + io_out8 (CMOS_INDEX_PORT, index); + return io_in8 (CMOS_DATA_PORT); +} -- cgit v1.2.3