summaryrefslogtreecommitdiff
path: root/com32
diff options
context:
space:
mode:
authorGene Cumm <gene.cumm@gmail.com>2010-08-01 10:23:00 -0400
committerGene Cumm <gene.cumm@gmail.com>2010-08-01 13:02:35 -0400
commit3066e47b9142551e63929557e9af182b316a3e86 (patch)
treea9fc9fbcc494f8ece696d86958e1c3af1b7e80ca /com32
parent74086566306996af8a2ea6224cd2406e5be034f8 (diff)
downloadsyslinux-3066e47b9142551e63929557e9af182b316a3e86.tar.gz
chain: Fix up and clean up DRMK load code; fix filename length; Patch memory.
Diffstat (limited to 'com32')
-rw-r--r--com32/modules/chain.c19
1 files changed, 8 insertions, 11 deletions
diff --git a/com32/modules/chain.c b/com32/modules/chain.c
index c32da11d..7b5cb74b 100644
--- a/com32/modules/chain.c
+++ b/com32/modules/chain.c
@@ -1354,7 +1354,7 @@ int main(int argc, char *argv[])
opt.sethidden = true;
} else if (!strncmp(argv[i], "drmk=", 5)) {
opt.seg = 0x70; /* DRMK wants this address */
- opt.loadfile = argv[i] + 6;
+ opt.loadfile = argv[i] + 5;
opt.sethidden = true;
opt.drmk = true;
} else if (!strncmp(argv[i], "grub=", 5)) {
@@ -1711,22 +1711,19 @@ int main(int argc, char *argv[])
*/
int tsize = (data[ndata].size + 31) & 0xfffffff0;
regs.ss = regs.fs = regs.gs = 0; /* Used before initialized */
- if (realloc(data[ndata].data, tsize)) {
+ if (!realloc(data[ndata].data, tsize)) {
error("Failed to realloc for DRMK\n");
goto bail;
}
data[ndata].size = tsize;
/* ds:[bp+28] must be 0x0000003f */
- regs.ds = (tsize >> 4) - 2;
-
- /* loadfile(opt.loadfile, &data[ndata].data, &data[ndata].size) */
-
+ regs.ds = (tsize >> 4) + (opt.seg - 2);
+ /* "Patch" into the extra row */
+ if (!memcpy(data[ndata].data + tsize - 4, "\x3f\0\0\0", 4)) {
+ error("Failed to patch DRMK\n");
+ goto bail;
+ }
}
-// dl=drive bp=0 cs=0x0070 ss=0
-// ds=0x2000 old code segment
-// bx=bytes of whole blocks(1024) loaded of file: fileSize & 0xFC00 probably just garbage remnants
-// fs,gs: zero so unlikely
-
ndata++;
}