qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] target-mips: fix CP0.BadVAddr by stopping translation on Address error
@ 2015-01-26 16:10 Leon Alrae
  2015-01-28  0:39 ` Maciej W. Rozycki
  0 siblings, 1 reply; 4+ messages in thread
From: Leon Alrae @ 2015-01-26 16:10 UTC (permalink / raw)
  To: qemu-devel; +Cc: aurelien

BadVAddr is supposed to capture the most recent address that caused
the exception. Currently this is not happening as translation is not stopped
and BadVAddr is updated with subsequent addresses.

Signed-off-by: Leon Alrae <leon.alrae@imgtec.com>
---
 target-mips/translate.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/target-mips/translate.c b/target-mips/translate.c
index f33c10c..635192c 100644
--- a/target-mips/translate.c
+++ b/target-mips/translate.c
@@ -18438,6 +18438,7 @@ static void decode_opc(CPUMIPSState *env, DisasContext *ctx)
     if (ctx->pc & 0x3) {
         env->CP0_BadVAddr = ctx->pc;
         generate_exception_err(ctx, EXCP_AdEL, EXCP_INST_NOTAVAIL);
+        ctx->bstate = BS_STOP;
         return;
     }
 
-- 
2.1.0

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

* Re: [Qemu-devel] [PATCH] target-mips: fix CP0.BadVAddr by stopping translation on Address error
  2015-01-26 16:10 [Qemu-devel] [PATCH] target-mips: fix CP0.BadVAddr by stopping translation on Address error Leon Alrae
@ 2015-01-28  0:39 ` Maciej W. Rozycki
  2015-02-19 11:32   ` Leon Alrae
  0 siblings, 1 reply; 4+ messages in thread
From: Maciej W. Rozycki @ 2015-01-28  0:39 UTC (permalink / raw)
  To: Leon Alrae; +Cc: qemu-devel, aurelien

On Mon, 26 Jan 2015, Leon Alrae wrote:

> BadVAddr is supposed to capture the most recent address that caused
> the exception. Currently this is not happening as translation is not stopped
> and BadVAddr is updated with subsequent addresses.
> 
> Signed-off-by: Leon Alrae <leon.alrae@imgtec.com>
> ---

 I think this deserves a better description as it is about the specific 
case of an unaligned standard MIPS instruction fetch.  Address Error 
exceptions can also happen for other reasons: unaligned data accesses or 
any accesses outside memory segments the current execution mode is allowed 
to reach.

 While at it I think it may be worth double-checking if the other places 
that trigger this exception get it right.

  Maciej

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

* Re: [Qemu-devel] [PATCH] target-mips: fix CP0.BadVAddr by stopping translation on Address error
  2015-01-28  0:39 ` Maciej W. Rozycki
@ 2015-02-19 11:32   ` Leon Alrae
  2015-02-20 13:11     ` Maciej W. Rozycki
  0 siblings, 1 reply; 4+ messages in thread
From: Leon Alrae @ 2015-02-19 11:32 UTC (permalink / raw)
  To: Maciej W. Rozycki; +Cc: qemu-devel, aurelien

On 28/01/2015 00:39, Maciej W. Rozycki wrote:
> On Mon, 26 Jan 2015, Leon Alrae wrote:
> 
>> BadVAddr is supposed to capture the most recent address that caused
>> the exception. Currently this is not happening as translation is not stopped
>> and BadVAddr is updated with subsequent addresses.
>>
>> Signed-off-by: Leon Alrae <leon.alrae@imgtec.com>
>> ---
> 
>  I think this deserves a better description as it is about the specific 
> case of an unaligned standard MIPS instruction fetch.  Address Error 
> exceptions can also happen for other reasons: unaligned data accesses or 
> any accesses outside memory segments the current execution mode is allowed 
> to reach.

I believe that the one line change in the patch makes that clear. I
agree however that the description itself could be more precise.

>  While at it I think it may be worth double-checking if the other places 
> that trigger this exception get it right.

Other places seem to look fine. Even decode_micromips_opc handles it
correctly whereas decode_opc -– which obviously was implemented before
microMIPS -- never got fixed.

Regards,
Leon

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

* Re: [Qemu-devel] [PATCH] target-mips: fix CP0.BadVAddr by stopping translation on Address error
  2015-02-19 11:32   ` Leon Alrae
@ 2015-02-20 13:11     ` Maciej W. Rozycki
  0 siblings, 0 replies; 4+ messages in thread
From: Maciej W. Rozycki @ 2015-02-20 13:11 UTC (permalink / raw)
  To: Leon Alrae; +Cc: qemu-devel, aurelien

On Thu, 19 Feb 2015, Leon Alrae wrote:

> >  I think this deserves a better description as it is about the specific 
> > case of an unaligned standard MIPS instruction fetch.  Address Error 
> > exceptions can also happen for other reasons: unaligned data accesses or 
> > any accesses outside memory segments the current execution mode is allowed 
> > to reach.
> 
> I believe that the one line change in the patch makes that clear. I
> agree however that the description itself could be more precise.

 I agree the patch itself is clear, but someone reading the commit might 
infer this is the only place the Address Error exception happens.  Also 
the patch itself does not show up in some places, e.g. `git log' where -p 
hasn't been also supplied, to complement information provided in the log.

> >  While at it I think it may be worth double-checking if the other places 
> > that trigger this exception get it right.
> 
> Other places seem to look fine. Even decode_micromips_opc handles it
> correctly whereas decode_opc -– which obviously was implemented before
> microMIPS -- never got fixed.

 Great that you checked, thanks!

  Maciej

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

end of thread, other threads:[~2015-02-20 13:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-26 16:10 [Qemu-devel] [PATCH] target-mips: fix CP0.BadVAddr by stopping translation on Address error Leon Alrae
2015-01-28  0:39 ` Maciej W. Rozycki
2015-02-19 11:32   ` Leon Alrae
2015-02-20 13:11     ` Maciej W. Rozycki

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).