From: H. Peter Anvin Date: Fri, 31 Jul 2009 15:24:27 +0000 (-0700) Subject: memdisk: don't write the EDD DPT unless we are in EDD mode... X-Git-Tag: syslinux-3.83-pre5~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a243241a43b48a7cf0fbe47e54851bd8f2c2023e;p=platform%2Fupstream%2Fsyslinux.git memdisk: don't write the EDD DPT unless we are in EDD mode... Don't write the EDD DPT unless we're actually in EDD mode! Otherwise we end up corrupting memory beyond the defined code. This was the reason 5ca2764460883f5e9a5bd83db00f242ea1272e33 worked, by moving variables out of the corruption zone. Debugged-by: Shao Miller Signed-off-by: H. Peter Anvin --- diff --git a/memdisk/setup.c b/memdisk/setup.c index 958f601..7af1610 100644 --- a/memdisk/setup.c +++ b/memdisk/setup.c @@ -895,19 +895,21 @@ void setup(const struct real_mode_args *rm_args_ptr) } /* Set up an EDD drive parameter table */ - pptr->edd_dpt.sectors = geometry->sectors; - /* The EDD spec has this as <= 15482880 sectors (1024x240x63); - this seems to make very little sense. Try for something saner. */ - if (geometry->c <= 1024 && geometry->h <= 255 && geometry->s <= 63) { + if (do_edd) { + pptr->edd_dpt.sectors = geometry->sectors; + /* The EDD spec has this as <= 15482880 sectors (1024x240x63); + this seems to make very little sense. Try for something saner. */ + if (geometry->c <= 1024 && geometry->h <= 255 && geometry->s <= 63) { pptr->edd_dpt.c = geometry->c; pptr->edd_dpt.h = geometry->h; pptr->edd_dpt.s = geometry->s; pptr->edd_dpt.flags |= 0x0002; /* Geometry valid */ - } - if (!(geometry->driveno & 0x80)) { + } + if (!(geometry->driveno & 0x80)) { /* Floppy drive. Mark it as a removable device with media change notification; media is present. */ pptr->edd_dpt.flags |= 0x0014; + } } /* The size is given by hptr->total_size plus the size of the E820