From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KYQYW-00020Y-0N for qemu-devel@nongnu.org; Wed, 27 Aug 2008 15:19:48 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KYQYU-0001ye-Ny for qemu-devel@nongnu.org; Wed, 27 Aug 2008 15:19:46 -0400 Received: from [199.232.76.173] (port=52921 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KYQYU-0001yO-HW for qemu-devel@nongnu.org; Wed, 27 Aug 2008 15:19:46 -0400 Received: from savannah.gnu.org ([199.232.41.3]:60163 helo=sv.gnu.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1KYQYU-00075W-I1 for qemu-devel@nongnu.org; Wed, 27 Aug 2008 15:19:46 -0400 Received: from cvs.savannah.gnu.org ([199.232.41.69]) by sv.gnu.org with esmtp (Exim 4.63) (envelope-from ) id 1KYQYT-0005kB-8T for qemu-devel@nongnu.org; Wed, 27 Aug 2008 19:19:45 +0000 Received: from blueswir1 by cvs.savannah.gnu.org with local (Exim 4.63) (envelope-from ) id 1KYQYS-0005k7-VH for qemu-devel@nongnu.org; Wed, 27 Aug 2008 19:19:45 +0000 MIME-Version: 1.0 Errors-To: blueswir1 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Blue Swirl Message-Id: Date: Wed, 27 Aug 2008 19:19:45 +0000 Subject: [Qemu-devel] [5091] Fix Sparc64 window handling problems detected by Vince Weaver Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Revision: 5091 http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=5091 Author: blueswir1 Date: 2008-08-27 19:19:44 +0000 (Wed, 27 Aug 2008) Log Message: ----------- Fix Sparc64 window handling problems detected by Vince Weaver Modified Paths: -------------- trunk/linux-user/main.c Modified: trunk/linux-user/main.c =================================================================== --- trunk/linux-user/main.c 2008-08-27 18:43:53 UTC (rev 5090) +++ trunk/linux-user/main.c 2008-08-27 19:19:44 UTC (rev 5091) @@ -808,11 +808,16 @@ static void restore_window(CPUSPARCState *env) { - unsigned int new_wim, i, cwp1; +#ifndef TARGET_SPARC64 + unsigned int new_wim; +#endif + unsigned int i, cwp1; abi_ulong sp_ptr; +#ifndef TARGET_SPARC64 new_wim = ((env->wim << 1) | (env->wim >> (env->nwindows - 1))) & ((1LL << env->nwindows) - 1); +#endif /* restore the invalid window */ cwp1 = cpu_cwp_inc(env, env->cwp + 1); @@ -826,12 +831,13 @@ get_user_ual(env->regbase[get_reg_index(env, cwp1, 8 + i)], sp_ptr); sp_ptr += sizeof(abi_ulong); } - env->wim = new_wim; #ifdef TARGET_SPARC64 env->canrestore++; if (env->cleanwin < env->nwindows - 1) env->cleanwin++; env->cansave--; +#else + env->wim = new_wim; #endif } @@ -843,14 +849,23 @@ for(;;) { /* if restore would invoke restore_window(), then we can stop */ cwp1 = cpu_cwp_inc(env, env->cwp + offset); +#ifndef TARGET_SPARC64 if (env->wim & (1 << cwp1)) break; +#else + if (env->canrestore == 0) + break; + env->cansave++; + env->canrestore--; +#endif save_window_offset(env, cwp1); offset++; } + cwp1 = cpu_cwp_inc(env, env->cwp + 1); +#ifndef TARGET_SPARC64 /* set wim so that restore will reload the registers */ - cwp1 = cpu_cwp_inc(env, env->cwp + 1); env->wim = 1 << cwp1; +#endif #if defined(DEBUG_WIN) printf("flush_windows: nb=%d\n", offset - 1); #endif