summaryrefslogtreecommitdiff
path: root/sys/arch/sparc64
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2006-05-31 06:51:26 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2006-05-31 06:51:26 +0000
commit272621574dff0db8a0801f4e4a0bc4d6fed4b0c0 (patch)
treec34b9a0a0b9827b593eee61b8610272a93838cf2 /sys/arch/sparc64
parent850db274bbcb76df23ac406771570411f17474dc (diff)
The bright people at Sun removed the secondary context from the IMMU in the
UltraSPARC III. Hack around it by temporarily switching to nucleus context when flushing TLBs. Put this hack under HORRID_III_HACK for now. Compiling with HORRID_III_HACK results in a kernel that runs on the Blade 2000 "at the speed of a 140MHz UltraSPARC I". ok jason@
Diffstat (limited to 'sys/arch/sparc64')
-rw-r--r--sys/arch/sparc64/sparc64/locore.s28
1 files changed, 26 insertions, 2 deletions
diff --git a/sys/arch/sparc64/sparc64/locore.s b/sys/arch/sparc64/sparc64/locore.s
index fb8af0d2f98..e8840660791 100644
--- a/sys/arch/sparc64/sparc64/locore.s
+++ b/sys/arch/sparc64/sparc64/locore.s
@@ -1,4 +1,4 @@
-/* $OpenBSD: locore.s,v 1.56 2006/05/31 02:43:05 kettenis Exp $ */
+/* $OpenBSD: locore.s,v 1.57 2006/05/31 06:51:25 kettenis Exp $ */
/* $NetBSD: locore.s,v 1.137 2001/08/13 06:10:10 jdolecek Exp $ */
/*
@@ -4680,6 +4680,25 @@ _C_LABEL(tlb_flush_pte):
.text
2:
#endif /* DEBUG */
+#ifdef HORRID_III_HACK
+ rdpr %pstate, %o5
+ andn %o5, PSTATE_IE, %o4
+ wrpr %o4, %pstate ! disable interrupts
+
+ rdpr %tl, %o3
+ brnz %o3, 1f
+ add %o3, 1, %g2
+ wrpr %g0, %g2, %tl ! Switch to traplevel > 0
+1:
+ mov CTX_PRIMARY, %o2
+ andn %o0, 0xfff, %g2 ! drop unused va bits
+ ldxa [%o2] ASI_DMMU, %g1 ! Save primary context
+ sethi %hi(KERNBASE), %o4
+ membar #LoadStore
+ stxa %o1, [%o2] ASI_DMMU ! Insert context to demap
+ membar #Sync
+ or %g2, DEMAP_PAGE_PRIMARY, %g2 ! Demap page from primary context only
+#else
mov CTX_SECONDARY, %o2
andn %o0, 0xfff, %g2 ! drop unused va bits
ldxa [%o2] ASI_DMMU, %g1 ! Save secondary context
@@ -4688,6 +4707,7 @@ _C_LABEL(tlb_flush_pte):
stxa %o1, [%o2] ASI_DMMU ! Insert context to demap
membar #Sync
or %g2, DEMAP_PAGE_SECONDARY, %g2 ! Demap page from secondary context only
+#endif
stxa %g2, [%g2] ASI_DMMU_DEMAP ! Do the demap
membar #Sync
stxa %g2, [%g2] ASI_IMMU_DEMAP ! to both TLBs
@@ -4699,9 +4719,13 @@ _C_LABEL(tlb_flush_pte):
stxa %g2, [%g2] ASI_IMMU_DEMAP ! Do the demap
membar #Sync ! No real reason for this XXXX
flush %o4
- stxa %g1, [%o2] ASI_DMMU ! Restore secondary asi
+ stxa %g1, [%o2] ASI_DMMU ! Restore asi
membar #Sync ! No real reason for this XXXX
flush %o4
+#ifdef HORRID_III_HACK
+ wrpr %g0, %o3, %tl ! Restore traplevel
+ wrpr %o5, %pstate ! Restore interrupts
+#endif
retl
nop