qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] qemu-system-ppc problem with PVR access from user space


From: Jason Wessel
Subject: Re: [Qemu-devel] qemu-system-ppc problem with PVR access from user space
Date: Fri, 02 Nov 2007 08:57:41 -0500
User-agent: Thunderbird 1.5.0.12 (X11/20070719)

J. Mayer wrote:
> On Fri, 2007-11-02 at 08:04 -0500, Jason Wessel wrote:
>   
>> 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.
>>     
>
> Seems like I made a mistake for program exception generation while
> fixing floating-point ones, I'm sorry. Your patch is incorrect but the
> one attached should fix the problem. Could you please check it in your
> case ?
>   

That worked quite well.  Now my patch is back to normal.  I use the
attached patch to silence the warning about the privileged access else
it prints every time the glibc processor feature check is used.  The
only difference of course from the last one is that the PC no longer
needs to be adjusted, much like before.

The other option would be for you to remove the printf of the debug
information?  Perhaps that was something accidentally left behind?

Thanks,
Jason.
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 <address@hidden>
---
 target-ppc/translate_init.c |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

--- a/target-ppc/translate_init.c
+++ b/target-ppc/translate_init.c
@@ -92,6 +92,12 @@ static void spr_write_clear (void *opaqu
 }
 #endif
 
+static void spr_read_generic_fault_user(void *opaque, int sprn)
+{
+    DisasContext *ctx = opaque;
+    GEN_EXCP_PRIVREG(ctx);
+}
+
 /* SPR common to all PowerPC */
 /* XER */
 static void spr_read_xer (void *opaque, int sprn)
@@ -5942,7 +5948,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, ...) */

reply via email to

[Prev in Thread] Current Thread [Next in Thread]