diff options
author | Robert de Bath <rdebath@poboxes.com> | 1996-11-03 22:33:35 +0100 |
---|---|---|
committer | Lubomir Rintel <lkundrak@v3.sk> | 2013-10-23 23:33:35 +0200 |
commit | c218c617b5be443b7968308506969ad2b726d73c (patch) | |
tree | 0051f396af56133d24fcf2ab757fabc78c1a09bf /elksemu | |
parent | 0936b9aeab611665645a4e6bafaded7ca76dd189 (diff) | |
parent | 0d2fbe9b1bd284ce2cad55be17e8f2c896031a25 (diff) | |
download | dev86-c218c617b5be443b7968308506969ad2b726d73c.tar.gz |
Import Dev86src-0.0.8.tar.gzv0.0.8
Diffstat (limited to 'elksemu')
-rw-r--r-- | elksemu/Kernel_patch | 2 | ||||
-rw-r--r-- | elksemu/Makefile | 14 | ||||
-rw-r--r-- | elksemu/V-files.tar | bin | 20480 -> 0 bytes | |||
-rw-r--r-- | elksemu/Version | 2 | ||||
-rw-r--r-- | elksemu/binfmt_elks.c | 6 | ||||
-rw-r--r-- | elksemu/elks.c | 13 | ||||
-rw-r--r-- | elksemu/elks_signal.c | 1 | ||||
-rw-r--r-- | elksemu/elks_sys.c | 9 |
8 files changed, 35 insertions, 12 deletions
diff --git a/elksemu/Kernel_patch b/elksemu/Kernel_patch index cc4ca40..1a9d93e 100644 --- a/elksemu/Kernel_patch +++ b/elksemu/Kernel_patch @@ -13,7 +13,7 @@ If you are using kernel 1.3.* or later try the module: binfmt_elks.o +#ifndef NO_ELKSEMU + /* What a horrible hack! :-) */ + if ((bprm.buf[0] == 1) && (bprm.buf[1] == 3) && -+ (bprm.buf[2] == 0x20) && (bprm.buf[3] == 4)) ++ (bprm.buf[2] == 0x20 || bprm.buf[2] == 0x10) && (bprm.buf[3] == 4)) + memcpy(bprm.buf, "#!/lib/elksemu\n", 16); +#endif if ((bprm.buf[0] == '#') && (bprm.buf[1] == '!') && (!sh_bang)) { diff --git a/elksemu/Makefile b/elksemu/Makefile index 2044160..e25f60f 100644 --- a/elksemu/Makefile +++ b/elksemu/Makefile @@ -2,10 +2,16 @@ # Makefile for elksemu. # -CFLAGS=-O2 -fno-strength-reduce -Wall -idirafter . $(DEFS) -# If you need an a.out exe. NB The program _does_ now work as ELF +# For gcc with the default compiler +# CFLAGS=-O2 -fno-strength-reduce -Wall -idirafter . $(DEFS) + +# For gcc making a.out with a basically ELF compiler # CFLAGS=-O2 -fno-strength-reduce -b i486-linuxaout -N -s -static +# Use BCC to make a tiny static a.out version. +CFLAGS=-O -3 -N -ansi +CC=bcc + OBJ=elks.o elks_sys.o elks_signal.o elksemu: $(OBJ) @@ -22,8 +28,8 @@ dummy: # The kernel patch or module _requires_ this location. install: elksemu - install -s -o root -g root -m 4111 elksemu /lib/elksemu - tar cvf V-files.tar call_tab.v defn_tab.v + install -d $(DIST)/lib + install -s -o root -g root -m 4555 elksemu $(DIST)/lib/elksemu clean: rm -f $(OBJ) elksemu call_tab.v defn_tab.v diff --git a/elksemu/V-files.tar b/elksemu/V-files.tar Binary files differdeleted file mode 100644 index 93e529d..0000000 --- a/elksemu/V-files.tar +++ /dev/null diff --git a/elksemu/Version b/elksemu/Version index 66a1fd7..68d2772 100644 --- a/elksemu/Version +++ b/elksemu/Version @@ -1 +1 @@ -Version elksemu-0.0.6 +Version elksemu-0.0.8 diff --git a/elksemu/binfmt_elks.c b/elksemu/binfmt_elks.c index 9c1ecd4..07babe4 100644 --- a/elksemu/binfmt_elks.c +++ b/elksemu/binfmt_elks.c @@ -23,9 +23,9 @@ static int do_load_elksaout(struct linux_binprm *bprm,struct pt_regs *regs) int retval; /* What a horrible hack! :-) */ - if ((bprm->buf[0] != 1) || (bprm->buf[1] != 3) || - (bprm->buf[2] != 0x20) || (bprm->buf[3] != 4) || - bprm->sh_bang) + if ((bprm->buf[0] != 1) || (bprm->buf[1] != 3) || + (bprm->buf[2] != 0x20 && bprm->buf[2] != 0x10) || + (bprm->buf[3] != 4) || bprm->sh_bang) return -ENOEXEC; bprm->sh_bang++; diff --git a/elksemu/elks.c b/elksemu/elks.c index 652b559..8cdcb14 100644 --- a/elksemu/elks.c +++ b/elksemu/elks.c @@ -13,6 +13,7 @@ #include <stdarg.h> #include <fcntl.h> #include <signal.h> +#include <errno.h> #include <sys/stat.h> #include <sys/vm86.h> #include <sys/mman.h> @@ -71,7 +72,7 @@ static int load_elks(int fd) return -ENOEXEC; if(mh.type!=ELKS_COMBID&&mh.type!=ELKS_SPLITID) return -ENOEXEC; -#if 0 +#ifdef DEBUG fprintf(stderr,"Linux-86 binary - %lX. tseg=%ld dseg=%ld bss=%ld\n", mh.type,mh.tseg,mh.dseg,mh.bseg); #endif @@ -88,8 +89,8 @@ static int load_elks(int fd) * Load the VM86 registers */ -/* if(mh.type==ELKS_COMBID) - dsp=elks_base;*/ + if(mh.type==ELKS_COMBID) + dsp=elks_base; elks_cpu.regs.ds=PARAGRAPH(dsp); elks_cpu.regs.es=PARAGRAPH(dsp); elks_cpu.regs.ss=PARAGRAPH(dsp); @@ -235,9 +236,15 @@ void main(int argc, char *argv[], char *envp[]) /* The Linux vm will deal with not allocating the unused pages */ #if __AOUT__ +#if __GNUC__ /* GNU malloc will align to 4k with large chunks */ elks_base = malloc(0x20000); #else + /* But others won't */ + elks_base = malloc(0x20000+4096); + elks_base = (void*) (((int)elks_base+4095) & -4096); +#endif +#else /* For ELF first 128M is unmapped, it needs to be mapped manually */ elks_base = mmap((void*)0x10000, 0x20000, PROT_EXEC|PROT_READ|PROT_WRITE, diff --git a/elksemu/elks_signal.c b/elksemu/elks_signal.c index 4b8e0c5..1eb9336 100644 --- a/elksemu/elks_signal.c +++ b/elksemu/elks_signal.c @@ -5,6 +5,7 @@ #include <unistd.h> #include <fcntl.h> #include <signal.h> +#include <errno.h> #include <sys/stat.h> #include <sys/vm86.h> #include "elks.h" diff --git a/elksemu/elks_sys.c b/elksemu/elks_sys.c index c16dc53..74afbf9 100644 --- a/elksemu/elks_sys.c +++ b/elksemu/elks_sys.c @@ -15,6 +15,7 @@ #include <termios.h> #include <time.h> #include <signal.h> +#include <errno.h> #include <sys/types.h> #include <sys/resource.h> #include <sys/wait.h> @@ -186,6 +187,14 @@ static int elks_chdir(int bx,int cx,int dx,int di,int si) return chdir(ELKS_PTR(char, bx)); } +#define sys_fchdir elks_fchdir +static int elks_fchdir(int bx,int cx,int dx,int di,int si) +{ + dbprintf(("fchdir(%s)\n",bx)); + return fchdir(bx); +} + + #define sys_mknod elks_mknod static int elks_mknod(int bx,int cx,int dx,int di,int si) { |