qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] qemu-system-ppc problem with PVR access from user space
@ 2007-11-02 13:04 Jason Wessel
  2007-11-02 13:38 ` J. Mayer
  0 siblings, 1 reply; 6+ messages in thread
From: Jason Wessel @ 2007-11-02 13:04 UTC (permalink / raw)
  To: qemu-devel

[-- Attachment #1: Type: text/plain, Size: 804 bytes --]

The typical kernel + user space I boot on the prep machine no longer
boots due to an issue accessing the PVR special purpose register.  When
the PVR is accessed from user space, it should generate an exception
with the PC set to the instruction that it occurred at when it saves to
the stack.  In the latest CVS, it is off by 4 bytes.  With out the fix
/sbin/init gets killed because the kernel's trap handler which does the
userspace emulation of the instruction does not clean up the trap.

I am using the attached patch to work around the problem, but I wonder
if there is a more generic problem that was introduced as a regression
with all ppc merges in the last month or so, given this used to work
fine through the generic handler.

Any insight into this would certainly be useful.

Thanks,
Jason.

[-- Attachment #2: ppc_pvr_access_from_user_space.patch --]
[-- Type: text/x-patch, Size: 1125 bytes --]


Work around the problem that the PC register is not saved with
the right address when taking a user space PVR access exception.

Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
---
 target-ppc/translate_init.c |    9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

--- a/target-ppc/translate_init.c
+++ b/target-ppc/translate_init.c
@@ -92,6 +92,13 @@ static void spr_write_clear (void *opaqu
 }
 #endif
 
+static void spr_read_generic_fault_user(void *opaque, int sprn)
+{
+	DisasContext *ctx = opaque;
+	ctx->nip -= 4;
+	GEN_EXCP_PRIVREG(ctx);
+}
+
 /* SPR common to all PowerPC */
 /* XER */
 static void spr_read_xer (void *opaque, int sprn)
@@ -5942,7 +5949,7 @@ static void init_ppc_proc (CPUPPCState *
     /* Register SPR common to all PowerPC implementations */
     gen_spr_generic(env);
     spr_register(env, SPR_PVR, "PVR",
-                 SPR_NOACCESS, SPR_NOACCESS,
+                 &spr_read_generic_fault_user, SPR_NOACCESS,
                  &spr_read_generic, SPR_NOACCESS,
                  def->pvr);
     /* PowerPC implementation specific initialisations (SPRs, timers, ...) */

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2007-11-02 22:10 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-11-02 13:04 [Qemu-devel] qemu-system-ppc problem with PVR access from user space Jason Wessel
2007-11-02 13:38 ` J. Mayer
2007-11-02 13:57   ` Jason Wessel
2007-11-02 16:23     ` Jocelyn Mayer
2007-11-02 20:46       ` Daniel Jacobowitz
2007-11-02 22:10         ` J. Mayer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).