target-ppc: permit linux-user to read PVR
authorNathan Froyd <froydnj@codesourcery.com>
Fri, 5 Jun 2009 01:45:03 +0000 (18:45 -0700)
committermalc <av1474@comtv.ru>
Tue, 23 Jun 2009 17:11:22 +0000 (21:11 +0400)
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>
target-ppc/translate_init.c

index 87083644f1bd2fd5544d1b2da2e484fb5c8418d6..04225e5576806c6c5132956c6d55110f66ff9135 100644 (file)
@@ -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 */