The only non-trivial modification is the use of DISAS_TOO_MANY
in the same way is used by the generic translation loop.
Signed-off-by: Emilio G. Cota
---
target/s390x/translate.c | 1267 +++---
1 file changed, 632 insertions(+), 635 deletions(-)
diff --git a/target/s390x/translate.c b/target/s390x/translate.c
index b470d69..5346791 100644
--- a/target/s390x/translate.c
+++ b/target/s390x/translate.c
@@ -42,6 +42,7 @@
#include "exec/helper-gen.h"
#include "trace-tcg.h"
+#include "exec/translator.h"
#include "exec/log.h"
@@ -73,9 +74,6 @@ typedef struct {
} u;
} DisasCompare;
-/* is_jmp field values */
-#define DISAS_EXCP DISAS_TARGET_0
-
#ifdef DEBUG_INLINE_BRANCHES
static uint64_t inline_branch_hit[CC_OP_MAX];
static uint64_t inline_branch_miss[CC_OP_MAX];
@@ -1087,26 +1085,24 @@ typedef struct {
#define SPEC_r2_f12816
/* Return values from translate_one, indicating the state of the TB. */
-typedef enum {
-/* Continue the TB. */
-NO_EXIT,
-/* We have emitted one or more goto_tb. No fixup required. */
-EXIT_GOTO_TB,
-/* We are not using a goto_tb (for whatever reason), but have updated
- the PC (for whatever reason), so there's no need to do it again on
- exiting the TB. */
-EXIT_PC_UPDATED,
-/* We have updated the PC and CC values. */
-EXIT_PC_CC_UPDATED,
-/* We are exiting the TB, but have neither emitted a goto_tb, nor
- updated the PC for the next instruction to be executed. */
-EXIT_PC_STALE,
-/* We are exiting the TB to the main loop. */
-EXIT_PC_STALE_NOCHAIN,
-/* We are ending the TB with a noreturn function call, e.g. longjmp.
- No following code will be executed. */
-EXIT_NORETURN,
-} ExitStatus;
+
+/* We are not using a goto_tb (for whatever reason), but have updated
+ the PC (for whatever reason), so there's no need to do it again on
+ exiting the TB. */
+#define DISAS_PC_UPDATEDDISAS_TARGET_0
+
+/* We have emitted one or more goto_tb. No fixup required. */
+#define DISAS_GOTO_TB DISAS_TARGET_1
+
+/* We have updated the PC and CC values. */
+#define DISAS_PC_CC_UPDATED DISAS_TARGET_2
+
+/* We are exiting the TB, but have neither emitted a goto_tb, nor
+ updated the PC for the next instruction to be executed. */
+#define DISAS_PC_STALE DISAS_TARGET_3
+
+/* We are exiting the TB to the main loop. */
+#define DISAS_PC_STALE_NOCHAIN DISAS_TARGET_4
struct DisasInsn {
unsigned opc:16;
@@ -1121,7 +1117,7 @@ struct DisasInsn {
void (*help_prep)(DisasContext *, DisasFields *, DisasOps *);
void (*help_wout)(DisasContext *, DisasFields *, DisasOps *);
void (*help_cout)(DisasContext *, DisasOps *);
-ExitStatus (*help_op)(DisasContext *, DisasOps *);
+DisasJumpType (*help_op)(DisasContext *, DisasOps *);
uint64_t data;
};
@@ -1143,11 +1139,11 @@ static void help_l2_shift(DisasContext *s, DisasFields
*f,
}
}
-static ExitStatus help_goto_direct(DisasContext *s, uint64_t dest)
+static DisasJumpType help_goto_direct(DisasContext *s, uint64_t dest)
{
if (dest == s->next_pc) {
per_branch(s, true);
-return NO_EXIT;
+return DISAS_NEXT;
}
if (use_goto_tb(s, dest)) {
update_cc_op(s);
@@ -1155,31 +1151,31 @@ static ExitStatus help_goto_direct(DisasContext *s,
uint64_t dest)
tcg_gen_goto_tb(0);
tcg_gen_movi_i64(psw_addr, dest);
tcg_gen_exit_tb((uintptr_t)s->tb);
-return EXIT_GOTO_TB;
+return DISAS_GOTO_TB;
} else {
tcg_gen_movi_i64(psw_addr, dest);
per_branch(s, false);
-return EXIT_PC_UPDATED;
+return DISAS_PC_UPDATED;
}
}
-static ExitStatus help_branch(DisasContext *s, DisasCompare *c,
- bool is_imm, int imm, TCGv_i64 cdest)
+static DisasJumpType help_branch(DisasContext *s, DisasCompare *c,
+ bool is_imm, int imm, TCGv_i64 cdest)
{
-ExitStatus ret;
+DisasJumpType ret;
uint64_t dest = s->pc + 2 * imm;
TCGLabel *lab;
/* Take care of the special cases first. */
if (c->cond == TCG_COND_NEVER) {
-ret = NO_EXIT;
+ret = DISAS_NEXT;
goto egress;
}
if (is_imm) {
if (dest == s->next_pc) {
/* Branch to next. */
per_branch(s, true);
-ret = NO_EXIT;
+ret = DISAS_NEXT;
goto egress;
}
if (c->cond == TCG_COND_ALWAYS) {
@@ -1189,13 +1185,13 @@ static ExitStatus help_branch(DisasContext *s,
DisasCompare *c,
} else {
if (!cdest) {
/* E.g. bcr %r0 -> no branch. */
-ret = NO_EXIT;
+ret = DISAS_NEXT;
goto egress;
}
if (c->cond == TCG_COND_ALWAYS) {
tcg_gen_mov_i64(psw_addr, cdest);
per_branch(s, false);
-ret = EXIT_PC