386BSD 0.1 development
authorWilliam F. Jolitz <wjolitz@soda.berkeley.edu>
Tue, 24 Dec 1991 22:23:49 +0000 (14:23 -0800)
committerWilliam F. Jolitz <wjolitz@soda.berkeley.edu>
Tue, 24 Dec 1991 22:23:49 +0000 (14:23 -0800)
Work on file usr/src/sys.386bsd/i386/i386/swapgeneric.c
Work on file usr/src/sys.386bsd/i386/i386/mem.c
Work on file usr/src/sys.386bsd/i386/i386/dkbad.c
Work on file usr/src/sys.386bsd/i386/i386/in_cksum.c
Work on file usr/src/sys.386bsd/i386/i386/cons.h
Work on file usr/src/sys.386bsd/i386/include/dkio.h
Work on file usr/src/sys.386bsd/i386/include/types.h
Work on file usr/src/sys.386bsd/i386/include/endian.h
Work on file usr/src/sys.386bsd/i386/include/stdarg.h
Work on file usr/src/sys.386bsd/i386/include/cpu.h
Work on file usr/src/sys.386bsd/i386/include/trap.h
Work on file usr/src/sys.386bsd/i386/include/frame.h
Work on file usr/src/sys.386bsd/i386/include/ansi.h
Work on file usr/src/sys.386bsd/i386/include/tss.h
Work on file usr/src/sys.386bsd/i386/include/float.h
Work on file usr/src/sys.386bsd/i386/include/proc.h
Work on file usr/src/sys.386bsd/i386/include/pte.h
Work on file usr/src/sys.386bsd/i386/include/reg.h
Work on file usr/src/sys.386bsd/i386/include/specialreg.h
Work on file usr/src/sys.386bsd/i386/isa/clock.c
Work on file usr/src/sys.386bsd/i386/i386/sys_machdep.c
Work on file usr/src/sys.386bsd/i386/isa/fdreg.h
Work on file usr/src/sys.386bsd/i386/isa/isa_device.h
Work on file usr/src/sys.386bsd/i386/isa/comreg.h
Work on file usr/src/sys.386bsd/i386/isa/wtreg.h
Work on file usr/src/sys.386bsd/i386/isa/ic/ds8390.h
Work on file usr/src/sys.386bsd/i386/isa/ic/ns16550.h
Work on file usr/src/sys.386bsd/i386/isa/ic/ns16450.h

Co-Authored-By: Lynne Greer Jolitz <ljolitz@cardio.ucsf.edu>
Synthesized-from: 386BSD-0.1

28 files changed:
usr/src/sys.386bsd/i386/i386/cons.h [new file with mode: 0644]
usr/src/sys.386bsd/i386/i386/dkbad.c [new file with mode: 0644]
usr/src/sys.386bsd/i386/i386/in_cksum.c [new file with mode: 0644]
usr/src/sys.386bsd/i386/i386/mem.c [new file with mode: 0644]
usr/src/sys.386bsd/i386/i386/swapgeneric.c [new file with mode: 0644]
usr/src/sys.386bsd/i386/i386/sys_machdep.c [new file with mode: 0644]
usr/src/sys.386bsd/i386/include/ansi.h [new file with mode: 0644]
usr/src/sys.386bsd/i386/include/cpu.h [new file with mode: 0644]
usr/src/sys.386bsd/i386/include/dkio.h [new file with mode: 0644]
usr/src/sys.386bsd/i386/include/endian.h [new file with mode: 0644]
usr/src/sys.386bsd/i386/include/float.h [new file with mode: 0644]
usr/src/sys.386bsd/i386/include/frame.h [new file with mode: 0644]
usr/src/sys.386bsd/i386/include/proc.h [new file with mode: 0644]
usr/src/sys.386bsd/i386/include/pte.h [new file with mode: 0644]
usr/src/sys.386bsd/i386/include/reg.h [new file with mode: 0644]
usr/src/sys.386bsd/i386/include/specialreg.h [new file with mode: 0644]
usr/src/sys.386bsd/i386/include/stdarg.h [new file with mode: 0644]
usr/src/sys.386bsd/i386/include/trap.h [new file with mode: 0644]
usr/src/sys.386bsd/i386/include/tss.h [new file with mode: 0644]
usr/src/sys.386bsd/i386/include/types.h [new file with mode: 0644]
usr/src/sys.386bsd/i386/isa/clock.c [new file with mode: 0644]
usr/src/sys.386bsd/i386/isa/comreg.h [new file with mode: 0644]
usr/src/sys.386bsd/i386/isa/fdreg.h [new file with mode: 0644]
usr/src/sys.386bsd/i386/isa/ic/ds8390.h [new file with mode: 0644]
usr/src/sys.386bsd/i386/isa/ic/ns16450.h [new file with mode: 0644]
usr/src/sys.386bsd/i386/isa/ic/ns16550.h [new file with mode: 0644]
usr/src/sys.386bsd/i386/isa/isa_device.h [new file with mode: 0644]
usr/src/sys.386bsd/i386/isa/wtreg.h [new file with mode: 0644]

diff --git a/usr/src/sys.386bsd/i386/i386/cons.h b/usr/src/sys.386bsd/i386/i386/cons.h
new file mode 100644 (file)
index 0000000..b3c7064
--- /dev/null
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 1988 University of Utah.
+ * Copyright (c) 1991 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * the Systems Programming Group of the University of Utah Computer
+ * Science Department.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *     This product includes software developed by the University of
+ *     California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *     @(#)cons.h      7.2 (Berkeley) 5/9/91
+ */
+
+
+struct consdev {
+       int     (*cn_probe)();  /* probe hardware and fill in consdev info */
+       int     (*cn_init)();   /* turn on as console */
+       int     (*cn_getc)();   /* kernel getchar interface */
+       int     (*cn_putc)();   /* kernel putchar interface */
+       struct  tty *cn_tp;     /* tty structure for console device */
+       dev_t   cn_dev;         /* major/minor of device */
+       short   cn_pri;         /* pecking order; the higher the better */
+};
+
+/* values for cn_pri - reflect our policy for console selection */
+#define        CN_DEAD         0       /* device doesn't exist */
+#define CN_NORMAL      1       /* device exists but is nothing special */
+#define CN_INTERNAL    2       /* "internal" bit-mapped display */
+#define CN_REMOTE      3       /* serial interface with remote bit set */
+
+/* XXX */
+#define        CONSMAJOR       0
+
+#ifdef KERNEL
+extern struct consdev constab[];
+extern struct consdev *cn_tab;
+extern struct tty *cn_tty;
+#endif
diff --git a/usr/src/sys.386bsd/i386/i386/dkbad.c b/usr/src/sys.386bsd/i386/i386/dkbad.c
new file mode 100644 (file)
index 0000000..6974af1
--- /dev/null
@@ -0,0 +1,67 @@
+/*-
+ * Copyright (c) 1990 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * William Jolitz.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *     This product includes software developed by the University of
+ *     California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *     @(#)dkbad.c     5.4 (Berkeley) 1/19/91
+ */
+
+
+#ifndef NOBADSECT
+#include "sys/param.h"
+#include "sys/buf.h"
+#include "sys/dkbad.h"
+
+/*
+ * Search the bad sector table looking for
+ * the specified sector.  Return index if found.
+ * Return -1 if not found.
+ */
+
+isbad(bt, cyl, trk, sec)
+       register struct dkbad *bt;
+{
+       register int i;
+       register long blk, bblk;
+
+       blk = ((long)cyl << 16) + (trk << 8) + sec;
+       for (i = 0; i < 126; i++) {
+               bblk = ((long)bt->bt_bad[i].bt_cyl << 16) + bt->bt_bad[i].bt_trksec;
+               if (blk == bblk)
+                       return (i);
+               if (blk < bblk || bblk < 0)
+                       break;
+       }
+       return (-1);
+}
+#endif
diff --git a/usr/src/sys.386bsd/i386/i386/in_cksum.c b/usr/src/sys.386bsd/i386/i386/in_cksum.c
new file mode 100644 (file)
index 0000000..e93b2df
--- /dev/null
@@ -0,0 +1,130 @@
+/*-
+ * Copyright (c) 1990 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *     This product includes software developed by the University of
+ *     California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * from tahoe: in_cksum.c      1.2     86/01/05
+ *     @(#)in_cksum.c  1.3 (Berkeley) 1/19/91
+ */
+
+#include "param.h"
+#include "sys/mbuf.h"
+#include "netinet/in.h"
+#include "netinet/in_systm.h"
+
+/*
+ * Checksum routine for Internet Protocol family headers.
+ *
+ * This routine is very heavily used in the network
+ * code and should be modified for each CPU to be as fast as possible.
+ * 
+ * This implementation is 386 version.
+ */
+
+#undef ADDCARRY
+#define ADDCARRY(sum)  {                               \
+                       if (sum & 0xffff0000) {         \
+                               sum &= 0xffff;          \
+                               sum++;                  \
+                       }                               \
+               }
+in_cksum(m, len)
+       register struct mbuf *m;
+       register int len;
+{
+       union word {
+               char    c[2];
+               u_short s;
+       } u;
+       register u_short *w;
+       register int sum = 0;
+       register int mlen = 0;
+
+       for (;m && len; m = m->m_next) {
+               if (m->m_len == 0)
+                       continue;
+               w = mtod(m, u_short *);
+               if (mlen == -1) {
+                       /*
+                        * The first byte of this mbuf is the continuation
+                        * of a word spanning between this mbuf and the
+                        * last mbuf.
+                        */
+
+                       /* u.c[0] is already saved when scanning previous 
+                        * mbuf.
+                        */
+                       u.c[1] = *(u_char *)w;
+                       sum += u.s;
+                       ADDCARRY(sum);
+                       w = (u_short *)((char *)w + 1);
+                       mlen = m->m_len - 1;
+                       len--;
+               } else
+                       mlen = m->m_len;
+
+               if (len < mlen)
+                       mlen = len;
+               len -= mlen;
+
+               /*
+                * add by words.
+                */
+               while ((mlen -= 2) >= 0) {
+                       if ((int)w & 0x1) {
+                               /* word is not aligned */
+                               u.c[0] = *(char *)w;
+                               u.c[1] = *((char *)w+1);
+                               sum += u.s;
+                               w++;
+                       } else
+                               sum += *w++;
+                       ADDCARRY(sum);
+               }
+               if (mlen == -1)
+                       /*
+                        * This mbuf has odd number of bytes. 
+                        * There could be a word split betwen
+                        * this mbuf and the next mbuf.
+                        * Save the last byte (to prepend to next mbuf).
+                        */
+                       u.c[0] = *(u_char *)w;
+       }
+       if (len)
+               printf("cksum: out of data\n");
+       if (mlen == -1) {
+               /* The last mbuf has odd # of bytes. Follow the
+                  standard (the odd byte is shifted left by 8 bits) */
+               u.c[1] = 0;
+               sum += u.s;
+               ADDCARRY(sum);
+       }
+       return (~sum & 0xffff);
+}
diff --git a/usr/src/sys.386bsd/i386/i386/mem.c b/usr/src/sys.386bsd/i386/i386/mem.c
new file mode 100644 (file)
index 0000000..650e21e
--- /dev/null
@@ -0,0 +1,191 @@
+/*-
+ * Copyright (c) 1988 University of Utah.
+ * Copyright (c) 1982, 1986, 1990 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * the Systems Programming Group of the University of Utah Computer
+ * Science Department, and code derived from software contributed to
+ * Berkeley by William Jolitz.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *     This product includes software developed by the University of
+ *     California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * from: Utah $Hdr: mem.c 1.13 89/10/08$
+ *     @(#)mem.c       7.2 (Berkeley) 5/9/91
+ */
+
+/*
+ * Memory special file
+ */
+
+#include "param.h"
+#include "conf.h"
+#include "buf.h"
+#include "systm.h"
+#include "uio.h"
+#include "malloc.h"
+
+#include "machine/cpu.h"
+
+#include "vm/vm_param.h"
+#include "vm/lock.h"
+#include "vm/vm_statistics.h"
+#include "vm/pmap.h"
+#include "vm/vm_prot.h"
+
+extern        char *vmmap;            /* poor name! */
+/*ARGSUSED*/
+mmrw(dev, uio, flags)
+       dev_t dev;
+       struct uio *uio;
+       int flags;
+{
+       register int o;
+       register u_int c, v;
+       register struct iovec *iov;
+       int error = 0;
+       caddr_t zbuf = NULL;
+
+       while (uio->uio_resid > 0 && error == 0) {
+               iov = uio->uio_iov;
+               if (iov->iov_len == 0) {
+                       uio->uio_iov++;
+                       uio->uio_iovcnt--;
+                       if (uio->uio_iovcnt < 0)
+                               panic("mmrw");
+                       continue;
+               }
+               switch (minor(dev)) {
+
+/* minor device 0 is physical memory */
+               case 0:
+                       v = uio->uio_offset;
+                       pmap_enter(pmap_kernel(), vmmap, v,
+                               uio->uio_rw == UIO_READ ? VM_PROT_READ : VM_PROT_WRITE,
+                               TRUE);
+                       o = (int)uio->uio_offset & PGOFSET;
+                       c = (u_int)(NBPG - ((int)iov->iov_base & PGOFSET));
+                       c = MIN(c, (u_int)(NBPG - o));
+                       c = MIN(c, (u_int)iov->iov_len);
+                       error = uiomove((caddr_t)&vmmap[o], (int)c, uio);
+                       pmap_remove(pmap_kernel(), vmmap, &vmmap[NBPG]);
+                       continue;
+
+/* minor device 1 is kernel memory */
+               case 1:
+                       c = iov->iov_len;
+                       if (!kernacc((caddr_t)uio->uio_offset, c,
+                           uio->uio_rw == UIO_READ ? B_READ : B_WRITE))
+                               return(EFAULT);
+                       error = uiomove((caddr_t)uio->uio_offset, (int)c, uio);
+                       continue;
+
+/* minor device 2 is EOF/RATHOLE */
+               case 2:
+                       if (uio->uio_rw == UIO_READ)
+                               return (0);
+                       c = iov->iov_len;
+                       break;
+
+/* minor device 12 (/dev/zero) is source of nulls on read, rathole on write */
+               case 12:
+                       if (uio->uio_rw == UIO_WRITE) {
+                               c = iov->iov_len;
+                               break;
+                       }
+                       if (zbuf == NULL) {
+                               zbuf = (caddr_t)
+                                   malloc(CLBYTES, M_TEMP, M_WAITOK);
+                               bzero(zbuf, CLBYTES);
+                       }
+                       c = MIN(iov->iov_len, CLBYTES);
+                       error = uiomove(zbuf, (int)c, uio);
+                       continue;
+
+#ifdef notyet
+/* 386 I/O address space (/dev/ioport[bwl]) is a read/write access to seperate
+   i/o device address bus, different than memory bus. Semantics here are
+   very different than ordinary read/write, as if iov_len is a multiple
+   an implied string move from a single port will be done. Note that lseek
+   must be used to set the port number reliably. */
+               case 14:
+                       if (iov->iov_len == 1) {
+                               u_char tmp;
+                               tmp = inb(uio->uio_offset);
+                               error = uiomove (&tmp, iov->iov_len, uio);
+                       } else {
+                               if (!useracc((caddr_t)iov->iov_base,
+                                       iov->iov_len, uio->uio_rw))
+                                       return (EFAULT);
+                               insb(uio->uio_offset, iov->iov_base,
+                                       iov->iov_len);
+                       }
+                       break;
+               case 15:
+                       if (iov->iov_len == sizeof (short)) {
+                               u_short tmp;
+                               tmp = inw(uio->uio_offset);
+                               error = uiomove (&tmp, iov->iov_len, uio);
+                       } else {
+                               if (!useracc((caddr_t)iov->iov_base,
+                                       iov->iov_len, uio->uio_rw))
+                                       return (EFAULT);
+                               insw(uio->uio_offset, iov->iov_base,
+                                       iov->iov_len/ sizeof (short));
+                       }
+                       break;
+               case 16:
+                       if (iov->iov_len == sizeof (long)) {
+                               u_long tmp;
+                               tmp = inl(uio->uio_offset);
+                               error = uiomove (&tmp, iov->iov_len, uio);
+                       } else {
+                               if (!useracc((caddr_t)iov->iov_base,
+                                       iov->iov_len, uio->uio_rw))
+                                       return (EFAULT);
+                               insl(uio->uio_offset, iov->iov_base,
+                                       iov->iov_len/ sizeof (long));
+                       }
+                       break;
+#endif
+
+               default:
+                       return (ENXIO);
+               }
+               if (error)
+                       break;
+               iov->iov_base += c;
+               iov->iov_len -= c;
+               uio->uio_offset += c;
+               uio->uio_resid -= c;
+       }
+       if (zbuf)
+               free(zbuf, M_TEMP);
+       return (error);
+}
diff --git a/usr/src/sys.386bsd/i386/i386/swapgeneric.c b/usr/src/sys.386bsd/i386/i386/swapgeneric.c
new file mode 100644 (file)
index 0000000..0d76e72
--- /dev/null
@@ -0,0 +1,166 @@
+/*-
+ * Copyright (c) 1990 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * William Jolitz.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *     This product includes software developed by the University of
+ *     California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *     @(#)swapgeneric.c       5.5 (Berkeley) 5/9/91
+ */
+
+#include "machine/pte.h"
+
+#include "sys/param.h"
+#include "sys/conf.h"
+#include "sys/buf.h"
+#include "sys/vm.h"
+#include "sys/systm.h"
+#include "sys/reboot.h"
+
+/*
+ * Generic configuration;  all in one
+ */
+dev_t  rootdev = makedev(0,0);
+dev_t  dumpdev = makedev(0,1);
+int    nswap;
+struct swdevt swdevt[] = {
+       { 1,    0,      0 },
+       { 0,    1,      0 },
+};
+long   dumplo;
+int    dmmin, dmmax, dmtext;
+
+extern struct driver wddriver;
+
+struct genericconf {
+       caddr_t gc_driver;
+       char    *gc_name;
+       dev_t   gc_root;
+} genericconf[] = {
+       { (caddr_t)&wddriver,   "wd",   makedev(0, 0),  },
+       { 0 },
+};
+
+setconf()
+{
+#ifdef notdef
+       register struct genericconf *gc;
+       int unit, swaponroot = 0;
+
+       if (rootdev != NODEV)
+               goto doswap;
+       if (boothowto & RB_ASKNAME) {
+               char name[128];
+retry:
+               printf("root device? ");
+               gets(name);
+               for (gc = genericconf; gc->gc_driver; gc++)
+                       if (gc->gc_name[0] == name[0] &&
+                           gc->gc_name[1] == name[1])
+                               goto gotit;
+               goto bad;
+gotit:
+               if (name[3] == '*') {
+                       name[3] = name[4];
+                       swaponroot++;
+               }
+               if (name[2] >= '0' && name[2] <= '7' && name[3] == 0) {
+                       unit = name[2] - '0';
+                       goto found;
+               }
+               printf("bad/missing unit number\n");
+bad:
+               printf("use dk%%d\n");
+               goto retry;
+       }
+       unit = 0;
+       for (gc = genericconf; gc->gc_driver; gc++) {
+               for (ui = vbdinit; ui->ui_driver; ui++) {
+                       if (ui->ui_alive == 0)
+                               continue;
+                       if (ui->ui_unit == 0 && ui->ui_driver ==
+                           (struct vba_driver *)gc->gc_driver) {
+                               printf("root on %s0\n",
+                                   ui->ui_driver->ud_dname);
+                               goto found;
+                       }
+               }
+       }
+       printf("no suitable root\n");
+       asm("halt");
+found:
+       gc->gc_root = makedev(major(gc->gc_root), unit*8);
+       rootdev = gc->gc_root;
+doswap:
+       swdevt[0].sw_dev = argdev = dumpdev =
+           makedev(major(rootdev), minor(rootdev)+1);
+       /* swap size and dumplo set during autoconfigure */
+       if (swaponroot)
+               rootdev = dumpdev;
+#endif
+}
+
+gets(cp)
+       char *cp;
+{
+       register char *lp;
+       register c;
+
+       lp = cp;
+       for (;;) {
+               printf("%c", c = cngetc()&0177);
+               switch (c) {
+               case '\n':
+               case '\r':
+                       *lp++ = '\0';
+                       return;
+               case '\b':
+               case '\177':
+                       if (lp > cp) {
+                               printf(" \b");
+                               lp--;
+                       }
+                       continue;
+               case '#':
+                       lp--;
+                       if (lp < cp)
+                               lp = cp;
+                       continue;
+               case '@':
+               case 'u'&037:
+                       lp = cp;
+                       printf("%c", '\n');
+                       continue;
+               default:
+                       *lp++ = c;
+               }
+       }
+}
diff --git a/usr/src/sys.386bsd/i386/i386/sys_machdep.c b/usr/src/sys.386bsd/i386/i386/sys_machdep.c
new file mode 100644 (file)
index 0000000..10b9ac2
--- /dev/null
@@ -0,0 +1,105 @@
+
+/*-
+ * Copyright (c) 1990 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * William Jolitz.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *     This product includes software developed by the University of
+ *     California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *     @(#)sys_machdep.c       5.5 (Berkeley) 1/19/91
+ */
+
+#include "param.h"
+#include "systm.h"
+#include "ioctl.h"
+#include "file.h"
+#include "time.h"
+#include "proc.h"
+#include "uio.h"
+#include "kernel.h"
+#include "mtio.h"
+#include "buf.h"
+#include "trace.h"
+
+#ifdef TRACE
+int    nvualarm;
+
+vtrace(p, uap, retval)
+       struct proc *p;
+       register struct args {
+               int     request;
+               int     value;
+       } *uap;
+       int *retval;
+{
+       int vdoualarm();
+
+       switch (uap->request) {
+
+       case VTR_DISABLE:               /* disable a trace point */
+       case VTR_ENABLE:                /* enable a trace point */
+               if (uap->value < 0 || uap->value >= TR_NFLAGS)
+                       return (EINVAL);
+               *retval = traceflags[uap->value];
+               traceflags[uap->value] = uap->request;
+               break;
+
+       case VTR_VALUE:         /* return a trace point setting */
+               if (uap->value < 0 || uap->value >= TR_NFLAGS)
+                       return (EINVAL);
+               *retval = traceflags[uap->value];
+               break;
+
+       case VTR_UALARM:        /* set a real-time ualarm, less than 1 min */
+               if (uap->value <= 0 || uap->value > 60 * hz || nvualarm > 5)
+                       return (EINVAL);
+               nvualarm++;
+               timeout(vdoualarm, (caddr_t)p->p_pid, uap->value);
+               break;
+
+       case VTR_STAMP:
+               trace(TR_STAMP, uap->value, p->p_pid);
+               break;
+       }
+       return (0);
+}
+
+vdoualarm(arg)
+       int arg;
+{
+       register struct proc *p;
+
+       p = pfind(arg);
+       if (p)
+               psignal(p, 16);
+       nvualarm--;
+}
+#endif
diff --git a/usr/src/sys.386bsd/i386/include/ansi.h b/usr/src/sys.386bsd/i386/include/ansi.h
new file mode 100644 (file)
index 0000000..ca67748
--- /dev/null
@@ -0,0 +1,57 @@
+/*-
+ * Copyright (c) 1990 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *     This product includes software developed by the University of
+ *     California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *     @(#)ansi.h      7.1 (Berkeley) 3/9/91
+ */
+
+#ifndef        _ANSI_H_
+#define        _ANSI_H_
+
+/*
+ * Types which are fundamental to the implementation and may appear in
+ * more than one standard header are defined here.  Standard headers
+ * then use:
+ *     #ifdef  _SIZE_T_
+ *     typedef _SIZE_T_ size_t;
+ *     #undef  _SIZE_T_
+ *     #endif
+ *
+ * Thanks, ANSI!
+ */
+#define        _CLOCK_T_       unsigned long           /* clock() */
+#define        _PTRDIFF_T_     int                     /* ptr1 - ptr2 */
+#define        _SIZE_T_        unsigned int            /* sizeof() */
+#define        _TIME_T_        long                    /* time() */
+#define        _VA_LIST_       char *                  /* va_list */
+#define        _WCHAR_T_       unsigned short          /* wchar_t */
+
+#endif /* _ANSI_H_ */
diff --git a/usr/src/sys.386bsd/i386/include/cpu.h b/usr/src/sys.386bsd/i386/include/cpu.h
new file mode 100644 (file)
index 0000000..583d76c
--- /dev/null
@@ -0,0 +1,108 @@
+/*-
+ * Copyright (c) 1990 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * William Jolitz.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *     This product includes software developed by the University of
+ *     California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *     @(#)cpu.h       5.4 (Berkeley) 5/9/91
+ */
+
+/*
+ * Definitions unique to i386 cpu support.
+ */
+#include "machine/frame.h"
+#include "machine/segments.h"
+
+/*
+ * definitions of cpu-dependent requirements
+ * referenced in generic code
+ */
+#undef COPY_SIGCODE            /* don't copy sigcode above user stack in exec */
+
+/*
+ * function vs. inline configuration;
+ * these are defined to get generic functions
+ * rather than inline or machine-dependent implementations
+ */
+#define        NEED_MINMAX             /* need {,i,l,ul}{min,max} functions */
+#define        NEED_FFS                /* need ffs function */
+#define        NEED_BCMP               /* need bcmp function */
+#define        NEED_STRLEN             /* need strlen function */
+
+#define        cpu_exec(p)     /* nothing */
+
+/*
+ * Arguments to hardclock, softclock and gatherstats
+ * encapsulate the previous machine state in an opaque
+ * clockframe; for now, use generic intrframe.
+ */
+typedef struct intrframe clockframe;
+
+#define        CLKF_USERMODE(framep)   (ISPL((framep)->if_cs) == SEL_UPL)
+#define        CLKF_BASEPRI(framep)    ((framep)->if_ppl == 0)
+#define        CLKF_PC(framep)         ((framep)->if_eip)
+
+#define        resettodr()     /* no todr to set */
+
+/*
+ * Preempt the current process if in interrupt from user mode,
+ * or after the current trap/syscall if in system mode.
+ */
+#define        need_resched()  { want_resched++; aston(); }
+
+/*
+ * Give a profiling tick to the current process from the softclock
+ * interrupt.  On tahoe, request an ast to send us through trap(),
+ * marking the proc as needing a profiling tick.
+ */
+#define        profile_tick(p, framep) { (p)->p_flag |= SOWEUPC; aston(); }
+
+/*
+ * Notify the current process (p) that it has a signal pending,
+ * process as soon as possible.
+ */
+#define        signotify(p)    aston()
+
+#define aston() (astpending++)
+
+int    astpending;             /* need to trap before returning to user mode */
+int    want_resched;           /* resched() was called */
+
+/*
+ * Kinds of processor
+ */
+
+#define        CPU_386SX       0
+#define        CPU_386         1
+#define        CPU_486SX       2
+#define        CPU_486         3
+#define        CPU_586         4
diff --git a/usr/src/sys.386bsd/i386/include/dkio.h b/usr/src/sys.386bsd/i386/include/dkio.h
new file mode 100644 (file)
index 0000000..1bb06c9
--- /dev/null
@@ -0,0 +1,48 @@
+/*-
+ * Copyright (c) 1990 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * William Jolitz.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *     This product includes software developed by the University of
+ *     California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *     @(#)dkio.h      5.2 (Berkeley) 1/18/91
+ */
+
+/*
+ * Structures and definitions for disk io control commands
+ *
+ * THIS WHOLE AREA NEEDS MORE THOUGHT.  FOR NOW JUST IMPLEMENT
+ * ENOUGH TO READ AND WRITE HEADERS ON MASSBUS DISKS.  EVENTUALLY
+ * SHOULD BE ABLE TO DETERMINE DRIVE TYPE AND DO OTHER GOOD STUFF.
+ */
+
+/* disk io control commands */
+#define DKIOCHDR       _IO(d, 1)       /* next I/O will read/write header */
diff --git a/usr/src/sys.386bsd/i386/include/endian.h b/usr/src/sys.386bsd/i386/include/endian.h
new file mode 100644 (file)
index 0000000..a5af5b7
--- /dev/null
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 1987, 1991 Regents of the University of California.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *     This product includes software developed by the University of
+ *     California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *     @(#)endian.h    7.8 (Berkeley) 4/3/91
+ */
+
+/*
+ * Definitions for byte order, according to byte significance from low
+ * address to high.
+ */
+#define        LITTLE_ENDIAN   1234    /* LSB first: i386, vax */
+#define        BIG_ENDIAN      4321    /* MSB first: 68000, ibm, net */
+#define        PDP_ENDIAN      3412    /* LSB first in word, MSW first in long */
+
+#define        BYTE_ORDER      LITTLE_ENDIAN
+
+#ifndef KERNEL
+#include <sys/cdefs.h>
+#endif
+
+__BEGIN_DECLS
+unsigned long  htonl __P((unsigned long));
+unsigned short htons __P((unsigned short));
+unsigned long  ntohl __P((unsigned long));
+unsigned short ntohs __P((unsigned short));
+__END_DECLS
+
+/*
+ * Macros for network/external number representation conversion.
+ */
+#if BYTE_ORDER == BIG_ENDIAN && !defined(lint)
+#define        ntohl(x)        (x)
+#define        ntohs(x)        (x)
+#define        htonl(x)        (x)
+#define        htons(x)        (x)
+
+#define        NTOHL(x)        (x)
+#define        NTOHS(x)        (x)
+#define        HTONL(x)        (x)
+#define        HTONS(x)        (x)
+
+#else
+
+#define        NTOHL(x)        (x) = ntohl((u_long)x)
+#define        NTOHS(x)        (x) = ntohs((u_short)x)
+#define        HTONL(x)        (x) = htonl((u_long)x)
+#define        HTONS(x)        (x) = htons((u_short)x)
+#endif
diff --git a/usr/src/sys.386bsd/i386/include/float.h b/usr/src/sys.386bsd/i386/include/float.h
new file mode 100644 (file)
index 0000000..f559291
--- /dev/null
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 1989 Regents of the University of California.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *     This product includes software developed by the University of
+ *     California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *     @(#)float.h     7.1 (Berkeley) 5/8/90
+ */
+
+#define FLT_RADIX      2               /* b */
+#define FLT_ROUNDS     1               /* FP addition rounds to nearest */
+
+#define FLT_MANT_DIG   24              /* p */
+#define FLT_EPSILON    1.19209290E-07F /* b**(1-p) */
+#define FLT_DIG                6               /* floor((p-1)*log10(b))+(b == 10) */
+#define FLT_MIN_EXP    -125            /* emin */
+#define FLT_MIN                1.17549435E-38F /* b**(emin-1) */
+#define FLT_MIN_10_EXP -37             /* ceil(log10(b**(emin-1))) */
+#define FLT_MAX_EXP    128             /* emax */
+#define FLT_MAX                3.40282347E+38F /* (1-b**(-p))*b**emax */
+#define FLT_MAX_10_EXP 38              /* floor(log10((1-b**(-p))*b**emax)) */
+
+#define DBL_MANT_DIG   53
+#define DBL_EPSILON    2.2204460492503131E-16
+#define DBL_DIG                15
+#define DBL_MIN_EXP    -1021
+#define DBL_MIN                2.225073858507201E-308
+#define DBL_MIN_10_EXP -307
+#define DBL_MAX_EXP    1024
+#define DBL_MAX                1.797693134862316E+308
+#define DBL_MAX_10_EXP 308
+
+#define LDBL_MANT_DIG  DBL_MANT_DIG
+#define LDBL_EPSILON   DBL_EPSILON
+#define LDBL_DIG       DBL_DIG
+#define LDBL_MIN_EXP   DBL_MIN_EXP
+#define LDBL_MIN       DBL_MIN
+#define LDBL_MIN_10_EXP        DBL_MIN_10_EXP
+#define LDBL_MAX_EXP   DBL_MAX_EXP
+#define LDBL_MAX       DBL_MAX
+#define LDBL_MAX_10_EXP        DBL_MAX_10_EXP
diff --git a/usr/src/sys.386bsd/i386/include/frame.h b/usr/src/sys.386bsd/i386/include/frame.h
new file mode 100644 (file)
index 0000000..4dbabd1
--- /dev/null
@@ -0,0 +1,116 @@
+/*-
+ * Copyright (c) 1990 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * William Jolitz.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *     This product includes software developed by the University of
+ *     California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *     @(#)frame.h     5.2 (Berkeley) 1/18/91
+ */
+
+/*
+ * System stack frames.
+ */
+
+/*
+ * Exception/Trap Stack Frame
+ */
+
+struct trapframe {
+       int     tf_es;
+       int     tf_ds;
+       int     tf_edi;
+       int     tf_esi;
+       int     tf_ebp;
+       int     tf_isp;
+       int     tf_ebx;
+       int     tf_edx;
+       int     tf_ecx;
+       int     tf_eax;
+       int     tf_trapno;
+       /* below portion defined in 386 hardware */
+       int     tf_err;
+       int     tf_eip;
+       int     tf_cs;
+       int     tf_eflags;
+       /* below only when transitting rings (e.g. user to kernel) */
+       int     tf_esp;
+       int     tf_ss;
+};
+
+/* Interrupt stack frame */
+
+struct intrframe {
+       int     if_vec;
+       int     if_ppl;
+       int     if_es;
+       int     if_ds;
+       int     if_edi;
+       int     if_esi;
+       int     if_ebp;
+       int     :32;
+       int     if_ebx;
+       int     if_edx;
+       int     if_ecx;
+       int     if_eax;
+       int     :32;            /* for compat with trap frame - trapno */
+       int     :32;            /* for compat with trap frame - err */
+       /* below portion defined in 386 hardware */
+       int     if_eip;
+       int     if_cs;
+       int     if_eflags;
+       /* below only when transitting rings (e.g. user to kernel) */
+       int     if_esp;
+       int     if_ss;
+};
+
+/*
+ * Call Gate/System Call Stack Frame
+ */
+
+struct syscframe {
+       int     sf_edi;
+       int     sf_esi;
+       int     sf_ebp;
+       int     :32;            /* redundant save of isp */
+       int     sf_ebx;
+       int     sf_edx;
+       int     sf_ecx;
+       int     sf_eax;
+       int     sf_eflags;
+       /* below portion defined in 386 hardware */
+/*     int     sf_args[N];     /* if call gate copy args enabled!*/
+       int     sf_eip;
+       int     sf_cs;
+       /* below only when transitting rings (e.g. user to kernel) */
+       int     sf_esp;
+       int     sf_ss;
+};
diff --git a/usr/src/sys.386bsd/i386/include/proc.h b/usr/src/sys.386bsd/i386/include/proc.h
new file mode 100644 (file)
index 0000000..02f3c01
--- /dev/null
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 1991 Regents of the University of California.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *     This product includes software developed by the University of
+ *     California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *     @(#)proc.h      7.1 (Berkeley) 5/15/91
+ */
+
+/*
+ * Machine-dependent part of the proc structure for hp300.
+ */
+struct mdproc {
+       int     md_flags;               /* machine-dependent flags */
+#ifdef notyet
+       int     *p_regs;                /* registers on current frame */
+#endif
+};
+
+/* md_flags */
+#define        MDP_AST         0x0001  /* async trap pending */
diff --git a/usr/src/sys.386bsd/i386/include/pte.h b/usr/src/sys.386bsd/i386/include/pte.h
new file mode 100644 (file)
index 0000000..4b98413
--- /dev/null
@@ -0,0 +1,136 @@
+/*-
+ * Copyright (c) 1990 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * William Jolitz.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *     This product includes software developed by the University of
+ *     California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *     @(#)pte.h       5.5 (Berkeley) 5/9/91
+ */
+
+/*
+ * 386 page table entry and page table directory
+ * W.Jolitz, 8/89
+ *
+ * There are two major kinds of pte's: those which have ever existed (and are
+ * thus either now in core or on the swap device), and those which have
+ * never existed, but which will be filled on demand at first reference.
+ * There is a structure describing each.  There is also an ancillary
+ * structure used in page clustering.
+ */
+
+#ifndef LOCORE
+struct pde
+{
+unsigned int   
+               pd_v:1,                 /* valid bit */
+               pd_prot:2,              /* access control */
+               pd_mbz1:2,              /* reserved, must be zero */
+               pd_u:1,                 /* hardware maintained 'used' bit */
+               :1,                     /* not used */
+               pd_mbz2:2,              /* reserved, must be zero */
+               :3,                     /* reserved for software */
+               pd_pfnum:20;            /* physical page frame number of pte's*/
+};
+struct pte
+{
+unsigned int   
+               pg_v:1,                 /* valid bit */
+               pg_prot:2,              /* access control */
+               pg_mbz1:2,              /* reserved, must be zero */
+               pg_u:1,                 /* hardware maintained 'used' bit */
+               pg_m:1,                 /* hardware maintained modified bit */
+               pg_mbz2:2,              /* reserved, must be zero */
+               pg_fod:1,               /* is fill on demand (=0) */
+               :1,                     /* must write back to swap (unused) */
+               pg_nc:1,                /* 'uncacheable page' bit */
+               pg_pfnum:20;            /* physical page frame number */
+};
+struct hpte
+{
+unsigned int   
+               pg_high:12,             /* special for clustering */
+               pg_pfnum:20;
+};
+struct fpte
+{
+unsigned int   
+               pg_v:1,                 /* valid bit */
+               pg_prot:2,              /* access control */
+               :5,
+               pg_fileno:1,            /* file mapped from or TEXT or ZERO */
+               pg_fod:1,               /* is fill on demand (=1) */
+               pg_blkno:22;            /* file system block number */
+};
+#endif
+
+#define        PD_MASK         0xffc00000      /* page directory address bits */
+#define        PD_SHIFT        22              /* page directory address bits */
+
+#define        PG_V            0x00000001
+#define        PG_PROT         0x00000006 /* all protection bits . */
+#define        PG_FOD          0x00000200
+#define        PG_SWAPM        0x00000400
+#define PG_N           0x00000800 /* Non-cacheable */
+#define        PG_M            0x00000040
+#define PG_U           0x00000020 /* not currently used */
+#define        PG_FRAME        0xfffff000
+
+#define        PG_FZERO        0
+#define        PG_FTEXT        1
+#define        PG_FMAX         (PG_FTEXT)
+
+#define        PG_NOACC        0
+#define        PG_KR           0x00000000
+#define        PG_KW           0x00000002
+#define        PG_URKR         0x00000004
+#define        PG_URKW         0x00000004
+#define        PG_UW           0x00000006
+
+/*
+ * Page Protection Exception bits
+ */
+
+#define PGEX_P         0x01    /* Protection violation vs. not present */
+#define PGEX_W         0x02    /* during a Write cycle */
+#define PGEX_U         0x04    /* access from User mode (UPL) */
+
+/*
+ * Pte related macros
+ */
+#define        dirty(pte)      ((pte)->pg_m)
+
+#ifndef LOCORE
+#ifdef KERNEL
+/* utilities defined in pmap.c */
+extern struct pte *Sysmap;
+#endif
+#endif
diff --git a/usr/src/sys.386bsd/i386/include/reg.h b/usr/src/sys.386bsd/i386/include/reg.h
new file mode 100644 (file)
index 0000000..bc2f05c
--- /dev/null
@@ -0,0 +1,93 @@
+/*-
+ * Copyright (c) 1990 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * William Jolitz.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *     This product includes software developed by the University of
+ *     California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *     @(#)reg.h       5.5 (Berkeley) 1/18/91
+ */
+
+/*
+ * Location of the users' stored
+ * registers within appropriate frame of 'trap' and 'syscall', relative to
+ * base of stack frame.
+ * Normal usage is u.u_ar0[XX] in kernel.
+ */
+
+/* When referenced during a trap/exception, registers are at these offsets */
+
+#define        tES     (0)
+#define        tDS     (1)
+#define        tEDI    (2)
+#define        tESI    (3)
+#define        tEBP    (4)
+
+#define        tEBX    (6)
+#define        tEDX    (7)
+#define        tECX    (8)
+#define        tEAX    (9)
+
+#define        tEIP    (12)
+#define        tCS     (13)
+#define        tEFLAGS (14)
+#define        tESP    (15)
+#define        tSS     (16)
+
+/* During a system call, registers are at these offsets instead of above. */
+
+#define        sEDI    (0)
+#define        sESI    (1)
+#define        sEBP    (2)
+
+#define        sEBX    (4)
+#define        sEDX    (5)
+#define        sECX    (6)
+#define        sEAX    (7)
+#define        sEFLAGS (8)
+#define        sEIP    (9)
+#define        sCS     (10)
+#define        sESP    (11)
+#define        sSS     (12)
+
+#define        PC      sEIP
+#define        SP      sESP
+#define        PS      sEFLAGS
+#define        R0      sEDX
+#define        R1      sECX
+/*
+ * Registers accessible to ptrace(2) syscall for debugger
+ */
+#ifdef IPCREG
+#define        NIPCREG 14
+int ipcreg[NIPCREG] =
+  { tES,tDS,tEDI,tESI,tEBP,tEBX,tEDX,tECX,tEAX,tEIP,tCS,tEFLAGS,tESP,tSS };
+#endif
diff --git a/usr/src/sys.386bsd/i386/include/specialreg.h b/usr/src/sys.386bsd/i386/include/specialreg.h
new file mode 100644 (file)
index 0000000..eb1a5b4
--- /dev/null
@@ -0,0 +1,45 @@
+/*-
+ * Copyright (c) 1991 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *     This product includes software developed by the University of
+ *     California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *     @(#)specialreg.h        7.1 (Berkeley) 5/9/91
+ */
+
+/*
+ * 386 Special registers:
+ */
+
+#define        CR0_PE  0x00000001      /* Protected mode Enable */
+#define        CR0_MP  0x00000002      /* "Math" Present (e.g. npx), wait for it */
+#define        CR0_EM  0x00000004      /* EMulate NPX, e.g. trap, don't execute code */
+#define        CR0_TS  0x00000008      /* Process has done Task Switch, do NPX save */
+#define        CR0_ET  0x00000010      /* 32 bit (if set) vs 16 bit (387 vs 287) */
+#define        CR0_PG  0x80000000      /* Paging Enable */
diff --git a/usr/src/sys.386bsd/i386/include/stdarg.h b/usr/src/sys.386bsd/i386/include/stdarg.h
new file mode 100644 (file)
index 0000000..f499253
--- /dev/null
@@ -0,0 +1,53 @@
+/*-
+ * Copyright (c) 1991 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *     This product includes software developed by the University of
+ *     California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *     @(#)stdarg.h    7.2 (Berkeley) 5/4/91
+ */
+
+typedef char *va_list;
+
+#ifdef KERNEL
+#define        va_arg(ap, type) \
+       ((type *)(ap += sizeof(type)))[-1]
+#else
+#define        va_arg(ap, type) \
+       ((type *)(ap += sizeof(type) < sizeof(int) ? \
+               (abort(), 0) : sizeof(type)))[-1]
+#endif
+
+#define        va_end(ap)
+
+#define        __va_promote(type) \
+       (((sizeof(type) + sizeof(int) - 1) / sizeof(int)) * sizeof(int))
+
+#define        va_start(ap, last) \
+       (ap = ((char *)&(last) + __va_promote(last)))
diff --git a/usr/src/sys.386bsd/i386/include/trap.h b/usr/src/sys.386bsd/i386/include/trap.h
new file mode 100644 (file)
index 0000000..6015605
--- /dev/null
@@ -0,0 +1,96 @@
+/*-
+ * Copyright (c) 1990 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * William Jolitz.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *     This product includes software developed by the University of
+ *     California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *     @(#)trap.h      5.4 (Berkeley) 5/9/91
+ */
+
+/*
+ * Trap type values
+ * also known in trap.c for name strings
+ */
+
+#define        T_RESADFLT      0       /* reserved addressing */
+#define        T_PRIVINFLT     1       /* privileged instruction */
+#define        T_RESOPFLT      2       /* reserved operand */
+#define        T_BPTFLT        3       /* breakpoint instruction */
+#define        T_SYSCALL       5       /* system call (kcall) */
+#define        T_ARITHTRAP     6       /* arithmetic trap */
+#define        T_ASTFLT        7       /* system forced exception */
+#define        T_SEGFLT        8       /* segmentation (limit) fault */
+#define        T_PROTFLT       9       /* protection fault */
+#define        T_TRCTRAP       10      /* trace trap */
+#define        T_PAGEFLT       12      /* page fault */
+#define        T_TABLEFLT      13      /* page table fault */
+#define        T_ALIGNFLT      14      /* alignment fault */
+#define        T_KSPNOTVAL     15      /* kernel stack pointer not valid */
+#define        T_BUSERR        16      /* bus error */
+#define        T_KDBTRAP       17      /* kernel debugger trap */
+
+#define        T_DIVIDE        18      /* integer divide fault */
+#define        T_NMI           19      /* non-maskable trap */
+#define        T_OFLOW         20      /* overflow trap */
+#define        T_BOUND         21      /* bound instruction fault */
+#define        T_DNA           22      /* device not available fault */
+#define        T_DOUBLEFLT     23      /* double fault */
+#define        T_FPOPFLT       24      /* fp coprocessor operand fetch fault */
+#define        T_TSSFLT        25      /* invalid tss fault */
+#define        T_SEGNPFLT      26      /* segment not present fault */
+#define        T_STKFLT        27      /* stack fault */
+#define        T_RESERVED      28      /* reserved fault base */
+
+/* definitions for <sys/signal.h> */
+#define            ILL_RESAD_FAULT     T_RESADFLT
+#define            ILL_PRIVIN_FAULT    T_PRIVINFLT
+#define            ILL_RESOP_FAULT     T_RESOPFLT
+#define            ILL_ALIGN_FAULT     T_ALIGNFLT
+#define            ILL_FPOP_FAULT      T_FPOPFLT       /* coprocessor operand fault */
+
+/* codes for SIGFPE/ARITHTRAP */
+#define            FPE_INTOVF_TRAP     0x1     /* integer overflow */
+#define            FPE_INTDIV_TRAP     0x2     /* integer divide by zero */
+#define            FPE_FLTDIV_TRAP     0x3     /* floating/decimal divide by zero */
+#define            FPE_FLTOVF_TRAP     0x4     /* floating overflow */
+#define            FPE_FLTUND_TRAP     0x5     /* floating underflow */
+#define            FPE_FPU_NP_TRAP     0x6     /* floating point unit not present */
+#define            FPE_SUBRNG_TRAP     0x7     /* subrange out of bounds */
+
+/* codes for SIGBUS */
+#define            BUS_PAGE_FAULT      T_PAGEFLT       /* page fault protection base */
+#define            BUS_SEGNP_FAULT     T_SEGNPFLT      /* segment not present */
+#define            BUS_STK_FAULT       T_STKFLT        /* stack segment */
+#define            BUS_SEGM_FAULT      T_RESERVED      /* segment protection base */
+
+/* Trap's coming from user mode */
+#define        T_USER  0x100
diff --git a/usr/src/sys.386bsd/i386/include/tss.h b/usr/src/sys.386bsd/i386/include/tss.h
new file mode 100644 (file)
index 0000000..8ba140d
--- /dev/null
@@ -0,0 +1,78 @@
+/*-
+ * Copyright (c) 1990 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * William Jolitz.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *     This product includes software developed by the University of
+ *     California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *     @(#)tss.h       5.4 (Berkeley) 1/18/91
+ */
+
+/*
+ * Intel 386 Context Data Type
+ */
+
+struct i386tss {
+       int     tss_link;       /* actually 16 bits: top 16 bits must be zero */
+       int     tss_esp0;       /* kernel stack pointer priviledge level 0 */
+#define        tss_ksp tss_esp0
+       int     tss_ss0;        /* actually 16 bits: top 16 bits must be zero */
+       int     tss_esp1;       /* kernel stack pointer priviledge level 1 */
+       int     tss_ss1;        /* actually 16 bits: top 16 bits must be zero */
+       int     tss_esp2;       /* kernel stack pointer priviledge level 2 */
+       int     tss_ss2;        /* actually 16 bits: top 16 bits must be zero */
+       /* struct  ptd *tss_cr3;        /* page table directory */
+       int     tss_cr3;        /* page table directory */
+#define        tss_ptd tss_cr3
+       int     tss_eip;        /* program counter */
+#define        tss_pc  tss_eip
+       int     tss_eflags;     /* program status longword */
+#define        tss_psl tss_eflags
+       int     tss_eax; 
+       int     tss_ecx; 
+       int     tss_edx; 
+       int     tss_ebx; 
+       int     tss_esp;        /* user stack pointer */
+#define        tss_usp tss_esp
+       int     tss_ebp;        /* user frame pointer */
+#define        tss_fp  tss_ebp
+       int     tss_esi; 
+       int     tss_edi; 
+       int     tss_es;         /* actually 16 bits: top 16 bits must be zero */
+       int     tss_cs;         /* actually 16 bits: top 16 bits must be zero */
+       int     tss_ss;         /* actually 16 bits: top 16 bits must be zero */
+       int     tss_ds;         /* actually 16 bits: top 16 bits must be zero */
+       int     tss_fs;         /* actually 16 bits: top 16 bits must be zero */
+       int     tss_gs;         /* actually 16 bits: top 16 bits must be zero */
+       int     tss_ldt;        /* actually 16 bits: top 16 bits must be zero */
+       int     tss_ioopt;      /* options & io offset bitmap: currently zero */
+                               /* XXX unimplemented .. i/o permission bitmap */
+};
diff --git a/usr/src/sys.386bsd/i386/include/types.h b/usr/src/sys.386bsd/i386/include/types.h
new file mode 100644 (file)
index 0000000..9eeaef3
--- /dev/null
@@ -0,0 +1,50 @@
+/*-
+ * Copyright (c) 1990 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *     This product includes software developed by the University of
+ *     California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *     @(#)types.h     7.5 (Berkeley) 3/9/91
+ */
+
+#ifndef        _MACHTYPES_H_
+#define        _MACHTYPES_H_
+
+typedef struct _physadr {
+       int r[1];
+} *physadr;
+
+typedef struct label_t {
+       int val[6];
+} label_t;
+
+typedef        u_long  vm_offset_t;
+typedef        u_long  vm_size_t;
+
+#endif /* _MACHTYPES_H_ */
diff --git a/usr/src/sys.386bsd/i386/isa/clock.c b/usr/src/sys.386bsd/i386/isa/clock.c
new file mode 100644 (file)
index 0000000..ef402f8
--- /dev/null
@@ -0,0 +1,206 @@
+/*-
+ * Copyright (c) 1990 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * William Jolitz and Don Ahn.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *     This product includes software developed by the University of
+ *     California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *     @(#)clock.c     7.2 (Berkeley) 5/12/91
+ */
+
+/*
+ * Primitive clock interrupt routines.
+ */
+#include "param.h"
+#include "time.h"
+#include "kernel.h"
+#include "machine/segments.h"
+#include "i386/isa/icu.h"
+#include "i386/isa/isa.h"
+#include "i386/isa/rtc.h"
+
+#define DAYST 119
+#define DAYEN 303
+
+startrtclock() {
+       int s;
+
+       /* initialize 8253 clock */
+       outb (IO_TIMER1+3, 0x36);
+       outb (IO_TIMER1, 1193182/hz);
+       outb (IO_TIMER1, (1193182/hz)/256);
+
+       /* initialize brain-dead battery powered clock */
+       outb (IO_RTC, RTC_STATUSA);
+       outb (IO_RTC+1, 0x26);
+       outb (IO_RTC, RTC_STATUSB);
+       outb (IO_RTC+1, 2);
+
+       outb (IO_RTC, RTC_DIAG);
+       if (s = inb (IO_RTC+1))
+               printf("RTC BIOS diagnostic error %b\n", s, RTCDG_BITS);
+       outb (IO_RTC, RTC_DIAG);
+       outb (IO_RTC+1, 0);
+}
+
+/* convert 2 digit BCD number */
+bcd(i)
+int i;
+{
+       return ((i/16)*10 + (i%16));
+}
+
+/* convert years to seconds (from 1970) */
+unsigned long
+ytos(y)
+int y;
+{
+       int i;
+       unsigned long ret;
+
+       ret = 0; y = y - 70;
+       for(i=0;i<y;i++) {
+               if (i % 4) ret += 365*24*60*60;
+               else ret += 366*24*60*60;
+       }
+       return ret;
+}
+
+/* convert months to seconds */
+unsigned long
+mtos(m,leap)
+int m,leap;
+{
+       int i;
+       unsigned long ret;
+
+       ret = 0;
+       for(i=1;i<m;i++) {
+               switch(i){
+               case 1: case 3: case 5: case 7: case 8: case 10: case 12:
+                       ret += 31*24*60*60; break;
+               case 4: case 6: case 9: case 11:
+                       ret += 30*24*60*60; break;
+               case 2:
+                       if (leap) ret += 29*24*60*60;
+                       else ret += 28*24*60*60;
+               }
+       }
+       return ret;
+}
+
+
+/*
+ * Initialize the time of day register, based on the time base which is, e.g.
+ * from a filesystem.
+ */
+inittodr(base)
+       time_t base;
+{
+       unsigned long sec;
+       int leap,day_week,t,yd;
+       int sa,s;
+
+       /* do we have a realtime clock present? (otherwise we loop below) */
+       sa = rtcin(RTC_STATUSA);
+       if (sa == 0xff || sa == 0) return;
+
+       /* ready for a read? */
+       while ((sa&RTCSA_TUP) == RTCSA_TUP)
+               sa = rtcin(RTC_STATUSA);
+
+       sec = bcd(rtcin(RTC_YEAR));
+       leap = !(sec % 4); sec += ytos(sec); /* year    */
+       yd = mtos(bcd(rtcin(RTC_MONTH)),leap); sec += yd;       /* month   */
+       t = (bcd(rtcin(RTC_DAY))-1) * 24*60*60; sec += t; yd += t; /* date    */
+       day_week = rtcin(RTC_WDAY);                             /* day     */
+       sec += bcd(rtcin(RTC_HRS)) * 60*60;                     /* hour    */
+       sec += bcd(rtcin(RTC_MIN)) * 60;                        /* minutes */
+       sec += bcd(rtcin(RTC_SEC));                             /* seconds */
+       sec -= 24*60*60; /* XXX why ??? */
+
+#ifdef notdef
+       /* XXX off by one? Need to calculate DST on SUNDAY */
+       /* Perhaps we should have the RTC hold GMT time to save */
+       /* us the bother of converting. */
+       yd = yd / 24*60*60;
+       if ((yd >= DAYST) && ( yd <= DAYEN)) {
+               sec -= 60*60;
+       }
+#endif
+       sec += tz.tz_minuteswest * 60;
+
+       time.tv_sec = sec;
+}
+
+#ifdef garbage
+/*
+ * Initialze the time of day register, based on the time base which is, e.g.
+ * from a filesystem.
+ */
+test_inittodr(base)
+       time_t base;
+{
+
+       outb(IO_RTC,9); /* year    */
+       printf("%d ",bcd(inb(IO_RTC+1)));
+       outb(IO_RTC,8); /* month   */
+       printf("%d ",bcd(inb(IO_RTC+1)));
+       outb(IO_RTC,7); /* day     */
+       printf("%d ",bcd(inb(IO_RTC+1)));
+       outb(IO_RTC,4); /* hour    */
+       printf("%d ",bcd(inb(IO_RTC+1)));
+       outb(IO_RTC,2); /* minutes */
+       printf("%d ",bcd(inb(IO_RTC+1)));
+       outb(IO_RTC,0); /* seconds */
+       printf("%d\n",bcd(inb(IO_RTC+1)));
+
+       time.tv_sec = base;
+}
+#endif
+
+/*
+ * Restart the clock.
+ */
+resettodr()
+{
+}
+
+/*
+ * Wire clock interrupt in.
+ */
+#define V(s)   __CONCAT(V, s)
+extern V(clk)();
+enablertclock() {
+       INTREN(IRQ0);
+       setidt(ICU_OFFSET+0, &V(clk), SDT_SYS386IGT, SEL_KPL);
+       splnone();
+}
diff --git a/usr/src/sys.386bsd/i386/isa/comreg.h b/usr/src/sys.386bsd/i386/isa/comreg.h
new file mode 100644 (file)
index 0000000..2a62683
--- /dev/null
@@ -0,0 +1,113 @@
+/*-
+ * Copyright (c) 1991 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *     This product includes software developed by the University of
+ *     California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *     @(#)comreg.h    7.2 (Berkeley) 5/9/91
+ */
+
+
+/* 16 bit baud rate divisor (lower byte in dca_data, upper in dca_ier) */
+#define        COMBRD(x)       (1843200 / (16*(x)))
+
+/* interrupt enable register */
+#define        IER_ERXRDY      0x1
+#define        IER_ETXRDY      0x2
+#define        IER_ERLS        0x4
+#define        IER_EMSC        0x8
+
+/* interrupt identification register */
+#define        IIR_IMASK       0xf
+#define        IIR_RXTOUT      0xc
+#define        IIR_RLS         0x6
+#define        IIR_RXRDY       0x4
+#define        IIR_TXRDY       0x2
+#define        IIR_NOPEND      0x1
+#define        IIR_MLSC        0x0
+#define        IIR_FIFO_MASK   0xc0    /* set if FIFOs are enabled */
+
+/* fifo control register */
+#define        FIFO_ENABLE     0x01
+#define        FIFO_RCV_RST    0x02
+#define        FIFO_XMT_RST    0x04
+#define        FIFO_DMA_MODE   0x08
+#define        FIFO_TRIGGER_1  0x00
+#define        FIFO_TRIGGER_4  0x40
+#define        FIFO_TRIGGER_8  0x80
+#define        FIFO_TRIGGER_14 0xc0
+
+/* character format control register */
+#define        CFCR_DLAB       0x80
+#define        CFCR_SBREAK     0x40
+#define        CFCR_PZERO      0x30
+#define        CFCR_PONE       0x20
+#define        CFCR_PEVEN      0x10
+#define        CFCR_PODD       0x00
+#define        CFCR_PENAB      0x08
+#define        CFCR_STOPB      0x04
+#define        CFCR_8BITS      0x03
+#define        CFCR_7BITS      0x02
+#define        CFCR_6BITS      0x01
+#define        CFCR_5BITS      0x00
+
+/* modem control register */
+#define        MCR_LOOPBACK    0x10
+#define        MCR_IENABLE     0x08
+#define        MCR_DRS         0x04
+#define        MCR_RTS         0x02
+#define        MCR_DTR         0x01
+
+/* line status register */
+#define        LSR_RCV_FIFO    0x80
+#define        LSR_TSRE        0x40
+#define        LSR_TXRDY       0x20
+#define        LSR_BI          0x10
+#define        LSR_FE          0x08
+#define        LSR_PE          0x04
+#define        LSR_OE          0x02
+#define        LSR_RXRDY       0x01
+#define        LSR_RCV_MASK    0x1f
+
+/* modem status register */
+#define        MSR_DCD         0x80
+#define        MSR_RI          0x40
+#define        MSR_DSR         0x20
+#define        MSR_CTS         0x10
+#define        MSR_DDCD        0x08
+#define        MSR_TERI        0x04
+#define        MSR_DDSR        0x02
+#define        MSR_DCTS        0x01
+
+/*
+ * WARNING: Serial console is assumed to be at COM1 address
+ * and CONUNIT must be 0.
+ */
+#define        CONADDR (0x3f8)
+#define        CONUNIT (0)
diff --git a/usr/src/sys.386bsd/i386/isa/fdreg.h b/usr/src/sys.386bsd/i386/isa/fdreg.h
new file mode 100644 (file)
index 0000000..1994c9a
--- /dev/null
@@ -0,0 +1,63 @@
+/*-
+ * Copyright (c) 1991 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *     This product includes software developed by the University of
+ *     California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *     @(#)fdreg.h     7.1 (Berkeley) 5/9/91
+ */
+
+/*
+ * AT floppy controller registers and bitfields
+ */
+
+/* uses NEC765 controller */
+#include "../i386/isa/ic/nec765.h"
+
+/* registers */
+#define        fdout   2       /* Digital Output Register (W) */
+#define        FDO_FDSEL       0x01    /*  floppy device select */
+#define        FDO_FRST        0x04    /*  floppy controller reset */
+#define        FDO_FDMAEN      0x08    /*  enable floppy DMA and Interrupt */
+#define        FDO_MOEN0       0x10    /*  motor enable drive 0 */
+#define        FDO_MOEN1       0x20    /*  motor enable drive 1 */
+
+#define        fdsts   4       /* NEC 765 Main Status Register (R) */
+#define        fddata  5       /* NEC 765 Data Register (R/W) */
+
+#define        fdctl   7       /* Control Register (W) */
+#define        FDC_500KBPS     0x00    /* 500KBPS MFM drive transfer rate */
+#define        FDC_300KBPS     0x01    /* 300KBPS MFM drive transfer rate */
+#define        FDC_250KBPS     0x02    /* 250KBPS MFM drive transfer rate */
+#define        FDC_125KBPS     0x03    /* 125KBPS FM drive transfer rate */
+
+#define        fdin    7       /* Digital Input Register (R) */
+#define        FDI_DCHG        0x80    /* diskette has been changed */
+
+
diff --git a/usr/src/sys.386bsd/i386/isa/ic/ds8390.h b/usr/src/sys.386bsd/i386/isa/ic/ds8390.h
new file mode 100644 (file)
index 0000000..000b453
--- /dev/null
@@ -0,0 +1,146 @@
+/*-
+ * Copyright (c) 1991 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *     This product includes software developed by the University of
+ *     California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *     @(#)ds8390.h    7.1 (Berkeley) 5/9/91
+ */
+
+/*
+ * Nominal Semidestructor DS8390 Ethernet Chip
+ * Register and bit definitions
+ */
+
+/*
+ * Page register offset values
+ */
+#define ds_cmd         0x00            /* Command register:            */
+#define  DSCM_STOP      0x01           /*      Stop controller         */
+#define  DSCM_START     0x02           /*      Start controller        */
+#define  DSCM_TRANS     0x04           /*      Transmit packet         */
+#define  DSCM_RREAD     0x08           /*      Remote read             */
+#define  DSCM_RWRITE    0x10           /*      Remote write            */
+#define  DSCM_NODMA     0x20           /*      No Remote DMA present   */
+#define  DSCM_PG0       0x00           /*      Select Page 0           */
+#define  DSCM_PG1       0x40           /*      Select Page 1           */
+#define  DSCM_PG2       0x80           /*      Select Page 2?          */
+
+#define ds0_pstart     0x01            /* Page Start register          */
+#define ds0_pstop      0x02            /* Page Stop register           */
+#define ds0_bnry       0x03            /* Boundary Pointer             */
+
+#define ds0_tsr                0x04            /* Transmit Status (read-only)  */
+#define         DSTS_PTX        0x01           /*  Successful packet transmit  */ 
+#define         DSTS_COLL       0x04           /*  Packet transmit w/ collision*/ 
+#define         DSTS_COLL16     0x04           /*  Packet had >16 collisions & fail */ 
+#define         DSTS_UND        0x20           /*  FIFO Underrun on transmission*/ 
+
+#define ds0_tpsr       ds0_tsr         /* Transmit Page (write-only)   */
+#define ds0_tbcr0      0x05            /* Transmit Byte count, low  WO */
+#define ds0_tbcr1      0x06            /* Transmit Byte count, high WO */
+
+#define ds0_isr                0x07            /* Interrupt status register    */
+#define         DSIS_RX         0x01           /*  Successful packet reception */ 
+#define         DSIS_TX         0x02           /*  Successful packet transmission  */ 
+#define         DSIS_RXE        0x04           /*  Packet reception  w/error   */ 
+#define         DSIS_TXE        0x08           /*  Packet transmission  w/error*/ 
+#define         DSIS_ROVRN      0x10           /*  Receiver overrun in the ring*/
+#define         DSIS_CTRS       0x20           /*  Diagnostic counters need attn */
+#define         DSIS_RDC        0x40           /*  Remote DMA Complete         */
+#define         DSIS_RESET      0x80           /*  Reset Complete              */
+
+#define ds0_rsar0      0x08            /* Remote start address low  WO */
+#define ds0_rsar1      0x09            /* Remote start address high WO */
+#define ds0_rbcr0      0x0A            /* Remote byte count low     WO */
+#define ds0_rbcr1      0x0B            /* Remote byte count high    WO */
+
+#define ds0_rsr                0x0C            /* Receive status            RO */
+#define         DSRS_RPC        0x01           /*  Received Packet Complete    */
+
+#define ds0_rcr                ds0_rsr         /* Receive configuration     WO */
+#define  DSRC_SEP       0x01           /* Save error packets           */
+#define  DSRC_AR        0x02           /* Accept Runt packets          */
+#define  DSRC_AB        0x04           /* Accept Broadcast packets     */
+#define  DSRC_AM        0x08           /* Accept Multicast packets     */
+#define  DSRC_PRO       0x10           /* Promiscuous physical         */
+#define  DSRC_MON       0x20           /* Monitor mode                 */
+
+#define ds0_tcr                0x0D            /* Transmit configuration    WO */
+#define  DSTC_CRC      0x01            /* Inhibit CRC                  */
+#define  DSTC_LB0      0x02            /* Encoded Loopback Control     */
+#define  DSTC_LB1      0x04            /* Encoded Loopback Control     */
+#define  DSTC_ATD      0x08            /* Auto Transmit Disable        */
+#define  DSTC_OFST     0x10            /* Collision Offset Enable      */
+
+#define ds0_rcvalctr   ds0_tcr         /* Receive alignment err ctr RO */
+
+#define ds0_dcr                0x0E            /* Data configuration        WO */
+#define  DSDC_WTS       0x01           /* Word Transfer Select         */
+#define  DSDC_BOS       0x02           /* Byte Order Select            */
+#define  DSDC_LAS       0x04           /* Long Address Select          */
+#define  DSDC_BMS       0x08           /* Burst Mode Select            */
+#define  DSDC_AR        0x10           /* Autoinitialize Remote        */
+#define  DSDC_FT0       0x20           /* Fifo Threshold Select        */
+#define  DSDC_FT1       0x40           /* Fifo Threshold Select        */
+
+#define ds0_rcvcrcctr  ds0_dcr         /* Receive CRC error counter RO */
+
+#define ds0_imr                0x0F            /* Interrupt mask register   WO */
+#define  DSIM_PRXE      0x01           /*  Packet received enable      */
+#define  DSIM_PTXE      0x02           /*  Packet transmitted enable   */
+#define  DSIM_RXEE      0x04           /*  Receive error enable        */
+#define  DSIM_TXEE      0x08           /*  Transmit error enable       */
+#define  DSIM_OVWE      0x10           /*  Overwrite warning enable    */
+#define  DSIM_CNTE      0x20           /*  Counter overflow enable     */
+#define  DSIM_RDCE      0x40           /*  Dma complete enable         */
+
+#define ds0_rcvfrmctr  ds0_imr         /* Receive Frame error cntr  RO */
+
+
+#define ds1_par0       ds0_pstart      /* Physical address register 0  */
+                               /* Physical address registers 1-4       */
+#define ds1_par5       ds0_tbcr1       /* Physical address register 5  */
+#define ds1_curr       ds0_isr         /* Current page (receive unit)  */
+#define ds1_mar0       ds0_rsar0       /* Multicast address register 0 */
+                               /* Multicast address registers 1-6      */
+#define ds1_mar7       ds0_imr         /* Multicast address register 7 */
+#define ds1_curr       ds0_isr         /* Current page (receive unit)  */
+
+#define DS_PGSIZE      256             /* Size of RAM pages in bytes   */
+
+/*
+ * Packet receive header, 1 per each buffer page used in receive packet
+ */
+struct prhdr {
+       u_char  pr_status;      /* is this a good packet, same as ds0_rsr */
+       u_char  pr_nxtpg;       /* next page of packet or next packet */
+       u_char  pr_sz0;
+       u_char  pr_sz1;
+};
diff --git a/usr/src/sys.386bsd/i386/isa/ic/ns16450.h b/usr/src/sys.386bsd/i386/isa/ic/ns16450.h
new file mode 100644 (file)
index 0000000..f059035
--- /dev/null
@@ -0,0 +1,49 @@
+/*-
+ * Copyright (c) 1991 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *     This product includes software developed by the University of
+ *     California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *     @(#)ns16450.h   7.1 (Berkeley) 5/9/91
+ */
+
+/*
+ * NS16450 UART registers
+ */
+
+#define        com_data        0       /* data register (R/W) */
+#define        com_dlbl        0       /* divisor latch low (W) */
+#define        com_dlbh        1       /* divisor latch high (W) */
+#define        com_ier         1       /* interrupt enable (W) */
+#define        com_iir         2       /* interrupt identification (R) */
+#define        com_lctl        3       /* line control register (R/W) */
+#define         com_cfcr       3       /* line control register (R/W) */
+#define        com_mcr         4       /* modem control register (R/W) */
+#define        com_lsr         5       /* line status register (R/W) */
+#define        com_msr         6       /* modem status register (R/W) */
diff --git a/usr/src/sys.386bsd/i386/isa/ic/ns16550.h b/usr/src/sys.386bsd/i386/isa/ic/ns16550.h
new file mode 100644 (file)
index 0000000..e20e9aa
--- /dev/null
@@ -0,0 +1,50 @@
+/*-
+ * Copyright (c) 1991 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *     This product includes software developed by the University of
+ *     California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *     @(#)ns16550.h   7.1 (Berkeley) 5/9/91
+ */
+
+/*
+ * NS16550 UART registers
+ */
+
+#define        com_data        0       /* data register (R/W) */
+#define        com_dlbl        0       /* divisor latch low (W) */
+#define        com_dlbh        1       /* divisor latch high (W) */
+#define        com_ier         1       /* interrupt enable (W) */
+#define        com_iir         2       /* interrupt identification (R) */
+#define        com_fifo        2       /* FIFO control (W) */
+#define        com_lctl        3       /* line control register (R/W) */
+#define        com_cfcr        3       /* line control register (R/W) */
+#define        com_mcr         4       /* modem control register (R/W) */
+#define        com_lsr         5       /* line status register (R/W) */
+#define        com_msr         6       /* modem status register (R/W) */
diff --git a/usr/src/sys.386bsd/i386/isa/isa_device.h b/usr/src/sys.386bsd/i386/isa/isa_device.h
new file mode 100644 (file)
index 0000000..371580a
--- /dev/null
@@ -0,0 +1,70 @@
+/*-
+ * Copyright (c) 1991 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *     This product includes software developed by the University of
+ *     California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *     @(#)isa_device.h        7.1 (Berkeley) 5/9/91
+ */
+
+/*
+ * ISA Bus Autoconfiguration
+ */
+
+/*
+ * Per device structure.
+ */
+struct isa_device {
+       struct  isa_driver *id_driver;
+       short   id_iobase;      /* base i/o address */
+       short   id_irq;         /* interrupt request */
+       short   id_drq;         /* DMA request */
+       caddr_t id_maddr;       /* physical i/o memory address on bus (if any)*/
+       int     id_msize;       /* size of i/o memory */
+       int     (*id_intr)();   /* interrupt interface routine */
+       int     id_unit;        /* unit number */
+       int     id_scsiid;      /* scsi id if needed */
+       int     id_alive;       /* device is present */
+};
+
+/*
+ * Per-driver structure.
+ *
+ * Each device driver defines entries for a set of routines
+ * as well as an array of types which are acceptable to it.
+ * These are used at boot time by the configuration program.
+ */
+struct isa_driver {
+       int     (*probe)();             /* test whether device is present */
+       int     (*attach)();            /* setup driver for a device */
+       char    *name;                  /* device name */
+};
+
+extern struct isa_device isa_devtab_bio[], isa_devtab_tty[], isa_devtab_net[],
+               isa_devtab_null[];
diff --git a/usr/src/sys.386bsd/i386/isa/wtreg.h b/usr/src/sys.386bsd/i386/isa/wtreg.h
new file mode 100644 (file)
index 0000000..8f79ca1
--- /dev/null
@@ -0,0 +1,95 @@
+/*-
+ * Copyright (c) 1991 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *     This product includes software developed by the University of
+ *     California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *     @(#)wtreg.h     7.1 (Berkeley) 5/9/91
+ */
+
+/*
+ *
+ * Copyright (c) 1989 Carnegie-Mellon University.
+ * All rights reserved.
+ *
+ * Authors: Robert Baron
+ * 
+ * Permission to use, copy, modify and distribute this software and
+ * its documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" 
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND 
+ * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ *
+ *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ *
+ * any improvements or extensions that they make and grant Carnegie the
+ * rights to redistribute these changes.
+ */
+
+/* 
+ * HISTORY
+ * $Log:       wtreg.h,v $
+ * Revision 2.2.1.1  90/01/08  13:29:25  rvb
+ *     Add Intel copyright.
+ *     [90/01/08            rvb]
+ * 
+ * Revision 2.2  89/09/25  12:33:09  rvb
+ *     Driver was provided by Intel 9/18/89.
+ *     [89/09/23            rvb]
+ * 
+ */
+
+/*
+ *
+ *  Copyright 1988, 1989 by Intel Corporation
+ *
+ */
+
+/*
+ *  wtioctl.h
+ *   defines ioctl parameters for direct QIC commands
+ */
+
+#define        WTIOC   ('W'<<8)
+#define        WTQICMD (WTIOC|0)
+
+/* QIC commands allowed */
+#define        SELECT  0x01
+#define        REWIND  0x21
+#define        ERASE   0x22
+#define        RETENS  0x24