aboutsummaryrefslogtreecommitdiff
path: root/unix/as.linux64
diff options
context:
space:
mode:
authorJoe Hunkeler <jhunkeler@gmail.com>2015-08-11 16:51:37 -0400
committerJoe Hunkeler <jhunkeler@gmail.com>2015-08-11 16:51:37 -0400
commit40e5a5811c6ffce9b0974e93cdd927cbcf60c157 (patch)
tree4464880c571602d54f6ae114729bf62a89518057 /unix/as.linux64
downloadiraf-osx-40e5a5811c6ffce9b0974e93cdd927cbcf60c157.tar.gz
Repatch (from linux) of OSX IRAF
Diffstat (limited to 'unix/as.linux64')
-rw-r--r--unix/as.linux64/aclrb.c16
-rw-r--r--unix/as.linux64/aclrc.c16
-rw-r--r--unix/as.linux64/aclrd.c16
-rw-r--r--unix/as.linux64/aclri.c16
-rw-r--r--unix/as.linux64/aclrl.c16
-rw-r--r--unix/as.linux64/aclrr.c16
-rw-r--r--unix/as.linux64/aclrs.c16
-rw-r--r--unix/as.linux64/amovc.c17
-rw-r--r--unix/as.linux64/amovd.c17
-rw-r--r--unix/as.linux64/amovi.c17
-rw-r--r--unix/as.linux64/amovl.c17
-rw-r--r--unix/as.linux64/amovr.c17
-rw-r--r--unix/as.linux64/amovs.c17
-rw-r--r--unix/as.linux64/bytmov.c23
-rw-r--r--unix/as.linux64/ieee.gx391
-rw-r--r--unix/as.linux64/ieeed.x356
-rw-r--r--unix/as.linux64/ieeer.x345
-rw-r--r--unix/as.linux64/zrtadr.s6
-rw-r--r--unix/as.linux64/zsvjmp.s48
-rw-r--r--unix/as.linux64/zsvjmp.s.BAD60
-rw-r--r--unix/as.linux64/zsvjmp_c170
-rw-r--r--unix/as.linux64/zsvjmp_demo.c13
-rw-r--r--unix/as.linux64/zzdebug.c48
23 files changed, 1674 insertions, 0 deletions
diff --git a/unix/as.linux64/aclrb.c b/unix/as.linux64/aclrb.c
new file mode 100644
index 00000000..8c03c7a1
--- /dev/null
+++ b/unix/as.linux64/aclrb.c
@@ -0,0 +1,16 @@
+/* Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+ */
+
+#define import_spp
+#define import_knames
+#include <iraf.h>
+
+/* ACLRB -- Clear a block of memory.
+ * [Specially optimized for Sun/IRAF].
+ */
+ACLRB (a, n)
+XCHAR *a;
+XINT *n;
+{
+ memset ((char *)a, 0, *n);
+}
diff --git a/unix/as.linux64/aclrc.c b/unix/as.linux64/aclrc.c
new file mode 100644
index 00000000..04e0e19b
--- /dev/null
+++ b/unix/as.linux64/aclrc.c
@@ -0,0 +1,16 @@
+/* Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+ */
+
+#define import_spp
+#define import_knames
+#include <iraf.h>
+
+/* ACLRC -- Clear a block of memory.
+ * [Specially optimized for Sun/IRAF].
+ */
+ACLRC (a, n)
+XCHAR *a;
+XINT *n;
+{
+ memset ((char *)a, 0, *n * sizeof(*a));
+}
diff --git a/unix/as.linux64/aclrd.c b/unix/as.linux64/aclrd.c
new file mode 100644
index 00000000..0cf06b01
--- /dev/null
+++ b/unix/as.linux64/aclrd.c
@@ -0,0 +1,16 @@
+/* Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+ */
+
+#define import_spp
+#define import_knames
+#include <iraf.h>
+
+/* ACLRD -- Clear a block of memory.
+ * [Specially optimized for Sun/IRAF].
+ */
+ACLRD (a, n)
+XDOUBLE *a;
+XINT *n;
+{
+ memset ((char *)a, 0, *n * sizeof(*a));
+}
diff --git a/unix/as.linux64/aclri.c b/unix/as.linux64/aclri.c
new file mode 100644
index 00000000..7d5b8ada
--- /dev/null
+++ b/unix/as.linux64/aclri.c
@@ -0,0 +1,16 @@
+/* Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+ */
+
+#define import_spp
+#define import_knames
+#include <iraf.h>
+
+/* ACLRI -- Clear a block of memory.
+ * [Specially optimized for Sun/IRAF].
+ */
+ACLRI (a, n)
+XINT *a;
+XINT *n;
+{
+ memset ((char *)a, 0, *n * sizeof(*a));
+}
diff --git a/unix/as.linux64/aclrl.c b/unix/as.linux64/aclrl.c
new file mode 100644
index 00000000..91f2a0ef
--- /dev/null
+++ b/unix/as.linux64/aclrl.c
@@ -0,0 +1,16 @@
+/* Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+ */
+
+#define import_spp
+#define import_knames
+#include <iraf.h>
+
+/* ACLRL -- Clear a block of memory.
+ * [Specially optimized for Sun/IRAF].
+ */
+ACLRL (a, n)
+XLONG *a;
+XINT *n;
+{
+ memset ((char *)a, 0, *n * sizeof(*a));
+}
diff --git a/unix/as.linux64/aclrr.c b/unix/as.linux64/aclrr.c
new file mode 100644
index 00000000..0426aa73
--- /dev/null
+++ b/unix/as.linux64/aclrr.c
@@ -0,0 +1,16 @@
+/* Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+ */
+
+#define import_spp
+#define import_knames
+#include <iraf.h>
+
+/* ACLRR -- Clear a block of memory.
+ * [Specially optimized for Sun/IRAF].
+ */
+ACLRR (a, n)
+XREAL *a;
+XINT *n;
+{
+ memset ((char *)a, 0, *n * sizeof(*a));
+}
diff --git a/unix/as.linux64/aclrs.c b/unix/as.linux64/aclrs.c
new file mode 100644
index 00000000..b4ff02a4
--- /dev/null
+++ b/unix/as.linux64/aclrs.c
@@ -0,0 +1,16 @@
+/* Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+ */
+
+#define import_spp
+#define import_knames
+#include <iraf.h>
+
+/* ACLRS -- Clear a block of memory.
+ * [Specially optimized for Sun/IRAF].
+ */
+ACLRS (a, n)
+XSHORT *a;
+XINT *n;
+{
+ memset ((char *)a, 0, *n * sizeof(*a));
+}
diff --git a/unix/as.linux64/amovc.c b/unix/as.linux64/amovc.c
new file mode 100644
index 00000000..ecba2573
--- /dev/null
+++ b/unix/as.linux64/amovc.c
@@ -0,0 +1,17 @@
+/* Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+ */
+
+#define import_spp
+#define import_knames
+#include <iraf.h>
+
+/* AMOVC -- Copy a block of memory.
+ * [Specially optimized for Sun/IRAF].
+ */
+AMOVC (a, b, n)
+XCHAR *a, *b;
+XINT *n;
+{
+ if (a != b)
+ memmove ((char *)b, (char *)a, *n * sizeof(*a));
+}
diff --git a/unix/as.linux64/amovd.c b/unix/as.linux64/amovd.c
new file mode 100644
index 00000000..0cfa8906
--- /dev/null
+++ b/unix/as.linux64/amovd.c
@@ -0,0 +1,17 @@
+/* Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+ */
+
+#define import_spp
+#define import_knames
+#include <iraf.h>
+
+/* AMOVD -- Copy a block of memory.
+ * [Specially optimized for Sun/IRAF].
+ */
+AMOVD (a, b, n)
+XDOUBLE *a, *b;
+XINT *n;
+{
+ if (a != b)
+ memmove ((char *)b, (char *)a, *n * sizeof(*a));
+}
diff --git a/unix/as.linux64/amovi.c b/unix/as.linux64/amovi.c
new file mode 100644
index 00000000..91bc2060
--- /dev/null
+++ b/unix/as.linux64/amovi.c
@@ -0,0 +1,17 @@
+/* Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+ */
+
+#define import_spp
+#define import_knames
+#include <iraf.h>
+
+/* AMOVI -- Copy a block of memory.
+ * [Specially optimized for Sun/IRAF].
+ */
+AMOVI (a, b, n)
+XINT *a, *b;
+XINT *n;
+{
+ if (a != b)
+ memmove ((char *)b, (char *)a, *n * sizeof(*a));
+}
diff --git a/unix/as.linux64/amovl.c b/unix/as.linux64/amovl.c
new file mode 100644
index 00000000..815fd651
--- /dev/null
+++ b/unix/as.linux64/amovl.c
@@ -0,0 +1,17 @@
+/* Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+ */
+
+#define import_spp
+#define import_knames
+#include <iraf.h>
+
+/* AMOVL -- Copy a block of memory.
+ * [Specially optimized for Sun/IRAF].
+ */
+AMOVL (a, b, n)
+XLONG *a, *b;
+XINT *n;
+{
+ if (a != b)
+ memmove ((char *)b, (char *)a, *n * sizeof(*a));
+}
diff --git a/unix/as.linux64/amovr.c b/unix/as.linux64/amovr.c
new file mode 100644
index 00000000..94522ea6
--- /dev/null
+++ b/unix/as.linux64/amovr.c
@@ -0,0 +1,17 @@
+/* Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+ */
+
+#define import_spp
+#define import_knames
+#include <iraf.h>
+
+/* AMOVR -- Copy a block of memory.
+ * [Specially optimized for Sun/IRAF].
+ */
+AMOVR (a, b, n)
+XREAL *a, *b;
+XINT *n;
+{
+ if (a != b)
+ memmove ((char *)b, (char *)a, *n * sizeof(*a));
+}
diff --git a/unix/as.linux64/amovs.c b/unix/as.linux64/amovs.c
new file mode 100644
index 00000000..8aa12ae7
--- /dev/null
+++ b/unix/as.linux64/amovs.c
@@ -0,0 +1,17 @@
+/* Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+ */
+
+#define import_spp
+#define import_knames
+#include <iraf.h>
+
+/* AMOVS -- Copy a block of memory.
+ * [Specially optimized for Sun/IRAF].
+ */
+AMOVS (a, b, n)
+XSHORT *a, *b;
+XINT *n;
+{
+ if (a != b)
+ memmove ((char *)b, (char *)a, *n * sizeof(*a));
+}
diff --git a/unix/as.linux64/bytmov.c b/unix/as.linux64/bytmov.c
new file mode 100644
index 00000000..aa43f6d1
--- /dev/null
+++ b/unix/as.linux64/bytmov.c
@@ -0,0 +1,23 @@
+/* Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+ */
+
+#define import_spp
+#define import_knames
+#include <iraf.h>
+
+/* BYTMOV -- Byte move from array "a" to array "b". The move must be
+ * nondestructive, allowing a byte array to be shifted left or right a
+ * few bytes, hence comparison of the addresses of the arrays is necessary
+ * to determine if they overlap.
+ * [Specially optimized version for Sun/IRAF].
+ */
+BYTMOV (a, aoff, b, boff, nbytes)
+XCHAR *a; /* input byte array */
+XINT *aoff; /* first byte in A to be moved */
+XCHAR *b; /* output byte array */
+XINT *boff; /* first byte in B to be written */
+XINT *nbytes; /* number of bytes to move */
+{
+ if ((a + *aoff) != (b + *boff))
+ memmove ((char *)b + (*boff-1), (char *)a + (*aoff-1), *nbytes);
+}
diff --git a/unix/as.linux64/ieee.gx b/unix/as.linux64/ieee.gx
new file mode 100644
index 00000000..9039b3d2
--- /dev/null
+++ b/unix/as.linux64/ieee.gx
@@ -0,0 +1,391 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <mach.h>
+
+.help IEEE
+.nf ------------------------------------------------------------------------
+Low level primitives for IEEE to native floating point datatype conversions.
+See also the MII package, which provides a higher level interface, and the
+IEEE related definitions in <mach.h>.
+
+ ieepak[rd] (datum) # scalar conversions
+ ieeupk[rd] (datum)
+ ieevpak[rd] (native, ieee, nelem) # vector conversions
+ ieevupk[rd] (ieee, native, nelem)
+ iee[sg]nan[rd] (NaN) # NaN handling
+ iee[sg]map[rd] (mapin, mapout)
+ ieestat[rd] (nin, nout)
+ ieezstat[rd] ()
+
+The first two routines handle scalar conversions, the second two routines
+vector conversions. The input and output vectors may be the same.
+Unfortunately, for portability reasons, functions cannot be used, so the
+scalar operators do an in-place conversion instead, and are a no-op on an
+unswapped IEEE system. The routines iee[sg]nan[rd] set/get the native
+floating value used to replace NaNs or overflows occuring when converting
+IEEE to the native floating format (any floating value will do, e.g., zero or
+INDEF). If NaN mapping is enabled, the ieestat[rd] routines may be used to
+determine the number of input or output NaN conversions occuring since the
+last call to ieezstat[rd].
+
+The NaN mapping enable switch and statistics counters are UNDEFINED at
+process startup; programs which use the IEEE conversion package should call
+ieesmap[rd] to enable or disable NaN mapping, and ieezstat[rd] to initialize
+the statistics counters.
+
+The routines in this file are the "portable" versions. The "portable"
+solution it to merely copy the array, swapping the bytes if necessary - this
+works on any host that uses the IEEE floating format. NaN mapping is
+implemented in the portable code, but will work properly only for input
+conversions; for output, the IEEE NaN value is undefined in the portable
+version of the code (it is trivial to supply this value in an as$ieee.gx
+version of the code).
+If the local host does
+not use IEEE floating, or if a significant efficiency gain can be realized
+by programming in assembler or C, a host specific version of this file should
+be written, placed in AS, and referenced in the MKPKG special file list.
+.endhelp -------------------------------------------------------------------
+
+
+# Give the generic preprocessor some help.
+$if (datatype == r)
+define IEEE_SWAP IEEE_SWAP4
+define BSWAP bswap4
+define NSWAP 4
+define IOFF 1
+$else
+define IEEE_SWAP IEEE_SWAP8
+define BSWAP bswap8
+define NSWAP 8
+define IOFF 1 # MACHDEP (normally 1, 2 on e.g. Intel)
+$endif
+
+
+# IEEVPAK -- Convert an array in the native floating point format into an
+# array in IEEE floating format. The input and output arrays can be the same.
+
+procedure ieevpak$t (native, ieee, nelem)
+
+PIXEL native[ARB] #I input native floating format array
+PIXEL ieee[ARB] #O output IEEE floating format array
+int nelem #I number of floating point numbers
+
+int i
+PIXEL native_NaN, ieee_NaN
+int mapin, mapout, nin, nout, NaNmask
+common /ieenan$t/ native_NaN, ieee_NaN, NaNmask, mapin, mapout, nin, nout
+
+begin
+ if (mapout == NO) {
+ if (IEEE_SWAP == YES)
+ call BSWAP (native, 1, ieee, 1, nelem * NSWAP)
+ else
+ call amov$t (native, ieee, nelem)
+ } else {
+ do i = 1, nelem
+ if (native[i] == native_NaN) {
+ ieee(i) = ieee_NaN
+ nout = nout + 1
+ } else
+ ieee[i] = native[i]
+
+ # Byteswap if necessary.
+ if (IEEE_SWAP == YES)
+ call BSWAP (ieee, 1, ieee, 1, nelem * NSWAP)
+ }
+end
+
+
+# IEEVUPK -- Convert an array in IEEE floating format into the native
+# floating point format. The input and output arrays can be the same.
+
+procedure ieevupk$t (ieee, native, nelem)
+
+PIXEL ieee[ARB] #I input IEEE floating format array
+PIXEL native[ARB] #O output native floating format array
+int nelem #I number of floating point numbers
+
+int expon, i, val
+$if (datatype == r)
+real fval
+int ival[1]
+% equivalence (fval, ival)
+$else
+double fval
+int ival[2]
+% equivalence (fval, ival)
+int iand32()
+$endif
+% equivalence (ival, val)
+
+PIXEL native_NaN, ieee_NaN
+int mapin, mapout, nin, nout, NaNmask
+common /ieenan$t/ native_NaN, ieee_NaN, NaNmask, mapin, mapout, nin, nout
+
+begin
+ if (IEEE_SWAP == YES) {
+ call BSWAP (ieee, 1, native, 1, nelem * NSWAP)
+ if (mapin != NO) {
+ # Check for IEEE exceptional values and map NaN to the native
+ # NaN value, and denormalized numbers (zero exponent) to zero.
+
+ do i = 1, nelem {
+ fval = native[i]
+$if (datatype == r)
+ expon = and (ival[IOFF], NaNmask)
+$else
+ if (SZ_INT == SZ_INT32)
+ expon = and (ival[IOFF], NaNmask)
+ else
+ expon = iand32 (val, NaNmask)
+$endif
+ if (expon == 0) {
+ native[i] = 0
+ } else if (expon == NaNmask) {
+ native[i] = native_NaN
+ nin = nin + 1
+ }
+ }
+ }
+ } else {
+ if (mapin == NO)
+ call amov$t (ieee, native, nelem)
+ else {
+ # Check for IEEE exceptional values and map NaN to the native
+ # NaN value, and denormalized numbers (zero exponent) to zero.
+
+ do i = 1, nelem {
+ fval = ieee[i]
+$if (datatype == r)
+ expon = and (ival[IOFF], NaNmask)
+$else
+ if (SZ_INT == SZ_INT32)
+ expon = and (ival[IOFF], NaNmask)
+ else
+ expon = iand32 (val, NaNmask)
+$endif
+ if (expon == 0) {
+ native[i] = 0
+ } else if (expon == NaNmask) {
+ native[i] = native_NaN
+ nin = nin + 1
+ } else
+ native[i] = ieee[i]
+ }
+ }
+ }
+end
+
+
+# IEEPAK -- Convert a native floating point number into IEEE format.
+
+procedure ieepak$t (x)
+
+PIXEL x #U datum to be converted
+
+PIXEL native_NaN, ieee_NaN
+int mapin, mapout, nin, nout, NaNmask
+common /ieenan$t/ native_NaN, ieee_NaN, NaNmask, mapin, mapout, nin, nout
+
+begin
+ if (mapout != NO)
+ if (x == native_NaN) {
+ x = ieee_NaN
+ nout = nout + 1
+ }
+ if (IEEE_SWAP == YES)
+ call BSWAP (x, 1, x, 1, NSWAP)
+end
+
+
+# IEEUPK -- Convert an IEEE format number into native floating point.
+
+procedure ieeupk$t (x)
+
+PIXEL x #U datum to be converted
+
+int expon, val
+$if (datatype == r)
+real fval
+int ival[1]
+% equivalence (fval, ival)
+$else
+double fval
+int ival[2]
+% equivalence (fval, ival)
+int iand32()
+$endif
+% equivalence (val, ival)
+
+PIXEL native_NaN, ieee_NaN
+int mapin, mapout, nin, nout, NaNmask
+common /ieenan$t/ native_NaN, ieee_NaN, NaNmask, mapin, mapout, nin, nout
+
+begin
+ if (IEEE_SWAP == YES)
+ call BSWAP (x, 1, x, 1, NSWAP)
+
+ # Check for IEEE exceptional values and map NaN to the native NaN
+ # value, and denormalized numbers (zero exponent) to zero.
+
+ if (mapin != NO) {
+ fval = x
+$if (datatype == r)
+ expon = and (ival[IOFF], NaNmask)
+$else
+ if (SZ_INT == SZ_INT32)
+ expon = and (ival[IOFF], NaNmask)
+ else
+ expon = iand32 (val, NaNmask)
+$endif
+ if (expon == 0)
+ x = 0
+ else if (expon == NaNmask) {
+ x = native_NaN
+ nin = nin + 1
+ }
+ }
+end
+
+
+# IEESNAN -- Set the native floating point value used to replace NaNs and
+# overflows when converting IEEE to native. This must be a legal (finite)
+# native floating point value.
+
+procedure ieesnan$t (x)
+
+PIXEL x #I native value which will replace NaN
+
+PIXEL native_NaN, ieee_NaN
+int mapin, mapout, nin, nout, NaNmask
+common /ieenan$t/ native_NaN, ieee_NaN, NaNmask, mapin, mapout, nin, nout
+
+begin
+ native_NaN = x
+ nin = 0
+ nout = 0
+end
+
+
+# IEEGNAN -- Get the NaN value.
+
+procedure ieegnan$t (x)
+
+PIXEL x #O native value which will replace NaN
+
+PIXEL native_NaN, ieee_NaN
+int mapin, mapout, nin, nout, NaNmask
+common /ieenan$t/ native_NaN, ieee_NaN, NaNmask, mapin, mapout, nin, nout
+
+begin
+ x = native_NaN
+end
+
+
+# IEESTAT -- Return statistics on the number of NaNs encountered in input
+# conversions (unpack) and output conversions (pack).
+
+procedure ieestat$t (o_nin, o_nout)
+
+int o_nin #O number of NaN seen on input
+int o_nout #O number of NaN values output
+
+PIXEL native_NaN, ieee_NaN
+int mapin, mapout, nin, nout, NaNmask
+common /ieenan$t/ native_NaN, ieee_NaN, NaNmask, mapin, mapout, nin, nout
+
+begin
+ o_nin = nin
+ o_nout = nout
+end
+
+
+# IEEZSTAT -- Zero the statistics counters.
+
+procedure ieezstat$t ()
+
+PIXEL native_NaN, ieee_NaN
+int mapin, mapout, nin, nout, NaNmask
+common /ieenan$t/ native_NaN, ieee_NaN, NaNmask, mapin, mapout, nin, nout
+
+begin
+ nin = 0
+ nout = 0
+end
+
+
+# IEEMAP -- Same as IEESMAP. Retained for backwards compatibility.
+
+procedure ieemap$t (inval, outval)
+
+int inval #I enable mapping on input
+int outval #I enable mapping on output
+
+begin
+ call ieesmap$t (inval, outval)
+end
+
+
+# IEEGMAP -- Query the current values of the input and output mapping
+# enables.
+
+procedure ieegmap$t (inval, outval)
+
+int inval #O get input mapping enable flag
+int outval #O get output mapping enable flag
+
+PIXEL native_NaN, ieee_NaN
+int mapin, mapout, nin, nout, NaNmask
+common /ieenan$t/ native_NaN, ieee_NaN, NaNmask, mapin, mapout, nin, nout
+
+begin
+ inval = mapin
+ outval = mapout
+end
+
+
+# MACHINE DEPENDENT PART.
+# ---------------------------
+
+# IEESMAP -- Enable or disable NaN mapping.
+#
+# sEEE EEEE Emmm mmmm mmmm mmmm mmmm mmmm
+# 3 2 1 0
+# 1098 7654 3210 9876 5432 1098 7654 3210
+# 7 f 8 0 0 0 0 0
+
+procedure ieesmap$t (inval, outval)
+
+int inval #I enable NaN mapping for input?
+int outval #I enable NaN mapping for output?
+
+# MACHDEP.
+#$if (datatype == r)
+#% real r_quiet_nan
+#$else
+#% double precision d_quiet_nan
+#$endif
+
+PIXEL native_NaN, ieee_NaN
+int mapin, mapout, nin, nout, NaNmask
+common /ieenan$t/ native_NaN, ieee_NaN, NaNmask, mapin, mapout, nin, nout
+
+begin
+ mapin = inval
+ mapout = outval
+
+ # MACHDEP.
+# if (mapout == YES)
+# $if (datatype == r)
+#% ieeenn = r_quiet_NaN()
+# $else
+#% ieeenn = d_quiet_NaN()
+# $endif
+
+ if (mapin == YES)
+ $if (datatype == r)
+ NaNmask = 7F800000X
+ $else
+ NaNmask = 7FF00000X
+ $endif
+end
diff --git a/unix/as.linux64/ieeed.x b/unix/as.linux64/ieeed.x
new file mode 100644
index 00000000..167b0561
--- /dev/null
+++ b/unix/as.linux64/ieeed.x
@@ -0,0 +1,356 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <mach.h>
+
+.help IEEE
+.nf ------------------------------------------------------------------------
+Low level primitives for IEEE to native floating point datatype conversions.
+See also the MII package, which provides a higher level interface, and the
+IEEE related definitions in <mach.h>.
+
+ ieepak[rd] (datum) # scalar conversions
+ ieeupk[rd] (datum)
+ ieevpak[rd] (native, ieee, nelem) # vector conversions
+ ieevupk[rd] (ieee, native, nelem)
+ iee[sg]nan[rd] (NaN) # NaN handling
+ iee[sg]map[rd] (mapin, mapout)
+ ieestat[rd] (nin, nout)
+ ieezstat[rd] ()
+
+The first two routines handle scalar conversions, the second two routines
+vector conversions. The input and output vectors may be the same.
+Unfortunately, for portability reasons, functions cannot be used, so the
+scalar operators do an in-place conversion instead, and are a no-op on an
+unswapped IEEE system. The routines iee[sg]nan[rd] set/get the native
+floating value used to replace NaNs or overflows occuring when converting
+IEEE to the native floating format (any floating value will do, e.g., zero or
+INDEFD). If NaN mapping is enabled, the ieestat[rd] routines may be used to
+determine the number of input or output NaN conversions occuring since the
+last call to ieezstat[rd].
+
+The NaN mapping enable switch and statistics counters are UNDEFINED at
+process startup; programs which use the IEEE conversion package should call
+ieesmap[rd] to enable or disable NaN mapping, and ieezstat[rd] to initialize
+the statistics counters.
+
+The routines in this file are the "portable" versions. The "portable"
+solution it to merely copy the array, swapping the bytes if necessary - this
+works on any host that uses the IEEE floating format. NaN mapping is
+implemented in the portable code, but will work properly only for input
+conversions; for output, the IEEE NaN value is undefined in the portable
+version of the code (it is trivial to supply this value in an as$ieee.gx
+version of the code).
+If the local host does
+not use IEEE floating, or if a significant efficiency gain can be realized
+by programming in assembler or C, a host specific version of this file should
+be written, placed in AS, and referenced in the MKPKG special file list.
+.endhelp -------------------------------------------------------------------
+
+
+# Give the generic preprocessor some help.
+define IEEE_SWAP IEEE_SWAP8
+define BSWAP bswap8
+define NSWAP 8
+define IOFF 1 # MACHDEP (normally 1, 2 on e.g. Intel)
+
+
+# IEEVPAK -- Convert an array in the native floating point format into an
+# array in IEEE floating format. The input and output arrays can be the same.
+
+procedure ieevpakd (native, ieee, nelem)
+
+double native[ARB] #I input native floating format array
+double ieee[ARB] #O output IEEE floating format array
+int nelem #I number of floating point numbers
+
+int i
+double native_NaN, ieee_NaN
+int mapin, mapout, nin, nout, NaNmask
+common /ieenand/ native_NaN, ieee_NaN, NaNmask, mapin, mapout, nin, nout
+
+begin
+ if (mapout == NO) {
+ if (IEEE_SWAP == YES)
+ call BSWAP (native, 1, ieee, 1, nelem * NSWAP)
+ else
+ call amovd (native, ieee, nelem)
+ } else {
+ do i = 1, nelem
+ if (native[i] == native_NaN) {
+ ieee(i) = ieee_NaN
+ nout = nout + 1
+ } else
+ ieee[i] = native[i]
+
+ # Byteswap if necessary.
+ if (IEEE_SWAP == YES)
+ call BSWAP (ieee, 1, ieee, 1, nelem * NSWAP)
+ }
+end
+
+
+# IEEVUPK -- Convert an array in IEEE floating format into the native
+# floating point format. The input and output arrays can be the same.
+
+procedure ieevupkd (ieee, native, nelem)
+
+double ieee[ARB] #I input IEEE floating format array
+double native[ARB] #O output native floating format array
+int nelem #I number of floating point numbers
+
+int expon, i, val
+double fval
+int ival[2]
+% equivalence (fval, ival)
+int iand32()
+% equivalence (ival, val)
+
+double native_NaN, ieee_NaN
+int mapin, mapout, nin, nout, NaNmask
+common /ieenand/ native_NaN, ieee_NaN, NaNmask, mapin, mapout, nin, nout
+
+begin
+ if (IEEE_SWAP == YES) {
+ call BSWAP (ieee, 1, native, 1, nelem * NSWAP)
+ if (mapin != NO) {
+ # Check for IEEE exceptional values and map NaN to the native
+ # NaN value, and denormalized numbers (zero exponent) to zero.
+
+ do i = 1, nelem {
+ fval = native[i]
+ if (SZ_INT == SZ_INT32)
+ expon = and (ival[IOFF], NaNmask)
+ else
+ expon = iand32 (val, NaNmask)
+ if (expon == 0) {
+ native[i] = 0
+ } else if (expon == NaNmask) {
+ native[i] = native_NaN
+ nin = nin + 1
+ }
+ }
+ }
+ } else {
+ if (mapin == NO)
+ call amovd (ieee, native, nelem)
+ else {
+ # Check for IEEE exceptional values and map NaN to the native
+ # NaN value, and denormalized numbers (zero exponent) to zero.
+
+ do i = 1, nelem {
+ fval = ieee[i]
+ if (SZ_INT == SZ_INT32)
+ expon = and (ival[IOFF], NaNmask)
+ else
+ expon = iand32 (val, NaNmask)
+ if (expon == 0) {
+ native[i] = 0
+ } else if (expon == NaNmask) {
+ native[i] = native_NaN
+ nin = nin + 1
+ } else
+ native[i] = ieee[i]
+ }
+ }
+ }
+end
+
+
+# IEEPAK -- Convert a native floating point number into IEEE format.
+
+procedure ieepakd (x)
+
+double x #U datum to be converted
+
+double native_NaN, ieee_NaN
+int mapin, mapout, nin, nout, NaNmask
+common /ieenand/ native_NaN, ieee_NaN, NaNmask, mapin, mapout, nin, nout
+
+begin
+ if (mapout != NO)
+ if (x == native_NaN) {
+ x = ieee_NaN
+ nout = nout + 1
+ }
+ if (IEEE_SWAP == YES)
+ call BSWAP (x, 1, x, 1, NSWAP)
+end
+
+
+# IEEUPK -- Convert an IEEE format number into native floating point.
+
+procedure ieeupkd (x)
+
+double x #U datum to be converted
+
+int expon, val
+double fval
+int ival[2]
+% equivalence (fval, ival)
+int iand32()
+% equivalence (val, ival)
+
+double native_NaN, ieee_NaN
+int mapin, mapout, nin, nout, NaNmask
+common /ieenand/ native_NaN, ieee_NaN, NaNmask, mapin, mapout, nin, nout
+
+begin
+ if (IEEE_SWAP == YES)
+ call BSWAP (x, 1, x, 1, NSWAP)
+
+ # Check for IEEE exceptional values and map NaN to the native NaN
+ # value, and denormalized numbers (zero exponent) to zero.
+
+ if (mapin != NO) {
+ fval = x
+ if (SZ_INT == SZ_INT32)
+ expon = and (ival[IOFF], NaNmask)
+ else
+ expon = iand32 (val, NaNmask)
+ if (expon == 0)
+ x = 0
+ else if (expon == NaNmask) {
+ x = native_NaN
+ nin = nin + 1
+ }
+ }
+end
+
+
+# IEESNAN -- Set the native floating point value used to replace NaNs and
+# overflows when converting IEEE to native. This must be a legal (finite)
+# native floating point value.
+
+procedure ieesnand (x)
+
+double x #I native value which will replace NaN
+
+double native_NaN, ieee_NaN
+int mapin, mapout, nin, nout, NaNmask
+common /ieenand/ native_NaN, ieee_NaN, NaNmask, mapin, mapout, nin, nout
+
+begin
+ native_NaN = x
+ nin = 0
+ nout = 0
+end
+
+
+# IEEGNAN -- Get the NaN value.
+
+procedure ieegnand (x)
+
+double x #O native value which will replace NaN
+
+double native_NaN, ieee_NaN
+int mapin, mapout, nin, nout, NaNmask
+common /ieenand/ native_NaN, ieee_NaN, NaNmask, mapin, mapout, nin, nout
+
+begin
+ x = native_NaN
+end
+
+
+# IEESTAT -- Return statistics on the number of NaNs encountered in input
+# conversions (unpack) and output conversions (pack).
+
+procedure ieestatd (o_nin, o_nout)
+
+int o_nin #O number of NaN seen on input
+int o_nout #O number of NaN values output
+
+double native_NaN, ieee_NaN
+int mapin, mapout, nin, nout, NaNmask
+common /ieenand/ native_NaN, ieee_NaN, NaNmask, mapin, mapout, nin, nout
+
+begin
+ o_nin = nin
+ o_nout = nout
+end
+
+
+# IEEZSTAT -- Zero the statistics counters.
+
+procedure ieezstatd ()
+
+double native_NaN, ieee_NaN
+int mapin, mapout, nin, nout, NaNmask
+common /ieenand/ native_NaN, ieee_NaN, NaNmask, mapin, mapout, nin, nout
+
+begin
+ nin = 0
+ nout = 0
+end
+
+
+# IEEMAP -- Same as IEESMAP. Retained for backwards compatibility.
+
+procedure ieemapd (inval, outval)
+
+int inval #I enable mapping on input
+int outval #I enable mapping on output
+
+begin
+ call ieesmapd (inval, outval)
+end
+
+
+# IEEGMAP -- Query the current values of the input and output mapping
+# enables.
+
+procedure ieegmapd (inval, outval)
+
+int inval #O get input mapping enable flag
+int outval #O get output mapping enable flag
+
+double native_NaN, ieee_NaN
+int mapin, mapout, nin, nout, NaNmask
+common /ieenand/ native_NaN, ieee_NaN, NaNmask, mapin, mapout, nin, nout
+
+begin
+ inval = mapin
+ outval = mapout
+end
+
+
+# MACHINE DEPENDENT PART.
+# ---------------------------
+
+# IEESMAP -- Enable or disable NaN mapping.
+#
+# sEEE EEEE Emmm mmmm mmmm mmmm mmmm mmmm
+# 3 2 1 0
+# 1098 7654 3210 9876 5432 1098 7654 3210
+# 7 f 8 0 0 0 0 0
+
+procedure ieesmapd (inval, outval)
+
+int inval #I enable NaN mapping for input?
+int outval #I enable NaN mapping for output?
+
+# MACHDEP.
+#$if (datatype == r)
+#% real r_quiet_nan
+#$else
+#% double precision d_quiet_nan
+#$endif
+
+double native_NaN, ieee_NaN
+int mapin, mapout, nin, nout, NaNmask
+common /ieenand/ native_NaN, ieee_NaN, NaNmask, mapin, mapout, nin, nout
+
+begin
+ mapin = inval
+ mapout = outval
+
+ # MACHDEP.
+# if (mapout == YES)
+# $if (datatype == r)
+#% ieeenn = r_quiet_NaN()
+# $else
+#% ieeenn = d_quiet_NaN()
+# $endif
+
+ if (mapin == YES)
+ NaNmask = 7FF00000X
+end
diff --git a/unix/as.linux64/ieeer.x b/unix/as.linux64/ieeer.x
new file mode 100644
index 00000000..59ce8566
--- /dev/null
+++ b/unix/as.linux64/ieeer.x
@@ -0,0 +1,345 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <mach.h>
+
+.help IEEE
+.nf ------------------------------------------------------------------------
+Low level primitives for IEEE to native floating point datatype conversions.
+See also the MII package, which provides a higher level interface, and the
+IEEE related definitions in <mach.h>.
+
+ ieepak[rd] (datum) # scalar conversions
+ ieeupk[rd] (datum)
+ ieevpak[rd] (native, ieee, nelem) # vector conversions
+ ieevupk[rd] (ieee, native, nelem)
+ iee[sg]nan[rd] (NaN) # NaN handling
+ iee[sg]map[rd] (mapin, mapout)
+ ieestat[rd] (nin, nout)
+ ieezstat[rd] ()
+
+The first two routines handle scalar conversions, the second two routines
+vector conversions. The input and output vectors may be the same.
+Unfortunately, for portability reasons, functions cannot be used, so the
+scalar operators do an in-place conversion instead, and are a no-op on an
+unswapped IEEE system. The routines iee[sg]nan[rd] set/get the native
+floating value used to replace NaNs or overflows occuring when converting
+IEEE to the native floating format (any floating value will do, e.g., zero or
+INDEFR). If NaN mapping is enabled, the ieestat[rd] routines may be used to
+determine the number of input or output NaN conversions occuring since the
+last call to ieezstat[rd].
+
+The NaN mapping enable switch and statistics counters are UNDEFINED at
+process startup; programs which use the IEEE conversion package should call
+ieesmap[rd] to enable or disable NaN mapping, and ieezstat[rd] to initialize
+the statistics counters.
+
+The routines in this file are the "portable" versions. The "portable"
+solution it to merely copy the array, swapping the bytes if necessary - this
+works on any host that uses the IEEE floating format. NaN mapping is
+implemented in the portable code, but will work properly only for input
+conversions; for output, the IEEE NaN value is undefined in the portable
+version of the code (it is trivial to supply this value in an as$ieee.gx
+version of the code).
+If the local host does
+not use IEEE floating, or if a significant efficiency gain can be realized
+by programming in assembler or C, a host specific version of this file should
+be written, placed in AS, and referenced in the MKPKG special file list.
+.endhelp -------------------------------------------------------------------
+
+
+# Give the generic preprocessor some help.
+define IEEE_SWAP IEEE_SWAP4
+define BSWAP bswap4
+define NSWAP 4
+define IOFF 1
+
+
+# IEEVPAK -- Convert an array in the native floating point format into an
+# array in IEEE floating format. The input and output arrays can be the same.
+
+procedure ieevpakr (native, ieee, nelem)
+
+real native[ARB] #I input native floating format array
+real ieee[ARB] #O output IEEE floating format array
+int nelem #I number of floating point numbers
+
+int i
+real native_NaN, ieee_NaN
+int mapin, mapout, nin, nout, NaNmask
+common /ieenanr/ native_NaN, ieee_NaN, NaNmask, mapin, mapout, nin, nout
+
+begin
+ if (mapout == NO) {
+ if (IEEE_SWAP == YES)
+ call BSWAP (native, 1, ieee, 1, nelem * NSWAP)
+ else
+ call amovr (native, ieee, nelem)
+ } else {
+ do i = 1, nelem
+ if (native[i] == native_NaN) {
+ ieee(i) = ieee_NaN
+ nout = nout + 1
+ } else
+ ieee[i] = native[i]
+
+ # Byteswap if necessary.
+ if (IEEE_SWAP == YES)
+ call BSWAP (ieee, 1, ieee, 1, nelem * NSWAP)
+ }
+end
+
+
+# IEEVUPK -- Convert an array in IEEE floating format into the native
+# floating point format. The input and output arrays can be the same.
+
+procedure ieevupkr (ieee, native, nelem)
+
+real ieee[ARB] #I input IEEE floating format array
+real native[ARB] #O output native floating format array
+int nelem #I number of floating point numbers
+
+int expon, i, val
+real fval
+int ival[1]
+% equivalence (fval, ival)
+% equivalence (ival, val)
+
+real native_NaN, ieee_NaN
+int mapin, mapout, nin, nout, NaNmask
+common /ieenanr/ native_NaN, ieee_NaN, NaNmask, mapin, mapout, nin, nout
+
+begin
+ if (IEEE_SWAP == YES) {
+ call BSWAP (ieee, 1, native, 1, nelem * NSWAP)
+ if (mapin != NO) {
+ # Check for IEEE exceptional values and map NaN to the native
+ # NaN value, and denormalized numbers (zero exponent) to zero.
+
+ do i = 1, nelem {
+ fval = native[i]
+ expon = and (ival[IOFF], NaNmask)
+ if (expon == 0) {
+ native[i] = 0
+ } else if (expon == NaNmask) {
+ native[i] = native_NaN
+ nin = nin + 1
+ }
+ }
+ }
+ } else {
+ if (mapin == NO)
+ call amovr (ieee, native, nelem)
+ else {
+ # Check for IEEE exceptional values and map NaN to the native
+ # NaN value, and denormalized numbers (zero exponent) to zero.
+
+ do i = 1, nelem {
+ fval = ieee[i]
+ expon = and (ival[IOFF], NaNmask)
+ if (expon == 0) {
+ native[i] = 0
+ } else if (expon == NaNmask) {
+ native[i] = native_NaN
+ nin = nin + 1
+ } else
+ native[i] = ieee[i]
+ }
+ }
+ }
+end
+
+
+# IEEPAK -- Convert a native floating point number into IEEE format.
+
+procedure ieepakr (x)
+
+real x #U datum to be converted
+
+real native_NaN, ieee_NaN
+int mapin, mapout, nin, nout, NaNmask
+common /ieenanr/ native_NaN, ieee_NaN, NaNmask, mapin, mapout, nin, nout
+
+begin
+ if (mapout != NO)
+ if (x == native_NaN) {
+ x = ieee_NaN
+ nout = nout + 1
+ }
+ if (IEEE_SWAP == YES)
+ call BSWAP (x, 1, x, 1, NSWAP)
+end
+
+
+# IEEUPK -- Convert an IEEE format number into native floating point.
+
+procedure ieeupkr (x)
+
+real x #U datum to be converted
+
+int expon, val
+real fval
+int ival[1]
+% equivalence (fval, ival)
+% equivalence (val, ival)
+
+real native_NaN, ieee_NaN
+int mapin, mapout, nin, nout, NaNmask
+common /ieenanr/ native_NaN, ieee_NaN, NaNmask, mapin, mapout, nin, nout
+
+begin
+ if (IEEE_SWAP == YES)
+ call BSWAP (x, 1, x, 1, NSWAP)
+
+ # Check for IEEE exceptional values and map NaN to the native NaN
+ # value, and denormalized numbers (zero exponent) to zero.
+
+ if (mapin != NO) {
+ fval = x
+ expon = and (ival[IOFF], NaNmask)
+ if (expon == 0)
+ x = 0
+ else if (expon == NaNmask) {
+ x = native_NaN
+ nin = nin + 1
+ }
+ }
+end
+
+
+# IEESNAN -- Set the native floating point value used to replace NaNs and
+# overflows when converting IEEE to native. This must be a legal (finite)
+# native floating point value.
+
+procedure ieesnanr (x)
+
+real x #I native value which will replace NaN
+
+real native_NaN, ieee_NaN
+int mapin, mapout, nin, nout, NaNmask
+common /ieenanr/ native_NaN, ieee_NaN, NaNmask, mapin, mapout, nin, nout
+
+begin
+ native_NaN = x
+ nin = 0
+ nout = 0
+end
+
+
+# IEEGNAN -- Get the NaN value.
+
+procedure ieegnanr (x)
+
+real x #O native value which will replace NaN
+
+real native_NaN, ieee_NaN
+int mapin, mapout, nin, nout, NaNmask
+common /ieenanr/ native_NaN, ieee_NaN, NaNmask, mapin, mapout, nin, nout
+
+begin
+ x = native_NaN
+end
+
+
+# IEESTAT -- Return statistics on the number of NaNs encountered in input
+# conversions (unpack) and output conversions (pack).
+
+procedure ieestatr (o_nin, o_nout)
+
+int o_nin #O number of NaN seen on input
+int o_nout #O number of NaN values output
+
+real native_NaN, ieee_NaN
+int mapin, mapout, nin, nout, NaNmask
+common /ieenanr/ native_NaN, ieee_NaN, NaNmask, mapin, mapout, nin, nout
+
+begin
+ o_nin = nin
+ o_nout = nout
+end
+
+
+# IEEZSTAT -- Zero the statistics counters.
+
+procedure ieezstatr ()
+
+real native_NaN, ieee_NaN
+int mapin, mapout, nin, nout, NaNmask
+common /ieenanr/ native_NaN, ieee_NaN, NaNmask, mapin, mapout, nin, nout
+
+begin
+ nin = 0
+ nout = 0
+end
+
+
+# IEEMAP -- Same as IEESMAP. Retained for backwards compatibility.
+
+procedure ieemapr (inval, outval)
+
+int inval #I enable mapping on input
+int outval #I enable mapping on output
+
+begin
+ call ieesmapr (inval, outval)
+end
+
+
+# IEEGMAP -- Query the current values of the input and output mapping
+# enables.
+
+procedure ieegmapr (inval, outval)
+
+int inval #O get input mapping enable flag
+int outval #O get output mapping enable flag
+
+real native_NaN, ieee_NaN
+int mapin, mapout, nin, nout, NaNmask
+common /ieenanr/ native_NaN, ieee_NaN, NaNmask, mapin, mapout, nin, nout
+
+begin
+ inval = mapin
+ outval = mapout
+end
+
+
+# MACHINE DEPENDENT PART.
+# ---------------------------
+
+# IEESMAP -- Enable or disable NaN mapping.
+#
+# sEEE EEEE Emmm mmmm mmmm mmmm mmmm mmmm
+# 3 2 1 0
+# 1098 7654 3210 9876 5432 1098 7654 3210
+# 7 f 8 0 0 0 0 0
+
+procedure ieesmapr (inval, outval)
+
+int inval #I enable NaN mapping for input?
+int outval #I enable NaN mapping for output?
+
+# MACHDEP.
+#$if (datatype == r)
+#% real r_quiet_nan
+#$else
+#% double precision d_quiet_nan
+#$endif
+
+real native_NaN, ieee_NaN
+int mapin, mapout, nin, nout, NaNmask
+common /ieenanr/ native_NaN, ieee_NaN, NaNmask, mapin, mapout, nin, nout
+
+begin
+ mapin = inval
+ mapout = outval
+
+ # MACHDEP.
+# if (mapout == YES)
+# $if (datatype == r)
+#% ieeenn = r_quiet_NaN()
+# $else
+#% ieeenn = d_quiet_NaN()
+# $endif
+
+ if (mapin == YES)
+ NaNmask = 7F800000X
+end
diff --git a/unix/as.linux64/zrtadr.s b/unix/as.linux64/zrtadr.s
new file mode 100644
index 00000000..22523154
--- /dev/null
+++ b/unix/as.linux64/zrtadr.s
@@ -0,0 +1,6 @@
+ .seg "text"
+ .global zrtadr_
+zrtadr_:
+ mov %i7,%o0
+ retl
+ nop
diff --git a/unix/as.linux64/zsvjmp.s b/unix/as.linux64/zsvjmp.s
new file mode 100644
index 00000000..7a952958
--- /dev/null
+++ b/unix/as.linux64/zsvjmp.s
@@ -0,0 +1,48 @@
+ .file "zsvjmp.s"
+
+# ZSVJMP, ZDOJMP -- Set up a jump (non-local goto) by saving the processor
+# registers in the buffer jmpbuf. A subsequent call to ZDOJMP restores
+# the registers, effecting a call in the context of the procedure which
+# originally called ZSVJMP, but with the new status code. These are Fortran
+# callable procedures.
+#
+# zsvjmp (jmp_buf, status) # (returns status)
+# zdojmp (jmp_buf, status) # (passes status to zsvjmp)
+#
+# These routines are directly comparable to the UNIX setjmp/longjmp, except
+# that they are Fortran callable kernel routines, i.e., trailing underscore,
+# call by reference, and no function returns. ZSVJMP requires an assembler
+# jacket routine to avoid modifying the call stack, but relies upon setjmp
+# to do the real work. ZDOJMP is implemented as a portable C routine in OS,
+# calling longjmp to do the restore. In these routines, JMP_BUF consists
+# of one longword containing the address of the STATUS variable, followed
+# by the "jmp_buf" used by setjmp/longjmp.
+#
+# This file contains the FreeBSD (x86) version of ZSVJMP.
+# Modified to remove leading underscore for ELF (Jan99).
+
+ #.globl _zsvjmp_
+ .globl zsvjmp_
+
+ # The following has nothing to do with ZSVJMP, and is included here
+ # only because this assembler module is loaded with every process.
+ # This code sets the value of the symbol MEM (the VOS or Fortran Mem
+ # common) to zero, setting the origin for IRAF pointers to zero
+ # rather than some arbitrary value, and ensuring that the MEM common
+ # is aligned for all datatypes as well as page aligned. A further
+ # advantage is that references to NULL pointers are likely to cause a
+ # memory violation.
+
+ #.globl mem_
+ #mem_ = 0
+ .globl _mem_
+ _mem_ = 0
+
+zsvjmp_:
+ # %rsi ... &status %rdi ... &jumpbuf
+ movq %rsi, (%rdi) # store &status in jmpbuf[0]
+ movl $0, (%rsi) # zero the value of status
+ addq $8, %rdi # change point to &jmpbuf[1]
+ movl $0, %esi # change arg2 to zero
+ jmp __sigsetjmp # let sigsetjmp do the rest
+
diff --git a/unix/as.linux64/zsvjmp.s.BAD b/unix/as.linux64/zsvjmp.s.BAD
new file mode 100644
index 00000000..74107830
--- /dev/null
+++ b/unix/as.linux64/zsvjmp.s.BAD
@@ -0,0 +1,60 @@
+ .file "zsvjmp.s"
+
+# ZSVJMP, ZDOJMP -- Set up a jump (non-local goto) by saving the processor
+# registers in the buffer jmpbuf. A subsequent call to ZDOJMP restores
+# the registers, effecting a call in the context of the procedure which
+# originally called ZSVJMP, but with the new status code. These are Fortran
+# callable procedures.
+#
+# zsvjmp (jmp_buf, status) # (returns status)
+# zdojmp (jmp_buf, status) # (passes status to zsvjmp)
+#
+# These routines are directly comparable to the UNIX setjmp/longjmp, except
+# that they are Fortran callable kernel routines, i.e., trailing underscore,
+# call by reference, and no function returns. ZSVJMP requires an assembler
+# jacket routine to avoid modifying the call stack, but relies upon setjmp
+# to do the real work. ZDOJMP is implemented as a portable C routine in OS,
+# calling longjmp to do the restore. In these routines, JMP_BUF consists
+# of one longword containing the address of the STATUS variable, followed
+# by the "jmp_buf" used by setjmp/longjmp.
+#
+# This file contains the FreeBSD (x86) version of ZSVJMP.
+# Modified to remove leading underscore for ELF (Jan99).
+
+ .globl _zsvjmp_
+
+ # The following has nothing to do with ZSVJMP, and is included here
+ # only because this assembler module is loaded with every process.
+ # This code sets the value of the symbol MEM (the VOS or Fortran Mem
+ # common) to zero, setting the origin for IRAF pointers to zero
+ # rather than some arbitrary value, and ensuring that the MEM common
+ # is aligned for all datatypes as well as page aligned. A further
+ # advantage is that references to NULL pointers are likely to cause a
+ # memory violation.
+
+ .globl mem_
+ mem_ = 0
+ .globl _mem_
+ _mem_ = 0
+
+_zsvjmp_:
+ pushl %ebp
+ movl %esp, %ebp
+ subl $24, %esp
+ movl 12(%ebp), %eax
+ movl $0, (%eax)
+ movl 12(%ebp), %eax
+ movl (%eax), %edx
+ movl 8(%ebp), %eax
+ movl %edx, (%eax)
+ movl 8(%ebp), %eax
+ addl $4, %eax
+ movl %eax, (%esp)
+ call L_setjmp$stub
+ leave
+ ret
+ .section __IMPORT,__jump_table,symbol_stubs,self_modifying_code+pure_instructions,5
+L_setjmp$stub:
+ .indirect_symbol _setjmp
+ hlt ; hlt ; hlt ; hlt ; hlt
+ .subsections_via_symbols
diff --git a/unix/as.linux64/zsvjmp_c b/unix/as.linux64/zsvjmp_c
new file mode 100644
index 00000000..2b42a0de
--- /dev/null
+++ b/unix/as.linux64/zsvjmp_c
@@ -0,0 +1,170 @@
+/*
+# ZSVJMP, ZDOJMP -- Set up a jump (non-local goto) by saving the processor
+# registers in the buffer jmpbuf. A subsequent call to ZDOJMP restores
+# the registers, effecting a call in the context of the procedure which
+# originally called ZSVJMP, but with the new status code. These are Fortran
+# callable procedusres.
+#
+# zsvjmp (jmp_buf, status) # (returns status)
+# zdojmp (jmp_buf, status) # (passes status to zsvjmp)
+#
+# These routines are directly comparable to the UNIX setjmp/longjmp, except
+# that they are Fortran callable kernel routines, i.e., trailing underscore,
+# call by reference, and no function returns. ZSVJMP requires an assembler
+# jacket routine to avoid modifying the call stack, but relies upon setjmp
+# to do the real work. ZDOJMP is implemented as a portable C routine in OS,
+# calling longjmp to do the restore. In these routines, JMP_BUF consists
+# of one longword containing the address of the STATUS variable, followed
+# by the "jmp_buf" used by setjmp/longjmp.
+*/
+
+
+#ifdef I386
+
+/*
+asm("# Set the address of the MEM common to zero.");
+asm(".globl mem_");
+asm(" mem_ = 0");
+*/
+
+/*
+#if defined(MACOSX)
+asm(".globl _mem_");
+asm(" _mem_ = 0");
+#endif
+*/
+
+#if defined(LINUX)
+asm(".text");
+asm(".globl zsvjmp_");
+asm("zsvjmp_:");
+asm(" movl 4(%esp), %ecx # &jmpbuf to ECX");
+asm(" movl 8(%esp), %eax # &status to EAX");
+asm(" movl %eax, (%ecx) # store &status in jmpbuf[0]");
+asm(" movl $0, (%eax) # zero the value of status");
+asm(" addl $4, %ecx # change stack to point to &jmpbuf[1]");
+asm(" movl %ecx, 4(%esp) # ...");
+asm(" movl $0, 8(%esp) # change arg2 to zero");
+asm(" jmp __sigsetjmp # let sigsetjmp do the rest");
+#endif /* LINUX */
+
+#if (defined(CYGWIN) || defined(MACOSX))
+asm(".text");
+asm(".globl _zsvjmp_");
+asm("_zsvjmp_:");
+asm(" movl 4(%esp), %ecx # &jmpbuf to ECX");
+asm(" movl 8(%esp), %eax # &status to EAX");
+asm(" movl %eax, (%ecx) # store &status in jmpbuf[0]");
+asm(" movl $0, (%eax) # zero the value of status");
+asm(" addl $4, %ecx # change stack to point to &jmpbuf[1]");
+asm(" movl %ecx, 4(%esp) # ...");
+asm(" movl $0, 8(%esp) # change arg2 to zero");
+asm(" jmp _setjmp # let setjmp do the rest");
+#endif /* CYGWIN || MACOSX */
+
+#endif /* I386 */
+
+
+#ifdef X86_64
+
+/*
+asm("# Set the address of the MEM common to zero.");
+asm(".globl mem_");
+asm(" mem_ = 0");
+*/
+
+#ifdef SPP_LP64
+/* LP64-SPP */
+asm(".text");
+asm(".globl zsvjmp_");
+asm("zsvjmp_:");
+asm(" # %rsi ... &status %rdi ... &jumpbuf");
+asm(" movq %rsi, (%rdi) # store &status in jmpbuf[0]");
+asm(" movl $0, (%rsi) # zero the value of status");
+asm(" addq $8, %rdi # change point to &jmpbuf[1]");
+asm(" movl $0, %esi # change arg2 to zero");
+asm(" jmp __sigsetjmp # let sigsetjmp do the rest");
+#else
+/* ILP64-SPP */
+asm(".text");
+asm(".globl zsvjmp_");
+asm("zsvjmp_:");
+asm(" # %rsi ... &status %rdi ... &jumpbuf");
+asm(" movq %rsi, (%rdi) # store &status in jmpbuf[0]");
+asm(" movq $0, (%rsi) # zero the value of status");
+asm(" addq $8, %rdi # change point to &jmpbuf[1]");
+asm(" movl $0, %esi # change arg2 to zero");
+asm(" jmp __sigsetjmp # let sigsetjmp do the rest");
+#endif
+
+#endif /* X86_64 */
+
+
+#ifdef POWERPC
+
+#if defined(LINUX)
+/*
+asm(" # Set the address of the MEM common to zero.");
+asm(" .globl mem_");
+asm(" mem_ = 0");
+*/
+asm(".text");
+asm(" # ZSVJMP -- SPP callable SETJMP.");
+asm(" .align 2");
+asm(" .globl zsvjmp_");
+asm(" .type zsvjmp_,@function");
+asm("zsvjmp_:");
+asm(" # R3 = buf, R4 = &status");
+asm(" li r11,0 # r11 = 0");
+asm(" stw r11,0(r4) # set *status to zero");
+asm(" stw r4,0(r3) # store &status in buf[0]");
+asm(" addi r3,r3,4 # reference buf[1] for sigsetjmp");
+asm(" li r4,0 # zero signal mask for sigsetjmp");
+asm(" b __sigsetjmp");
+#endif /* LINUX */
+
+#if defined(MACOSX)
+/*
+asm(" # Set the address of the MEM common to zero.");
+asm(" .globl _mem_");
+asm(" _mem_ = 0");
+*/
+asm(".text");
+asm(" # ZSVJMP -- SPP callable SETJMP.");
+asm(" .align 2");
+asm(" .globl _zsvjmp_");
+asm("_zsvjmp_:");
+asm(" # R3 = buf, R4 = &status");
+asm(" li r11,0 # r11 = 0");
+asm(" stw r11,0(r4) # set *status to zero");
+asm(" stw r4,0(r3) # store &status in buf[0]");
+asm(" addi r3,r3,4 # reference buf[1] for setjmp");
+asm(" b L_setjmp$stub");
+asm("L2:");
+asm(" lwz r1,0(r1)");
+asm(" lwz r0,8(r1)");
+asm(" mtlr r0");
+asm(" lmw r30,-8(r1)");
+asm(" blr");
+asm("");
+asm(" # The setjmp code is only available in a dynamic library on 10.1.");
+asm(".picsymbol_stub");
+asm("L_setjmp$stub:");
+asm(" .indirect_symbol _setjmp");
+asm(" mflr r0");
+asm(" bcl 20,31,L1$pb");
+asm("L1$pb:");
+asm(" mflr r11");
+asm(" addis r11,r11,ha16(L1$lz-L1$pb)");
+asm(" mtlr r0");
+asm(" lwz r12,lo16(L1$lz-L1$pb)(r11)");
+asm(" mtctr r12");
+asm(" addi r11,r11,lo16(L1$lz-L1$pb)");
+asm(" bctr");
+asm(".lazy_symbol_pointer");
+asm("L1$lz:");
+asm(" .indirect_symbol _setjmp");
+asm(" .long dyld_stub_binding_helper");
+#endif /* MACOSX */
+
+#endif /* POWERPC */
diff --git a/unix/as.linux64/zsvjmp_demo.c b/unix/as.linux64/zsvjmp_demo.c
new file mode 100644
index 00000000..3dd2d90e
--- /dev/null
+++ b/unix/as.linux64/zsvjmp_demo.c
@@ -0,0 +1,13 @@
+/* Compile with gcc -S to get demo assembler code.
+ */
+#include <setjmp.h>
+
+#define import_spp
+#include <iraf.h>
+
+int zsvjmp_( XPOINTER *buf, XINT *status )
+{
+ *status = 0;
+ ((XINT **)buf)[0] = status;
+ return sigsetjmp ((void *)((XINT **)buf+1),0);
+}
diff --git a/unix/as.linux64/zzdebug.c b/unix/as.linux64/zzdebug.c
new file mode 100644
index 00000000..81247e78
--- /dev/null
+++ b/unix/as.linux64/zzdebug.c
@@ -0,0 +1,48 @@
+/* Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+ */
+
+#include <stdio.h>
+#define import_spp
+#define import_kernel
+#define import_knames
+#include <iraf.h>
+
+/*
+ * ZZDEBUG -- Test program for ZSVJMP/ZDOJMP. Will return "exit status 1"
+ * if it runs successfully.
+ */
+
+
+int jmpbuf[LEN_JUMPBUF];
+int status;
+
+main()
+{
+ zsvjmp_((char *)jmpbuf, &status);
+ if (status) {
+ printf ("exit status %d\n", status);
+ exit (status);
+ }
+
+ a(1);
+ exit (0);
+}
+
+
+a(status)
+int status;
+{
+ ZDOJMP(jmpbuf, &status);
+}
+
+
+/* ZDOJMP -- Restore the saved processor context (non-local goto). See also
+ * as$zsvjmp.s, where most of the work is done.
+ */
+ZDOJMP (jmpbuf, status)
+XINT *jmpbuf;
+XINT *status;
+{
+ *((int *)jmpbuf[0]) = *status;
+ longjmp (&jmpbuf[1], *status);
+}