Commit a139aa17515032993bad21415dd55e3033f7c664

Authored by Nathan Froyd
Committed by malc
1 parent 913bbbca

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>
Showing 1 changed file with 7 additions and 1 deletions
target-ppc/translate_init.c
... ... @@ -8903,7 +8903,13 @@ static void init_ppc_proc (CPUPPCState *env, const ppc_def_t *def)
8903 8903 /* Register SPR common to all PowerPC implementations */
8904 8904 gen_spr_generic(env);
8905 8905 spr_register(env, SPR_PVR, "PVR",
8906   - SPR_NOACCESS, SPR_NOACCESS,
  8906 + /* Linux permits userspace to read PVR */
  8907 +#if defined(CONFIG_LINUX_USER)
  8908 + &spr_read_generic,
  8909 +#else
  8910 + SPR_NOACCESS,
  8911 +#endif
  8912 + SPR_NOACCESS,
8907 8913 &spr_read_generic, SPR_NOACCESS,
8908 8914 def->pvr);
8909 8915 /* Register SVR if it's defined to anything else than POWERPC_SVR_NONE */
... ...