Like I said - don't futz with the trapframe in pmap_activate. Instead

update the trapframe space and protection register in cpu_lwp_fork and
setregs.
This commit is contained in:
skrll 2007-07-12 14:15:36 +00:00
parent e20a341cde
commit 7db093553a
4 changed files with 22 additions and 26 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: machdep.c,v 1.37 2007/03/07 11:29:46 skrll Exp $ */
/* $NetBSD: machdep.c,v 1.38 2007/07/12 14:15:36 skrll Exp $ */
/*-
* Copyright (c) 2001, 2002 The NetBSD Foundation, Inc.
@ -70,7 +70,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.37 2007/03/07 11:29:46 skrll Exp $");
__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.38 2007/07/12 14:15:36 skrll Exp $");
#include "opt_cputype.h"
#include "opt_ddb.h"
@ -1691,6 +1691,8 @@ setregs(struct lwp *l, struct exec_package *pack, u_long stack)
{
struct proc *p = l->l_proc;
struct trapframe *tf = l->l_md.md_regs;
pmap_t pmap = p->p_vmspace->vm_map.pmap;
pa_space_t space = pmap->pmap_space;
struct pcb *pcb = &l->l_addr->u_pcb;
tf->tf_flags = TFF_SYS|TFF_LAST;
@ -1700,6 +1702,17 @@ setregs(struct lwp *l, struct exec_package *pack, u_long stack)
tf->tf_arg0 = (u_long)p->p_psstr;
tf->tf_arg1 = tf->tf_arg2 = 0; /* XXX dynload stuff */
tf->tf_sr7 = HPPA_SID_KERNEL;
/* Load all of the user's space registers. */
tf->tf_sr0 = tf->tf_sr1 = tf->tf_sr2 = tf->tf_sr3 =
tf->tf_sr4 = tf->tf_sr5 = tf->tf_sr6 = space;
tf->tf_iisq_head = tf->tf_iisq_tail = space;
/* Load the protection regsiters. */
tf->tf_pidr1 = tf->tf_pidr2 = pmap->pmap_pid;
/* reset any of the pending FPU exceptions */
hppa_fpu_flush(l);
pcb->pcb_fpregs[0] = ((uint64_t)HPPA_FPU_INIT) << 32;

View File

@ -1,4 +1,4 @@
/* $NetBSD: pmap.c,v 1.36 2007/05/18 09:10:50 skrll Exp $ */
/* $NetBSD: pmap.c,v 1.37 2007/07/12 14:15:37 skrll Exp $ */
/*-
* Copyright (c) 2001, 2002 The NetBSD Foundation, Inc.
@ -171,7 +171,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.36 2007/05/18 09:10:50 skrll Exp $");
__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.37 2007/07/12 14:15:37 skrll Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -1242,7 +1242,6 @@ pmap_pinit(pmap_t pmap)
pmap->pmap_refcnt = 1;
pmap->pmap_stats.resident_count = 0;
pmap->pmap_stats.wired_count = 0;
pmap->pmap_vmspace = NULL;
splx(s);
}
@ -1334,20 +1333,6 @@ pmap_activate(struct lwp *l)
/* space is cached for the copy{in,out}'s pleasure */
pcb->pcb_space = space;
if (pmap->pmap_vmspace != l->l_proc->p_vmspace) {
struct trapframe *tf = l->l_md.md_regs;
pmap->pmap_vmspace = l->l_proc->p_vmspace;
/* Load all of the user's space registers. */
tf->tf_sr0 = tf->tf_sr1 = tf->tf_sr2 = tf->tf_sr3 =
tf->tf_sr4 = tf->tf_sr5 = tf->tf_sr6 = space;
tf->tf_iisq_head = tf->tf_iisq_tail = space;
/* Load the protection registers. */
tf->tf_pidr1 = tf->tf_pidr2 = pmap->pmap_pid;
}
if (p == curproc)
mtctl(pmap->pmap_pid, CR_PIDR2);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: vm_machdep.c,v 1.26 2007/05/18 09:10:50 skrll Exp $ */
/* $NetBSD: vm_machdep.c,v 1.27 2007/07/12 14:15:38 skrll Exp $ */
/* $OpenBSD: vm_machdep.c,v 1.25 2001/09/19 20:50:56 mickey Exp $ */
@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.26 2007/05/18 09:10:50 skrll Exp $");
__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.27 2007/07/12 14:15:38 skrll Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -164,10 +164,9 @@ cpu_lwp_fork(struct lwp *l1, struct lwp *l2, void *stack, size_t stacksize,
tf->tf_sr0 = tf->tf_sr1 = tf->tf_sr3 = tf->tf_sr2 =
tf->tf_sr4 = tf->tf_sr5 = tf->tf_sr6 = space;
tf->tf_iisq_head = tf->tf_iisq_tail = space;
tf->tf_pidr1 = tf->tf_pidr2 = pmap->pmap_pid;
/* record the vmspace just in case it changes underneath us. */
pmap->pmap_vmspace = p->p_vmspace;
/* Load the protection registers */
tf->tf_pidr1 = tf->tf_pidr2 = pmap->pmap_pid;
/*
* theoretically these could be inherited from the father,

View File

@ -1,4 +1,4 @@
/* $NetBSD: pmap.h,v 1.13 2007/05/18 09:10:50 skrll Exp $ */
/* $NetBSD: pmap.h,v 1.14 2007/07/12 14:15:38 skrll Exp $ */
/* $OpenBSD: pmap.h,v 1.14 2001/05/09 15:31:24 art Exp $ */
@ -92,7 +92,6 @@ struct pmap {
pa_space_t pmap_space; /* space for this pmap */
u_int pmap_pid; /* protection id for pmap */
struct pmap_statistics pmap_stats; /* statistics */
struct vmspace *pmap_vmspace; /* last vmspace */
} *pmap_t;
extern pmap_t kernel_pmap; /* The kernel's map */