mboot.c32: clear inputs to BIOS calls
authorTim Deegan <Tim.Deegan@cl.cam.ac.uk>
Fri, 17 Mar 2006 16:57:52 +0000 (16:57 +0000)
committerH. Peter Anvin <hpa@zytor.com>
Fri, 17 Mar 2006 17:04:29 +0000 (09:04 -0800)
Zero the inputs to BIOS calls, to fix two bugs in mboot.c32's E820 mmap code.

Signed-off-by: Tim Deegan <Tim.Deegan@cl.cam.ac.uk>
com32/modules/mboot.c

index 4238c5c..96e4102 100644 (file)
@@ -358,7 +358,8 @@ static void init_mmap(struct multiboot_info *mbi)
     
     while(((void *)(e820 + 1)) < __com32.cs_bounce + __com32.cs_bounce_size) 
     {
-
+        memset(e820, 0, sizeof (*e820));
+        memset(&regs_in, 0, sizeof regs_in);
         e820->size = sizeof(*e820) - sizeof(e820->size);
       
         /* Ask the BIOS to fill in this descriptor */
@@ -862,6 +863,7 @@ static void boot(size_t mbi_run_addr, size_t entry)
     memmove(trampoline, trampoline_start, trampoline_size);
       
     /* Tell SYSLINUX to clean up */
+    memset(&regs, 0, sizeof regs);
     regs.eax.l = 0x000c; /* "Perform final cleanup" */
     regs.edx.l = 0;      /* "Normal cleanup" */
     __intcall(0x22, &regs, NULL);