qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Richard Henderson <richard.henderson@linaro.org>
To: qemu-devel@nongnu.org
Cc: edgar.iglesias@gmail.com
Subject: [PATCH v3 10/15] target/cris: Add DISAS_UPDATE_NEXT
Date: Tue, 22 Jun 2021 08:48:15 -0700	[thread overview]
Message-ID: <20210622154820.1978982-11-richard.henderson@linaro.org> (raw)
In-Reply-To: <20210622154820.1978982-1-richard.henderson@linaro.org>

Move this pc update into tb_stop.
We will be able to re-use this code shortly.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 target/cris/translate.c | 20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)

diff --git a/target/cris/translate.c b/target/cris/translate.c
index 80276ae84d..c9822eae4c 100644
--- a/target/cris/translate.c
+++ b/target/cris/translate.c
@@ -52,9 +52,15 @@
 #define BUG() (gen_BUG(dc, __FILE__, __LINE__))
 #define BUG_ON(x) ({if (x) BUG();})
 
-/* is_jmp field values */
-#define DISAS_JUMP    DISAS_TARGET_0 /* only pc was modified dynamically */
-#define DISAS_UPDATE  DISAS_TARGET_1 /* cpu state was modified dynamically */
+/*
+ * Target-specific is_jmp field values
+ */
+/* Only pc was modified dynamically */
+#define DISAS_JUMP          DISAS_TARGET_0
+/* Cpu state was modified dynamically, including pc */
+#define DISAS_UPDATE        DISAS_TARGET_1
+/* Cpu state was modified dynamically, excluding pc -- use npc */
+#define DISAS_UPDATE_NEXT   DISAS_TARGET_2
 
 /* Used by the decoder.  */
 #define EXTRACT_FIELD(src, start, end) \
@@ -3266,8 +3272,8 @@ static void cris_tr_translate_insn(DisasContextBase *dcbase, CPUState *cs)
 
     /* Force an update if the per-tb cpu state has changed.  */
     if (dc->base.is_jmp == DISAS_NEXT && dc->cpustate_changed) {
-        dc->base.is_jmp = DISAS_UPDATE;
-        tcg_gen_movi_tl(env_pc, dc->pc);
+        dc->base.is_jmp = DISAS_UPDATE_NEXT;
+        return;
     }
 
     /*
@@ -3309,6 +3315,7 @@ static void cris_tr_tb_stop(DisasContextBase *dcbase, CPUState *cpu)
     if (unlikely(dc->base.singlestep_enabled)) {
         switch (is_jmp) {
         case DISAS_TOO_MANY:
+        case DISAS_UPDATE_NEXT:
             tcg_gen_movi_tl(env_pc, npc);
             /* fall through */
         case DISAS_JUMP:
@@ -3325,6 +3332,9 @@ static void cris_tr_tb_stop(DisasContextBase *dcbase, CPUState *cpu)
     case DISAS_TOO_MANY:
         gen_goto_tb(dc, 0, npc);
         break;
+    case DISAS_UPDATE_NEXT:
+        tcg_gen_movi_tl(env_pc, npc);
+        /* fall through */
     case DISAS_JUMP:
     case DISAS_UPDATE:
         /* Indicate that interupts must be re-evaluated before the next TB. */
-- 
2.25.1



  parent reply	other threads:[~2021-06-22 15:55 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-22 15:48 [PATCH v3 00/15] target/cris: Convert to TranslatorOps Richard Henderson
2021-06-22 15:48 ` [PATCH v3 01/15] target/cris: Add DisasContextBase to DisasContext Richard Henderson
2021-06-22 15:48 ` [PATCH v3 02/15] target/cris: Remove DISAS_SWI Richard Henderson
2021-06-22 15:48 ` [PATCH v3 03/15] target/cris: Replace DISAS_TB_JUMP with DISAS_NORETURN Richard Henderson
2021-06-22 15:48 ` [PATCH v3 04/15] target/cris: Mark exceptions as DISAS_NORETURN Richard Henderson
2021-06-22 15:48 ` [PATCH v3 05/15] target/cris: Fix use_goto_tb Richard Henderson
2021-06-22 15:48 ` [PATCH v3 06/15] target/cris: Convert to TranslatorOps Richard Henderson
2021-06-22 15:48 ` [PATCH v3 07/15] target/cris: Mark helper_raise_exception noreturn Richard Henderson
2021-06-22 15:48 ` [PATCH v3 08/15] target/cris: Mark static arrays const Richard Henderson
2021-06-22 15:48 ` [PATCH v3 09/15] target/cris: Fold unhandled X_FLAG changes into cpustate_changed Richard Henderson
2021-06-22 15:48 ` Richard Henderson [this message]
2021-06-22 15:48 ` [PATCH v3 11/15] target/cris: Add DISAS_DBRANCH Richard Henderson
2021-06-23 13:43   ` Edgar E. Iglesias
2021-06-23 13:55     ` Richard Henderson
2021-06-23 14:17       ` Edgar E. Iglesias
2021-06-28 14:56         ` Richard Henderson
2021-06-22 15:48 ` [PATCH v3 12/15] target/cris: Use tcg_gen_lookup_and_goto_ptr Richard Henderson
2021-06-22 15:48 ` [PATCH v3 13/15] target/cris: Improve JMP_INDIRECT Richard Henderson
2021-06-22 15:48 ` [PATCH v3 14/15] target/cris: Remove dc->flagx_known Richard Henderson
2021-06-22 15:48 ` [PATCH v3 15/15] target/cris: Do not exit tb for X_FLAG changes 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=20210622154820.1978982-11-richard.henderson@linaro.org \
    --to=richard.henderson@linaro.org \
    --cc=edgar.iglesias@gmail.com \
    --cc=qemu-devel@nongnu.org \
    /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).