aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2008-10-13 12:35:42 -0700
committerH. Peter Anvin <hpa@zytor.com>2008-10-13 12:35:42 -0700
commite5c9012ac933f95aee0cd0da11451a7c0986b84d (patch)
treebcbf6b0cd2df2784152f958861b9afc1a185e1cb
parente6f38a11e398dd934d567178174fbc3a6ebcbc1a (diff)
downloadsyslinux-elf-e5c9012ac933f95aee0cd0da11451a7c0986b84d.tar.gz
syslinux-elf-e5c9012ac933f95aee0cd0da11451a7c0986b84d.tar.xz
syslinux-elf-e5c9012ac933f95aee0cd0da11451a7c0986b84d.zip
e820: pre-initialize buffer
Pre-initialize the e820 buffer to all zero, except for the active bit; we have found that BIOSes will make assumptions about the pre-existing value of the buffer and this seems the most conservative value. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-rw-r--r--com32/lib/syslinux/memmap.c2
-rw-r--r--core/highmem.inc5
-rw-r--r--memdisk/msetup.c2
3 files changed, 9 insertions, 0 deletions
diff --git a/com32/lib/syslinux/memmap.c b/com32/lib/syslinux/memmap.c
index e14dd70b..105c9473 100644
--- a/com32/lib/syslinux/memmap.c
+++ b/com32/lib/syslinux/memmap.c
@@ -78,6 +78,8 @@ struct syslinux_memmap *syslinux_memory_map(void)
ireg.ecx.l = sizeof(*e820buf);
ireg.es = SEG(e820buf);
ireg.edi.w[0] = OFFS(e820buf);
+ memset(e820buf, 0, sizeof *e820buf);
+ e820buf->extattr = 1;
do {
__intcall(0x15, &ireg, &oreg);
diff --git a/core/highmem.inc b/core/highmem.inc
index 7341bf27..69652b7f 100644
--- a/core/highmem.inc
+++ b/core/highmem.inc
@@ -40,6 +40,11 @@ get_e820:
mov dword [E820Max],-(1 << 20) ; Max amount of high memory
mov dword [E820Mem],(1 << 20) ; End of detected high memory
.start_over:
+ mov di,E820Buf
+ xor ax,ax
+ mov cx,12
+ rep stosw ; Clear buffer
+ mov byte [di-4],01h ; Initial extattr value
xor ebx,ebx ; Start with first record
jmp short .do_e820 ; Skip "at end" check first time!
.int_loop: and ebx,ebx ; If we're back at beginning...
diff --git a/memdisk/msetup.c b/memdisk/msetup.c
index 60149c3b..a2067011 100644
--- a/memdisk/msetup.c
+++ b/memdisk/msetup.c
@@ -45,6 +45,8 @@ static inline int get_e820(void)
com32sys_t regs;
memset(&regs, 0, sizeof regs);
+ memset(buf, 0, sizeof *buf);
+ buf->extattr = 1;
do {
regs.eax.l = 0x0000e820;