Restore ci_curpm since it re-enables 603 to working state.

This commit is contained in:
matt 2003-11-21 18:07:29 +00:00
parent c3751e8404
commit d765841d3e
6 changed files with 31 additions and 30 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: cpu.h,v 1.37 2003/09/03 21:33:31 matt Exp $ */
/* $NetBSD: cpu.h,v 1.38 2003/11/21 18:07:29 matt Exp $ */
/*
* Copyright (C) 1999 Wolfgang Solfrank.
@ -63,6 +63,7 @@ struct cpu_info {
struct lwp *ci_curlwp; /* current owner of the processor */
struct pcb *ci_curpcb;
struct pmap *ci_curpm;
struct lwp *ci_fpulwp;
struct lwp *ci_veclwp;
struct pcb *ci_idle_pcb; /* PA of our idle pcb */
@ -161,6 +162,7 @@ curcpu(void)
#define curlwp (curcpu()->ci_curlwp)
#define curpcb (curcpu()->ci_curpcb)
#define curpm (curcpu()->ci_curpm)
static __inline register_t
mfmsr(void)

View File

@ -1,4 +1,4 @@
# $NetBSD: genassym.cf,v 1.6 2003/08/27 20:20:07 matt Exp $
# $NetBSD: genassym.cf,v 1.7 2003/11/21 18:07:29 matt Exp $
#
# Copyright (C) 1995, 1996 Wolfgang Solfrank.
@ -170,6 +170,7 @@ define P_MD_SYSCALL offsetof(struct proc, p_md.md_syscall)
define CI_SIZE sizeof(struct cpu_info)
define CI_CURLWP offsetof(struct cpu_info, ci_curlwp)
define CI_CURPCB offsetof(struct cpu_info, ci_curpcb)
define CI_CURPM offsetof(struct cpu_info, ci_curpm)
define CI_IDLE_PCB offsetof(struct cpu_info, ci_idle_pcb)
define CI_ASTPENDING offsetof(struct cpu_info, ci_astpending)
define CI_WANT_RESCHED offsetof(struct cpu_info, ci_want_resched)

View File

@ -1,4 +1,4 @@
/* $NetBSD: oea_machdep.c,v 1.11 2003/08/12 05:06:57 matt Exp $ */
/* $NetBSD: oea_machdep.c,v 1.12 2003/11/21 18:07:29 matt Exp $ */
/*
* Copyright (C) 2002 Matt Thomas
@ -33,7 +33,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: oea_machdep.c,v 1.11 2003/08/12 05:06:57 matt Exp $");
__KERNEL_RCSID(0, "$NetBSD: oea_machdep.c,v 1.12 2003/11/21 18:07:29 matt Exp $");
#include "opt_compat_netbsd.h"
#include "opt_ddb.h"
@ -158,7 +158,7 @@ oea_init(void (*handler)(void))
curpcb->pcb_vr.vscr = 0;
curpcb->pcb_vr.vrsave = 0;
#endif
curpcb->pcb_pm = pmap_kernel();
curpm = curpcb->pcb_pm = pmap_kernel();
/*
* Cause a PGM trap if we branch to 0.

View File

@ -1,4 +1,4 @@
/* $NetBSD: pmap.c,v 1.16 2003/10/27 23:35:41 kleink Exp $ */
/* $NetBSD: pmap.c,v 1.17 2003/11/21 18:09:27 matt Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
* All rights reserved.
@ -67,7 +67,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.16 2003/10/27 23:35:41 kleink Exp $");
__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.17 2003/11/21 18:09:27 matt Exp $");
#include "opt_altivec.h"
#include "opt_pmap.h"
@ -2101,6 +2101,15 @@ pmap_activate(struct lwp *l)
* XXX Normally performed in cpu_fork().
*/
pcb->pcb_pm = pmap;
/*
* In theory, the SR registers need only be valid on return
* to user space wait to do them there.
*/
if (l == curlwp) {
/* Store pointer to new current pmap. */
curpm = pmap;
}
}
/*

View File

@ -1,4 +1,4 @@
/* $NetBSD: locore_subr.S,v 1.23 2003/10/17 22:21:38 matt Exp $ */
/* $NetBSD: locore_subr.S,v 1.24 2003/11/21 18:07:29 matt Exp $ */
/*
* Copyright (c) 2001 Wasabi Systems, Inc.
@ -360,6 +360,8 @@ switch_common:
stptr %r31,CI_CURLWP(%r7)
ldptr %r4,L_ADDR(%r31) /* put PCB addr in r4 */
stptr %r4,CI_CURPCB(%r7) /* indicate new pcb */
ldptr %r3,PCB_PM(%r4) /* save pmap pointer */
stptru %r3,CI_CURPM(%r7)
#if 0
li %r3,CI_CURPCB
#ifdef PPC_OEA64
@ -423,8 +425,7 @@ switch_return:
#if defined(PPC_IBM4XX)
0:
GET_CPUINFO(%r3)
ldreg %r3,CI_CURPCB(%r3) /* Do we need a context? */
ldreg %r3,PCB_PM(%r3)
ldreg %r3,CI_CURPM(%r3) /* Do we need a context? */
ldreg %r4,PM_CTX(%r3)
cmpwi %r4,0
# mtspr SPR_SPR0,4 /* Always keep the current ctx here */

View File

@ -1,4 +1,4 @@
/* $NetBSD: trap_subr.S,v 1.51 2003/10/22 17:27:58 matt Exp $ */
/* $NetBSD: trap_subr.S,v 1.52 2003/11/21 18:07:29 matt Exp $ */
/*
* Copyright (C) 1995, 1996 Wolfgang Solfrank.
@ -60,6 +60,8 @@
* User segment table is loaded through a pointer to the current pmap.
*/
#define RESTORE_USER_SRS(t0,t1) \
GET_CPUINFO(t0); \
ldptr t0,CI_CURPM(t0); \
ldreg t0,PM_STEG(t0); \
mtasr t0
@ -98,6 +100,8 @@
* User SRs are loaded through a pointer to the current pmap.
*/
#define RESTORE_USER_SRS(pmap,sr) \
GET_CPUINFO(pmap); \
ldptr pmap,CI_CURPM(pmap); \
ldregu sr,PM_SR(pmap); \
RESTORE_SRS(pmap,sr)
@ -770,11 +774,6 @@ _C_LABEL(ipkdbsize) = .-_C_LABEL(ipkdblow)
/* Can't touch %r1 from here on */ \
mtsprg2 %r2; /* save r2 & r3 */ \
mtsprg3 %r3; \
/* While the MMU is on, get the PMAP address and save it */ \
GET_CPUINFO(%r2); \
ldptr %r3,CI_CURPCB(%r2); \
ldptr %r3,PCB_PM(%r3); \
stptr %r3,(savearea+CPUSAVE_R28)(%r2); \
/* Disable translation, machine check and recoverability: */ \
mfmsr %r2; \
andi. %r2,%r2,~(PSL_DR|PSL_IR|PSL_ME|PSL_RI)@l; \
@ -787,8 +786,6 @@ _C_LABEL(ipkdbsize) = .-_C_LABEL(ipkdblow)
bf 17,1f; /* branch if PSL_PR is false */ \
/* Restore user SRs */ \
CPU601_KERN_LEAVE(%r2,%r3); \
GET_CPUINFO(%r2); \
ldreg %r2,(savearea+CPUSAVE_R28)(%r2); \
RESTORE_USER_SRS(%r2,%r3); \
1: mfsprg1 %r2; /* restore cr */ \
mtcr %r2; \
@ -1011,9 +1008,9 @@ _C_LABEL(extint_call):
bl _C_LABEL(extint_call) /* to be filled in later */
intr_exit:
/* Disable interrupts (should already be disabled) and recoverability here: */
/* Disable interrupts (should already be disabled) and MMU here: */
mfmsr %r3
andi. %r3,%r3,~(PSL_EE|PSL_ME|PSL_RI)@l
andi. %r3,%r3,~(PSL_EE|PSL_ME|PSL_RI|PSL_DR|PSL_IR)@l
mtmsr %r3
isync
@ -1038,20 +1035,11 @@ intr_exit:
addi %r4,%r4,-1 /* adjust reentrancy count */
stint %r4,CI_INTRDEPTH(%r5)
ldptr %r3,CI_CURPCB(%r5) /* access PCB while MMU is on */
ldptr %r3,PCB_PM(%r3) /* get pmap pointer */
/* Now disable MMU */
mfmsr %r4
andi. %r4,%r4,~(PSL_DR|PSL_IR)@l
mtmsr %r4
isync
/* Returning to user mode? */
mtcr %r6 /* saved SRR1 */
bf 17,1f /* branch if PSL_PR is false */
CPU601_KERN_LEAVE(%r6,%r4) /* leave r3 alone */
CPU601_KERN_LEAVE(%r3,%r4)
RESTORE_USER_SRS(%r3,%r4)
ldint %r3,CI_ASTPENDING(%r5) /* Test AST pending */
andi. %r3,%r3,1