summaryrefslogtreecommitdiff
path: root/target-ppc
diff options
context:
space:
mode:
authorNathan Froyd <froydnj@codesourcery.com>2009-06-04 18:45:03 -0700
committermalc <av1474@comtv.ru>2009-06-23 21:11:22 +0400
commita139aa17515032993bad21415dd55e3033f7c664 (patch)
tree62ee0f08d84cbc63aadc79bf4d1eeae493a92ef1 /target-ppc
parent913bbbca4eac9fc9ed927e2b2da184850f32ff52 (diff)
downloadqemu-a139aa17515032993bad21415dd55e3033f7c664.tar.gz
qemu-a139aa17515032993bad21415dd55e3033f7c664.tar.bz2
qemu-a139aa17515032993bad21415dd55e3033f7c664.zip
target-ppc: permit linux-user to read PVR
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 <froydnj@codesourcery.com> Signed-off-by: malc <av1474@comtv.ru>
Diffstat (limited to 'target-ppc')
-rw-r--r--target-ppc/translate_init.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/target-ppc/translate_init.c b/target-ppc/translate_init.c
index 87083644f1..04225e5576 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 */