Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/mac68k/mac68k Sync with hp300.



details:   https://anonhg.NetBSD.org/src/rev/af854d72dd72
branches:  trunk
changeset: 471618:af854d72dd72
user:      scottr <scottr%NetBSD.org@localhost>
date:      Tue Apr 06 04:04:45 1999 +0000

description:
Sync with hp300.

diffstat:

 sys/arch/mac68k/mac68k/vm_machdep.c |  138 ++++++++++-------------------------
 1 files changed, 41 insertions(+), 97 deletions(-)

diffs (293 lines):

diff -r 82c25cb2085f -r af854d72dd72 sys/arch/mac68k/mac68k/vm_machdep.c
--- a/sys/arch/mac68k/mac68k/vm_machdep.c       Tue Apr 06 03:59:11 1999 +0000
+++ b/sys/arch/mac68k/mac68k/vm_machdep.c       Tue Apr 06 04:04:45 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vm_machdep.c,v 1.35 1999/03/26 23:41:31 mycroft Exp $  */
+/*     $NetBSD: vm_machdep.c,v 1.36 1999/04/06 04:04:45 scottr Exp $   */
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -36,8 +36,7 @@
  * 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: vm_machdep.c 1.21 91/04/06$
  *
  *     @(#)vm_machdep.c        8.6 (Berkeley) 1/12/94
@@ -48,26 +47,21 @@
 #include <sys/proc.h>
 #include <sys/malloc.h>
 #include <sys/buf.h>
+#include <sys/vnode.h>
 #include <sys/user.h>
-#include <sys/vnode.h>
 #include <sys/core.h>
 #include <sys/exec.h>
 
+#include <machine/frame.h>
+#include <machine/cpu.h>
+#include <machine/pte.h>
+#include <machine/reg.h>
+
 #include <vm/vm.h>
 #include <vm/vm_kern.h>
-#if 0
-#include <vm/vm_map.h>
-#endif
 
 #include <uvm/uvm_extern.h>
 
-#include <machine/cpu.h>
-#include <machine/pmap.h>
-#include <machine/pte.h>
-#include <machine/reg.h>
-
-void savectx __P((struct pcb *));
-
 /*
  * Finish a fork operation, with process p2 nearly set up.
  * Copy and update the kernel stack and pcb, making the child
@@ -88,7 +82,7 @@
 
        p2->p_md.md_flags = p1->p_md.md_flags;
 
-       /* Copy pcb from p1 to p2. */
+       /* Copy pcb from proc p1 to p2. */
        if (p1 == curproc) {
                /* Sync the PCB before we copy it. */
                savectx(curpcb);
@@ -100,29 +94,26 @@
        *pcb = p1->p_addr->u_pcb;
 
        /*
-        * Copy the trap frame and arrange for the child to return directly
+        * Copy the trap frame, and arrange for the child to return directly
         * through child_return().  Note the in-line cpu_set_kpc().
         */
-       tf = (struct trapframe *)((u_int)p2->p_addr + USPACE) -1;
+       tf = (struct trapframe *)((u_int)p2->p_addr + USPACE) - 1;
        p2->p_md.md_regs = (int *)tf;
-
        *tf = *(struct trapframe *)p1->p_md.md_regs;
        sf = (struct switchframe *)tf - 1;
        sf->sf_pc = (u_int)proc_trampoline;
-
        pcb->pcb_regs[6] = (int)child_return;   /* A2 */
        pcb->pcb_regs[7] = (int)p2;             /* A3 */
        pcb->pcb_regs[11] = (int)sf;            /* SSP */
 }
 
 /*
- * cpu_set_kpc
- *     Arrange for in-kernel execution of a process to continue at the
- * named PC as if the code at that address had been called as a function
+ * Arrange for in-kernel execution of a process to continue at the
+ * named pc, as if the code at that address were called as a function
  * with the supplied argument.
  *
- * Note that it's assumed that whne the named process returns, rei()
- * should be invoked to return to user mode.
+ * Note that it's assumed that when the named process returns, rei()
+ * should be invoked, to return to user code.
  */
 void
 cpu_set_kpc(p, pc, arg)
@@ -130,18 +121,11 @@
        void (*pc) __P((void *));
        void *arg;
 {
-       struct pcb *pcbp;
-       struct switchframe *sf;
 
-       pcbp = &p->p_addr->u_pcb;
-       sf = (struct switchframe *)pcbp->pcb_regs[11];
-       sf->sf_pc = (u_int)proc_trampoline;
-       pcbp->pcb_regs[6] = (int)pc;    /* A2 */
-       pcbp->pcb_regs[7] = (int)arg;   /* A3 */
+       p->p_addr->u_pcb.pcb_regs[6] = (int) pc;        /* A2 */
+       p->p_addr->u_pcb.pcb_regs[7] = (int) arg;       /* A3 */
 }
 
-void   switch_exit __P((struct proc *));
-
 /*
  * cpu_exit is called as the last action during exit.
  *
@@ -153,18 +137,14 @@
        struct proc *p;
 {
 
-       (void)splhigh();
+       (void) splhigh();
        uvmexp.swtch++;
        switch_exit(p);
        /* NOTREACHED */
 }
 
 /*
- * Dump the machine specific segment at the start of a core dump.
- * This means the CPU and FPU registers.  The format used here is
- * the same one ptrace uses, so gdb can be machine independent.
- *
- * XXX - Generate Sun format core dumps for Sun executables?
+ * Dump the machine specific header information at the start of a core dump.
  */
 struct md_core {
        struct reg intreg;
@@ -177,11 +157,9 @@
        struct ucred *cred;
        struct core *chdr;
 {
-       int error;
        struct md_core md_core;
        struct coreseg cseg;
-       struct user *up = p->p_addr;
-       int i;
+       int error;
 
        CORE_SETMAGIC(*chdr, COREMAGIC, MID_MACHINE, 0);
        chdr->c_hdrsize = ALIGN(sizeof(*chdr));
@@ -189,28 +167,17 @@
        chdr->c_cpusize = sizeof(md_core);
 
        /* Save integer registers. */
-       {
-               struct frame *f;
+       error = process_read_regs(p, &md_core.intreg);
+       if (error)
+               return error;
 
-               f = (struct frame*)p->p_md.md_regs;
-               for (i = 0; i < 16; i++) {
-                       md_core.intreg.r_regs[i] = f->f_regs[i];
-               }
-               md_core.intreg.r_sr = f->f_sr;
-               md_core.intreg.r_pc = f->f_pc;
-       }
        if (fputype) {
-               struct fpframe *f;
-
-               f = &up->u_pcb.pcb_fpregs;
-               m68881_save(f);
-               for (i = 0; i < (8*3); i++) {
-                       md_core.freg.r_regs[i] = f->fpf_regs[i];
-               }
-               md_core.freg.r_fpcr  = f->fpf_fpcr;
-               md_core.freg.r_fpsr  = f->fpf_fpsr;
-               md_core.freg.r_fpiar = f->fpf_fpiar;
+               /* Save floating point registers. */
+               error = process_read_fpregs(p, &md_core.freg);
+               if (error)
+                       return error;
        } else {
+               /* Make sure these are clear. */
                bzero((caddr_t)&md_core.freg, sizeof(md_core.freg));
        }
 
@@ -219,19 +186,19 @@
        cseg.c_size = chdr->c_cpusize;
 
        error = vn_rdwr(UIO_WRITE, vp, (caddr_t)&cseg, chdr->c_seghdrsize,
-           (off_t)chdr->c_hdrsize, UIO_SYSSPACE,
-           IO_NODELOCKED|IO_UNIT, cred, NULL, p);
+           (off_t)chdr->c_hdrsize, UIO_SYSSPACE, IO_NODELOCKED|IO_UNIT, cred,
+           NULL, p);
        if (error)
                return error;
 
        error = vn_rdwr(UIO_WRITE, vp, (caddr_t)&md_core, sizeof(md_core),
            (off_t)(chdr->c_hdrsize + chdr->c_seghdrsize), UIO_SYSSPACE,
            IO_NODELOCKED|IO_UNIT, cred, NULL, p);
+       if (error)
+               return error;
 
-       if (!error)
-               chdr->c_nseg++;
-
-       return error;
+       chdr->c_nseg++;
+       return 0;
 }
 
 /*
@@ -247,7 +214,7 @@
        paddr_t pa;
 
 #ifdef DEBUG
-       if (size % PAGE_SIZE)
+       if (size & CLOFSET)
                panic("pagemove");
 #endif
        while (size > 0) {
@@ -259,7 +226,7 @@
                        panic("pagemove 3");
 #endif
                pmap_remove(pmap_kernel(),
-                          (vaddr_t)from, (vaddr_t)from + PAGE_SIZE);
+                           (vaddr_t)from, (vaddr_t)from + PAGE_SIZE);
                pmap_enter(pmap_kernel(),
                           (vaddr_t)to, pa, VM_PROT_READ|VM_PROT_WRITE, 1,
                           VM_PROT_READ|VM_PROT_WRITE);
@@ -304,29 +271,6 @@
        TBIAS();
 }
 
-void   setredzone __P((void *, caddr_t));
-
-/*
- * Set a red zone in the kernel stack after the u. area.
- * We don't support a redzone right now.  It really isn't clear
- * that it is a good idea since, if the kernel stack were to roll
- * into a write protected page, the processor would lock up (since
- * it cannot create an exception frame) and we would get no useful
- * post-mortem info.  Currently, under the DEBUG option, we just
- * check at every clock interrupt to see if the current k-stack has
- * gone too far (i.e. into the "redzone" page) and if so, panic.
- * Look at _lev6intr in locore.s for more details.
- */
-/*ARGSUSED*/
-void
-setredzone(pte, vaddr)
-       void *pte;
-       caddr_t vaddr;
-{
-}
-
-int    kvtop __P((caddr_t addr));
-
 /*
  * Convert kernel VA to physical address
  */
@@ -355,13 +299,13 @@
 void
 vmapbuf(bp, len)
        struct buf *bp;
-       vm_size_t len;
+       vsize_t len;
 {
        struct pmap *upmap, *kpmap;
        vaddr_t uva;            /* User VA (map from) */
        vaddr_t kva;            /* Kernel VA (new to) */
-       paddr_t pa;             /* physical address */
-       vm_size_t off;
+       paddr_t pa;             /* physical address */
+       vsize_t off;
 
        if ((bp->b_flags & B_PHYS) == 0)
                panic("vmapbuf");
@@ -391,10 +335,10 @@
 void
 vunmapbuf(bp, len)
        struct buf *bp;
-       vm_size_t len;
+       vsize_t len;
 {
        vaddr_t kva;
-       vm_size_t off;
+       vsize_t off;
 
        if ((bp->b_flags & B_PHYS) == 0)
                panic("vunmapbuf");



Home | Main Index | Thread Index | Old Index