diff options
| -rw-r--r-- | NetBSD/386/include/fpuctl.h | 76 | ||||
| -rw-r--r-- | NetBSD/386/include/lib9.h | 28 | ||||
| -rw-r--r-- | emu/NetBSD/asm-386.S | 10 | ||||
| -rw-r--r-- | emu/NetBSD/emu-g | 102 | ||||
| -rw-r--r-- | emu/NetBSD/mkfile | 5 | ||||
| -rw-r--r-- | emu/NetBSD/mkfile-NetBSD | 17 | ||||
| -rw-r--r-- | emu/port/fns.h | 2 | ||||
| -rw-r--r-- | emu/port/main.c | 4 | ||||
| -rw-r--r-- | lib9/setfcr-NetBSD-386.S | 34 | ||||
| -rw-r--r-- | mkfiles/mkfile-NetBSD-386 | 5 | ||||
| -rw-r--r-- | tools/styxtest/mkfile-NetBSD | 0 |
11 files changed, 176 insertions, 107 deletions
diff --git a/NetBSD/386/include/fpuctl.h b/NetBSD/386/include/fpuctl.h index 8389f6ee..e69de29b 100644 --- a/NetBSD/386/include/fpuctl.h +++ b/NetBSD/386/include/fpuctl.h @@ -1,76 +0,0 @@ -/* - * Linux 386 fpu support - * Mimic Plan9 floating point support - */ - -static void -setfcr(ulong fcr) -{ - __asm__( "xorb $0x3f, %%al\n\t" - "pushw %%ax\n\t" - "fwait\n\t" - "fldcw (%%esp)\n\t" - "popw %%ax\n\t" - : /* no output */ - : "al" (fcr) - ); -} - -static ulong -getfcr(void) -{ - ulong fcr = 0; - - __asm__( "pushl %%eax\n\t" - "fwait\n\t" - "fstcw (%%esp)\n\t" - "popl %%eax\n\t" - "xorb $0x3f, %%al\n\t" - : "=a" (fcr) - : "eax" (fcr) - ); - return fcr; -} - -static ulong -getfsr(void) -{ - ulong fsr = -1; - - __asm__( "fwait\n\t" - "fstsw (%%eax)\n\t" - "movl (%%eax), %%eax\n\t" - "andl $0xffff, %%eax\n\t" - : "=a" (fsr) - : "eax" (&fsr) - ); - return fsr; -} - -static void -setfsr(ulong fsr) -{ - __asm__("fclex\n\t"); -} - -/* FCR */ -#define FPINEX (1<<5) -#define FPUNFL ((1<<4)|(1<<1)) -#define FPOVFL (1<<3) -#define FPZDIV (1<<2) -#define FPINVAL (1<<0) -#define FPRNR (0<<10) -#define FPRZ (3<<10) -#define FPRPINF (2<<10) -#define FPRNINF (1<<10) -#define FPRMASK (3<<10) -#define FPPEXT (3<<8) -#define FPPSGL (0<<8) -#define FPPDBL (2<<8) -#define FPPMASK (3<<8) -/* FSR */ -#define FPAINEX FPINEX -#define FPAOVFL FPOVFL -#define FPAUNFL FPUNFL -#define FPAZDIV FPZDIV -#define FPAINVAL FPINVAL diff --git a/NetBSD/386/include/lib9.h b/NetBSD/386/include/lib9.h index 0e0222ea..c8eb499a 100644 --- a/NetBSD/386/include/lib9.h +++ b/NetBSD/386/include/lib9.h @@ -274,7 +274,7 @@ extern void _assert(char*); extern double charstod(int(*)(void*), void*); extern char* cleanname(char*); extern double frexp(double, int*); -extern uintptr getcallerpc(void*); +extern ulong getcallerpc(void*); extern int getfields(char*, char**, int, int, char*); extern char* getuser(void); extern char* getwd(char*, int); @@ -476,3 +476,29 @@ extern char *argv0; #define setbinmode() +/* FCR */ +#define FPINEX (1<<5) +#define FPUNFL ((1<<4)|(1<<1)) +#define FPOVFL (1<<3) +#define FPZDIV (1<<2) +#define FPINVAL (1<<0) +#define FPRNR (0<<10) +#define FPRZ (3<<10) +#define FPRPINF (2<<10) +#define FPRNINF (1<<10) +#define FPRMASK (3<<10) +#define FPPEXT (3<<8) +#define FPPSGL (0<<8) +#define FPPDBL (2<<8) +#define FPPMASK (3<<8) +/* FSR */ +#define FPAINEX FPINEX +#define FPAOVFL FPOVFL +#define FPAUNFL FPUNFL +#define FPAZDIV FPZDIV +#define FPAINVAL FPINVAL + +extern void setfcr(ulong); +extern void setfsr(ulong); +extern ulong getfcr(void); +extern ulong getfsr(void); diff --git a/emu/NetBSD/asm-386.S b/emu/NetBSD/asm-386.S index ca701782..d21c03bb 100644 --- a/emu/NetBSD/asm-386.S +++ b/emu/NetBSD/asm-386.S @@ -5,7 +5,7 @@ * executeonnewstack(void *tos, void (*tramp)(void *arg), void *arg) */ - .type ournewstack,@function + .type executeonnewstack,@function .global executeonnewstack executeonnewstack: pushl %ebp @@ -23,7 +23,7 @@ executeonnewstack: popl %eax /* recover the tramp address */ call *%eax /* and jump to it (ho ho) */ - /* if we return here, tramp didn't do it's job */ + /* if we return here, tramp didn't do its job */ addl $8, %esp /* clean up for pose value */ @@ -92,12 +92,6 @@ FPrestore: popl %ebp ret - .type getcallerpc,@function - .global getcallerpc -getcallerpc: - movl 4(%ebp), %eax - ret - .type _tas,@function .globl _tas _tas: diff --git a/emu/NetBSD/emu-g b/emu/NetBSD/emu-g new file mode 100644 index 00000000..e662b4c1 --- /dev/null +++ b/emu/NetBSD/emu-g @@ -0,0 +1,102 @@ +env + X11LIBS= +dev + root + cons + env + mnt + pipe + prog + prof + srv + dup + ssl + cap + fs + cmd cmd + indir + + ip ipif-posix ipaux + eia + audio audio + mem + +lib + interp + math + + keyring + sec + mp + + 9 + +link + +mod + sys + math + srv srv + keyring + crypt + ipints + loader + +port + alloc + cache + chan + dev + devtab + + dial + dis + discall + env + error + errstr + exception + exportfs + inferno + latin1 + main + parse + pgrp + print + proc + qio + random + sysfile + uqid + +code + void setpointer(int x, int y){USED(x); USED(y);} + ulong strtochan(char *s){USED(s); return ~0;} + +init + emuinit + +root + /dev / + /fd / + /prog / + /prof / + /net / + /net.alt / + /chan / + /nvfs / + /env / +# /chan +# /dev +# /dis +# /env +# /n +# /net +# /nvfs / +# /prog +# /icons +# /osinit.dis +# /dis/emuinit.dis +# /dis/lib/auth.dis +# /dis/lib/ssl.dis +# /n/local / diff --git a/emu/NetBSD/mkfile b/emu/NetBSD/mkfile index 8531a68b..effbaefe 100644 --- a/emu/NetBSD/mkfile +++ b/emu/NetBSD/mkfile @@ -14,6 +14,9 @@ INSTALLDIR=$ROOT/$SYSTARG/$OBJTYPE/bin #path of directory where kernel is instal #end configurable parameters +# can remove or override X11LIBS using env section in config files +X11LIBS= -L/usr/X11R7/lib -R/usr/X11R7/lib -lXext -lX11 + <$ROOT/mkfiles/mkfile-$SYSTARG-$OBJTYPE #set vars based on target system <| $SHELLNAME ../port/mkdevlist $CONF #sets $IP, $DEVS, $PORT, $LIBS @@ -29,7 +32,7 @@ OBJ=\ HFILES=\ CFLAGS='-DROOT="'$ROOT'"' -DEMU -I. -I../port -I$ROOT/$SYSTARG/$OBJTYPE/include -I$ROOT/include -I$ROOT/libinterp $CTHREADFLAGS $CFLAGS $EMUOPTIONS -SYSLIBS= -lXext -lX11 -lossaudio -lm +SYSLIBS= ${X11LIBS} -lossaudio -lm KERNDATE=`{$NDATE} default:V: $O.$CONF diff --git a/emu/NetBSD/mkfile-NetBSD b/emu/NetBSD/mkfile-NetBSD deleted file mode 100644 index 3fdc164e..00000000 --- a/emu/NetBSD/mkfile-NetBSD +++ /dev/null @@ -1,17 +0,0 @@ -# -# architecture-dependent files for NetBSD -# - -LDFLAGS= - -TARGFILES=devfs-posix.$O\ - deveia-NetBSD.$O\ - devip.$O\ - ipif-posix.$O\ - os-NetBSD.$O\ - win-x11.$O\ - srv.$O\ - lock.$O\ - asm-NetBSD-$OBJTYPE.$O - -#SYSLIBS= -lXext -lX11 -lossaudio -lm diff --git a/emu/port/fns.h b/emu/port/fns.h index 6a0809c0..36d341b7 100644 --- a/emu/port/fns.h +++ b/emu/port/fns.h @@ -20,7 +20,7 @@ Dir* chandirstat(Chan*); void cinit(void); char* clipread(void); int clipwrite(char*); -void (*coherence)(void); +extern void (*coherence)(void); void copen(Chan*); void cmderror(Cmdbuf*, char*); Block* concatblock(Block*); diff --git a/emu/port/main.c b/emu/port/main.c index 158f6b03..da1aa432 100644 --- a/emu/port/main.c +++ b/emu/port/main.c @@ -27,6 +27,10 @@ extern int mflag; ulong displaychan; char *cputype; +/* For dynamic linking init/fini code that needs malloc */ +void (*coherence)(void) = nofence; + + static void usage(void) { diff --git a/lib9/setfcr-NetBSD-386.S b/lib9/setfcr-NetBSD-386.S new file mode 100644 index 00000000..d981f36a --- /dev/null +++ b/lib9/setfcr-NetBSD-386.S @@ -0,0 +1,34 @@ + +#define FN(x) .type x,@function; .global x; x +#define ENT subl $16, %esp +#define RET addl $16, %esp; ret + + .file "setfcr-Linux-386.S" +FN(setfcr): + ENT + xorb $0x3f, %al + movl %eax, (%esp) + fwait + fldcw (%esp) + RET + +FN(getfcr): + ENT + fwait + fstcw (%esp) + movw (%esp), %ax + andl $0xffff, %eax + xorb $0x3f, %al + RET + +FN(getfsr): + ENT + fwait + fstsw (%esp) + movw (%esp), %ax + andl $0xffff, %eax + RET + +FN(setfsr): + fclex + ret diff --git a/mkfiles/mkfile-NetBSD-386 b/mkfiles/mkfile-NetBSD-386 index e22f620b..5234688a 100644 --- a/mkfiles/mkfile-NetBSD-386 +++ b/mkfiles/mkfile-NetBSD-386 @@ -17,12 +17,11 @@ CFLAGS= -g\ -Wno-deprecated-declarations -Wuninitialized -Wunused -Wreturn-type -Wimplicit\ -I$ROOT/NetBSD/386/include\ -I$ROOT/include\ - -I/usr/X11R7/include\ - -I/usr/X11R6/include + -I/usr/X11R7/include ANSICPP= LD= cc -LDFLAGS= -L/usr/X11R6/lib -R/usr/X11R6/lib +LDFLAGS= SYSLIBS= diff --git a/tools/styxtest/mkfile-NetBSD b/tools/styxtest/mkfile-NetBSD new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/tools/styxtest/mkfile-NetBSD |
