From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MCOUe-0006l2-Gx for qemu-devel@nongnu.org; Thu, 04 Jun 2009 21:45:16 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MCOUa-0006j7-R2 for qemu-devel@nongnu.org; Thu, 04 Jun 2009 21:45:16 -0400 Received: from [199.232.76.173] (port=50179 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MCOUa-0006iw-I4 for qemu-devel@nongnu.org; Thu, 04 Jun 2009 21:45:12 -0400 Received: from mx20.gnu.org ([199.232.41.8]:45130) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1MCOUa-0001Mz-D9 for qemu-devel@nongnu.org; Thu, 04 Jun 2009 21:45:12 -0400 Received: from mail.codesourcery.com ([65.74.133.4]) by mx20.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MCOUV-00034V-39 for qemu-devel@nongnu.org; Thu, 04 Jun 2009 21:45:07 -0400 From: Nathan Froyd Date: Thu, 4 Jun 2009 18:45:03 -0700 Message-Id: <1244166303-471-1-git-send-email-froydnj@codesourcery.com> Subject: [Qemu-devel] [PATCH] target-ppc: permit linux-user to read PVR List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Access to the PVR SPR is normally forbidden from userspace apps. The Linux kernel, however, fixes up reads in the appropriate trap handler. To permit applications that read PVR to run on QEMU, then, we need to implement the same handling of PVR reads. Signed-off-by: Nathan Froyd --- target-ppc/translate_init.c | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletions(-) diff --git a/target-ppc/translate_init.c b/target-ppc/translate_init.c index f5e3b28..ef1987a 100644 --- a/target-ppc/translate_init.c +++ b/target-ppc/translate_init.c @@ -8903,7 +8903,13 @@ static void init_ppc_proc (CPUPPCState *env, const ppc_def_t *def) /* Register SPR common to all PowerPC implementations */ gen_spr_generic(env); spr_register(env, SPR_PVR, "PVR", - SPR_NOACCESS, SPR_NOACCESS, + /* Linux permits userspace to read PVR */ +#if defined(CONFIG_LINUX_USER) + &spr_read_generic, +#else + SPR_NOACCESS, +#endif + SPR_NOACCESS, &spr_read_generic, SPR_NOACCESS, def->pvr); /* Register SVR if it's defined to anything else than POWERPC_SVR_NONE */ -- 1.6.3.2