summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcharles forsyth <charles.forsyth@gmail.com>2014-05-18 14:19:01 +0100
committercharles forsyth <charles.forsyth@gmail.com>2014-05-18 14:19:01 +0100
commit37e9221a5d1905cba45c96ac44dbe26d947bc4af (patch)
tree87bf6a76dc94bc638418883e0ca21afcfa2ad78f
parent7e479951464b9bb71e87aeef19d908e9fb9be494 (diff)
20140518-1419
-rw-r--r--CHANGES12
-rw-r--r--emu/Linux/os.c1
-rw-r--r--emu/port/fns.h1
-rw-r--r--emu/port/kproc-pthreads.c1
-rw-r--r--lib9/setfcr-DragonFly-386.c56
-rw-r--r--lib9/setfcr-Linux-arm.c32
-rw-r--r--lib9/setfcr-Linux-power.S20
-rw-r--r--lib9/setfcr-MacOSX-386.c56
-rw-r--r--lib9/setfcr-MacOSX-power.c39
-rw-r--r--lib9/setfcr-NetBSD-386.c55
-rw-r--r--lib9/setfcr-OpenBSD-386.c57
-rw-r--r--lib9/setfcr-Solaris-sparc.c42
-rw-r--r--man/2/sh2
-rw-r--r--mkfiles/mkfile-Linux-3861
-rw-r--r--mkfiles/mkfile-Linux-arm1
-rw-r--r--mkfiles/mkfile-Linux-power1
-rw-r--r--mkfiles/mkfile-Linux-spim2
-rw-r--r--mkfiles/mkfile-MacOSX-3861
18 files changed, 378 insertions, 2 deletions
diff --git a/CHANGES b/CHANGES
index f2276beb..80a71acc 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,15 @@
+20140518
+ sh(2): exec -> run [issue 311]
+20140501
+ add -s option to dns in cs(8) [issue 310]
+ don't send nil soa to dnscache [issue 309]
+20140309
+ temporarily remove warnings about unused results
+ define NaN for lib9/charstod.c
+ define nrand for libmp
+ move fpu control to lib9 from fpuctl.h
+ move fpu definitions to lib9.h from fpuctl.h (should possibly add back arch-specific u.h)
+ define __USE_GNU for extra pthreads definitions in emu/port/kproc-pthreads.c
20140302
utils/cc/funct.c - remove out-of-bounds reference
os/ipaq1110, ip/ipaux.c, os/sa1110 - add default cases to keep compiler happy
diff --git a/emu/Linux/os.c b/emu/Linux/os.c
index 0d91518a..08b039d6 100644
--- a/emu/Linux/os.c
+++ b/emu/Linux/os.c
@@ -13,7 +13,6 @@
#include "dat.h"
#include "fns.h"
#include "error.h"
-#include <fpuctl.h>
#include <semaphore.h>
diff --git a/emu/port/fns.h b/emu/port/fns.h
index be825d17..db08957d 100644
--- a/emu/port/fns.h
+++ b/emu/port/fns.h
@@ -119,6 +119,7 @@ Pgrp* newpgrp(void);
Proc* newproc(void);
void nexterror(void);
void notkilled(void);
+int nrand(int);
int openmode(ulong);
void osblock(void);
void* oscmd(char**, int, char*, int*);
diff --git a/emu/port/kproc-pthreads.c b/emu/port/kproc-pthreads.c
index 32053794..5560f737 100644
--- a/emu/port/kproc-pthreads.c
+++ b/emu/port/kproc-pthreads.c
@@ -7,6 +7,7 @@
#include <unistd.h>
#include <signal.h>
+#define __USE_GNU
#include <pthread.h>
#include <limits.h>
#include <errno.h>
diff --git a/lib9/setfcr-DragonFly-386.c b/lib9/setfcr-DragonFly-386.c
new file mode 100644
index 00000000..3589dd80
--- /dev/null
+++ b/lib9/setfcr-DragonFly-386.c
@@ -0,0 +1,56 @@
+/*
+ * Linux 386 fpu support
+ * Mimic Plan9 floating point support
+ */
+
+#include "lib9.h"
+
+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)
+ );
+}
+
+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;
+}
+
+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;
+}
+
+void
+setfsr(ulong fsr)
+{
+ __asm__("fclex\n\t");
+}
diff --git a/lib9/setfcr-Linux-arm.c b/lib9/setfcr-Linux-arm.c
new file mode 100644
index 00000000..eb77b872
--- /dev/null
+++ b/lib9/setfcr-Linux-arm.c
@@ -0,0 +1,32 @@
+/*
+ * Linux arm fpu support
+ * Mimic Plan9 floating point support
+ */
+
+#include "lib9.h"
+
+#include <fenv.h>
+
+void
+setfcr(ulong fcr)
+{
+}
+
+ulong
+getfcr(void)
+{
+ ulong fcr = 0;
+ return fcr;
+}
+
+ulong
+getfsr(void)
+{
+ ulong fsr = -1;
+ return fsr;
+}
+
+void
+setfsr(ulong fsr)
+{
+}
diff --git a/lib9/setfcr-Linux-power.S b/lib9/setfcr-Linux-power.S
new file mode 100644
index 00000000..dee67528
--- /dev/null
+++ b/lib9/setfcr-Linux-power.S
@@ -0,0 +1,20 @@
+
+#define FN(x) .type x,@function; .global x; x
+
+FN(getfcr):
+ mffs %f0
+ cvtfl %r3,%f0
+ blr
+
+FN(getfsr):
+ mffs %f0
+ cvtfl %r3,%f0
+ blr
+
+FN(setfsr):
+ mtfsf 0xff, %f0
+ blr
+
+FN(setfcr):
+ mtfsf 0xff, %f0
+ blr
diff --git a/lib9/setfcr-MacOSX-386.c b/lib9/setfcr-MacOSX-386.c
new file mode 100644
index 00000000..3589dd80
--- /dev/null
+++ b/lib9/setfcr-MacOSX-386.c
@@ -0,0 +1,56 @@
+/*
+ * Linux 386 fpu support
+ * Mimic Plan9 floating point support
+ */
+
+#include "lib9.h"
+
+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)
+ );
+}
+
+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;
+}
+
+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;
+}
+
+void
+setfsr(ulong fsr)
+{
+ __asm__("fclex\n\t");
+}
diff --git a/lib9/setfcr-MacOSX-power.c b/lib9/setfcr-MacOSX-power.c
new file mode 100644
index 00000000..17b76a88
--- /dev/null
+++ b/lib9/setfcr-MacOSX-power.c
@@ -0,0 +1,39 @@
+/*
+ * MacOSX/Darwin ppc fpu support
+ * Mimic Plan9 floating point support
+ */
+
+#include "lib9.h"
+#include <architecture/ppc/fp_regs.h>
+
+__inline__ ulong
+getfcr(void)
+{
+ ppc_fp_scr_t fpscr = get_fp_scr();
+ return ((ulong *)&fpscr)[1];
+}
+
+ulong
+getfsr(void)
+{
+ ppc_fp_scr_t fpscr = get_fp_scr();
+ return ((ulong *)&fpscr)[1];
+}
+
+void
+setfsr(ulong fsr)
+{
+ ppc_fp_scr_t fpscr;
+ // fpscr = get_fp_scr();
+ (((ulong *)&fpscr)[1]) = fsr;
+ set_fp_scr(fpscr);
+}
+
+void
+setfcr(ulong fcr)
+{
+ ppc_fp_scr_t fpscr;
+ // fpscr = get_fp_scr();
+ (((ulong *)&fpscr)[1]) = fcr;
+ set_fp_scr(fpscr);
+}
diff --git a/lib9/setfcr-NetBSD-386.c b/lib9/setfcr-NetBSD-386.c
new file mode 100644
index 00000000..e58171a3
--- /dev/null
+++ b/lib9/setfcr-NetBSD-386.c
@@ -0,0 +1,55 @@
+/*
+ * Linux 386 fpu support
+ * Mimic Plan9 floating point support
+ */
+#include "lib9.h"
+
+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)
+ );
+}
+
+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;
+}
+
+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;
+}
+
+void
+setfsr(ulong fsr)
+{
+ __asm__("fclex\n\t");
+}
diff --git a/lib9/setfcr-OpenBSD-386.c b/lib9/setfcr-OpenBSD-386.c
new file mode 100644
index 00000000..c512f033
--- /dev/null
+++ b/lib9/setfcr-OpenBSD-386.c
@@ -0,0 +1,57 @@
+/*
+ * 386 fpu support
+ * Mimic Plan9 floating point support
+ */
+
+#include "lib9.h"
+
+
+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)
+ );
+}
+
+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;
+}
+
+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;
+}
+
+void
+setfsr(ulong fsr)
+{
+ __asm__("fclex\n\t");
+}
diff --git a/lib9/setfcr-Solaris-sparc.c b/lib9/setfcr-Solaris-sparc.c
new file mode 100644
index 00000000..405e9cf2
--- /dev/null
+++ b/lib9/setfcr-Solaris-sparc.c
@@ -0,0 +1,42 @@
+/* This code is a little awkward. If somebody who understands Solaris
+ better would tell me an idiomatic way to invoke equivalent
+ behavior, I'd be grateful. ehg@bell-labs.com */
+
+#include "lib9.h"
+
+ulong
+getfcr(void)
+{
+ ulong v;
+
+ asm(" st %fsr, [%fp-8]");
+ return v;
+}
+
+void
+setfcr(ulong v)
+{
+ ulong vv;
+
+ vv = (getfcr() & ~FPFCR) | (v & FPFCR);
+ asm(" ld [%fp-4], %fsr");
+}
+
+ulong
+getfsr(void)
+{
+ ulong v;
+
+ asm(" st %fsr, [%fp-8]");
+ return v;
+}
+
+void
+setfsr(ulong v)
+{
+ ulong vv;
+
+ vv = (getfsr() & ~FPFSR) | (v & FPFSR);
+ asm(" ld [%fp-4], %fsr");
+}
+
diff --git a/man/2/sh b/man/2/sh
index 74b2dbc7..fd5dc074 100644
--- a/man/2/sh
+++ b/man/2/sh
@@ -98,7 +98,7 @@ command contained in
.I s
and returns its result. It catches any exceptions raised by the command.
Almost as simple is
-.BR exec ,
+.BR run ,
which runs
.I argv
as a command, taking the first word as the command to be
diff --git a/mkfiles/mkfile-Linux-386 b/mkfiles/mkfile-Linux-386
index 68699989..545c8571 100644
--- a/mkfiles/mkfile-Linux-386
+++ b/mkfiles/mkfile-Linux-386
@@ -15,6 +15,7 @@ CC= cc -c -m32
CFLAGS= -g\
-O\
-Wuninitialized -Wunused-variable -Wreturn-type -Wimplicit\
+ -Wno-unused-result\
-I$ROOT/Linux/386/include\
-I$ROOT/include\
-DLINUX_386
diff --git a/mkfiles/mkfile-Linux-arm b/mkfiles/mkfile-Linux-arm
index a0c7b17d..7bc23968 100644
--- a/mkfiles/mkfile-Linux-arm
+++ b/mkfiles/mkfile-Linux-arm
@@ -14,6 +14,7 @@ ASFLAGS=
CC= arm-gcc -c
CFLAGS= -O\
-Wuninitialized -Wunused-variable -Wreturn-type -Wimplicit\
+ -Wno-unused-result\
-I$ROOT/Linux/arm/include\
-I$ROOT/include\
-DLINUX_ARM
diff --git a/mkfiles/mkfile-Linux-power b/mkfiles/mkfile-Linux-power
index 678af2e4..9ac9f9d3 100644
--- a/mkfiles/mkfile-Linux-power
+++ b/mkfiles/mkfile-Linux-power
@@ -15,6 +15,7 @@ CC= cc -c -m32
CFLAGS= -g\
-O\
-Wuninitialized -Wunused-variable -Wreturn-type -Wimplicit\
+ -Wno-unused-result\
-I$ROOT/Linux/power/include\
-I$ROOT/include\
-I/usr/X11R6/include
diff --git a/mkfiles/mkfile-Linux-spim b/mkfiles/mkfile-Linux-spim
index c68c798b..d49c950c 100644
--- a/mkfiles/mkfile-Linux-spim
+++ b/mkfiles/mkfile-Linux-spim
@@ -14,6 +14,8 @@ ASFLAGS=
CC= mipsel-linux-uclibc-gcc -c -mips32
CFLAGS= -g\
-Os\
+ -Wuninitialized -Wunused-variable -Wreturn-type -Wimplicit\
+ -Wno-unused-result\
-I$ROOT/Linux/spim/include\
-I$ROOT/include\
-I/usr/X11R6/include
diff --git a/mkfiles/mkfile-MacOSX-386 b/mkfiles/mkfile-MacOSX-386
index 5326233c..ea1a7a6c 100644
--- a/mkfiles/mkfile-MacOSX-386
+++ b/mkfiles/mkfile-MacOSX-386
@@ -21,6 +21,7 @@ CTHREADFLAGS=
CFLAGS= -arch i386 -m32\
-mmacosx-version-min=10.6\
-Wno-deprecated-declarations -Wuninitialized -Wunused -Wreturn-type -Wimplicit -Wno-four-char-constants -Wno-unknown-pragmas\
+ -Wno-unused-result\
-pipe\
-fno-strict-aliasing\
-no-cpp-precomp\