All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] Allow microMIPS SWP and SDP to have RD equal to BASE.
@ 2011-09-18  0:28 Eric Johnson
  2012-08-27 11:45 ` Aurelien Jarno
  0 siblings, 1 reply; 2+ messages in thread
From: Eric Johnson @ 2011-09-18  0:28 UTC (permalink / raw)
  To: qemu-devel, aurelien

The microMIPS SWP and SDP instructions do not modify GPRs.  So their
behavior is well defined when RD equals BASE.  The MIPS Architecture
Verification Programs (AVPs) check that they work as expected.  This
is required for AVPs to pass.

Signed-off-by: Eric Johnson <ericj@mips.com>
---
 target-mips/translate.c |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

The patch applies to a8467c7a0e8b024a18608ff7db31ca2f2297e641.

diff --git a/target-mips/translate.c b/target-mips/translate.c
index d5b1c76..82cf75b 100644
--- a/target-mips/translate.c
+++ b/target-mips/translate.c
@@ -10034,7 +10034,7 @@ static void gen_ldst_pair (DisasContext *ctx, uint32_t opc, int rd,
     const char *opn = "ldst_pair";
     TCGv t0, t1;
 
-    if (ctx->hflags & MIPS_HFLAG_BMASK || rd == 31 || rd == base) {
+    if (ctx->hflags & MIPS_HFLAG_BMASK || rd == 31) {
         generate_exception(ctx, EXCP_RI);
         return;
     }
@@ -10046,6 +10046,10 @@ static void gen_ldst_pair (DisasContext *ctx, uint32_t opc, int rd,
 
     switch (opc) {
     case LWP:
+        if (rd == base) {
+            generate_exception(ctx, EXCP_RI);
+            return;
+        }
         save_cpu_state(ctx, 0);
         op_ld_lw(t1, t0, ctx);
         gen_store_gpr(t1, rd);
@@ -10067,6 +10071,10 @@ static void gen_ldst_pair (DisasContext *ctx, uint32_t opc, int rd,
         break;
 #ifdef TARGET_MIPS64
     case LDP:
+        if (rd == base) {
+            generate_exception(ctx, EXCP_RI);
+            return;
+        }
         save_cpu_state(ctx, 0);
         op_ld_ld(t1, t0, ctx);
         gen_store_gpr(t1, rd);

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

* Re: [Qemu-devel] [PATCH] Allow microMIPS SWP and SDP to have RD equal to BASE.
  2011-09-18  0:28 [Qemu-devel] [PATCH] Allow microMIPS SWP and SDP to have RD equal to BASE Eric Johnson
@ 2012-08-27 11:45 ` Aurelien Jarno
  0 siblings, 0 replies; 2+ messages in thread
From: Aurelien Jarno @ 2012-08-27 11:45 UTC (permalink / raw)
  To: Eric Johnson; +Cc: qemu-devel

On Sat, Sep 17, 2011 at 05:28:16PM -0700, Eric Johnson wrote:
> The microMIPS SWP and SDP instructions do not modify GPRs.  So their
> behavior is well defined when RD equals BASE.  The MIPS Architecture
> Verification Programs (AVPs) check that they work as expected.  This
> is required for AVPs to pass.
> 
> Signed-off-by: Eric Johnson <ericj@mips.com>
> ---
>  target-mips/translate.c |   10 +++++++++-
>  1 files changed, 9 insertions(+), 1 deletions(-)
> 
> The patch applies to a8467c7a0e8b024a18608ff7db31ca2f2297e641.
> 
> diff --git a/target-mips/translate.c b/target-mips/translate.c
> index d5b1c76..82cf75b 100644
> --- a/target-mips/translate.c
> +++ b/target-mips/translate.c
> @@ -10034,7 +10034,7 @@ static void gen_ldst_pair (DisasContext *ctx, uint32_t opc, int rd,
>      const char *opn = "ldst_pair";
>      TCGv t0, t1;
>  
> -    if (ctx->hflags & MIPS_HFLAG_BMASK || rd == 31 || rd == base) {
> +    if (ctx->hflags & MIPS_HFLAG_BMASK || rd == 31) {
>          generate_exception(ctx, EXCP_RI);
>          return;
>      }
> @@ -10046,6 +10046,10 @@ static void gen_ldst_pair (DisasContext *ctx, uint32_t opc, int rd,
>  
>      switch (opc) {
>      case LWP:
> +        if (rd == base) {
> +            generate_exception(ctx, EXCP_RI);
> +            return;
> +        }
>          save_cpu_state(ctx, 0);
>          op_ld_lw(t1, t0, ctx);
>          gen_store_gpr(t1, rd);
> @@ -10067,6 +10071,10 @@ static void gen_ldst_pair (DisasContext *ctx, uint32_t opc, int rd,
>          break;
>  #ifdef TARGET_MIPS64
>      case LDP:
> +        if (rd == base) {
> +            generate_exception(ctx, EXCP_RI);
> +            return;
> +        }
>          save_cpu_state(ctx, 0);
>          op_ld_ld(t1, t0, ctx);
>          gen_store_gpr(t1, rd);
> 
> 

Thanks, applied.

-- 
Aurelien Jarno                          GPG: 1024D/F1BCDB73
aurelien@aurel32.net                 http://www.aurel32.net

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

end of thread, other threads:[~2012-08-27 11:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-09-18  0:28 [Qemu-devel] [PATCH] Allow microMIPS SWP and SDP to have RD equal to BASE Eric Johnson
2012-08-27 11:45 ` Aurelien Jarno

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.