? gnu/lib/libbfd/arch/hppa
? gnu/usr.bin/binutils/common/arch/hppa
? gnu/usr.bin/binutils/gas/arch/hppa
? gnu/usr.bin/binutils/gprof/arch/hppa
? gnu/usr.bin/binutils/ld/arch/hppa
? sys/arch/hp700/conf/ZOOROPA
? sys/arch/hp700/conf/PLAIN-D
? sys/arch/hp700/conf/SUNRISE
? sys/dev/ic/stivar.h
? sys/dev/ic/stireg.h
? sys/dev/ic/sti.c
Index: etc/mtree/NetBSD.dist
===================================================================
RCS file: /cvsroot/basesrc/etc/mtree/NetBSD.dist,v
retrieving revision 1.197
diff -u -r1.197 NetBSD.dist
--- etc/mtree/NetBSD.dist       2002/06/29 17:27:43     1.197
+++ etc/mtree/NetBSD.dist       2002/11/14 16:23:02
@@ -408,6 +408,7 @@
./usr/share/man/cat4/arm32
./usr/share/man/cat4/atari
./usr/share/man/cat4/hp300
+./usr/share/man/cat4/hp700
./usr/share/man/cat4/i386
./usr/share/man/cat4/mac68k
./usr/share/man/cat4/macppc
@@ -480,6 +481,7 @@
./usr/share/man/cat9/amiga
./usr/share/man/cat9/atari
./usr/share/man/cat9/hp300
+./usr/share/man/cat9/hp700
./usr/share/man/cat9/i386
./usr/share/man/cat9/mac68k
./usr/share/man/cat9/pc532
@@ -501,6 +503,7 @@
./usr/share/man/man4/arm32
./usr/share/man/man4/atari
./usr/share/man/man4/hp300
+./usr/share/man/man4/hp700
./usr/share/man/man4/i386
./usr/share/man/man4/mac68k
./usr/share/man/man4/macppc
@@ -573,6 +576,7 @@
./usr/share/man/man9/amiga
./usr/share/man/man9/atari
./usr/share/man/man9/hp300
+./usr/share/man/man9/hp700
./usr/share/man/man9/i386
./usr/share/man/man9/mac68k
./usr/share/man/man9/pc532
@@ -594,6 +598,7 @@
./usr/share/man/html4/arm32
./usr/share/man/html4/atari
./usr/share/man/html4/hp300
+./usr/share/man/html4/hp700
./usr/share/man/html4/i386
./usr/share/man/html4/mac68k
./usr/share/man/html4/macppc
@@ -666,6 +671,7 @@
./usr/share/man/html9/amiga
./usr/share/man/html9/atari
./usr/share/man/html9/hp300
+./usr/share/man/html9/hp700
./usr/share/man/html9/i386
./usr/share/man/html9/mac68k
./usr/share/man/html9/pc532
Index: gnu/usr.bin/groff/Makefile
===================================================================
RCS file: /cvsroot/gnusrc/gnu/usr.bin/groff/Makefile,v
retrieving revision 1.12
diff -u -r1.12 Makefile
--- gnu/usr.bin/groff/Makefile  2001/04/19 14:40:40     1.12
+++ gnu/usr.bin/groff/Makefile  2002/11/14 16:24:15
@@ -5,6 +5,11 @@
       indxbib lkbib lookbib man mm nroff pfbtops pic refer \
       tbl tfmtodit tmac troff

+# XXX fredette - never commit:
+.if ${MACHINE_ARCH} == "hppa"
+SUBDIR=
+.endif
+
# afmtodit is a perl script; xditview an X program (we can't assume X is
# installed); NetBSD has its own soelim.
MISC=  afmtodit xditview soelim
Index: libexec/ld.elf_so/arch/hppa/hppa_reloc.c
===================================================================
RCS file: /cvsroot/basesrc/libexec/ld.elf_so/arch/hppa/hppa_reloc.c,v
retrieving revision 1.1
diff -u -r1.1 hppa_reloc.c
--- libexec/ld.elf_so/arch/hppa/hppa_reloc.c    2002/07/10 15:12:38     1.1
+++ libexec/ld.elf_so/arch/hppa/hppa_reloc.c    2002/11/14 16:24:28
@@ -333,5 +333,64 @@
       where[1] = func_sl;
       if (addrp != NULL)
               *addrp = (caddr_t)where;
+
+#if 1
+       /*
+        * Flush the PLT stub that's before the GOT.
+        */
+       /*
+        * XXX fredette - I struggled with this for days.
+        * Without this flushing, my 735/99 (with separate
+        * 256K instruction and data caches) would see
+        * all-bits-zero words for instructions in the PLT
+        * stub, causing break traps.
+        *
+        * After reading and rereading the rules for
+        * instruction- and data-cache movein, I can't see
+        * why any flushing of the PLT stub is needed, since
+        * I never write to the instruction part of the stub.
+        *
+        * Sure, I write the data parts of the stub, and I
+        * write data into the GOT near the stub, but unless
+        * there's some sort of cache line sharing/copying
+        * between the I and D caches, the first time that
+        * control transfers to the stub, the line should get
+        * moved-in from main memory into the I-cache, even if
+        * the line is also present and dirty in the D-cache.
+        *
+        * If someone has any ideas, please experiment.
+        * This flushing almost certainly hurts performance.
+        */
+       __asm __volatile(
+       "       copy    %0, %%r22       \n"
+       "       fdc,m   %1(%0)          \n"
+       "       fdc,m   %1(%0)          \n"
+       "       fdc,m   %1(%0)          \n"
+       "       fdc,m   %1(%0)          \n"
+       "       fdc,m   %1(%0)          \n"
+       "       fdc,m   %1(%0)          \n"
+       "       nop                     \n"
+       "       nop                     \n"
+       "       sync                    \n"
+       "       syncdma                 \n"
+       "       nop                     \n"
+       "       nop                     \n"
+       "       fic,m   %1(%%r22)       \n"
+       "       fic,m   %1(%%r22)       \n"
+       "       fic,m   %1(%%r22)       \n"
+       "       fic,m   %1(%%r22)       \n"
+       "       fic,m   %1(%%r22)       \n"
+       "       fic,m   %1(%%r22)       \n"
+       "       nop                     \n"
+       "       nop                     \n"
+       "       sync                    \n"
+       "       syncdma                 \n"
+       "       nop                     \n"
+       "       nop                     \n"
+       : /* no outputs */
+       : "r" ((Elf_Addr)HPPA_OBJ_GOT(obj)), "r" ((int) -16)
+       : "r22");
+#endif
+
       return 0;
}
Index: regress/lib/libc/Makefile
===================================================================
RCS file: /cvsroot/basesrc/regress/lib/libc/Makefile,v
retrieving revision 1.29
diff -u -r1.29 Makefile
--- regress/lib/libc/Makefile   2002/07/05 15:42:41     1.29
+++ regress/lib/libc/Makefile   2002/11/14 16:24:29
@@ -3,7 +3,9 @@
SUBDIR+= _setjmp clone db div divrem \
       gen getaddrinfo hsearch int_fmtio md5sha popen regex rpc \
       setjmp sigsetjmp string sys time
-.if (${MACHINE_ARCH} != "vax" && ${MACHINE_ARCH} != "m68000")
+.if (${MACHINE_ARCH} != "hppa" && \
+     ${MACHINE_ARCH} != "m68000" && \
+     ${MACHINE_ARCH} != "vax")
SUBDIR+= ieeefp
.endif
.if (${MACHINE_ARCH} != "vax")
Index: sys/arch/hp700/hp700/machdep.c
===================================================================
RCS file: /cvsroot/syssrc/sys/arch/hp700/hp700/machdep.c,v
retrieving revision 1.4
diff -u -r1.4 machdep.c
--- sys/arch/hp700/hp700/machdep.c      2002/08/25 20:20:01     1.4
+++ sys/arch/hp700/hp700/machdep.c      2002/11/14 16:24:48
@@ -1419,9 +1419,16 @@

       if (howto & RB_HALT) {
haltsys:
+#ifndef DEBUG
               printf("System halted!\n");
               __asm __volatile("stwas %0, 0(%1)"
                   :: "r" (CMD_STOP), "r" (LBCAST_ADDR + iomod_command));
+#else  /* DEBUG */
+               printf("rebooting...");
+               DELAY(1000000);
+               __asm __volatile("stwas %0, 0(%1)"
+                   :: "r" (CMD_RESET), "r" (LBCAST_ADDR + iomod_command));
+#endif /* DEBUG */
       } else {
               printf("rebooting...");
               DELAY(1000000);
Index: sys/arch/hppa/hppa/trap.c
===================================================================
RCS file: /cvsroot/syssrc/sys/arch/hppa/hppa/trap.c,v
retrieving revision 1.4
diff -u -r1.4 trap.c
--- sys/arch/hppa/hppa/trap.c   2002/08/19 15:07:33     1.4
+++ sys/arch/hppa/hppa/trap.c   2002/11/14 16:24:50
@@ -636,13 +636,38 @@
               if (trap_kdebug(type, va, frame))
                       return;
               else if (type == T_DATALIGN)
-                       panic ("trap: %s at 0x%x", tts, (u_int) va);
-               else
-                       panic ("trap: no debugger for \"%s\" (%d)", tts, type);
+                       panic ("trap: %s at 0x%x at %x:%08x (%08x)", tts, (u_int) va,
+                               frame->tf_iisq_head, frame->tf_iioq_head, frame->tf_iir);
+               else {
+                       extern vaddr_t hpt_base;
+                       extern vsize_t hpt_mask;
+                       printf("isr %08x ior %08x r24 %08x cr28 %08x\nvtop %08x mask %08x hpt_base %08x hpt_mask %08x\n", frame->tf_isr, frame->tf_ior, frame->tf_arg2, frame->tf_cr28, frame->tf_vtop, frame->tf_hptm, (u_int) hpt_base, (u_int) hpt_mask);
+                       panic ("trap: no debugger for \"%s\" (%d) at %x:%08x (%08x)",
+                               tts, type,
+                               frame->tf_iisq_head, frame->tf_iioq_head, frame->tf_iir);
+               }
               break;

       case T_IBREAK | T_USER:
       case T_DBREAK | T_USER:
+#if 1
+               space = frame->tf_iisq_head;
+               va = frame->tf_iioq_head & ~HPPA_PC_PRIV_MASK;
+               printf("%s at 0x%x:0x%x, iir=0x%08x\n", tts, space, (u_int)va,
+                       frame->tf_iir);
+               __asm __volatile(
+               "       mtsp    %1, %%sr1       \n"
+               "       ldw     0(%%sr1, %2), %0\n"
+               : "=r" (opcode) : "r" (space), "r" (va));
+               printf("first ld yields 0x%08x\n", opcode);
+               fcacheall();
+               __asm __volatile(
+               "       mtsp    %1, %%sr1       \n"
+               "       ldw     0(%%sr1, %2), %0\n"
+               : "=r" (opcode) : "r" (space), "r" (va));
+               printf("second ld yields 0x%08x\n", opcode);
+               ret = 0;
+#endif
               /* pass to user debugger */
               break;

Index: sys/conf/files
===================================================================
RCS file: /cvsroot/syssrc/sys/conf/files,v
retrieving revision 1.540
diff -u -r1.540 files
--- sys/conf/files      2002/07/02 20:27:45     1.540
+++ sys/conf/files      2002/11/14 16:25:02
@@ -373,7 +373,7 @@
device lfmiop: scsi
file   dev/ic/lfmiop.c                 lfmiop

-# Symbios/NCR 53c710 SCSI controllers
+# Symbios/NCR 53c700/53c710 SCSI controllers
#
device osiop: scsi
file   dev/ic/osiop.c                  osiop
@@ -773,6 +773,10 @@
#
device igsfb: wsemuldisplaydev, wsrasteremulops, rasops8
file   dev/ic/igsfb.c                  igsfb
+# STI (HP graphics)
+#
+device sti: wsemuldisplaydev
+file   dev/ic/sti.c                    sti & (sti_pci|sti_sgc) needs-flag

# Attributes which machine-independent bus support can be attached to.
# These should be defined here, because some of these busses can have
Index: sys/dev/ic/osiop.c
===================================================================
RCS file: /cvsroot/syssrc/sys/dev/ic/osiop.c,v
retrieving revision 1.9
diff -u -r1.9 osiop.c
--- sys/dev/ic/osiop.c  2002/04/05 18:27:54     1.9
+++ sys/dev/ic/osiop.c  2002/11/14 16:25:04
@@ -98,10 +98,14 @@

#include <machine/cpu.h>
#include <machine/bus.h>
+#include <machine/bswap.h>

#include <dev/ic/osiopreg.h>
#include <dev/ic/osiopvar.h>

+/* 53C700 script */
+#include <dev/microcode/siop/oosiop.out>
+
/* 53C710 script */
#include <dev/microcode/siop/osiop.out>

@@ -116,6 +120,7 @@
void osiop_init(struct osiop_softc *);
void osiop_reset(struct osiop_softc *);
void osiop_resetbus(struct osiop_softc *);
+void osiop_write_dsa(struct osiop_softc *, struct osiop_acb *);
void osiop_start(struct osiop_softc *);
int osiop_checkintr(struct osiop_softc *, u_int8_t, u_int8_t, u_int8_t, int *);
void osiop_select(struct osiop_softc *);
@@ -191,6 +196,8 @@
#define OSIOP_TRACE(a,b,c,d)
#endif

+#define        SIZEOF_ARRAY(a) (sizeof(a) / sizeof(a[0]))
+
void
osiop_attach(sc)
       struct osiop_softc *sc;
@@ -230,8 +237,68 @@

       /*
        * Copy and sync script
+        */
+       switch(sc->sc_rev) {
+       case OSIOP_VARIANT_NCR53C700:
+
+               /* Copy the raw script. */
+               memcpy(sc->sc_script, oosiop_script, sizeof(oosiop_script));
+
+               /*
+                * The 53c700 can't do relative jumps, so we have to
+                * adjust all script offsets used in the script.
+                */
+               for(i = 0; i < SIZEOF_ARRAY(LABELPATCHES); i++)
+                       sc->sc_script[LABELPATCHES[i]] += sc->sc_scrdma->dm_segs[0].ds_addr;
+
+               /*
+                * Certain block transfer instructions in our script
+                * always involve the same count of bytes; these
+                * correspond to the constant .count values set up
+                * in the ACB data structure below.  For example,
+                * all data structures always have a status.count value
+                * of one.  We take advantage of these constant values
+                * to fix up all count values in instructions that we
+                * can now, leaving us only to fix up their address
+                * values at transfer time.
+                *
+                * We can't do this all of the time - for example,
+                * the counts for command and scatter/gather need
+                * to be set at script-runtime.
+                *
+                * Note that the script offsets we have are for
+                * data pointers only.  I didn't bother creating
+                * externals for the data counts, because count
+                * and pointer are always used together.  The count
+                * immediately precedes the pointer in the script.
+                * We also take advantage of the fact that the
+                * count fields in the unfixed script are zero.
+                */
+#define        FIXED_COUNT(name, count)                        \
+       for(i = 0; i < SIZEOF_ARRAY(name); i++)         \
+               sc->sc_script[name[i] - 1] |= (count)
+               FIXED_COUNT(E_ds_Status_Used,   1);
+               FIXED_COUNT(E_ds_Msg_Used,      1);
+               FIXED_COUNT(E_ds_MsgIn_Used,    1);
+               FIXED_COUNT(E_ds_ExtMsg_Used,   1);
+               FIXED_COUNT(E_ds_SyncMsg_Used,  3);
+#undef FIXED_COUNT
+               break;
+
+       case OSIOP_VARIANT_NCR53C710:
+               memcpy(sc->sc_script, osiop_script, sizeof(osiop_script));
+               break;
+       }
+
+       /*
+        * If the byte order of the chip is not the same as
+        * the byte order of the CPU, we need to byteswap
+        * the script.
        */
-       memcpy(sc->sc_script, osiop_script, sizeof(osiop_script));
+       if (sc->sc_byteorder != OSIOP_BYTEORDER_NATIVE) {
+               for(i = 0; i < SIZEOF_ARRAY(osiop_script); i++)
+                       sc->sc_script[i] = bswap32(sc->sc_script[i]);
+       }
       bus_dmamap_sync(sc->sc_dmat, sc->sc_scrdma, 0, sizeof(osiop_script),
           BUS_DMASYNC_PREWRITE);

@@ -324,8 +391,19 @@
               acb++;
       }

-       printf(": NCR53C710 rev %d, %dMHz, SCSI ID %d\n",
-           osiop_read_1(sc, OSIOP_CTEST8) >> 4, sc->sc_clock_freq, sc->sc_id);
+       printf(": ");
+       switch(sc->sc_rev) {
+       case OSIOP_VARIANT_NCR53C700:
+               printf("NCR53C700 rev %d",
+                   osiop_read_1(sc, OSIOP_CTEST7) >> 4);
+               break;
+       case OSIOP_VARIANT_NCR53C710:
+               printf("NCR53C710 rev %d",
+                   osiop_read_1(sc, OSIOP_CTEST8) >> 4);
+               break;
+       }
+       printf(", %dMHz, SCSI ID %d\n",
+           sc->sc_clock_freq, sc->sc_id);

       /*
        * Initialize all
@@ -548,6 +626,7 @@
                       i--;
               }
               sstat0 = osiop_read_1(sc, OSIOP_SSTAT0);
+               delay(25);
               dstat = osiop_read_1(sc, OSIOP_DSTAT);
               if (osiop_checkintr(sc, istat, dstat, sstat0, &status)) {
                       if (acb != sc->sc_nexus)
@@ -832,6 +911,8 @@
       struct osiop_acb *acb;
       int i, s;
       u_int8_t stat;
+       bus_size_t rst_reg, dmode_reg;
+       u_int8_t rst_bit;

#ifdef OSIOP_DEBUG
       printf("%s: resetting chip\n", sc->sc_dev.dv_xname);
@@ -850,11 +931,23 @@
       osiop_write_1(sc, OSIOP_ISTAT,
           osiop_read_1(sc, OSIOP_ISTAT) | OSIOP_ISTAT_ABRT);
       /* reset chip */
-       osiop_write_1(sc, OSIOP_ISTAT,
-           osiop_read_1(sc, OSIOP_ISTAT) | OSIOP_ISTAT_RST);
+       switch(sc->sc_rev) {
+       case OSIOP_VARIANT_NCR53C700:
+               rst_reg = OSIOP_DCNTL;
+               rst_bit = OSIOP_DCNTL_RST;
+               dmode_reg = OSIOP_DMODE_53C700;
+               break;
+       case OSIOP_VARIANT_NCR53C710:
+               rst_reg = OSIOP_ISTAT;
+               rst_bit = OSIOP_ISTAT_RST;
+               dmode_reg = OSIOP_DMODE_53C710;
+               break;
+       }
+       osiop_write_1(sc, rst_reg,
+           osiop_read_1(sc, rst_reg) | rst_bit);
       delay(100);
-       osiop_write_1(sc, OSIOP_ISTAT,
-           osiop_read_1(sc, OSIOP_ISTAT) & ~OSIOP_ISTAT_RST);
+       osiop_write_1(sc, rst_reg,
+           osiop_read_1(sc, rst_reg) & ~rst_bit);
       delay(100);

       /*
@@ -864,14 +957,15 @@
           OSIOP_ARB_FULL | OSIOP_SCNTL0_EPC | OSIOP_SCNTL0_EPG);
       osiop_write_1(sc, OSIOP_SCNTL1, OSIOP_SCNTL1_ESR);
       osiop_write_1(sc, OSIOP_DCNTL, sc->sc_dcntl);
-       osiop_write_1(sc, OSIOP_DMODE, OSIOP_DMODE_BL4);
+       osiop_write_1(sc, dmode_reg, OSIOP_DMODE_BL4);
       /* don't enable interrupts yet */
       osiop_write_1(sc, OSIOP_SIEN, 0x00);
       osiop_write_1(sc, OSIOP_DIEN, 0x00);
       osiop_write_1(sc, OSIOP_SCID, OSIOP_SCID_VALUE(sc->sc_id));
       osiop_write_1(sc, OSIOP_DWT, 0x00);
-       osiop_write_1(sc, OSIOP_CTEST0, osiop_read_1(sc, OSIOP_CTEST0)
-           | OSIOP_CTEST0_BTD | OSIOP_CTEST0_EAN);
+       if (sc->sc_rev != OSIOP_VARIANT_NCR53C700)
+               osiop_write_1(sc, OSIOP_CTEST0, osiop_read_1(sc, OSIOP_CTEST0)
+                       | OSIOP_CTEST0_BTD | OSIOP_CTEST0_EAN);
       osiop_write_1(sc, OSIOP_CTEST7,
           osiop_read_1(sc, OSIOP_CTEST7) | sc->sc_ctest7);

@@ -885,6 +979,7 @@
       stat = osiop_read_1(sc, OSIOP_ISTAT);
       if (stat & OSIOP_ISTAT_SIP)
               osiop_read_1(sc, OSIOP_SSTAT0);
+       delay(25);
       if (stat & OSIOP_ISTAT_DIP)
               osiop_read_1(sc, OSIOP_DSTAT);

@@ -912,8 +1007,10 @@
       /* enable SCSI and DMA interrupts */
       sc->sc_sien = OSIOP_SIEN_M_A | OSIOP_SIEN_STO | /*OSIOP_SIEN_SEL |*/
           OSIOP_SIEN_SGE | OSIOP_SIEN_UDC | OSIOP_SIEN_RST | OSIOP_SIEN_PAR;
-       sc->sc_dien = OSIOP_DIEN_BF | OSIOP_DIEN_ABRT | OSIOP_DIEN_SIR |
+       sc->sc_dien = OSIOP_DIEN_ABRT | OSIOP_DIEN_SIR |
           /*OSIOP_DIEN_WTD |*/ OSIOP_DIEN_IID;
+       if (sc->sc_rev != OSIOP_VARIANT_NCR53C700)
+               sc->sc_dien |= OSIOP_DIEN_BF;
       osiop_write_1(sc, OSIOP_SIEN, sc->sc_sien);
       osiop_write_1(sc, OSIOP_DIEN, sc->sc_dien);
}
@@ -932,6 +1029,90 @@
}

/*
+ * On the 53c710, this loads the DSA with the address of the
+ * data structure we'd like our script to use.  On the 53c700,
+ * since it doesn't have a DSA, we have to stuff the values
+ * in the data structure directly into the script.
+ */
+
+void
+osiop_write_dsa(sc, acb)
+       struct osiop_softc *sc;
+       struct osiop_acb *acb;
+{
+       int i;
+       int off;
+       u_int32_t inst;
+       int need_swap;
+       struct osiop_ds *ds = acb->ds;
+
+       switch(sc->sc_rev) {
+       case OSIOP_VARIANT_NCR53C700:
+
+               need_swap = (sc->sc_byteorder != OSIOP_BYTEORDER_NATIVE);
+
+               for(i = 0; i < SIZEOF_ARRAY(E_ds_Device_Used); i++) {
+                       off = E_ds_Device_Used[i] - 1;
+                       inst = oosiop_script[off] | (ds->scsi_addr & 0x00ff0000);
+                       sc->sc_script[off] = (need_swap ? bswap32(inst) : inst);
+               }
+
+       /* Some macros for clarity. */
+#define FOREACH_OFF(sym, body) do {                                    \
+       for(i = 0; i < SIZEOF_ARRAY(sym); i++) { off = sym[i]; body; }  \
+} while(/* CONSTCOND */ 0)
+#define        STUFF_ADDR(what)                                                \
+       inst = ds->what.addr;                                           \
+       sc->sc_script[off] = (need_swap ? bswap32(inst) : inst)
+#define        STUFF_FULL(what)                                                \
+       inst = ds->what.addr;                                           \
+       sc->sc_script[off--] = (need_swap ? bswap32(inst) : inst);      \
+       inst = oosiop_script[off] | ds->what.count;                     \
+       sc->sc_script[off] = (need_swap ? bswap32(inst) : inst)
+
+               FOREACH_OFF(E_ds_MsgOut_Used,   STUFF_FULL(id));
+               FOREACH_OFF(E_ds_Cmd_Used,      STUFF_FULL(cmd));
+               FOREACH_OFF(E_ds_Status_Used,   STUFF_ADDR(status));
+               FOREACH_OFF(E_ds_Msg_Used,      STUFF_ADDR(msg));
+               FOREACH_OFF(E_ds_MsgIn_Used,    STUFF_ADDR(msgin));
+               FOREACH_OFF(E_ds_ExtMsg_Used,   STUFF_ADDR(extmsg));
+               FOREACH_OFF(E_ds_SyncMsg_Used,  STUFF_ADDR(synmsg));
+
+               /*
+                * The DMA scatter/gather buffers are handled
+                * differently.  To avoid a bunch of external
+                * symbols in the script (OSIOP_NSG of them)
+                * there is only E_ds_Data1_Used, with exactly
+                * OSIOP_NSG * 2 references.  We rely on the
+                * scripts compiler laying out the _Used
+                * array such that _Used[0] and _Used[OSIOP_NSG]
+                * are really ds_Data1, [1] and [OSIOP_NSG + 1]
+                * are really ds_Data2, etc.
+                */
+               for(i = 0; i < OSIOP_NSG; i++) {
+                       off = E_ds_Data1_Used[i];
+                       STUFF_FULL(data[i]);
+                       off = E_ds_Data1_Used[OSIOP_NSG + i];
+                       STUFF_FULL(data[i]);
+               }
+
+#undef FOREACH_OFF
+#undef STUFF_COUNT
+#undef STUFF_FULL
+
+               /* Resync the script. */
+               bus_dmamap_sync(sc->sc_dmat, sc->sc_scrdma,
+                       0, sizeof(oosiop_script), BUS_DMASYNC_PREWRITE);
+
+               break;
+       case OSIOP_VARIANT_NCR53C710:
+               osiop_write_4(sc, OSIOP_DSA,
+                           sc->sc_dsdma->dm_segs[0].ds_addr + acb->dsoffset);
+               break;
+       }
+}
+
+/*
 * Setup Data Storage for 53C710 and start SCRIPTS processing
 */

@@ -956,7 +1137,8 @@
               printf("istat %02x sfbr %02x lcrc %02x sien %02x dien %02x\n",
                   osiop_read_1(sc, OSIOP_ISTAT),
                   osiop_read_1(sc, OSIOP_SFBR),
-                   osiop_read_1(sc, OSIOP_LCRC),
+                   (sc->sc_rev == OSIOP_VARIANT_NCR53C700
+                       ? 0 : osiop_read_1(sc, OSIOP_LCRC)),
                   osiop_read_1(sc, OSIOP_SIEN),
                   osiop_read_1(sc, OSIOP_DIEN));
#ifdef DDB
@@ -1072,14 +1254,14 @@
                           sc->sc_dev.dv_xname);
               osiop_write_4(sc, OSIOP_TEMP, 0);
               osiop_write_1(sc, OSIOP_SBCL, ti->sbcl);
-               osiop_write_4(sc, OSIOP_DSA,
-                   dsdma->dm_segs[0].ds_addr + acb->dsoffset);
+               osiop_write_dsa(sc, acb);
               osiop_write_4(sc, OSIOP_DSP,
                   sc->sc_scrdma->dm_segs[0].ds_addr + Ent_scripts);
               OSIOP_TRACE('s', 1, 0, 0);
       } else {
               if ((osiop_read_1(sc, OSIOP_ISTAT) & OSIOP_ISTAT_CON) == 0) {
-                       osiop_write_1(sc, OSIOP_ISTAT, OSIOP_ISTAT_SIGP);
+                       if (sc->sc_rev != OSIOP_VARIANT_NCR53C700)
+                               osiop_write_1(sc, OSIOP_ISTAT, OSIOP_ISTAT_SIGP);
                       OSIOP_TRACE('s', 2, 0, 0);
               } else {
                       OSIOP_TRACE('s', 3,
@@ -1109,17 +1291,29 @@
       bus_addr_t scraddr = sc->sc_scrdma->dm_segs[0].ds_addr;
       int target = 0;
       int dfifo, dbc, intcode, sstat1;
+       bus_size_t clf_reg;
+       u_int8_t clf_bit;
+       u_int8_t dfifo_bo;

       dfifo = osiop_read_1(sc, OSIOP_DFIFO);
       dbc = osiop_read_4(sc, OSIOP_DBC) & 0x00ffffff;
       sstat1 = osiop_read_1(sc, OSIOP_SSTAT1);
-       osiop_write_1(sc, OSIOP_CTEST8,
-           osiop_read_1(sc, OSIOP_CTEST8) | OSIOP_CTEST8_CLF);
+       if (sc->sc_rev == OSIOP_VARIANT_NCR53C700) {
+               clf_reg = OSIOP_DFIFO;
+               clf_bit = OSIOP_DFIFO_CLF;
+               dfifo_bo = OSIOP_DFIFO_BO_53C700;
+       } else {
+               clf_reg = OSIOP_CTEST8;
+               clf_bit = OSIOP_CTEST8_CLF;
+               dfifo_bo = OSIOP_DFIFO_BO_53C710;
+       }
+       osiop_write_1(sc, clf_reg,
+           osiop_read_1(sc, clf_reg) | clf_bit);
       while ((osiop_read_1(sc, OSIOP_CTEST1) & OSIOP_CTEST1_FMT) !=
           OSIOP_CTEST1_FMT)
               ;
-       osiop_write_1(sc, OSIOP_CTEST8,
-           osiop_read_1(sc, OSIOP_CTEST8) & ~OSIOP_CTEST8_CLF);
+       osiop_write_1(sc, clf_reg,
+           osiop_read_1(sc, clf_reg) & ~clf_bit);
       intcode = osiop_read_4(sc, OSIOP_DSPS);
#ifdef OSIOP_DEBUG
       osiopints++;
@@ -1156,7 +1350,8 @@
               /* Normal completion status, or check condition */
               struct osiop_tinfo *ti;
#ifdef OSIOP_DEBUG
-               if (osiop_read_4(sc, OSIOP_DSA) !=
+               if (sc->sc_rev != OSIOP_VARIANT_NCR53C700 &&
+                   osiop_read_4(sc, OSIOP_DSA) !=
                   dsdma->dm_segs[0].ds_addr + acb->dsoffset) {
                       printf("osiop: invalid dsa: %x %lx\n",
                           osiop_read_4(sc, OSIOP_DSA),
@@ -1248,7 +1443,7 @@
                           sc->sc_dev.dv_xname);
#endif
               if (acb->datalen > 0) {
-                       int adjust = (dfifo - (dbc & 0x7f)) & 0x7f;
+                       int adjust = (dfifo - (dbc & dfifo_bo)) & dfifo_bo;
                       if (sstat1 & OSIOP_SSTAT1_ORF)
                               adjust++;
                       if (sstat1 & OSIOP_SSTAT1_OLF)
@@ -1519,7 +1714,10 @@
               return (0);
       }
       if (dstat & OSIOP_DSTAT_SIR && intcode == A_int_reconnect) {
-               int reselid = ffs(osiop_read_4(sc, OSIOP_SCRATCH) & 0xff) - 1;
+               /* XXX this needs to be addressed for the 53c700 */
+               int reselid = ffs((sc->sc_rev == OSIOP_VARIANT_NCR53C700 ?
+                                  osiop_read_1(sc, OSIOP_SFBR) :
+                                  osiop_read_4(sc, OSIOP_SCRATCH) & 0xff)) - 1;
               int reselun = osiop_read_1(sc, OSIOP_SFBR) & 0x07;
#ifdef OSIOP_DEBUG
               u_int8_t resmsg;
@@ -1565,8 +1763,7 @@
                       sc->sc_nexus = acb;
                       sc->sc_flags |= acb->intstat;
                       acb->intstat = 0;
-                       osiop_write_4(sc, OSIOP_DSA,
-                           dsdma->dm_segs[0].ds_addr + acb->dsoffset);
+                       osiop_write_dsa(sc, acb);
                       osiop_write_1(sc, OSIOP_SXFER,
                           sc->sc_tinfo[reselid].sxfer);
                       osiop_write_1(sc, OSIOP_SBCL,
@@ -1617,8 +1814,7 @@
               }
               target = sc->sc_nexus->xs->xs_periph->periph_target;
               osiop_write_4(sc, OSIOP_TEMP, 0);
-               osiop_write_4(sc, OSIOP_DSA,
-                   dsdma->dm_segs[0].ds_addr + sc->sc_nexus->dsoffset);
+               osiop_write_dsa(sc, sc->sc_nexus);
               osiop_write_1(sc, OSIOP_SXFER, sc->sc_tinfo[target].sxfer);
               osiop_write_1(sc, OSIOP_SBCL, sc->sc_tinfo[target].sbcl);
               osiop_write_4(sc, OSIOP_DSP, scraddr + Ent_scripts);
@@ -1683,7 +1879,8 @@
       printf("osiop_chkintr: istat %x dstat %x sstat0 %x "
           "dsps %x dsa %x sbcl %x sts %x msg %x %x sfbr %x\n",
           istat, dstat, sstat0, intcode,
-           osiop_read_4(sc, OSIOP_DSA),
+           (sc->sc_rev == OSIOP_VARIANT_NCR53C700
+               ? 0: osiop_read_4(sc, OSIOP_DSA)),
           osiop_read_1(sc, OSIOP_SBCL),
           ds->stat[0], ds->msgbuf[0], ds->msgbuf[1],
           osiop_read_1(sc, OSIOP_SFBR));
@@ -1810,7 +2007,8 @@
                                   periph->periphtarget,
                                   osiop_read_1(sc, OSIOP_SBCL),
                                   osiop_read_1(sc, OSIOP_SFBR),
-                                   osiop_read_1(sc, OSIOP_LCRC),
+                                   (sc->sc_rev == OSIOP_VARIANT_NCR53C700
+                                       ? 0 : osiop_read_1(sc, OSIOP_LCRC)),
                                   osiop_read_4(sc, OSIOP_DSP) -
                                       sc->sc_scrdma->dm_segs[0].ds_addr);
                       }
Index: sys/dev/ic/osiopreg.h
===================================================================
RCS file: /cvsroot/syssrc/sys/dev/ic/osiopreg.h,v
retrieving revision 1.1
diff -u -r1.1 osiopreg.h
--- sys/dev/ic/osiopreg.h       2001/04/30 04:47:51     1.1
+++ sys/dev/ic/osiopreg.h       2002/11/14 16:25:04
@@ -108,9 +108,10 @@

#define OSIOP_DSPS     0x30            /* rw: DMA SCRIPTS Pointer Save reg */

+#define OSIOP_DMODE_53C700     (0x34+BL0)      /* rw: DMA Mode reg */
#define OSIOP_SCRATCH  0x34            /* rw: Scratch register */

-#define OSIOP_DMODE    (0x38+BL0)      /* rw: DMA Mode reg */
+#define OSIOP_DMODE_53C710     (0x38+BL0)      /* rw: DMA Mode reg */
#define OSIOP_DIEN     (0x38+BL1)      /* rw: DMA Interrupt Enable */
#define OSIOP_DWT      (0x38+BL2)      /* rw: DMA Watchdog Timer */
#define OSIOP_DCNTL    (0x38+BL3)      /* rw: DMA Control reg */
@@ -318,8 +319,10 @@

/* DMA FIFO register (dfifo) */

-#define OSIOP_DFIFO_FLF                0x80    /* Flush (spill) DMA FIFO */
-#define OSIOP_DFIFO_BO         0x7f    /* FIFO byte offset counter */
+#define OSIOP_DFIFO_FLF                0x80    /* Flush (spill) DMA FIFO (53C700 only) */
+#define OSIOP_DFIFO_CLF                0x40    /* Clear DMA FIFO (53C700 only) */
+#define OSIOP_DFIFO_BO_53C710  0x7f    /* FIFO byte offset counter */
+#define OSIOP_DFIFO_BO_53C700  0x3f    /* FIFO byte offset counter */

/* Interrupt status register (istat) */

@@ -375,4 +378,5 @@
#define OSIOP_DCNTL_LLM                0x08    /* Enable SCSI Low-level mode */
#define OSIOP_DCNTL_STD                0x04    /* Start DMA operation */
#define OSIOP_DCNTL_FA         0x02    /* Fast arbitration */
-#define OSIOP_DCNTL_COM                0x01    /* 53C700 Compatibility */
+#define OSIOP_DCNTL_RST                0x01    /* Software reset (53C700 only) */
+#define OSIOP_DCNTL_COM                0x01    /* 53C700 Compatibility (53C710 only) */
Index: sys/dev/ic/osiopvar.h
===================================================================
RCS file: /cvsroot/syssrc/sys/dev/ic/osiopvar.h,v
retrieving revision 1.3
diff -u -r1.3 osiopvar.h
--- sys/dev/ic/osiopvar.h       2002/05/14 02:58:35     1.3
+++ sys/dev/ic/osiopvar.h       2002/11/14 16:25:04
@@ -65,14 +65,18 @@
 */

#define osiop_read_1(sc, reg)                                  \
-    bus_space_read_1((sc)->sc_bst, (sc)->sc_reg, reg)
+    bus_space_read_1((sc)->sc_bst, (sc)->sc_reg, reg ^ sc->sc_byteorder)
#define osiop_write_1(sc, reg, val)                            \
-    bus_space_write_1((sc)->sc_bst, (sc)->sc_reg, reg, val)
+    bus_space_write_1((sc)->sc_bst, (sc)->sc_reg, reg ^ sc->sc_byteorder, val)

#define osiop_read_4(sc, reg)                                  \
-    bus_space_read_4((sc)->sc_bst, (sc)->sc_reg, reg)
+    (sc->sc_byteorder ?                                                \
+     bswap32(bus_space_read_4((sc)->sc_bst, (sc)->sc_reg, reg)) :      \
+     bus_space_read_4((sc)->sc_bst, (sc)->sc_reg, reg))
+
#define osiop_write_4(sc, reg, val)                            \
-    bus_space_write_4((sc)->sc_bst, (sc)->sc_reg, reg, val)
+    bus_space_write_4((sc)->sc_bst, (sc)->sc_reg, reg,         \
+                       (sc->sc_byteorder ? bswap32(val) : val))

/*
 * The largest single request will be MAXPHYS bytes which will require
@@ -222,6 +226,12 @@

       int sc_clock_freq;
       int sc_tcp[4];
+       int sc_rev;
+#define OSIOP_VARIANT_NCR53C700        (0)
+#define OSIOP_VARIANT_NCR53C710        (1)
+       bus_size_t sc_byteorder;
+#define OSIOP_BYTEORDER_NATIVE         (0x00)
+#define OSIOP_BYTEORDER_NONNATIVE      (0x03)
       int sc_flags;
#define OSIOP_INTSOFF  0x80    /* Interrupts turned off */
#define OSIOP_INTDEFER 0x40    /* MD interrupt has been deferred */
Index: sys/kern/exec_elf_common.c
===================================================================
RCS file: /cvsroot/syssrc/sys/kern/exec_elf_common.c,v
retrieving revision 1.15
diff -u -r1.15 exec_elf_common.c
--- sys/kern/exec_elf_common.c  2002/05/31 16:49:12     1.15
+++ sys/kern/exec_elf_common.c  2002/11/14 16:25:06
@@ -62,6 +62,9 @@
int
exec_elf_setup_stack(struct proc *p, struct exec_package *epp)
{
+       u_long max_stack_size;
+       u_long access_linear_min, access_size;
+       u_long noaccess_linear_min, noaccess_size;

#ifndef        USRSTACK32
#define USRSTACK32     (0x00000000ffffffffL&~PGOFSET)
@@ -69,11 +72,13 @@

       if (epp->ep_flags & EXEC_32) {
               epp->ep_minsaddr = USRSTACK32;
-               epp->ep_maxsaddr = epp->ep_minsaddr - MAXSSIZ;
+               max_stack_size = MAXSSIZ;
       } else {
-               epp->ep_maxsaddr = USRSTACK - MAXSSIZ;
               epp->ep_minsaddr = USRSTACK;
+               max_stack_size = MAXSSIZ;
       }
+       epp->ep_maxsaddr = (u_long)STACK_GROW(epp->ep_minsaddr,
+               max_stack_size);
       epp->ep_ssize = p->p_rlimit[RLIMIT_STACK].rlim_cur;

       /*
@@ -83,15 +88,16 @@
        *
        * arguably, it could be made into one, but that would require the
        * addition of another mapping proc, which is unnecessary
-        *
-        * note that in memory, things assumed to be: 0 ... ep_maxsaddr
-        * <stack> ep_minsaddr
        */
-       NEW_VMCMD(&epp->ep_vmcmds, vmcmd_map_zero,
-           ((epp->ep_minsaddr - epp->ep_ssize) - epp->ep_maxsaddr),
-           epp->ep_maxsaddr, NULLVP, 0, VM_PROT_NONE);
-       NEW_VMCMD(&epp->ep_vmcmds, vmcmd_map_zero, epp->ep_ssize,
-           (epp->ep_minsaddr - epp->ep_ssize), NULLVP, 0,
+       access_size = epp->ep_ssize;
+       access_linear_min = (u_long)STACK_ALLOC(epp->ep_minsaddr, access_size);
+       noaccess_size = max_stack_size - access_size;
+       noaccess_linear_min = (u_long)STACK_ALLOC(STACK_GROW(epp->ep_minsaddr,
+           access_size), noaccess_size);
+       NEW_VMCMD(&epp->ep_vmcmds, vmcmd_map_zero, noaccess_size,
+           noaccess_linear_min, NULLVP, 0, VM_PROT_NONE);
+       NEW_VMCMD(&epp->ep_vmcmds, vmcmd_map_zero, access_size,
+           access_linear_min, NULLVP, 0,
           VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE);

       return 0;
Index: sys/kern/genassym.sh
===================================================================
RCS file: /cvsroot/syssrc/sys/kern/genassym.sh,v
retrieving revision 1.11
diff -u -r1.11 genassym.sh
--- sys/kern/genassym.sh        2001/09/24 00:20:11     1.11
+++ sys/kern/genassym.sh        2002/11/14 16:25:06
@@ -107,7 +107,10 @@
}

/^member[ \t]/ {
-       $0 = "define " $2 " offsetof(struct " structname ", " $2 ")";
+       if (NF > 2)
+               $0 = "define " $2 " offsetof(struct " structname ", " $3 ")";
+       else
+               $0 = "define " $2 " offsetof(struct " structname ", " $2 ")";
       # fall through
}

Index: sys/kern/init_main.c
===================================================================
RCS file: /cvsroot/syssrc/sys/kern/init_main.c,v
retrieving revision 1.201
diff -u -r1.201 init_main.c
--- sys/kern/init_main.c        2002/06/17 16:22:50     1.201
+++ sys/kern/init_main.c        2002/11/14 16:25:06
@@ -598,17 +598,17 @@
       /*
        * Need just enough stack to hold the faked-up "execve()" arguments.
        */
-       addr = USRSTACK - PAGE_SIZE;
+       addr = (vaddr_t)STACK_ALLOC(USRSTACK, PAGE_SIZE);
       if (uvm_map(&p->p_vmspace->vm_map, &addr, PAGE_SIZE,
                    NULL, UVM_UNKNOWN_OFFSET, 0,
                    UVM_MAPFLAG(UVM_PROT_ALL, UVM_PROT_ALL, UVM_INH_COPY,
                   UVM_ADV_NORMAL,
                    UVM_FLAG_FIXED|UVM_FLAG_OVERLAY|UVM_FLAG_COPYONW)) != 0)
               panic("init: couldn't allocate argument space");
-       p->p_vmspace->vm_maxsaddr = (caddr_t)addr;
+       p->p_vmspace->vm_maxsaddr = (caddr_t)STACK_MAX(addr, PAGE_SIZE);

       for (pathp = &initpaths[0]; (path = *pathp) != NULL; pathp++) {
-               ucp = (char *)(addr + PAGE_SIZE);
+               ucp = (char *)USRSTACK;

               /*
                * Construct the boot flag argument.
@@ -637,8 +637,9 @@
#ifdef DEBUG
                       printf("init: copying out flags `%s' %d\n", flags, i);
#endif
-                       (void)copyout((caddr_t)flags, (caddr_t)(ucp -= i), i);
-                       arg1 = ucp;
+                       arg1 = STACK_ALLOC(ucp, i);
+                       ucp = STACK_MAX(arg1, i);
+                       (void)copyout((caddr_t)flags, arg1, i);
               }

               /*
@@ -648,29 +649,27 @@
#ifdef DEBUG
               printf("init: copying out path `%s' %d\n", path, i);
#endif
-               (void)copyout((caddr_t)path, (caddr_t)(ucp -= i), i);
-               arg0 = ucp;
+               arg0 = STACK_ALLOC(ucp, i);
+               ucp = STACK_MAX(arg0, i);
+               (void)copyout((caddr_t)path, arg0, i);

               /*
                * Move out the arg pointers.
                */
-               uap = (char **)((long)ucp & ~ALIGNBYTES);
-               (void)suword((caddr_t)--uap, 0);        /* terminator */
-               if (options != 0)
-                       (void)suword((caddr_t)--uap, (long)arg1);
+               ucp = (caddr_t)STACK_ALIGN(ucp, ALIGNBYTES);
+               uap = (char **)STACK_ALLOC(ucp, sizeof(char *) * 3);
+               SCARG(&args, path) = arg0;
+               SCARG(&args, argp) = uap;
+               SCARG(&args, envp) = NULL;
               slash = strrchr(path, '/');
               if (slash)
-                       (void)suword((caddr_t)--uap,
+                       (void)suword((caddr_t)uap++,
                           (long)arg0 + (slash + 1 - path));
               else
-                       (void)suword((caddr_t)--uap, (long)arg0);
-
-               /*
-                * Point at the arguments.
-                */
-               SCARG(&args, path) = arg0;
-               SCARG(&args, argp) = uap;
-               SCARG(&args, envp) = NULL;
+                       (void)suword((caddr_t)uap++, (long)arg0);
+               if (options != 0)
+                       (void)suword((caddr_t)uap++, (long)arg1);
+               (void)suword((caddr_t)uap++, 0);        /* terminator */

               /*
                * Now try to exec the program.  If can't for any reason
Index: sys/kern/kern_exec.c
===================================================================
RCS file: /cvsroot/syssrc/sys/kern/kern_exec.c,v
retrieving revision 1.152
diff -u -r1.152 kern_exec.c
--- sys/kern/kern_exec.c        2002/04/23 15:11:25     1.152
+++ sys/kern/kern_exec.c        2002/11/14 16:25:07
@@ -545,7 +545,36 @@
       arginfo.ps_nargvstr = argc;
       arginfo.ps_nenvstr = envc;

-       stack = (char *) (vm->vm_minsaddr - len);
+       stack = (char *)STACK_ALLOC(STACK_GROW(vm->vm_minsaddr,
+               sizeof(struct ps_strings) + szsigcode),
+               len - (sizeof(struct ps_strings) + szsigcode));
+#ifdef __MACHINE_STACK_GROWS_UP
+       /*
+        * The copyargs call always copies into lower addresses
+        * first, moving towards higher addresses, starting with
+        * the stack pointer that we give.  When the stack grows
+        * down, this puts argc/argv/envp very shallow on the
+        * stack, right at the first user stack pointer, and puts
+        * STACKGAPLEN very deep in the stack.  When the stack
+        * grows up, the situation is reversed.
+        *
+        * Normally, this is no big deal.  But the ld_elf.so _rtld()
+        * function expects to be called with a single pointer to
+        * a region that has a few words it can stash values into,
+        * followed by argc/argv/envp.  When the stack grows down,
+        * it's easy to decrement the stack pointer a little bit to
+        * allocate the space for these few words and pass the new
+        * stack pointer to _rtld.  When the stack grows up, however,
+        * a few words before argc is part of the signal trampoline,
+        * so we have a problem.
+        *
+        * Instead of changing how _rtld works, we take the easy way
+        * out and steal 32 bytes before we call copyargs.  This
+        * space is effectively stolen from STACKGAPLEN.
+        */
+       stack += 32;
+#endif /* __MACHINE_STACK_GROWS_UP */
+
       /* Now copy argc, args & environ to new stack */
       error = (*pack.ep_es->es_copyargs)(&pack, &arginfo, &stack, argp);
       if (error) {
@@ -553,11 +582,11 @@
               goto exec_abort;
       }
       /* Move the stack back to original point */
-       stack = (char *) (vm->vm_minsaddr - len);
+       stack = (char *)STACK_GROW(vm->vm_minsaddr, len);

       /* fill process ps_strings info */
-       p->p_psstr = (struct ps_strings *)(vm->vm_minsaddr
-               - sizeof(struct ps_strings));
+       p->p_psstr = (struct ps_strings *)STACK_ALLOC(vm->vm_minsaddr,
+           sizeof(struct ps_strings));
       p->p_psargv = offsetof(struct ps_strings, ps_argvstr);
       p->p_psnargv = offsetof(struct ps_strings, ps_nargvstr);
       p->p_psenv = offsetof(struct ps_strings, ps_envstr);
@@ -573,9 +602,10 @@

       /* copy out the process's signal trapoline code */
       if (szsigcode) {
+               p->p_sigctx.ps_sigcode = STACK_ALLOC(STACK_MAX(p->p_psstr,
+                   sizeof(struct ps_strings)), szsigcode);
               if ((error = copyout((char *)pack.ep_es->es_emul->e_sigcode,
-                   p->p_sigctx.ps_sigcode = (char *)p->p_psstr - szsigcode,
-                   szsigcode)) != 0) {
+                   p->p_sigctx.ps_sigcode, szsigcode)) != 0) {
                       DPRINTF(("execve: sig trampoline copyout failed\n"));
                       goto exec_abort;
               }
Index: sys/sys/cdefs_elf.h
===================================================================
RCS file: /cvsroot/syssrc/sys/sys/cdefs_elf.h,v
retrieving revision 1.11
diff -u -r1.11 cdefs_elf.h
--- sys/sys/cdefs_elf.h 2002/01/27 07:19:25     1.11
+++ sys/sys/cdefs_elf.h 2002/11/14 16:25:08
@@ -38,6 +38,14 @@
#define _C_LABEL_STRING(x)     x
#endif

+#ifdef __ASM_DELIMITER
+#ifndef __STDC__
+#error "__ASM_DELIMITER needs __STDC__"
+#endif
+#else
+#define __ASM_DELIMITER " ; "
+#endif
+
#if __STDC__
#define        ___RENAME(x)    __asm__(___STRING(_C_LABEL(x)))
#else
@@ -59,13 +67,13 @@

#ifndef __DO_NOT_DO_WEAK__
#define        __weak_alias(alias,sym)                                         \
-    __asm__(".weak " _C_LABEL_STRING(#alias) " ; "                     \
+    __asm__(".weak " _C_LABEL_STRING(#alias) __ASM_DELIMITER           \
           _C_LABEL_STRING(#alias) " = " _C_LABEL_STRING(#sym));
#endif /* !__DO_NOT_DO_WEAK__ */
#define        __weak_extern(sym)                                              \
    __asm__(".weak " _C_LABEL_STRING(#sym));
#define        __warn_references(sym,msg)                                      \
-    __asm__(".section .gnu.warning." #sym " ; .ascii \"" msg "\" ; .text");
+    __asm__(".section .gnu.warning." #sym __ASM_DELIMITER ".ascii \"" msg "\"" __ASM_DELIMITER ".text");

#else /* !__STDC__ */

@@ -94,7 +102,7 @@

#if __STDC__
#define        __SECTIONSTRING(_sec, _str)                                     \
-       __asm__(".section " #_sec " ; .asciz \"" _str "\" ; .text")
+       __asm__(".section " #_sec __ASM_DELIMITER ".asciz \"" _str "\"" __ASM_DELIMITER ".text")
#else
#define        __SECTIONSTRING(_sec, _str)                                     \
       __asm__(".section _sec ; .asciz _str ; .text")
Index: sys/sys/param.h
===================================================================
RCS file: /cvsroot/syssrc/sys/sys/param.h,v
retrieving revision 1.143
diff -u -r1.143 param.h
--- sys/sys/param.h     2002/07/06 01:31:33     1.143
+++ sys/sys/param.h     2002/11/14 16:25:08
@@ -145,6 +145,37 @@
#include <machine/limits.h>

/*
+ * Stack macros.  On most architectures, the stack grows down,
+ * towards lower addresses; it is the rare architecture where
+ * it grows up, towards higher addresses.
+ *
+ * STACK_GROW and STACK_SHRINK adjust a stack pointer by some
+ * size, no questions asked.  STACK_ALIGN aligns a stack pointer.
+ *
+ * STACK_ALLOC returns a pointer to allocated stack space of
+ * some size; given such a pointer and a size, STACK_MAX gives
+ * the maximum (in the "maxsaddr" sense) stack address of the
+ * allocated memory.
+ */
+#ifdef _KERNEL
+#ifdef __MACHINE_STACK_GROWS_UP
+#define        STACK_GROW(sp, _size)           (((caddr_t)(sp)) + (_size))
+#define        STACK_SHRINK(sp, _size)         (((caddr_t)(sp)) - (_size))
+#define        STACK_ALIGN(sp, bytes)  \
+       ((caddr_t)((((unsigned long)(sp)) + (bytes)) & ~(bytes)))
+#define        STACK_ALLOC(sp, _size)          ((caddr_t)(sp))
+#define        STACK_MAX(p, _size)             (((caddr_t)(p)) + (_size))
+#else
+#define        STACK_GROW(sp, _size)           (((caddr_t)(sp)) - (_size))
+#define        STACK_SHRINK(sp, _size)         (((caddr_t)(sp)) + (_size))
+#define        STACK_ALIGN(sp, bytes)  \
+       ((caddr_t)(((unsigned long)(sp)) & ~(bytes)))
+#define        STACK_ALLOC(sp, _size)          (((caddr_t)(sp)) - (_size))
+#define        STACK_MAX(p, _size)             ((caddr_t)(p))
+#endif
+#endif /* _KERNEL */
+
+/*
 * Priorities.  Note that with 32 run queues, differences less than 4 are
 * insignificant.
 */
Index: sys/ufs/ext2fs/ext2fs_subr.c
===================================================================
RCS file: /cvsroot/syssrc/sys/ufs/ext2fs/ext2fs_subr.c,v
retrieving revision 1.6
diff -u -r1.6 ext2fs_subr.c
--- sys/ufs/ext2fs/ext2fs_subr.c        2001/11/08 02:39:07     1.6
+++ sys/ufs/ext2fs/ext2fs_subr.c        2002/11/14 16:25:09
@@ -112,7 +112,7 @@
               vprint("Disk overlap", vp);
               printf("\tstart %d, end %d overlap start %d, end %ld\n",
                       start, last, ep->b_blkno,
-                       ep->b_blkno + btodb(ep->b_bcount) - 1);
+                       (long) ep->b_blkno + btodb(ep->b_bcount) - 1);
               panic("Disk buffer overlap");
       }
}