From 1bea7e724e628d2d9487881fdbfaa0d789ca244b Mon Sep 17 00:00:00 2001 From: Mark Kettenis Date: Tue, 20 Jan 2009 21:22:32 +0000 Subject: 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. --- sys/arch/sparc64/sparc64/trap.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'sys/arch') 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); -- cgit v1.2.3