Skip to contentSkip to conversation

target-ppc: permit linux-user to read PVR

PATCH In review Nathan Froyd 1 participant 2 messages Jun 5, 2009 – Jun 23, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---
 target-ppc/translate_init.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)
target-ppc/translate_init.c +7 -1
index f5e3b28..ef1987a 100644
@@ -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 */
Signature · 1 line
1.6.3.2
#1 lore raw
Quoted 4 lines · Nathan Froyd

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.

Ping.

-Nathan