[syslinux:master] chain: Fix up and clean up DRMK load code; fix filename length; Patch memory.

syslinux-bot for Gene Cumm gene.cumm at gmail.com
Sun Aug 1 14:57:25 PDT 2010


Commit-ID:  3066e47b9142551e63929557e9af182b316a3e86
Gitweb:     http://syslinux.zytor.com/commit/3066e47b9142551e63929557e9af182b316a3e86
Author:     Gene Cumm <gene.cumm at gmail.com>
AuthorDate: Sun, 1 Aug 2010 10:23:00 -0400
Committer:  Gene Cumm <gene.cumm at gmail.com>
CommitDate: Sun, 1 Aug 2010 13:02:35 -0400

chain: Fix up and clean up DRMK load code; fix filename length;  Patch memory.



---
 com32/modules/chain.c |   19 ++++++++-----------
 1 files changed, 8 insertions(+), 11 deletions(-)

diff --git a/com32/modules/chain.c b/com32/modules/chain.c
index c32da11..7b5cb74 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++;
     }



More information about the Syslinux-commits mailing list