summaryrefslogtreecommitdiff
path: root/sys/arch/sparc64
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2009-01-20 21:22:32 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2009-01-20 21:22:32 +0000
commit1bea7e724e628d2d9487881fdbfaa0d789ca244b (patch)
treef58206512d74921fdbdbd5ba91bbc84431bb5186 /sys/arch/sparc64
parentc46ae44564992ec1fafca7eff36efd91f0849593 (diff)
I can't figure out why flushing all user windows before writing out windows
saved in the pcb to the stack fixes the problems with user space register window corruption I see on sun4v. So I give up and commit the workaround. It isn't too evil, since this isn't in the fast path and we're likely to spill these windows anyway in the process of writing out the register windows. Curiously enough, the OpenSolaris code seems to do pretty much the same.
Diffstat (limited to 'sys/arch/sparc64')
-rw-r--r--sys/arch/sparc64/sparc64/trap.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/sys/arch/sparc64/sparc64/trap.c b/sys/arch/sparc64/sparc64/trap.c
index 0a3af9cacea..186224e40cc 100644
--- a/sys/arch/sparc64/sparc64/trap.c
+++ b/sys/arch/sparc64/sparc64/trap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: trap.c,v 1.63 2008/07/12 08:08:54 kettenis Exp $ */
+/* $OpenBSD: trap.c,v 1.64 2009/01/20 21:22:31 kettenis Exp $ */
/* $NetBSD: trap.c,v 1.73 2001/08/09 01:03:01 eeh Exp $ */
/*
@@ -511,6 +511,15 @@ badtrap:
break;
case T_RWRET:
+ /*
+ * XXX Flushing the user windows here should not be
+ * necessary, but not doing so here causes corruption
+ * of user windows on sun4v. Flushing them shouldn't
+ * be much of a prefermance penalty since we're
+ * probably going to spill any remaining user windows
+ * anyhow.
+ */
+ write_user_windows();
if (rwindow_save(p) == -1) {
KERNEL_PROC_LOCK(p);
trapsignal(p, SIGILL, 0, ILL_BADSTK, sv);