diff options
author | christos <christos> | 1999-12-18 01:46:29 +0000 |
---|---|---|
committer | christos <christos> | 1999-12-18 01:46:29 +0000 |
commit | 5dbd3695a9e1b6b38d4405ac0ff47b43a0dc339a (patch) | |
tree | 4828eb30f752c1226e5835b8d46b1df8a90e8c84 /emulators/doscmd | |
parent | d75c8e322019b47a5fbd53ee664bb1ec1df013a7 (diff) | |
download | pkgsrc-5dbd3695a9e1b6b38d4405ac0ff47b43a0dc339a.tar.gz |
- Fix Makefile to work with elf
- Fix RO string that got written
- Add mmap() when we run ELF, because we need to map lomem
- Fix uninitialized reference in di->location
- Make doscmd_loader use loadfile() [Tested only with ELF]
Diffstat (limited to 'emulators/doscmd')
-rw-r--r-- | emulators/doscmd/patches/patch-ab | 132 | ||||
-rw-r--r-- | emulators/doscmd/patches/patch-af | 66 | ||||
-rw-r--r-- | emulators/doscmd/patches/patch-ah | 74 | ||||
-rw-r--r-- | emulators/doscmd/patches/patch-ai | 27 |
4 files changed, 241 insertions, 58 deletions
diff --git a/emulators/doscmd/patches/patch-ab b/emulators/doscmd/patches/patch-ab index f79741db50a..0084ae09a22 100644 --- a/emulators/doscmd/patches/patch-ab +++ b/emulators/doscmd/patches/patch-ab @@ -1,44 +1,90 @@ -$NetBSD: patch-ab,v 1.3 1998/10/28 01:29:16 hubertf Exp $ +$NetBSD: patch-ab,v 1.4 1999/12/18 01:46:29 christos Exp $ ---- Makefile.orig Thu May 2 19:55:19 1996 -+++ Makefile Wed Oct 28 02:07:49 1998 -@@ -8,30 +8,33 @@ - int1a.c int2f.c intff.c \ - mem.c mouse.c net.c null.c port.c setver.c signal.c timer.c trace.c trap.c tty.c xms.c - -+BINDIR= ${PREFIX}/bin -+MANDIR= ${PREFIX}/man -+ - BINGRP= kmem - EXEGRP= bin - BINMODE=2555 - EXEMODE=444 --CFLAGS+=-I/usr/X11/include -DDISASSEMBLER -g --LDFLAGS+=-L/usr/X11/lib -+CFLAGS+=-I${X11BASE}/include -DDISASSEMBLER -+LDFLAGS+=-L${X11BASE}/lib - LDADD+= -lX11 -li386 -lgcc -lc -lgcc - DPADD+= /usr/X11/lib/libX11.a ${LIBC} ${LIBGCC} - - afterinstall: - install ${COPY} -o ${BINOWN} -g ${EXEGRP} -m ${EXEMODE} \ -- doscmd.kernel ${DESTDIR}/usr/libexec/doscmd.kernel -+ doscmd.kernel ${PREFIX}/libexec/doscmd.kernel - install -c -o ${BINOWN} -g ${EXEGRP} -m ${EXEMODE} \ -- ${.CURDIR}/instbsdi.exe ${DESTDIR}/usr/dos/ -+ ${.CURDIR}/instbsdi.exe ${PREFIX}/libexec/ - - doscmd: doscmd.kernel ${LIBCRT0} doscmd_loader.o -- ld -N -Bstatic -o doscmd ${LDFLAGS} ${LIBCRT0} doscmd_loader.o ${LDADD} -+ ld -N -Bstatic -o doscmd ${LDFLAGS:S/^-Wl,//g} ${LIBCRT0} doscmd_loader.o ${LDADD} - - .include <bsd.prog.mk> - - .depend: doscmd_loader.c - - doscmd.kernel: crt0.o ${OBJS} -- ld -N -Bstatic -T 110000 -o doscmd.kernel ${LDFLAGS} crt0.o ${OBJS} ${LDADD} -+ ld -N -Bstatic -T 110000 -o doscmd.kernel ${LDFLAGS:S/^-Wl,//g} crt0.o ${OBJS} ${LDADD} - - doscmd.0: doscmd.1 - tbl ${.IMPSRC} | nroff -mandoc > ${.TARGET} +*** Makefile.orig Thu May 2 13:55:19 1996 +--- Makefile Fri Dec 17 20:27:36 1999 +*************** +*** 8,37 **** + int1a.c int2f.c intff.c \ + mem.c mouse.c net.c null.c port.c setver.c signal.c timer.c trace.c trap.c tty.c xms.c + + BINGRP= kmem + EXEGRP= bin + BINMODE=2555 + EXEMODE=444 +! CFLAGS+=-I/usr/X11/include -DDISASSEMBLER +! LDFLAGS+=-L/usr/X11/lib + LDADD+= -lX11 -li386 -lgcc -lc -lgcc +! DPADD+= /usr/X11/lib/libX11.a ${LIBC} ${LIBGCC} + + afterinstall: + install ${COPY} -o ${BINOWN} -g ${EXEGRP} -m ${EXEMODE} \ +! doscmd.kernel ${DESTDIR}/usr/libexec/doscmd.kernel + install -c -o ${BINOWN} -g ${EXEGRP} -m ${EXEMODE} \ +! ${.CURDIR}/instbsdi.exe ${DESTDIR}/usr/dos/ + +! doscmd: doscmd.kernel ${LIBCRT0} doscmd_loader.o +! ld -N -Bstatic -o doscmd ${LDFLAGS} ${LIBCRT0} doscmd_loader.o ${LDADD} + +! .include <bsd.prog.mk> + + .depend: doscmd_loader.c + + doscmd.kernel: crt0.o ${OBJS} +! ld -N -Bstatic -T 110000 -o doscmd.kernel ${LDFLAGS} crt0.o ${OBJS} ${LDADD} + + doscmd.0: doscmd.1 + tbl ${.IMPSRC} | nroff -mandoc > ${.TARGET} +--- 8,60 ---- + int1a.c int2f.c intff.c \ + mem.c mouse.c net.c null.c port.c setver.c signal.c timer.c trace.c trap.c tty.c xms.c + ++ BINDIR= ${PREFIX}/bin ++ MANDIR= ${PREFIX}/man ++ + BINGRP= kmem + EXEGRP= bin + BINMODE=2555 + EXEMODE=444 +! CFLAGS+=-I${X11BASE}/include -DDISASSEMBLER -g +! LDFLAGS+=-L${X11BASE}/lib -R${X11BASE}/lib + LDADD+= -lX11 -li386 -lgcc -lc -lgcc +! DPADD+= ${X11BASE}/lib/libX11.a ${LIBC} ${LIBGCC} +! # XXX: For loadfile +! LIBSA= /usr/src/sys/lib/libsa +! CLEANFILES+= loadfile.c loadfile.h +! +! .include <bsd.prog.mk> +! .if ${OBJECT_FMT} == "ELF" +! TEXT=-e start -Ttext +! CRTBEGIN=/usr/lib/crtbegin.o +! .else +! TEXT=-e _start -T +! CRTBEGIN= +! .endif +! + + afterinstall: + install ${COPY} -o ${BINOWN} -g ${EXEGRP} -m ${EXEMODE} \ +! doscmd.kernel ${PREFIX}/libexec/doscmd.kernel + install -c -o ${BINOWN} -g ${EXEGRP} -m ${EXEMODE} \ +! ${.CURDIR}/instbsdi.exe ${PREFIX}/libexec/ + +! doscmd: doscmd.kernel ${LIBCRT0} ${CRTBEGIN} doscmd_loader.o loadfile.o +! ld -N -Bstatic -o doscmd ${LDFLAGS:S/^-Wl,//g} ${LIBCRT0} ${CRTBEGIN} doscmd_loader.o loadfile.o ${LDADD} + +! +! loadfile.c: ${LIBSA}/loadfile.c +! @cp $> $@ +! +! loadfile.h: ${LIBSA}/loadfile.h +! @cp $> $@ +! +! doscmd_loader.o: loadfile.h + + .depend: doscmd_loader.c + + doscmd.kernel: crt0.o ${OBJS} +! ld -N -Bstatic ${TEXT} 0x110000 -o doscmd.kernel ${LDFLAGS:S/^-Wl,//g} crt0.o ${OBJS} ${LDADD} + + doscmd.0: doscmd.1 + tbl ${.IMPSRC} | nroff -mandoc > ${.TARGET} diff --git a/emulators/doscmd/patches/patch-af b/emulators/doscmd/patches/patch-af index a6026f9aa43..c6545835b77 100644 --- a/emulators/doscmd/patches/patch-af +++ b/emulators/doscmd/patches/patch-af @@ -1,16 +1,52 @@ -$NetBSD: patch-af,v 1.1 1998/10/28 01:29:16 hubertf Exp $ +$NetBSD: patch-af,v 1.2 1999/12/18 01:46:29 christos Exp $ ---- doscmd.c.BAK Wed Oct 28 01:57:30 1998 -+++ doscmd.c Wed Oct 28 01:58:17 1998 -@@ -581,7 +581,11 @@ - SET16(sc.sc_fs, 0x0000); - SET16(sc.sc_gs, 0x0000); - -+#if defined(__LIBC12_SOURCE__) - sc.sc_mask = 0; -+#else -+ sigemptyset(&sc.sc_mask); -+#endif - sc.sc_onstack = 0; - - if (tflag) { +*** doscmd.c.orig Thu May 2 15:37:33 1996 +--- doscmd.c Fri Dec 17 20:25:25 1999 +*************** +*** 100,106 **** + char *dos_path = 0; + char cmdname[256]; + +! char *memfile = "/tmp/doscmd.XXXXXX"; + + int + main(int argc, char **argv) +--- 100,106 ---- + char *dos_path = 0; + char cmdname[256]; + +! char memfile[] = "/tmp/doscmd.XXXXXX"; + + int + main(int argc, char **argv) +*************** +*** 133,138 **** +--- 133,146 ---- + if (fd != 3 && fd != 4) + close (fd); + ++ #ifdef __ELF__ ++ if (mmap((void *)4096, 1024 * 1024, PROT_READ|PROT_WRITE, ++ MAP_ANON|MAP_FIXED|MAP_PRIVATE, -1, (off_t)0) == MAP_FAILED) { ++ perror("mmap botch"); ++ quit(1); ++ } ++ #endif ++ + fd = -1; + + debug_set(0); /* debug any D_TRAPS without intnum */ +*************** +*** 581,587 **** +--- 589,599 ---- + SET16(sc.sc_fs, 0x0000); + SET16(sc.sc_gs, 0x0000); + ++ #if defined(__LIBC12_SOURCE__) + sc.sc_mask = 0; ++ #else ++ sigemptyset(&sc.sc_mask); ++ #endif + sc.sc_onstack = 0; + + if (tflag) { diff --git a/emulators/doscmd/patches/patch-ah b/emulators/doscmd/patches/patch-ah new file mode 100644 index 00000000000..b317a583dbf --- /dev/null +++ b/emulators/doscmd/patches/patch-ah @@ -0,0 +1,74 @@ +$NetBSD: patch-ah,v 1.1 1999/12/18 01:46:29 christos Exp $ + +--- doscmd_loader.c.orig Fri Dec 17 20:40:25 1999 ++++ doscmd_loader.c Sun Dec 5 18:11:38 1999 +@@ -31,38 +31,52 @@ + */ + + #include <stdio.h> +-#include <a.out.h> ++#include <unistd.h> ++#include "loadfile.h" + + /* + * reserve space in "low" memory for the interrupt vector table + */ + static const char filler[4096] = { 0, }; + +-#define _PATH_DOS_KERNEL_DIR "%PREFIX%/libexec/" ++#define _PATH_DOS_KERNEL_DIR "/usr/pkg/libexec/" + #define _PATH_DOS_KERNEL "doscmd.kernel" + +-int ++static char *locations[] = { ++ _PATH_DOS_KERNEL, ++ "obj/" _PATH_DOS_KERNEL, ++ _PATH_DOS_KERNEL_DIR _PATH_DOS_KERNEL, ++ NULL ++}; ++ ++#define COUNT (COUNT_TEXT|COUNT_DATA|COUNT_BSS) ++#define LOAD (LOAD_TEXT|LOAD_DATA|LOAD_BSS) ++ ++u_long + load_kernel(void) + { +- FILE *fp; +- struct exec exec; + int start_address; ++ int i; ++ u_long marks[MARK_MAX]; + +- if ((fp = fopen(_PATH_DOS_KERNEL, "r")) == NULL && +- (fp = fopen("obj/" _PATH_DOS_KERNEL, "r")) == NULL && +- (fp = fopen(_PATH_DOS_KERNEL_DIR _PATH_DOS_KERNEL, "r")) == NULL) ++ for (i = 0; locations[i] != NULL; i++) { ++ if (access(locations[i], R_OK) != -1) ++ break; ++ } ++ if (locations[i] == NULL) + err(1, "load_kernel"); + +- if (fread(&exec, sizeof(exec), 1, fp) != 1 || N_GETMAGIC(exec) != OMAGIC) +- errx(1, "bad kernel file format"); ++ memset(marks, 0, sizeof(marks)); ++ if (loadfile(locations[i], marks, COUNT) == -1) ++ err(1, "loadfile(COUNT)"); + +- start_address = exec.a_entry & (~(getpagesize() - 1)); +- if (brk(start_address + exec.a_text + exec.a_data + exec.a_bss) < 0) +- err(1, "load_kernel"); +- fread((char *)start_address, exec.a_text + exec.a_data, 1, fp); +- bzero((char *)(start_address + exec.a_text + exec.a_data), exec.a_bss); +- fclose(fp); +- return(exec.a_entry); ++ if (brk((void *)marks[MARK_END]) == -1) ++ err(1, "brk"); ++ ++ if (loadfile(locations[i], marks, LOAD) == -1) ++ err(1, "loadfile(LOAD)"); ++ ++ return(marks[MARK_ENTRY]); + } + + void diff --git a/emulators/doscmd/patches/patch-ai b/emulators/doscmd/patches/patch-ai new file mode 100644 index 00000000000..f9ff5fc3eeb --- /dev/null +++ b/emulators/doscmd/patches/patch-ai @@ -0,0 +1,27 @@ +$NetBSD: patch-ai,v 1.1 1999/12/18 01:46:29 christos Exp $ + +--- int13.c.orig Thu May 2 16:49:57 1996 ++++ int13.c Fri Dec 17 20:36:23 1999 +@@ -296,7 +296,7 @@ + di->secsize = 512; + di->path = strdup(file); + +- di->location = ((table & 0xf0000) << 12) | (table & 0xffff); ++ di->location = ((htable & 0xf0000) << 12) | (htable & 0xffff); + + if (drive == 0) { + ivec[0x41] = di->location; +@@ -413,11 +413,11 @@ + di->path = strdup(file); + } + di->fd = -1; +- di->location = ((table & 0xf0000) << 12) | (table & 0xffff); ++ di->location = ((ftable & 0xf0000) << 12) | (ftable & 0xffff); + di->sector0 = 0; + di->offset = 0; + +- ivec[0x1e] = ((ftable & 0xf0000) << 12) | (ftable & 0xffff); ++ ivec[0x1e] = di->location; + + table = ftable + drive * 0x0a; + |