[syslinux:master] chain.c32: prepare for loading DRMK

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


Commit-ID:  74086566306996af8a2ea6224cd2406e5be034f8
Gitweb:     http://syslinux.zytor.com/commit/74086566306996af8a2ea6224cd2406e5be034f8
Author:     Gene Cumm <gene.cumm at gmail.com>
AuthorDate: Sat, 31 Jul 2010 23:14:06 -0400
Committer:  Gene Cumm <gene.cumm at gmail.com>
CommitDate: Sun, 1 Aug 2010 13:01:37 -0400

chain.c32: prepare for loading DRMK



---
 com32/modules/chain.c |   31 +++++++++++++++++++++++++++++++
 1 files changed, 31 insertions(+), 0 deletions(-)

diff --git a/com32/modules/chain.c b/com32/modules/chain.c
index a5f6401..c32da11 100644
--- a/com32/modules/chain.c
+++ b/com32/modules/chain.c
@@ -133,6 +133,7 @@ static struct options {
     bool swap;
     bool hide;
     bool sethidden;
+    bool drmk;
 } opt;
 
 struct data_area {
@@ -1351,6 +1352,11 @@ int main(int argc, char *argv[])
 	    opt.seg = 0x70;	/* MS-DOS 2.0+ wants this address */
 	    opt.loadfile = argv[i] + 6;
 	    opt.sethidden = true;
+	} else if (!strncmp(argv[i], "drmk=", 5)) {
+	    opt.seg = 0x70;	/* DRMK wants this address */
+	    opt.loadfile = argv[i] + 6;
+	    opt.sethidden = true;
+	    opt.drmk = true;
 	} else if (!strncmp(argv[i], "grub=", 5)) {
 	    opt.seg = 0x800;	/* stage2 wants this address */
 	    opt.loadfile = argv[i] + 5;
@@ -1697,6 +1703,31 @@ int main(int argc, char *argv[])
 	    }
 	}
 
+	if (opt.drmk) {
+	    /* DRMK entry is different */
+	    /*
+	     * A new size, aligned to 16 bytes, with one full extra row to
+	     * guarantee the needed space and ease other values.
+	     */
+	    int tsize = (data[ndata].size + 31) & 0xfffffff0;
+	    regs.ss = regs.fs = regs.gs = 0;	/* Used before initialized */
+	    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) */
+
+	}
+// 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