diff options
author | Artur Grabowski <art@cvs.openbsd.org> | 2000-02-19 22:08:52 +0000 |
---|---|---|
committer | Artur Grabowski <art@cvs.openbsd.org> | 2000-02-19 22:08:52 +0000 |
commit | 12c11d7a9e3c547b2f586e50b4db01dce97b601d (patch) | |
tree | 73f68beb87e54a9126ad5e993be3ec27793be4b0 | |
parent | db127d4ce1bb32b353f9392d22572615ac0cb209 (diff) |
flush the caches that need flushing on context switch.
-rw-r--r-- | sys/arch/sparc/sparc/locore.s | 14 | ||||
-rw-r--r-- | sys/arch/sparc/sparc/pmap.c | 11 |
2 files changed, 22 insertions, 3 deletions
diff --git a/sys/arch/sparc/sparc/locore.s b/sys/arch/sparc/sparc/locore.s index a3d722c790c..326c72e3cd6 100644 --- a/sys/arch/sparc/sparc/locore.s +++ b/sys/arch/sparc/sparc/locore.s @@ -1,4 +1,4 @@ -/* $OpenBSD: locore.s,v 1.32 2000/02/19 21:45:56 art Exp $ */ +/* $OpenBSD: locore.s,v 1.33 2000/02/19 22:08:50 art Exp $ */ /* $NetBSD: locore.s,v 1.73 1997/09/13 20:36:48 pk Exp $ */ /* @@ -4662,8 +4662,18 @@ Lsw_havectx: #endif 1: #if defined(SUN4M) + /* + * Flush caches that need to be flushed on context switch. + * We know this is currently only necessary on the sun4m hypersparc. + */ + set CPUINFO_VA+CPUINFO_PURE_VCACHE_FLS, %o2 + ld [%o2], %o2 + mov %o7, %g7 ! save return address + jmpl %o2, %o7 ! this function must not clobber %o0 and %g7 + nop + set SRMMU_CXR, %o1 - retl + jmp %g7 + 8 ! (retl, but we saved the ret address in g7) sta %o0, [%o1] ASI_SRMMU ! setcontext(vm->vm_pmap.pm_ctxnum); #endif diff --git a/sys/arch/sparc/sparc/pmap.c b/sys/arch/sparc/sparc/pmap.c index 313cebc25fa..4c1b4f7774b 100644 --- a/sys/arch/sparc/sparc/pmap.c +++ b/sys/arch/sparc/sparc/pmap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.c,v 1.76 2000/02/18 17:05:33 art Exp $ */ +/* $OpenBSD: pmap.c,v 1.77 2000/02/19 22:08:51 art Exp $ */ /* $NetBSD: pmap.c,v 1.118 1998/05/19 19:00:18 thorpej Exp $ */ /* @@ -1847,6 +1847,8 @@ ctx_alloc(pm) * XXX: Do we have to flush cache after reloading ctx tbl? */ + /* Do any cache flush needed on context switch */ + (*cpuinfo.pure_vcache_flush)(); #ifdef DEBUG #if 0 ctxbusyvector[cnum] = 1; /* mark context as busy */ @@ -1883,6 +1885,9 @@ ctx_free(pm) oldc = getcontext(); if (CACHEINFO.c_vactype != VAC_NONE) { + /* Do any cache flush needed on context switch */ + (*cpuinfo.pure_vcache_flush)(); + newc = pm->pm_ctxnum; CHANGE_CONTEXTS(oldc, newc); cache_flush_context(); @@ -1894,6 +1899,8 @@ ctx_free(pm) } else { #if defined(SUN4M) if (CPU_ISSUN4M) { + /* Do any cache flush needed on context switch */ + (*cpuinfo.pure_vcache_flush)(); newc = pm->pm_ctxnum; CHANGE_CONTEXTS(oldc, newc); tlb_flush_context(); @@ -6652,6 +6659,8 @@ pmap_activate(p) if (pmap->pm_ctx == NULL) { ctx_alloc(pmap); /* performs setcontext() */ } else { + /* Do any cache flush needed on context switch */ + (*cpuinfo.pure_vcache_flush)(); setcontext(pmap->pm_ctxnum); } } |