From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1L9lYS-00036H-Dg for qemu-devel@nongnu.org; Mon, 08 Dec 2008 14:14:04 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1L9lYR-00035Y-A9 for qemu-devel@nongnu.org; Mon, 08 Dec 2008 14:14:03 -0500 Received: from [199.232.76.173] (port=36769 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1L9lYR-00035T-5g for qemu-devel@nongnu.org; Mon, 08 Dec 2008 14:14:03 -0500 Received: from mx20.gnu.org ([199.232.41.8]:16624) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1L9lYM-0001pn-Jp for qemu-devel@nongnu.org; Mon, 08 Dec 2008 14:13:59 -0500 Received: from mail.codesourcery.com ([65.74.133.4]) by mx20.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1L9lYJ-00043R-P3 for qemu-devel@nongnu.org; Mon, 08 Dec 2008 14:13:56 -0500 Date: Mon, 8 Dec 2008 11:13:51 -0800 From: Nathan Froyd Message-ID: <20081208191351.GF26277@codesourcery.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Subject: [Qemu-devel] [PATCH] target-ppc: initialize MSR appropriately in user-mode 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 We shouldn't blindly initialize the floating-point bit in MSR; we should only do so if the processor we're targetting supports floating-point. We should also do the same thing with the Altivec and e500 bits. Signed-off-by: Nathan Froyd diff --git a/target-ppc/helper.c b/target-ppc/helper.c index 6bffa06..1a4d69e 100644 --- a/target-ppc/helper.c +++ b/target-ppc/helper.c @@ -2905,7 +2905,13 @@ void cpu_ppc_reset (void *opaque) msr |= (target_ulong)1 << MSR_BE; #endif #if defined(CONFIG_USER_ONLY) - msr |= (target_ulong)1 << MSR_FP; /* Allow floating point usage */ + /* Initialize MSR with appropriate instruction capabilities. */ + if (env->msr_mask & ((target_ulong)1 << MSR_FP)) + msr |= (target_ulong)1 << MSR_FP; + if (env->msr_mask & ((target_ulong)1 << MSR_VR)) + msr |= (target_ulong)1 << MSR_VR; + if (env->msr_mask & ((target_ulong)1 << MSR_SPE)) + msr |= (target_ulong)1 << MSR_SPE; msr |= (target_ulong)1 << MSR_PR; #else env->nip = env->hreset_vector | env->excp_prefix;