Updated to new configure.
authorpefo <pefo@openbsd.org>
Wed, 1 May 1996 18:15:48 +0000 (18:15 +0000)
committerpefo <pefo@openbsd.org>
Wed, 1 May 1996 18:15:48 +0000 (18:15 +0000)
17 files changed:
sys/arch/pica/pica/autoconf.c
sys/arch/pica/pica/clock.c
sys/arch/pica/pica/clock_mc.c
sys/arch/pica/pica/conf.c
sys/arch/pica/pica/cpu.c
sys/arch/pica/pica/cpu_exec.c
sys/arch/pica/pica/disksubr.c
sys/arch/pica/pica/elf.c
sys/arch/pica/pica/locore.S
sys/arch/pica/pica/machdep.c
sys/arch/pica/pica/mainbus.c
sys/arch/pica/pica/minidebug.c
sys/arch/pica/pica/pica.c
sys/arch/pica/pica/pmap.c
sys/arch/pica/pica/process_machdep.c
sys/arch/pica/pica/trap.c
sys/arch/pica/pica/vm_machdep.c

index 66bf8b2..e6ea9b4 100644 (file)
@@ -38,7 +38,7 @@
  * from: Utah Hdr: autoconf.c 1.31 91/01/21
  *
  *     from: @(#)autoconf.c    8.1 (Berkeley) 6/10/93
- *      $Id: autoconf.c,v 1.1.1.1 1995/10/18 10:39:17 deraadt Exp $
+ *      $Id: autoconf.c,v 1.2 1996/05/01 18:15:48 pefo Exp $
  */
 
 /*
@@ -115,7 +115,7 @@ swapconf()
 u_long bootdev;                /* should be dev_t, but not until 32 bits */
 
 static char devname[][2] = {
-       's','d',        /* 0 = rz */
+       's','d',        /* 0 = sd */
        'x','x',        /* 1 = unused */
        'x','x',        /* 2 = unused */
        'x','x',        /* 3 = unused */
@@ -187,55 +187,44 @@ setroot()
 
 /*
  * Look at the string 'cp' and decode the boot device.
- * Boot names can be something like 'rz(0,0,0)vmunix' or '5/rz0/vmunix'.
+ * Boot names look like: scsi()disk(n)rdisk()partition(1)\bsd
  */
 void
 makebootdev(cp)
-       register char *cp;
+       char *cp;
 {
        int majdev, unit, part, ctrl;
+       char dv[8];
 
-       if (*cp >= '0' && *cp <= '9') {
-               /* XXX should be able to specify controller */
-               if (cp[1] != '/' || cp[4] < '0' || cp[4] > '9')
-                       goto defdev;
-               unit = cp[4] - '0';
-               if (cp[5] >= 'a' && cp[5] <= 'h')
-                       part = cp[5] - 'a';
-               else
-                       part = 0;
-               cp += 2;
-               for (majdev = 0; majdev < sizeof(devname)/sizeof(devname[0]);
-                   majdev++) {
-                       if (cp[0] == devname[majdev][0] &&
-                           cp[1] == devname[majdev][1]) {
-                               bootdev = MAKEBOOTDEV(majdev, 0, 0, unit, part);
-                               return;
-                       }
+       bootdev = B_DEVMAGIC;
+
+       dv[0] = *cp;
+       ctrl = getpno(&cp);
+       if(*cp++ == ')') {
+               dv[1] = *cp;
+               unit = getpno(&cp);
+
+               for (majdev = 0; majdev < sizeof(devname)/sizeof(devname[0]); majdev++)
+                       if (dv[0] == devname[majdev][0] &&
+                           dv[1] == devname[majdev][1] && cp[0] == ')')
+                               bootdev = MAKEBOOTDEV(majdev, 0, ctrl, unit,0);
+       }
+}
+getpno(cp)
+       char **cp;
+{
+       int val = 0;
+       char *cx = *cp;
+
+       while(*cx && *cx != '(')
+               cx++;
+       if(*cx == '(') {
+               cx++;
+               while(*cx && *cx != ')') {
+                       val = val * 10 + *cx - '0';
+                       cx++;
                }
-               goto defdev;
        }
-       for (majdev = 0; majdev < sizeof(devname)/sizeof(devname[0]); majdev++)
-               if (cp[0] == devname[majdev][0] &&
-                   cp[1] == devname[majdev][1] &&
-                   cp[2] == '(')
-                       goto fndmaj;
-defdev:
-       bootdev = B_DEVMAGIC;
-       return;
-
-fndmaj:
-       for (ctrl = 0, cp += 3; *cp >= '0' && *cp <= '9'; )
-               ctrl = ctrl * 10 + *cp++ - '0';
-       if (*cp == ',')
-               cp++;
-       for (unit = 0; *cp >= '0' && *cp <= '9'; )
-               unit = unit * 10 + *cp++ - '0';
-       if (*cp == ',')
-               cp++;
-       for (part = 0; *cp >= '0' && *cp <= '9'; )
-               part = part * 10 + *cp++ - '0';
-       if (*cp != ')')
-               goto defdev;
-       bootdev = MAKEBOOTDEV(majdev, 0, ctrl, unit, part);
+       *cp = cx;
+       return val;
 }
index 076f9fe..2ed953d 100644 (file)
@@ -38,7 +38,7 @@
  * from: Utah Hdr: clock.c 1.18 91/01/21
  *
  *     from: @(#)clock.c       8.1 (Berkeley) 6/10/93
- *      $Id: clock.c,v 1.1.1.1 1995/10/18 10:39:17 deraadt Exp $
+ *      $Id: clock.c,v 1.2 1996/05/01 18:15:51 pefo Exp $
  */
 
 #include <sys/param.h>
@@ -57,9 +57,13 @@ extern int cputype;  /* What kind of cpu we are running on */
 /* Definition of the driver for autoconfig. */
 static int     clockmatch __P((struct device *, void *, void *));
 static void    clockattach __P((struct device *, struct device *, void *));
-struct cfdriver clockcd =
-    { NULL, "clock", clockmatch, clockattach, DV_DULL,
-       sizeof(struct clock_softc) };
+
+struct cfattach clock_ca = {
+       sizeof(struct clock_softc), clockmatch, clockattach
+};
+struct cfdriver clock_cd = {
+       NULL, "clock", DV_DULL, NULL, 0
+};
 
 void   mcclock_attach __P((struct device *, struct device *, void *));
 
@@ -156,7 +160,7 @@ delay(n)
 cpu_initclocks()
 {
        extern int tickadj;
-       struct clock_softc *csc = (struct clock_softc *)clockcd.cd_devs[0];
+       struct clock_softc *csc = (struct clock_softc *)clock_cd.cd_devs[0];
 
        hz = 100;               /* 100 Hz */
        tick = 1000000 / hz;    /* number of micro-seconds between interrupts */
@@ -196,7 +200,7 @@ inittodr(base)
        time_t base;
 {
        struct tod_time c;
-       struct clock_softc *csc = (struct clock_softc *)clockcd.cd_devs[0];
+       struct clock_softc *csc = (struct clock_softc *)clock_cd.cd_devs[0];
        register int days, yr;
        long deltat;
        int badbase, s;
@@ -266,7 +270,7 @@ void
 resettodr()
 {
        struct tod_time c;
-       struct clock_softc *csc = (struct clock_softc *)clockcd.cd_devs[0];
+       struct clock_softc *csc = (struct clock_softc *)clock_cd.cd_devs[0];
        register int t, t2;
        int s;
 
index 81211a3..f08f942 100644 (file)
@@ -48,6 +48,7 @@
 #include <sys/device.h>
 
 #include <machine/autoconf.h>
+#include <machine/pio.h>
 
 #include <pica/pica/clockvar.h>
 #include <pica/pica/picatype.h>
index a2bbb6d..3b6842d 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: conf.c,v 1.3 1996/02/21 12:53:51 mickey Exp $ */
+/*     $OpenBSD: conf.c,v 1.4 1996/05/01 18:15:55 pefo Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -36,7 +36,7 @@
  * SUCH DAMAGE.
  *
  *     from: @(#)conf.c        8.2 (Berkeley) 11/14/93
- *      $Id: conf.c,v 1.3 1996/02/21 12:53:51 mickey Exp $
+ *      $Id: conf.c,v 1.4 1996/05/01 18:15:55 pefo Exp $
  */
 
 #include <sys/param.h>
@@ -59,23 +59,21 @@ bdev_decl(vnd);
 bdev_decl(sw);
 #include "sd.h"
 bdev_decl(sd);
+#include "cd.h"
+bdev_decl(cd);
 #include "fdc.h"
-#define fdopen Fdopen
 bdev_decl(fd);
-#undef fdopen
 
 struct bdevsw  bdevsw[] =
 {
        bdev_disk_init(NSD,sd),         /* 0: SCSI disk */
        bdev_swap_init(1,sw),           /* 1: should be here swap pseudo-dev */
        bdev_disk_init(NVND,vnd),       /* 2: vnode disk driver */
-       bdev_notdef(),                  /* 3:  */
+       bdev_disk_init(NCD,cd),         /* 3: SCSI CD-ROM */
        bdev_notdef(),                  /* 4:  */
        bdev_notdef(),                  /* 5:  */
        bdev_notdef(),                  /* 6:  */
-#define fdopen Fdopen
        bdev_disk_init(NFDC,fd),        /* 7: Floppy disk driver */
-#undef fdopen
        bdev_notdef(),                  /* 8:  */
        bdev_notdef(),                  /* 9:  */
        bdev_notdef(),                  /* 10:  */
@@ -129,9 +127,7 @@ cdev_decl(fd);
 #include "st.h"
 cdev_decl(st);
 #include "fdc.h"
-#define fdopen Fdopen
 bdev_decl(fd);
-#undef fdopen
 cdev_decl(vnd);
 #include "bpfilter.h"
 cdev_decl(bpf);
@@ -143,9 +139,18 @@ cdev_decl(sd);
 #include "pc.h"
 cdev_decl(pc);
 cdev_decl(pms);
+cdev_decl(cd);
 
 /* open, close, read, ioctl */
 cdev_decl(ipl);
+<<<<<<< 1.2
+#define        cdev_gen_ipf(c,n) { \
+       dev_init(c,n,open), dev_init(c,n,close), dev_init(c,n,read), \
+       (dev_type_write((*))) enodev, dev_init(c,n,ioctl), \
+       (dev_type_stop((*))) nullop, 0, (dev_type_select((*))) enodev, \
+       (dev_type_mmap((*))) enodev, 0 }
+=======
+>>>>>>> 1.3
 #ifdef IPFILTER
 #define NIPF 1
 #else
@@ -162,14 +167,12 @@ struct cdevsw     cdevsw[] =
        cdev_ptc_init(NPTY,ptc),        /* 5: pseudo-tty master */
        cdev_log_init(1,log),           /* 6: /dev/klog */
        cdev_fd_init(1,fd),             /* 7: file descriptor pseudo-dev */
-       cdev_notdef(),                  /* 8: SCSI CD */
+       cdev_disk_init(NCD,cd),         /* 8: SCSI CD */
        cdev_disk_init(NSD,sd),         /* 9: SCSI disk */
        cdev_tape_init(NST,st),         /* 10: SCSI tape */
        cdev_disk_init(NVND,vnd),       /* 11: vnode disk */
        cdev_bpftun_init(NBPFILTER,bpf),/* 12: berkeley packet filter */
-#define fdopen Fdopen
        cdev_disk_init(NFDC,fd),        /* 13: Floppy disk */
-#undef fdopen
        cdev_pc_init(1,pc),             /* 14: builtin pc style console dev */
        cdev_mouse_init(1,pms),         /* 15: builtin PS2 style mouse */
        cdev_lpt_init(NLPT,lpt),        /* 16: lpt paralell printer interface */
index d0f61e5..9dd2678 100644 (file)
 /* Definition of the driver for autoconfig. */
 static int     cpumatch(struct device *, void *, void *);
 static void    cpuattach(struct device *, struct device *, void *);
-struct cfdriver cpucd =
-    { NULL, "cpu", cpumatch, cpuattach, DV_DULL, sizeof (struct device) };
+
+struct cfattach cpu_ca = {
+       sizeof(struct device), cpumatch, cpuattach
+};
+struct cfdriver cpu_cd = {
+       NULL, "cpu", DV_DULL, NULL, 0
+};
 
 static int     cpuprint __P((void *, char *pnp));
 
@@ -52,7 +57,7 @@ cpumatch(parent, cfdata, aux)
        struct confargs *ca = aux;
 
        /* make sure that we're looking for a CPU. */
-       if (strcmp(ca->ca_name, cpucd.cd_name) != 0)
+       if (strcmp(ca->ca_name, cpu_cd.cd_name) != 0)
                return (0);
 
        return (1);
index bf0c853..a5cd893 100644 (file)
@@ -77,7 +77,11 @@ cpu_exec_aout_makecmds(p, epp)
                /* If it's not a.out, maybe it's ELF.  (This wants to
                   be moved up to the machine independent code as soon
                   as possible.)  XXX */
+#if 0
                return pmax_elf_makecmds (p, epp);
+#else
+               return ENOEXEC;
+#endif
 
 #ifdef COMPAT_09
        epp -> ep_taddr = 0x1000;
index 132c13b..d7cc707 100644 (file)
@@ -45,7 +45,7 @@ extern struct device *bootdv;
 /* was this the boot device ? */
 int
 dk_establish(dk, dev)
-       struct dkdevice *dk;
+       struct disk *dk;
        struct device *dev;
 {
 #ifdef NOTDEF
index f4a12e0..bed2a4f 100644 (file)
@@ -132,17 +132,30 @@ pmax_elf_makecmds (p, epp)
                                        epp->ep_daddr = vaddr;
                                epp->ep_dsize += ph.memsz;
                                /* Read the data from the file... */
+#if 1
+                               offset -= (vaddr & (NBPG - 1));
+                               length += (vaddr & (NBPG - 1));
+                               vaddr &= ~(NBPG - 1);
                                NEW_VMCMD(&epp->ep_vmcmds, vmcmd_map_readvn,
                                          length, vaddr,
                                          epp->ep_vp, offset, prot);
+                               length = roundup (length, NBPG);
+                               if (residue) {
+                                       residue = (ph.vaddr + ph.memsz)
+                                                 - (vaddr + length);
+                               }
+#else
+                               offset -= (vaddr & (NBPG - 1));
+                               vaddr &= ~(NBPG - 1);
+                               length = roundup (length + ph.vaddr - vaddr, NBPG);
+                               NEW_VMCMD(&epp->ep_vmcmds, vmcmd_map_pagedvn,
+                                         length, vaddr, epp->ep_vp,
+                                         offset, prot);
                                if (residue) {
-                                       vaddr &= ~(NBPG - 1);
-                                       offset &= ~(NBPG - 1);
-                                       length = roundup (length + ph.vaddr
-                                                         - vaddr, NBPG);
                                        residue = (ph.vaddr + ph.memsz)
                                                  - (vaddr + length);
                                }
+#endif
                        } else {
                                vaddr &= ~(NBPG - 1);
                                offset &= ~(NBPG - 1);
index c6ddd82..b356cf3 100644 (file)
@@ -49,7 +49,7 @@
  *     v 1.1 89/07/10 14:27:41 nelson Exp  SPRITE (DECWRL)
  *
  *     from: @(#)locore.s      8.5 (Berkeley) 1/4/94
- *     $Id: locore.S,v 1.2 1995/10/30 13:38:02 deraadt Exp $
+ *     $Id: locore.S,v 1.3 1996/05/01 18:16:05 pefo Exp $
  */
 
 /*
@@ -62,8 +62,8 @@
 
 #include <machine/param.h>
 #include <machine/psl.h>
-#include <machine/reg.h>
-#include <machine/machAsmDefs.h>
+#include <machine/asm.h>
+#include <machine/regnum.h>
 #include <machine/pte.h>
 
 #include "assym.h"
@@ -150,14 +150,6 @@ start:
        eret
        .set    at
 
-/*
- * GCC2 seems to want to call __main in main() for some reason.
- */
-LEAF(__main)
-       j       ra
-       nop
-END(__main)
-
 /*
  * Primitives
  */
@@ -350,19 +342,6 @@ smallclr:
        nop
 END(bzero)
 
-/*
- * fillw(pat, addr, count)
- */
-LEAF(fillw)
-1:
-       addiu   a2, a2, -1
-       sh      a0, 0(a1)
-       bne     a2,zero, 1b
-       addiu   a1, a1, 2
-
-       jr      ra
-       nop
-END(fillw)
 /*
  * bcmp(s1, s2, n)
  */
@@ -559,6 +538,20 @@ LEAF(copystr)
        move    v0, zero
 END(copystr)
 
+/*
+ * fillw(pat, addr, count)
+ */
+LEAF(fillw)
+1:
+       addiu   a2, a2, -1
+       sh      a0, 0(a1)
+       bne     a2,zero, 1b
+       addiu   a1, a1, 2
+
+       jr      ra
+       nop
+END(fillw)
+
 /*
  * Copy a null terminated string from the user address space into
  * the kernel address space.
@@ -2952,6 +2945,7 @@ END(MachFlushDCache)
  *----------------------------------------------------------------------------
  */
 LEAF(MachHitFlushDCache)
+       beq     a1, zero, 2f
        addu    a1, 127         # Align
        addu    a1, a1, a0
        and     a0, a0, -128
@@ -2970,6 +2964,7 @@ LEAF(MachHitFlushDCache)
        bne     a1, zero, 1b
        addu    a0, 128
 
+2:
        j       ra
        nop
 END(MachHitFlushDCache)
index a93b28a..1173542 100644 (file)
@@ -37,7 +37,7 @@
  * SUCH DAMAGE.
  *
  *     from: @(#)machdep.c     8.3 (Berkeley) 1/12/94
- *      $Id: machdep.c,v 1.5 1996/01/05 16:18:09 deraadt Exp $
+ *      $Id: machdep.c,v 1.6 1996/05/01 18:16:09 pefo Exp $
  */
 
 /* from: Utah Hdr: machdep.c 1.63 91/04/24 */
@@ -78,6 +78,7 @@
 
 #include <machine/cpu.h>
 #include <machine/reg.h>
+#include <machine/pio.h>
 #include <machine/psl.h>
 #include <machine/pte.h>
 #include <machine/autoconf.h>
@@ -196,10 +197,8 @@ mips_init(argc, argv, code)
                break;
        }
 
-#if 0
        /* look at argv[0] and compute bootdev */
        makebootdev(argv[0]);
-#endif
 
        /*
         * Look at arguments passed to us and compute boothowto.
@@ -214,29 +213,31 @@ mips_init(argc, argv, code)
 #endif
        if (argc > 1) {
                for (i = 1; i < argc; i++) {
-                       for (cp = argv[i]; *cp; cp++) {
-                               switch (*cp) {
-                               case 'a': /* autoboot */
-                                       boothowto &= ~RB_SINGLE;
-                                       break;
-
-                               case 'd': /* use compiled in default root */
-                                       boothowto |= RB_DFLTROOT;
-                                       break;
-
-                               case 'm': /* mini root present in memory */
-                                       boothowto |= RB_MINIROOT;
-                                       break;
-
-                               case 'n': /* ask for names */
-                                       boothowto |= RB_ASKNAME;
-                                       break;
-
-                               case 'N': /* don't ask for names */
-                                       boothowto &= ~RB_ASKNAME;
-                                       break;
-                               }
+                       if(strncmp("OSLOADOPTIONS=",argv[i],14) == 0) {
+                               for (cp = argv[i]+14; *cp; cp++) {
+                                       switch (*cp) {
+                                       case 'a': /* autoboot */
+                                               boothowto &= ~RB_SINGLE;
+                                               break;
+
+                                       case 'd': /* use compiled in default root */
+                                               boothowto |= RB_DFLTROOT;
+                                               break;
+
+                                       case 'm': /* mini root present in memory */
+                                               boothowto |= RB_MINIROOT;
+                                               break;
+
+                                       case 'n': /* ask for names */
+                                               boothowto |= RB_ASKNAME;
+                                               break;
+
+                                       case 'N': /* don't ask for names */
+                                               boothowto &= ~RB_ASKNAME;
+                                               break;
+                                       }
 
+                               }
                        }
                }
        }
@@ -665,10 +666,12 @@ setregs(p, pack, stack, retval)
        bzero((caddr_t)p->p_md.md_regs, (FSR + 1) * sizeof(int));
        p->p_md.md_regs[SP] = stack;
        p->p_md.md_regs[PC] = pack->ep_entry & ~3;
+       p->p_md.md_regs[T9] = pack->ep_entry & ~3; /* abicall req */
        p->p_md.md_regs[PS] = PSL_USERSET;
        p->p_md.md_flags & ~MDP_FPUSED;
        if (machFPCurProcPtr == p)
                machFPCurProcPtr = (struct proc *)0;
+       p->p_md.md_ss_addr = 0;
 }
 
 /*
@@ -777,6 +780,7 @@ sendsig(catcher, sig, mask, code)
        regs[A3] = (int)catcher;
 
        regs[PC] = (int)catcher;
+       regs[T9] = (int)catcher;
        regs[SP] = (int)fp;
        /*
         * Signal trampoline code is at base of user stack.
index 6d66229..10a5ca7 100644 (file)
@@ -44,9 +44,13 @@ struct mainbus_softc {
 static int     mbmatch __P((struct device *, void *, void *));
 static void    mbattach __P((struct device *, struct device *, void *));
 static int     mbprint __P((void *, char *));
-struct cfdriver mainbuscd =
-    { NULL, "mainbus", mbmatch, mbattach, DV_DULL,
-       sizeof (struct mainbus_softc) };
+
+struct cfattach mainbus_ca = {
+       sizeof(struct device), mbmatch, mbattach
+};
+struct cfdriver mainbus_cd = {
+       NULL, "mainbus", DV_DULL, NULL, 0
+};
 
 void   mb_intr_establish __P((struct confargs *, int (*)(void *), void *));
 void   mb_intr_disestablish __P((struct confargs *));
index fa74c16..62f68d8 100644 (file)
@@ -34,7 +34,7 @@
  * SUCH DAMAGE.
  *
  *     from: @(#)kadb.c        8.1 (Berkeley) 6/10/93
- *      $Id: minidebug.c,v 1.1.1.1 1995/10/18 10:39:18 deraadt Exp $
+ *      $Id: minidebug.c,v 1.2 1996/05/01 18:16:13 pefo Exp $
  */
 
 /*
@@ -532,6 +532,7 @@ static int ssandrun;        /* Single step and run flag (when cont at brk) */
                        break;
                        
                default:
+                       cnputc('\a');
                        break;
                }
                printf("\n# ");
@@ -548,7 +549,12 @@ mdbsetsstep()
        int i;
 
        /* compute next address after current location */
-       va = MachEmulateBranch(locr0, locr0[PC], 0, 1);
+       if(mdbpeek(locr0[PC]) != 0) {
+               va = MachEmulateBranch(locr0, locr0[PC], 0, mdbpeek(locr0[PC]));
+       }
+       else {
+               va = locr0[PC] + 4;
+       }
        if (mdb_ss_addr) {
                printf("mdbsetsstep: breakpoint already set at %x (va %x)\n",
                        mdb_ss_addr, va);
index f0bfe18..f4e300b 100644 (file)
@@ -31,6 +31,7 @@
 #include <sys/device.h>
 
 #include <machine/cpu.h>
+#include <machine/pio.h>
 #include <machine/autoconf.h>
 
 #include <pica/pica/pica.h>
@@ -46,8 +47,13 @@ struct pica_softc {
 int    picamatch(struct device *, void *, void *);
 void   picaattach(struct device *, struct device *, void *);
 int    picaprint(void *, char *);
-struct cfdriver picacd =
-    { NULL, "pica", picamatch, picaattach, DV_DULL, sizeof (struct pica_softc) };
+
+struct cfattach pica_ca = {
+       sizeof(struct device), picamatch, picaattach
+};
+struct cfdriver pica_cd = {
+       NULL, "pica", DV_DULL, NULL, 0
+};
 
 void   pica_intr_establish __P((struct confargs *, int (*)(void *), void *));
 void   pica_intr_disestablish __P((struct confargs *));
@@ -137,7 +143,7 @@ picamatch(parent, cfdata, aux)
        struct confargs *ca = aux;
 
         /* Make sure that we're looking for a PICA. */
-        if (strcmp(ca->ca_name, picacd.cd_name) != 0)
+        if (strcmp(ca->ca_name, pica_cd.cd_name) != 0)
                 return (0);
 
         /* Make sure that unit exists. */
@@ -206,7 +212,7 @@ caddr_t
 pica_cvtaddr(ca)
        struct confargs *ca;
 {
-       struct pica_softc *sc = picacd.cd_devs[0];
+       struct pica_softc *sc = pica_cd.cd_devs[0];
 
        return(sc->sc_devs[ca->ca_slot].ps_base + ca->ca_offset);
 
@@ -218,7 +224,7 @@ pica_intr_establish(ca, handler, val)
        intr_handler_t handler;
        void *val;
 {
-       struct pica_softc *sc = picacd.cd_devs[0];
+       struct pica_softc *sc = pica_cd.cd_devs[0];
 
        int slot;
 
@@ -243,7 +249,7 @@ void
 pica_intr_disestablish(ca)
        struct confargs *ca;
 {
-       struct pica_softc *sc = picacd.cd_devs[0];
+       struct pica_softc *sc = pica_cd.cd_devs[0];
 
        int slot;
 
index 4d7e22f..9336cc4 100644 (file)
@@ -35,7 +35,7 @@
  * SUCH DAMAGE.
  *
  *     from: @(#)pmap.c        8.4 (Berkeley) 1/26/94
- *      $Id: pmap.c,v 1.1.1.1 1995/10/18 10:39:18 deraadt Exp $
+ *      $Id: pmap.c,v 1.2 1996/05/01 18:16:17 pefo Exp $
  */
 
 /*
@@ -160,7 +160,6 @@ vm_offset_t avail_end;      /* PA of last available physical page */
 vm_size_t      mem_size;       /* memory size in bytes */
 vm_offset_t    virtual_avail;  /* VA of first avail page (after kernel bss)*/
 vm_offset_t    virtual_end;    /* VA of last avail page (end of kernel AS) */
-int            picapagesperpage;       /* PAGE_SIZE / NBPG */
 #ifdef ATTR
 char           *pmap_attributes;       /* reference and modify bits */
 #endif
@@ -223,7 +222,6 @@ pmap_bootstrap(firstaddr)
        virtual_avail = VM_MIN_KERNEL_ADDRESS;
        virtual_end = VM_MIN_KERNEL_ADDRESS + Sysmapsize * NBPG;
        /* XXX need to decide how to set cnt.v_page_size */
-       picapagesperpage = 1;
 
        simple_lock_init(&pmap_kernel()->pm_lock);
        pmap_kernel()->pm_count = 1;
@@ -357,7 +355,7 @@ pmap_pinit(pmap)
                pmap_zero_page(VM_PAGE_TO_PHYS(mem));
                pmap->pm_segtab = stp = (struct segtab *)
                        MACH_PHYS_TO_CACHED(VM_PAGE_TO_PHYS(mem));
-               i = picapagesperpage * (NBPG / sizeof(struct segtab));
+               i = NBPG / sizeof(struct segtab);
                s = splimp();
                while (--i != 0) {
                        stp++;
@@ -926,13 +924,14 @@ pmap_enter(pmap, va, pa, prot, wired)
                         * Check if they are cache index compatible. If not
                         * remove all mappings, flush the cache and set page
                         * to be mapped uncached. Caching will be restored
-                        * when pages are mapped compatible again.
+                        * when pages are mapped compatible again. NOT!
                         */
                                for (npv = pv; npv; npv = npv->pv_next) {
                                        /*
                                         * Check cache aliasing incompatibility
                                         */
                                        if((npv->pv_va & machCacheAliasMask) != (va & machCacheAliasMask)) {
+                                               printf("pmap_enter: creating uncached mapping.\n");
                                                pmap_page_cache(pa,PV_UNCACHED);
                                                MachFlushDCache(pv->pv_va, PAGE_SIZE);
                                                npte = (npte & ~PG_CACHEMODE) | PG_UNCACHED;
@@ -1023,28 +1022,22 @@ pmap_enter(pmap, va, pa, prot, wired)
                pte = kvtopte(va);
                npte |= vad_to_pfn(pa) | PG_ROPAGE | PG_G;
                if (wired) {
-                       pmap->pm_stats.wired_count += picapagesperpage;
+                       pmap->pm_stats.wired_count++;
                        npte |= PG_WIRED;
                }
-               i = picapagesperpage;
-               do {
-                       if (!(pte->pt_entry & PG_V)) {
-                               pmap->pm_stats.resident_count++;
-                       } else {
+               if (!(pte->pt_entry & PG_V)) {
+                       pmap->pm_stats.resident_count++;
+               } else {
 #ifdef DIAGNOSTIC
-                               if (pte->pt_entry & PG_WIRED)
-                                       panic("pmap_enter: kernel wired");
+                       if (pte->pt_entry & PG_WIRED)
+                               panic("pmap_enter: kernel wired");
 #endif
-                       }
-                       /*
-                        * Update the same virtual address entry.
-                        */
-                       j = MachTLBUpdate(va, npte);
-                       pte->pt_entry = npte;
-                       va += NBPG;
-                       npte += vad_to_pfn(NBPG);
-                       pte++;
-               } while (--i != 0);
+               }
+               /*
+                * Update the same virtual address entry.
+                */
+               j = MachTLBUpdate(va, npte);
+               pte->pt_entry = npte;
                return;
        }
 
@@ -1069,7 +1062,7 @@ pmap_enter(pmap, va, pa, prot, wired)
         */
        npte |= vad_to_pfn(pa);
        if (wired) {
-               pmap->pm_stats.wired_count += picapagesperpage;
+               pmap->pm_stats.wired_count++;
                npte |= PG_WIRED;
        }
 #ifdef DEBUG
@@ -1080,16 +1073,13 @@ pmap_enter(pmap, va, pa, prot, wired)
                printf("\n");
        }
 #endif
-       i = picapagesperpage;
-       do {
-               pte->pt_entry = npte;
-               if (pmap->pm_tlbgen == tlbpid_gen)
-                       j = MachTLBUpdate(va | (pmap->pm_tlbpid <<
-                               VMMACH_TLB_PID_SHIFT), npte);
-               va += NBPG;
-               npte += vad_to_pfn(NBPG);
-               pte++;
-       } while (--i != 0);
+       if (!(pte->pt_entry & PG_V)) {
+               pmap->pm_stats.resident_count++;
+       }
+       pte->pt_entry = npte;
+       if (pmap->pm_tlbgen == tlbpid_gen)
+               j = MachTLBUpdate(va | (pmap->pm_tlbpid <<
+                       VMMACH_TLB_PID_SHIFT), npte);
 }
 
 /*
@@ -1134,16 +1124,13 @@ pmap_change_wiring(pmap, va, wired)
                pte += (va >> PGSHIFT) & (NPTEPG - 1);
        }
 
-       i = picapagesperpage;
        if (!(pte->pt_entry & PG_WIRED) && p)
-               pmap->pm_stats.wired_count += i;
+               pmap->pm_stats.wired_count++;
        else if ((pte->pt_entry & PG_WIRED) && !p)
-               pmap->pm_stats.wired_count -= i;
-       do {
-               if (pte->pt_entry & PG_V)
-                       pte->pt_entry = (pte->pt_entry & ~PG_WIRED) | p;
-               pte++;
-       } while (--i != 0);
+               pmap->pm_stats.wired_count--;
+
+       if (pte->pt_entry & PG_V)
+               pte->pt_entry = (pte->pt_entry & ~PG_WIRED) | p;
 }
 
 /*
@@ -1624,3 +1611,23 @@ vm_page_free1(mem)
                splx(spl);
        }
 }
+
+/*
+ * Find first virtual address >= *vap that doesn't cause
+ * a cache alias conflict.
+ */
+void
+pmap_prefer(foff, vap)
+       register vm_offset_t foff;
+       register vm_offset_t *vap;
+{
+       register vm_offset_t    va = *vap;
+       register long           m, d;
+
+       m = 0x10000;            /* Max aliased cache size */
+
+       d = foff - va;
+       d &= (m-1);
+       *vap = va + d;
+}
+
index 5bb773e..8d62d1e 100644 (file)
@@ -38,7 +38,7 @@
  * From:
  *     Id: procfs_i386.c,v 4.1 1993/12/17 10:47:45 jsp Rel
  *
- *     $Id: process_machdep.c,v 1.1.1.1 1995/10/18 10:39:19 deraadt Exp $
+ *     $Id: process_machdep.c,v 1.2 1996/05/01 18:16:20 pefo Exp $
  */
 
 /*
@@ -79,6 +79,7 @@ process_read_regs(p, regs)
        struct proc *p;
        struct reg *regs;
 {
+       bcopy((caddr_t)p->p_md.md_regs, (caddr_t)regs, sizeof(struct reg));
        return (0);
 }
 
@@ -87,6 +88,8 @@ process_write_regs(p, regs)
        struct proc *p;
        struct reg *regs;
 {
+       bcopy((caddr_t)regs, (caddr_t)p->p_md.md_regs, sizeof(struct reg));
+/*XXX Clear to user set bits!! */
        return (0);
 }
 
@@ -94,6 +97,8 @@ int
 process_sstep(p, sstep)
        struct proc *p;
 {
+       if(sstep)
+               cpu_singlestep(p);
        return (0);
 }
 
@@ -102,6 +107,7 @@ process_set_pc(p, addr)
        struct proc *p;
        caddr_t addr;
 {
+       p->p_md.md_regs[PC] = (int)addr;
        return (0);
 }
 
index ce3e164..2743d6a 100644 (file)
@@ -38,7 +38,7 @@
  * from: Utah Hdr: trap.c 1.32 91/04/06
  *
  *     from: @(#)trap.c        8.5 (Berkeley) 1/11/94
- *      $Id: trap.c,v 1.4 1996/01/12 16:45:19 deraadt Exp $
+ *      $Id: trap.c,v 1.5 1996/05/01 18:16:22 pefo Exp $
  */
 
 #include <sys/param.h>
@@ -59,6 +59,7 @@
 #include <machine/psl.h>
 #include <machine/reg.h>
 #include <machine/cpu.h>
+#include <machine/pio.h>
 #include <machine/autoconf.h>
 #include <machine/pte.h>
 #include <machine/pmap.h>
@@ -616,6 +617,8 @@ trap(statusReg, causeReg, vadr, pc, args)
                        locr0[V0] = i;
                        locr0[A3] = 1;
                }
+               if(code == SYS_ptrace)
+                       MachFlushCache();
        done:
 #ifdef SYSCALL_DEBUG
                scdebug_ret(p, code, i, rval);
@@ -630,6 +633,8 @@ trap(statusReg, causeReg, vadr, pc, args)
        case T_BREAK+T_USER:
            {
                register unsigned va, instr;
+               struct uio uio;
+               struct iovec iov;
 
                /* compute address of break instruction */
                va = pc;
@@ -642,36 +647,31 @@ trap(statusReg, causeReg, vadr, pc, args)
                printf("trap: %s (%d) breakpoint %x at %x: (adr %x ins %x)\n",
                        p->p_comm, p->p_pid, instr, pc,
                        p->p_md.md_ss_addr, p->p_md.md_ss_instr); /* XXX */
-#endif
-#ifdef DEBUG
-               if (instr == MACH_BREAK_BRKPT || instr == MACH_BREAK_SSTEP)
-                       goto err;
 #endif
                if (p->p_md.md_ss_addr != va || instr != MACH_BREAK_SSTEP) {
                        i = SIGTRAP;
                        break;
                }
 
-               /* restore original instruction and clear BP  */
-               i = suiword((caddr_t)va, p->p_md.md_ss_instr);
-               if (i < 0) {
-                       vm_offset_t sa, ea;
-                       int rv;
+               /*
+                * Restore original instruction and clear BP
+                */
+               iov.iov_base = (caddr_t)&p->p_md.md_ss_instr;
+               iov.iov_len = sizeof(int); 
+               uio.uio_iov = &iov;
+               uio.uio_iovcnt = 1; 
+               uio.uio_offset = (off_t)va;
+               uio.uio_resid = sizeof(int);
+               uio.uio_segflg = UIO_SYSSPACE;
+               uio.uio_rw = UIO_WRITE;
+               uio.uio_procp = curproc;
+               i = procfs_domem(p, p, NULL, &uio);
+               MachFlushCache();
 
-                       sa = trunc_page((vm_offset_t)va);
-                       ea = round_page((vm_offset_t)va+sizeof(int)-1);
-                       rv = vm_map_protect(&p->p_vmspace->vm_map, sa, ea,
-                               VM_PROT_DEFAULT, FALSE);
-                       if (rv == KERN_SUCCESS) {
-                               i = suiword((caddr_t)va, p->p_md.md_ss_instr);
-                               (void) vm_map_protect(&p->p_vmspace->vm_map,
-                                       sa, ea, VM_PROT_READ|VM_PROT_EXECUTE,
-                                       FALSE);
-                       }
-               }
                if (i < 0)
                        printf("Warning: can't restore instruction at %x: %x\n",
                                p->p_md.md_ss_addr, p->p_md.md_ss_instr);
+
                p->p_md.md_ss_addr = 0;
                i = SIGTRAP;
                break;
@@ -1044,10 +1044,17 @@ MachEmulateBranch(regsPtr, instPC, fpcCSR, allowNonBranch)
        InstFmt inst;
        unsigned retAddr;
        int condition;
-       extern unsigned GetBranchDest();
 
+#define GetBranchDest(InstPtr, inst) \
+       ((unsigned)InstPtr + 4 + ((short)inst.IType.imm << 2))
 
-       inst = *(InstFmt *)instPC;
+
+       if(allowNonBranch == 0) {
+               inst = *(InstFmt *)instPC;
+       }
+       else {
+               inst = *(InstFmt *)&allowNonBranch;
+       }
 #if 0
        printf("regsPtr=%x PC=%x Inst=%x fpcCsr=%x\n", regsPtr, instPC,
                inst.word, fpcCSR); /* XXX */
@@ -1075,7 +1082,7 @@ MachEmulateBranch(regsPtr, instPC, fpcCSR, allowNonBranch)
                case OP_BLTZAL:
                case OP_BLTZALL:
                        if ((int)(regsPtr[inst.RType.rs]) < 0)
-                               retAddr = GetBranchDest((InstFmt *)instPC);
+                               retAddr = GetBranchDest(instPC, inst);
                        else
                                retAddr = instPC + 8;
                        break;
@@ -1085,7 +1092,7 @@ MachEmulateBranch(regsPtr, instPC, fpcCSR, allowNonBranch)
                case OP_BGEZAL:
                case OP_BGEZALL:
                        if ((int)(regsPtr[inst.RType.rs]) >= 0)
-                               retAddr = GetBranchDest((InstFmt *)instPC);
+                               retAddr = GetBranchDest(instPC, inst);
                        else
                                retAddr = instPC + 8;
                        break;
@@ -1104,7 +1111,7 @@ MachEmulateBranch(regsPtr, instPC, fpcCSR, allowNonBranch)
        case OP_BEQ:
        case OP_BEQL:
                if (regsPtr[inst.RType.rs] == regsPtr[inst.RType.rt])
-                       retAddr = GetBranchDest((InstFmt *)instPC);
+                       retAddr = GetBranchDest(instPC, inst);
                else
                        retAddr = instPC + 8;
                break;
@@ -1112,7 +1119,7 @@ MachEmulateBranch(regsPtr, instPC, fpcCSR, allowNonBranch)
        case OP_BNE:
        case OP_BNEL:
                if (regsPtr[inst.RType.rs] != regsPtr[inst.RType.rt])
-                       retAddr = GetBranchDest((InstFmt *)instPC);
+                       retAddr = GetBranchDest(instPC, inst);
                else
                        retAddr = instPC + 8;
                break;
@@ -1120,7 +1127,7 @@ MachEmulateBranch(regsPtr, instPC, fpcCSR, allowNonBranch)
        case OP_BLEZ:
        case OP_BLEZL:
                if ((int)(regsPtr[inst.RType.rs]) <= 0)
-                       retAddr = GetBranchDest((InstFmt *)instPC);
+                       retAddr = GetBranchDest(instPC, inst);
                else
                        retAddr = instPC + 8;
                break;
@@ -1128,7 +1135,7 @@ MachEmulateBranch(regsPtr, instPC, fpcCSR, allowNonBranch)
        case OP_BGTZ:
        case OP_BGTZL:
                if ((int)(regsPtr[inst.RType.rs]) > 0)
-                       retAddr = GetBranchDest((InstFmt *)instPC);
+                       retAddr = GetBranchDest(instPC, inst);
                else
                        retAddr = instPC + 8;
                break;
@@ -1142,7 +1149,7 @@ MachEmulateBranch(regsPtr, instPC, fpcCSR, allowNonBranch)
                        else
                                condition = !(fpcCSR & MACH_FPC_COND_BIT);
                        if (condition)
-                               retAddr = GetBranchDest((InstFmt *)instPC);
+                               retAddr = GetBranchDest(instPC, inst);
                        else
                                retAddr = instPC + 8;
                        break;
@@ -1165,13 +1172,6 @@ MachEmulateBranch(regsPtr, instPC, fpcCSR, allowNonBranch)
        return (retAddr);
 }
 
-unsigned
-GetBranchDest(InstPtr)
-       InstFmt *InstPtr;
-{
-       return ((unsigned)InstPtr + 4 + ((short)InstPtr->IType.imm << 2));
-}
-
 /*
  * This routine is called by procxmt() to single step one instruction.
  * We do this by storing a break instruction after the current instruction,
@@ -1183,38 +1183,73 @@ cpu_singlestep(p)
        register unsigned va;
        register int *locr0 = p->p_md.md_regs;
        int i;
+       int bpinstr = MACH_BREAK_SSTEP;
+       int curinstr;
+       struct uio uio;
+       struct iovec iov;
+
+       /*
+        * Fetch what's at the current location.
+        */
+       iov.iov_base = (caddr_t)&curinstr;
+       iov.iov_len = sizeof(int); 
+       uio.uio_iov = &iov;
+       uio.uio_iovcnt = 1; 
+       uio.uio_offset = (off_t)locr0[PC];
+       uio.uio_resid = sizeof(int);
+       uio.uio_segflg = UIO_SYSSPACE;
+       uio.uio_rw = UIO_READ;
+       uio.uio_procp = curproc;
+       procfs_domem(curproc, p, NULL, &uio);
 
        /* compute next address after current location */
-       va = MachEmulateBranch(locr0, locr0[PC], locr0[FSR], 1);
-       if (p->p_md.md_ss_addr || p->p_md.md_ss_addr == va ||
-           !useracc((caddr_t)va, 4, B_READ)) {
+       if(curinstr != 0) {
+               va = MachEmulateBranch(locr0, locr0[PC], locr0[FSR], curinstr);
+       }
+       else {
+               va = locr0[PC] + 4;
+       }
+       if (p->p_md.md_ss_addr) {
                printf("SS %s (%d): breakpoint already set at %x (va %x)\n",
                        p->p_comm, p->p_pid, p->p_md.md_ss_addr, va); /* XXX */
                return (EFAULT);
        }
        p->p_md.md_ss_addr = va;
-       p->p_md.md_ss_instr = fuiword((caddr_t)va);
-       i = suiword((caddr_t)va, MACH_BREAK_SSTEP);
-       if (i < 0) {
-               vm_offset_t sa, ea;
-               int rv;
+       /*
+        * Fetch what's at the current location.
+        */
+       iov.iov_base = (caddr_t)&p->p_md.md_ss_instr;
+       iov.iov_len = sizeof(int); 
+       uio.uio_iov = &iov;
+       uio.uio_iovcnt = 1; 
+       uio.uio_offset = (off_t)va;
+       uio.uio_resid = sizeof(int);
+       uio.uio_segflg = UIO_SYSSPACE;
+       uio.uio_rw = UIO_READ;
+       uio.uio_procp = curproc;
+       procfs_domem(curproc, p, NULL, &uio);
+
+       /*
+        * Store breakpoint instruction at the "next" location now.
+        */
+       iov.iov_base = (caddr_t)&bpinstr;
+       iov.iov_len = sizeof(int); 
+       uio.uio_iov = &iov;
+       uio.uio_iovcnt = 1; 
+       uio.uio_offset = (off_t)va;
+       uio.uio_resid = sizeof(int);
+       uio.uio_segflg = UIO_SYSSPACE;
+       uio.uio_rw = UIO_WRITE;
+       uio.uio_procp = curproc;
+       i = procfs_domem(curproc, p, NULL, &uio);
+       MachFlushCache();
 
-               sa = trunc_page((vm_offset_t)va);
-               ea = round_page((vm_offset_t)va+sizeof(int)-1);
-               rv = vm_map_protect(&p->p_vmspace->vm_map, sa, ea,
-                       VM_PROT_DEFAULT, FALSE);
-               if (rv == KERN_SUCCESS) {
-                       i = suiword((caddr_t)va, MACH_BREAK_SSTEP);
-                       (void) vm_map_protect(&p->p_vmspace->vm_map,
-                               sa, ea, VM_PROT_READ|VM_PROT_EXECUTE, FALSE);
-               }
-       }
        if (i < 0)
                return (EFAULT);
 #if 0
        printf("SS %s (%d): breakpoint set at %x: %x (pc %x) br %x\n",
                p->p_comm, p->p_pid, p->p_md.md_ss_addr,
-               p->p_md.md_ss_instr, locr0[PC], fuword((caddr_t)va)); /* XXX */
+               p->p_md.md_ss_instr, locr0[PC], curinstr); /* XXX */
 #endif
        return (0);
 }
index 51708f0..55066d4 100644 (file)
@@ -38,7 +38,7 @@
  * from: Utah Hdr: vm_machdep.c 1.21 91/04/06
  *
  *     from: @(#)vm_machdep.c  8.3 (Berkeley) 1/4/94
- *      $Id: vm_machdep.c,v 1.1.1.1 1995/10/18 10:39:19 deraadt Exp $
+ *      $Id: vm_machdep.c,v 1.2 1996/05/01 18:16:25 pefo Exp $
  */
 
 
@@ -248,8 +248,10 @@ extern vm_map_t phys_map;
  *
  * All requests are (re)mapped into kernel VA space via the phys_map
  */
-vmapbuf(bp)
-       register struct buf *bp;
+void
+vmapbuf(bp, len)
+       struct buf *bp;
+       vm_size_t len;
 {
        register caddr_t addr;
        register vm_size_t sz;
@@ -263,7 +265,7 @@ vmapbuf(bp)
        addr = bp->b_saveaddr = bp->b_un.b_addr;
        off = (int)addr & PGOFSET;
        p = bp->b_proc;
-       sz = round_page(bp->b_bcount + off);
+       sz = round_page(off + len);
        kva = kmem_alloc_wait_align(phys_map, sz, (vm_size_t)addr & machCacheAliasMask);
        bp->b_un.b_addr = (caddr_t) (kva + off);
        sz = atop(sz);
@@ -283,8 +285,10 @@ vmapbuf(bp)
  * Free the io map PTEs associated with this IO operation.
  * We also invalidate the TLB entries and restore the original b_addr.
  */
-vunmapbuf(bp)
-       register struct buf *bp;
+void
+vunmapbuf(bp, len)
+       struct buf *bp;
+       vm_size_t len;
 {
        register caddr_t addr = bp->b_un.b_addr;
        register vm_size_t sz;
@@ -292,7 +296,7 @@ vunmapbuf(bp)
 
        if ((bp->b_flags & B_PHYS) == 0)
                panic("vunmapbuf");
-       sz = round_page(bp->b_bcount + ((int)addr & PGOFSET));
+       sz = round_page(len + ((int)addr & PGOFSET));
        kva = (vm_offset_t)((int)addr & ~PGOFSET);
        kmem_free_wakeup(phys_map, kva, sz);
        bp->b_un.b_addr = bp->b_saveaddr;