summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/arch/sparc/sparc/pmap.c47
1 files changed, 28 insertions, 19 deletions
diff --git a/sys/arch/sparc/sparc/pmap.c b/sys/arch/sparc/sparc/pmap.c
index 1578c18c957..b3d919dfc87 100644
--- a/sys/arch/sparc/sparc/pmap.c
+++ b/sys/arch/sparc/sparc/pmap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pmap.c,v 1.78 2000/02/21 17:08:37 art Exp $ */
+/* $OpenBSD: pmap.c,v 1.79 2000/11/07 11:42:10 art Exp $ */
/* $NetBSD: pmap.c,v 1.118 1998/05/19 19:00:18 thorpej Exp $ */
/*
@@ -1884,32 +1884,33 @@ ctx_free(pm)
if ((c = pm->pm_ctx) == NULL)
panic("ctx_free");
pm->pm_ctx = NULL;
- oldc = getcontext();
- if (CACHEINFO.c_vactype != VAC_NONE) {
+ if (CPU_ISSUN4M) {
+#if defined(SUN4M)
+ oldc = getcontext4m();
/* Do any cache flush needed on context switch */
(*cpuinfo.pure_vcache_flush)();
-
newc = pm->pm_ctxnum;
- CHANGE_CONTEXTS(oldc, newc);
+ if (oldc != newc) {
+ write_user_windows();
+ setcontext4m(newc);
+ }
cache_flush_context();
-#if defined(SUN4M)
- if (CPU_ISSUN4M)
- tlb_flush_context();
+ tlb_flush_context();
+ setcontext4m(0);
#endif
- setcontext(0);
} else {
-#if defined(SUN4M)
- if (CPU_ISSUN4M) {
- /* Do any cache flush needed on context switch */
- (*cpuinfo.pure_vcache_flush)();
+ oldc = getcontext4();
+ if (CACHEINFO.c_vactype != VAC_NONE) {
newc = pm->pm_ctxnum;
CHANGE_CONTEXTS(oldc, newc);
- tlb_flush_context();
+ cache_flush_context();
+ setcontext(0);
+ } else {
+ CHANGE_CONTEXTS(oldc, 0);
}
-#endif
- CHANGE_CONTEXTS(oldc, 0);
}
+
c->c_nextfree = ctx_freelist;
ctx_freelist = c;
@@ -2412,8 +2413,15 @@ pv_syncflags4m(pv0)
va = pv->pv_va;
ptep = getptep4m(pm, va);
- if (ptep == NULL) /* invalid */
+
+ /*
+ * XXX - This can't happen?!?
+ */
+ if (ptep == NULL) { /* invalid */
+ printf("pv_syncflags4m: no pte pmap: 0x%x, va: 0x%x\n",
+ pm, va);
continue;
+ }
/*
* We need the PTE from memory as the TLB version will
@@ -2423,6 +2431,7 @@ pv_syncflags4m(pv0)
setcontext4m(pm->pm_ctxnum);
tlb_flush_page(va);
}
+
tpte = *ptep;
if ((tpte & SRMMU_TETYPE) == SRMMU_TEPTE && /* if valid pte */
@@ -2431,8 +2440,8 @@ pv_syncflags4m(pv0)
flags |= MR4M(tpte);
if (pm->pm_ctx && (tpte & SRMMU_PG_M)) {
- cache_flush_page(va); /* XXX: do we need this?*/
- tlb_flush_page(va); /* paranoid? */
+ cache_flush_page(va); /* XXX:do we need this?*/
+ tlb_flush_page(va);
}
/* Clear mod/ref bits from PTE and write it back */