⛏️ index : haiku.git

author Augustin Cavalier <waddlesplash@gmail.com> 2025-05-01 12:27:16.0 -04:00:00
committer Augustin Cavalier <waddlesplash@gmail.com> 2025-05-01 12:27:16.0 -04:00:00
commit
77bb0948724e6f28d30ade9f55ea36d4b19f8a53 [patch]
tree
f16f2e1a64983224629ef298744567fc983e4fe4
parent
3479a4d9ae7929c2bc6c55c8cb1786104caa2ad1
download
77bb0948724e6f28d30ade9f55ea36d4b19f8a53.tar.gz

bootloader/bios_ia32: Automatically zero bios_regs on initialization.

Many places didn't zero them, so we'd put bogus data in those registers
during BIOS calls.

Diff

 src/system/boot/platform/bios_ia32/bios.h  | 4 ++++
 src/system/boot/platform/bios_ia32/mmu.cpp | 5 +++++
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/system/boot/platform/bios_ia32/bios.h b/src/system/boot/platform/bios_ia32/bios.h
index 1b70bd4..df0ab58 100644
--- a/src/system/boot/platform/bios_ia32/bios.h
+++ b/src/system/boot/platform/bios_ia32/bios.h
@@ -21,6 +21,10 @@
	uint32	edi;
	uint16	es;
	uint16	flags;

#ifdef __cplusplus
	bios_regs() : eax(0), ebx(0), ecx(0), edx(0), esi(0), edi(0), es(0), flags(0) {}
#endif
};

#define CARRY_FLAG	0x01
diff --git a/src/system/boot/platform/bios_ia32/mmu.cpp b/src/system/boot/platform/bios_ia32/mmu.cpp
index ae53684..22158aa 100644
--- a/src/system/boot/platform/bios_ia32/mmu.cpp
+++ b/src/system/boot/platform/bios_ia32/mmu.cpp
@@ -296,10 +296,13 @@
get_memory_map(extended_memory **_extendedMemory)
{
	extended_memory *block = (extended_memory *)kExtraSegmentScratch;
	bios_regs regs = {0, 0, sizeof(extended_memory), 0, 0, (uint32)block, 0, 0};
	bios_regs regs;
	uint32 count = 0;

	TRACE("get_memory_map()\n");

	regs.ecx = sizeof(extended_memory);
	regs.edi = (uint32)block;

	do {
		regs.eax = 0xe820;