aboutsummaryrefslogtreecommitdiffstats
path: root/com32/modules
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2009-05-02 17:27:03 -0700
committerH. Peter Anvin <hpa@zytor.com>2009-05-02 17:27:03 -0700
commitb55f8a80e17e7b9c1b003c808ea8048c49fbf59c (patch)
tree0aeb376fcaf40764d94bcf526b9b9f438f217c78 /com32/modules
parent9cd4a3b4fb21482b474d63486fe677966eeb2761 (diff)
downloadsyslinux.git-b55f8a80e17e7b9c1b003c808ea8048c49fbf59c.tar.gz
syslinux.git-b55f8a80e17e7b9c1b003c808ea8048c49fbf59c.tar.xz
syslinux.git-b55f8a80e17e7b9c1b003c808ea8048c49fbf59c.zip
shuffler: correctly handle one-to-many relationshipssyslinux-3.80-pre7
One-to-many relationships, in which one chunk of a file is used in more than one place, tends to naturally show up in decoding certain fileformats, including (but not limited to) Microsoft SDI. Make the shuffler library handle those cases correctly, and remove a special-purpose hack in sdi.c. This is based on the observation that all one-to-many relationships can be treated as a one-to-one shuffle followed by destination-to-destination copies; i.e. one copy is (arbitrarily) assigned the "master copy" status, and all aliases are then copied from the master copy when the master copy is already in its final place. All other copies can then be simply ignored for the duration of the shuffle, just as zero-memory is. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Diffstat (limited to 'com32/modules')
-rw-r--r--com32/modules/sdi.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/com32/modules/sdi.c b/com32/modules/sdi.c
index 7c898591..a5df4dab 100644
--- a/com32/modules/sdi.c
+++ b/com32/modules/sdi.c
@@ -1,6 +1,7 @@
/* ----------------------------------------------------------------------- *
*
* Copyright 2008 H. Peter Anvin - All Rights Reserved
+ * Copyright 2009 Intel Corporation; author: H. Peter Anvin
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -116,14 +117,8 @@ static int boot_sdi(void *ptr, size_t len)
}
if (syslinux_add_memmap(&amap, 0x7c00, hdr->BootCodeSize, SMT_ALLOC))
goto bail;
-
- /* The shuffle library doesn't handle duplication well... */
- boot_blob = malloc(hdr->BootCodeSize);
- if (!boot_blob)
- goto bail;
- memcpy(boot_blob, (char *)ptr + hdr->BootCodeOffset, hdr->BootCodeSize);
-
- if (syslinux_add_movelist(&ml, 0x7c00, (addr_t)boot_blob, hdr->BootCodeSize))
+ if (syslinux_add_movelist(&ml, 0x7c00, (addr_t)ptr + hdr->BootCodeOffset,
+ hdr->BootCodeSize))
goto bail;
/* **** Map the entire image to SDI_LOAD_ADDR **** */