summaryrefslogtreecommitdiff
path: root/com32/chain
diff options
context:
space:
mode:
authorMichal Soltys <soltys@ziu.info>2010-10-25 10:27:23 +0200
committerMichal Soltys <soltys@ziu.info>2010-10-25 10:27:23 +0200
commitf0618a1eab06703fc66e6815e4a9e0b8aac1bc8b (patch)
tree3c942d38a2408f4b8507d323fa79ab697b3c0578 /com32/chain
parentca128a5d1d013a7a6276d107c076f57a0196824a (diff)
parent778fcea7d4e3e2a595df0a18475d83d008216117 (diff)
downloadsyslinux-f0618a1eab06703fc66e6815e4a9e0b8aac1bc8b.tar.gz
Merge branch 'master' into chaindev
Conflicts: com32/modules/chain.c Changes to DRMK imported into commented-out section of com32/chain/mangle.c Signed-off-by: Michal Soltys <soltys@ziu.info>
Diffstat (limited to 'com32/chain')
-rw-r--r--com32/chain/mangle.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/com32/chain/mangle.c b/com32/chain/mangle.c
index b7645ccf..e4d4be36 100644
--- a/com32/chain/mangle.c
+++ b/com32/chain/mangle.c
@@ -209,16 +209,33 @@ int manglef_drmk(struct data_area *data)
return 0;
uint32_t tsize = (data->size + 19) & 0xfffffff0;
+ const union syslinux_derivative_info *sdi;
+ uint64_t fs_lba;
+
+ sdi = syslinux_derivative_info();
+ /* We should lookup the Syslinux partition offset and use it */
+ fs_lba = *sdi->disk.partoffset;
+
+ /*
+ * fs_lba should be verified against the disk as some DRMK
+ * variants will check and fail if it does not match
+ */
+ dprintf(" fs_lba offset is %d\n", fs_lba);
+ /* DRMK only uses a DWORD */
+ if (fs_lba > 0xffffffff) {
+ error("LBA very large; Only using lower 32 bits; DRMK will probably fail\n");
+ }
opt.regs.ss = opt.regs.fs = opt.regs.gs = 0; /* Used before initialized */
if (!realloc(data->data, tsize)) {
error("Failed to realloc for DRMK.\n");
goto bail;
}
data->size = tsize;
- /* ds:[bp+28] must be 0x0000003f */
+ /* ds:bp is assumed by DRMK to be the boot sector */
+ /* offset 28 is the FAT HiddenSectors value */
opt.regs.ds = (uint16_t)((tsize >> 4) + (opt.fseg - 2));
/* "Patch" into tail of the new space */
- *(uint32_t *)((char*)data->data + tsize - 4) = 0x0000003f;
+ *(uint32_t *)((char*)data->data + tsize - 4) = (uint32_t)fs_lba;
return 0;
bail: