qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Richard Henderson <richard.henderson@linaro.org>
To: "Emilio G. Cota" <cota@braap.org>, qemu-devel@nongnu.org
Cc: Aurelien Jarno <aurelien@aurel32.net>,
	Yongbok Kim <yongbok.kim@mips.com>
Subject: Re: [Qemu-devel] [PATCH v2 06/17] target/mips: convert to DisasJumpType
Date: Tue, 10 Apr 2018 13:56:25 +1000	[thread overview]
Message-ID: <a95ec4d4-72f7-486d-4123-a7bd4740cf03@linaro.org> (raw)
In-Reply-To: <1523038800-2494-7-git-send-email-cota@braap.org>

On 04/07/2018 04:19 AM, Emilio G. Cota wrote:
> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> Cc: Aurelien Jarno <aurelien@aurel32.net>
> Cc: Yongbok Kim <yongbok.kim@mips.com>
> Signed-off-by: Emilio G. Cota <cota@braap.org>
> ---
>  target/mips/translate.c | 186 +++++++++++++++++++++++-------------------------
>  1 file changed, 91 insertions(+), 95 deletions(-)
> 
> diff --git a/target/mips/translate.c b/target/mips/translate.c
> index d05ee67..a133205 100644
> --- a/target/mips/translate.c
> +++ b/target/mips/translate.c
> @@ -36,6 +36,7 @@
>  
>  #include "target/mips/trace.h"
>  #include "trace-tcg.h"
> +#include "exec/translator.h"
>  #include "exec/log.h"
>  
>  #define MIPS_DEBUG_DISAS 0
> @@ -1439,7 +1440,7 @@ typedef struct DisasContext {
>      int mem_idx;
>      TCGMemOp default_tcg_memop_mask;
>      uint32_t hflags, saved_hflags;
> -    int bstate;
> +    DisasJumpType is_jmp;
>      target_ulong btarget;
>      bool ulri;
>      int kscrexist;
> @@ -1460,13 +1461,8 @@ typedef struct DisasContext {
>      bool abs2008;
>  } DisasContext;
>  
> -enum {
> -    BS_NONE     = 0, /* We go out of the TB without reaching a branch or an
> -                      * exception condition */
> -    BS_STOP     = 1, /* We want to stop translation for any reason */
> -    BS_BRANCH   = 2, /* We reached a branch condition     */
> -    BS_EXCP     = 3, /* We reached an exception condition */
> -};
> +#define DISAS_STOP       DISAS_TARGET_0
> +#define DISAS_EXCP       DISAS_TARGET_1

Ok, well, there are existing bugs within the MIPS translation here, and we
might as well fix them within this patch set.

(1) The description for BS_STOP says we want to stop, but (what will become)
mips_tr_tb_stop calls goto_tb.

That's not correct, since we use that after e.g. helper_mtc0_hwrena,
MIPS_HFLAG_HWRENA_ULR is included in tb->flags, and therefore the next TB is
not fixed but depends on the actual value stored into hwrena.

We should instead use lookup_and_goto_ptr, which does a full lookup of the
processor state every time through.

(2) The BS_EXCP in generate_exception_err should map to DISAS_NORETURN, because
we do not return after raising an exception.

(3) Otherwise, the use of BS_EXCP has nothing to do with an exception; e.g.

>         case 0:
>             save_cpu_state(ctx, 1);
>             gen_helper_mtc0_status(cpu_env, arg);
>             /* BS_STOP isn't good enough here, hflags may have changed. */
>             gen_save_pc(ctx->pc + 4);
>             ctx->bstate = BS_EXCP;
>             rn = "Status";
>             break;

where we are in fact relying on (what will become) mips_tr_tb_stop to emit
exit_tb.  It would be better to name these uses DISAS_EXIT, which would match
e.g. target/arm.



r~

  reply	other threads:[~2018-04-10  3:56 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-06 18:19 [Qemu-devel] [PATCH v2 00/17] Translation loop conversion for sh4/sparc/mips/s390x/openrisc/riscv targets Emilio G. Cota
2018-04-06 18:19 ` [Qemu-devel] [PATCH v2 01/17] translator: merge max_insns into DisasContextBase Emilio G. Cota
2018-04-06 18:19 ` [Qemu-devel] [PATCH v2 02/17] target/sh4: convert to TranslatorOps Emilio G. Cota
2018-04-06 18:19 ` [Qemu-devel] [PATCH v2 03/17] target/sparc: convert to DisasJumpType Emilio G. Cota
2018-04-06 18:19 ` [Qemu-devel] [PATCH v2 04/17] target/sparc: convert to DisasContextBase Emilio G. Cota
2018-04-10  3:22   ` Richard Henderson
2018-04-06 18:19 ` [Qemu-devel] [PATCH v2 05/17] target/sparc: convert to TranslatorOps Emilio G. Cota
2018-04-10  3:24   ` Richard Henderson
2018-04-06 18:19 ` [Qemu-devel] [PATCH v2 06/17] target/mips: convert to DisasJumpType Emilio G. Cota
2018-04-10  3:56   ` Richard Henderson [this message]
2018-04-10 14:23     ` Emilio G. Cota
2018-04-10 23:27       ` Richard Henderson
2018-04-11 16:30         ` Emilio G. Cota
2018-04-06 18:19 ` [Qemu-devel] [PATCH v2 07/17] target/mips: convert to DisasContextBase Emilio G. Cota
2018-04-10  3:57   ` Richard Henderson
2018-04-06 18:19 ` [Qemu-devel] [PATCH v2 08/17] target/mips: use *ctx for DisasContext Emilio G. Cota
2018-04-10  3:57   ` Richard Henderson
2018-04-06 18:19 ` [Qemu-devel] [PATCH v2 09/17] target/mips: convert to TranslatorOps Emilio G. Cota
2018-04-10  4:02   ` Richard Henderson
2018-04-06 18:19 ` [Qemu-devel] [PATCH v2 10/17] target/s390x: convert to DisasJumpType Emilio G. Cota
2018-04-06 18:19 ` [Qemu-devel] [PATCH v2 11/17] target/s390x: convert to DisasContextBase Emilio G. Cota
2018-04-10  4:07   ` Richard Henderson
2018-04-06 18:19 ` [Qemu-devel] [PATCH v2 12/17] target/s390x: convert to TranslatorOps Emilio G. Cota
2018-04-10  4:10   ` Richard Henderson
2018-04-06 18:19 ` [Qemu-devel] [PATCH v2 13/17] target/openrisc: convert to DisasContextBase Emilio G. Cota
2018-04-10  4:13   ` Richard Henderson
2018-04-06 18:19 ` [Qemu-devel] [PATCH v2 14/17] target/openrisc: convert to TranslatorOps Emilio G. Cota
2018-04-10  4:23   ` Richard Henderson
2018-04-06 18:19 ` [Qemu-devel] [PATCH v2 15/17] target/riscv: convert to DisasJumpType Emilio G. Cota
2018-04-09 14:03   ` Bastian Koppelmann
2018-04-13  4:24   ` Richard Henderson
2018-04-06 18:19 ` [Qemu-devel] [PATCH v2 16/17] target/riscv: convert to DisasContextBase Emilio G. Cota
2018-04-09 14:22   ` Bastian Koppelmann
2018-04-09 16:01     ` Emilio G. Cota
2018-04-13  4:36   ` Richard Henderson
2018-04-06 18:20 ` [Qemu-devel] [PATCH v2 17/17] target/riscv: convert to TranslatorOps Emilio G. Cota
2018-04-10  1:24   ` Richard Henderson
2018-04-10 12:59     ` Emilio G. Cota
2018-04-10 14:05       ` Eric Blake
2018-04-10 14:38         ` Emilio G. Cota
2018-04-13  4:40   ` Richard Henderson
2018-04-06 18:39 ` [Qemu-devel] [PATCH v2 00/17] Translation loop conversion for sh4/sparc/mips/s390x/openrisc/riscv targets no-reply
2018-04-09 14:01 ` Bastian Koppelmann
2018-04-09 16:11   ` Emilio G. Cota
2018-04-10  4:24     ` Richard Henderson
2018-04-10 13:03       ` Emilio G. Cota
2018-04-10 13:16         ` Bastian Koppelmann
2018-04-10 13:40           ` Emilio G. Cota
2018-04-10 13:45             ` Bastian Koppelmann
2018-04-10 23:33               ` Richard Henderson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a95ec4d4-72f7-486d-4123-a7bd4740cf03@linaro.org \
    --to=richard.henderson@linaro.org \
    --cc=aurelien@aurel32.net \
    --cc=cota@braap.org \
    --cc=qemu-devel@nongnu.org \
    --cc=yongbok.kim@mips.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).