summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordavem <davem@openbsd.org>1996-01-07 15:18:08 +0000
committerdavem <davem@openbsd.org>1996-01-07 15:18:08 +0000
commit8d6bbf2a237220f820f733445fb6e4334c9b27ed (patch)
tree50f010e433f4b150a388db7764924c2d82ae7afc
parentfrom netbsd: Put #includes in the right order (diff)
downloadwireguard-openbsd-8d6bbf2a237220f820f733445fb6e4334c9b27ed.tar.xz
wireguard-openbsd-8d6bbf2a237220f820f733445fb6e4334c9b27ed.zip
When servicing a memory error on the sun4/sun4c make
sure the store buffers on the chip are completely flushed to ensure proper handler completion.
-rw-r--r--sys/arch/sparc/sparc/locore.s19
-rw-r--r--sys/arch/sparc/sparc/memreg.c5
2 files changed, 23 insertions, 1 deletions
diff --git a/sys/arch/sparc/sparc/locore.s b/sys/arch/sparc/sparc/locore.s
index 0ada5b63f1f..ddf44c3a459 100644
--- a/sys/arch/sparc/sparc/locore.s
+++ b/sys/arch/sparc/sparc/locore.s
@@ -3458,6 +3458,25 @@ Lcopyfault:
jmp %g7 + 8
mov EFAULT, %o0
+/* Force the cpu to complete all pending store operations
+ * and flush it's on chip write buffers. This is the sun4c/sun4
+ * version and will only be called when servicing a memory
+ * error so that we do not loop indefinately.
+ */
+ENTRY(sun4c_sun4_storebuf_flush)
+ set AC_CONTEXT, %o1
+ lduba [%o1] ASI_CONTROL, %o0 ! load context reg
+ stba %o0, [%o1] ASI_CONTROL ! store same value, flush begins
+ nop
+ nop
+ nop
+ /* Pipeline is now clear */
+ nop
+ nop
+ nop
+ /* Store buffer is empty, safe to return now. */
+ retl
+ nop
/*
* Write all user windows presently in the CPU back to the user's stack.
diff --git a/sys/arch/sparc/sparc/memreg.c b/sys/arch/sparc/sparc/memreg.c
index b66b899cba9..8c2a3e95b6a 100644
--- a/sys/arch/sparc/sparc/memreg.c
+++ b/sys/arch/sparc/sparc/memreg.c
@@ -105,11 +105,14 @@ memregattach(parent, self, aux)
* Should kill the process that got its bits clobbered,
* and take the page out of the page pool, but for now...
*/
+
+extern void sun4c_sun4_storebuf_flush(void);
+
void
memerr(issync, ser, sva, aer, ava)
int issync, ser, sva, aer, ava;
{
-
+ sun4c_sun4_storebuf_flush(); /* prevent loops... */
if (cputyp == CPU_SUN4) {
if (par_err_reg) {
printf("mem err: ser=%b sva=%x\n", ser, SER_BITS, sva);