aboutsummaryrefslogtreecommitdiffstats
path: root/memdisk
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2009-07-31 08:24:27 -0700
committerH. Peter Anvin <hpa@zytor.com>2009-07-31 08:24:27 -0700
commita243241a43b48a7cf0fbe47e54851bd8f2c2023e (patch)
treec1560e0b165aabb7d58b2e434a57663c3d567a19 /memdisk
parent8b9b22fee5e3febcddf7439e0b4369615fc9ecd7 (diff)
downloadsyslinux.git-a243241a43b48a7cf0fbe47e54851bd8f2c2023e.tar.gz
syslinux.git-a243241a43b48a7cf0fbe47e54851bd8f2c2023e.tar.xz
syslinux.git-a243241a43b48a7cf0fbe47e54851bd8f2c2023e.zip
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 <Shao.Miller@yrdsb.edu.on.ca> Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Diffstat (limited to 'memdisk')
-rw-r--r--memdisk/setup.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/memdisk/setup.c b/memdisk/setup.c
index 958f6011..7af16108 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