X-Git-Url: https://repo.jachan.dev/qemu.git/blobdiff_plain/f7c61bf8fc1b05613b49d1dd2300d1a1fbc927de..407ba0844d90a344e5ed012129e6e40e091bf48b:/target-s390x/translate.c diff --git a/target-s390x/translate.c b/target-s390x/translate.c index a4f2194ec7..0cb036f667 100644 --- a/target-s390x/translate.c +++ b/target-s390x/translate.c @@ -33,14 +33,16 @@ #include "tcg-op.h" #include "qemu/log.h" #include "qemu/host-utils.h" +#include "exec/cpu_ldst.h" /* global register indexes */ static TCGv_ptr cpu_env; #include "exec/gen-icount.h" -#include "helper.h" -#define GEN_HELPER 1 -#include "helper.h" +#include "exec/helper-proto.h" +#include "exec/helper-gen.h" + +#include "trace-tcg.h" /* Information that (most) every instruction needs to manipulate. */ @@ -86,9 +88,11 @@ static uint64_t pc_to_link_info(DisasContext *s, uint64_t pc) return pc; } -void cpu_dump_state(CPUS390XState *env, FILE *f, fprintf_function cpu_fprintf, - int flags) +void s390_cpu_dump_state(CPUState *cs, FILE *f, fprintf_function cpu_fprintf, + int flags) { + S390CPU *cpu = S390_CPU(cs); + CPUS390XState *env = &cpu->env; int i; if (env->cc_op > 3) { @@ -186,10 +190,6 @@ void s390x_translate_init(void) offsetof(CPUS390XState, fregs[i].d), cpu_reg_names[i + 16]); } - - /* register helpers */ -#define GEN_HELPER 2 -#include "helper.h" } static TCGv_i64 load_reg(int reg) @@ -266,11 +266,6 @@ static inline uint64_t ld_code4(CPUS390XState *env, uint64_t pc) return (uint64_t)(uint32_t)cpu_ldl_code(env, pc); } -static inline uint64_t ld_code6(CPUS390XState *env, uint64_t pc) -{ - return (ld_code2(env, pc) << 32) | ld_code4(env, pc + 2); -} - static int get_mem_index(DisasContext *s) { switch (s->tb->flags & FLAG_MASK_ASC) { @@ -1167,7 +1162,7 @@ static ExitStatus help_goto_direct(DisasContext *s, uint64_t dest) update_cc_op(s); tcg_gen_goto_tb(0); tcg_gen_movi_i64(psw_addr, dest); - tcg_gen_exit_tb((tcg_target_long)s->tb); + tcg_gen_exit_tb((uintptr_t)s->tb); return EXIT_GOTO_TB; } else { tcg_gen_movi_i64(psw_addr, dest); @@ -1225,13 +1220,13 @@ static ExitStatus help_branch(DisasContext *s, DisasCompare *c, /* Branch not taken. */ tcg_gen_goto_tb(0); tcg_gen_movi_i64(psw_addr, s->next_pc); - tcg_gen_exit_tb((tcg_target_long)s->tb + 0); + tcg_gen_exit_tb((uintptr_t)s->tb + 0); /* Branch taken. */ gen_set_label(lab); tcg_gen_goto_tb(1); tcg_gen_movi_i64(psw_addr, dest); - tcg_gen_exit_tb((tcg_target_long)s->tb + 1); + tcg_gen_exit_tb((uintptr_t)s->tb + 1); ret = EXIT_GOTO_TB; } else { @@ -1254,7 +1249,7 @@ static ExitStatus help_branch(DisasContext *s, DisasCompare *c, update_cc_op(s); tcg_gen_goto_tb(0); tcg_gen_movi_i64(psw_addr, s->next_pc); - tcg_gen_exit_tb((tcg_target_long)s->tb + 0); + tcg_gen_exit_tb((uintptr_t)s->tb + 0); gen_set_label(lab); if (is_imm) { @@ -3088,6 +3083,7 @@ static ExitStatus op_srnm(DisasContext *s, DisasOps *o) break; case 0xb9: /* SRNMT */ pos = 4, len = 3; + break; default: tcg_abort(); } @@ -3805,7 +3801,7 @@ static void cout_tm64(DisasContext *s, DisasOps *o) } /* ====================================================================== */ -/* The "PREPeration" generators. These initialize the DisasOps.OUT fields +/* The "PREParation" generators. These initialize the DisasOps.OUT fields with the TCG register to which we will write. Used in combination with the "wout" generators, in some cases we need a new temporary, and in some cases we can write to a TCG global. */ @@ -4733,10 +4729,12 @@ static ExitStatus translate_one(CPUS390XState *env, DisasContext *s) return ret; } -static inline void gen_intermediate_code_internal(CPUS390XState *env, +static inline void gen_intermediate_code_internal(S390CPU *cpu, TranslationBlock *tb, - int search_pc) + bool search_pc) { + CPUState *cs = CPU(cpu); + CPUS390XState *env = &cpu->env; DisasContext dc; target_ulong pc_start; uint64_t next_page_start; @@ -4757,7 +4755,7 @@ static inline void gen_intermediate_code_internal(CPUS390XState *env, dc.tb = tb; dc.pc = pc_start; dc.cc_op = CC_OP_DYNAMIC; - do_debug = dc.singlestep_enabled = env->singlestep_enabled; + do_debug = dc.singlestep_enabled = cs->singlestep_enabled; gen_opc_end = tcg_ctx.gen_opc_buf + OPC_MAX_SIZE; @@ -4794,8 +4792,8 @@ static inline void gen_intermediate_code_internal(CPUS390XState *env, } status = NO_EXIT; - if (unlikely(!QTAILQ_EMPTY(&env->breakpoints))) { - QTAILQ_FOREACH(bp, &env->breakpoints, entry) { + if (unlikely(!QTAILQ_EMPTY(&cs->breakpoints))) { + QTAILQ_FOREACH(bp, &cs->breakpoints, entry) { if (bp->pc == dc.pc) { status = EXIT_PC_STALE; do_debug = true; @@ -4814,7 +4812,7 @@ static inline void gen_intermediate_code_internal(CPUS390XState *env, || tcg_ctx.gen_opc_ptr >= gen_opc_end || num_insns >= max_insns || singlestep - || env->singlestep_enabled)) { + || cs->singlestep_enabled)) { status = EXIT_PC_STALE; } } while (status == NO_EXIT); @@ -4869,12 +4867,12 @@ static inline void gen_intermediate_code_internal(CPUS390XState *env, void gen_intermediate_code (CPUS390XState *env, struct TranslationBlock *tb) { - gen_intermediate_code_internal(env, tb, 0); + gen_intermediate_code_internal(s390_env_get_cpu(env), tb, false); } void gen_intermediate_code_pc (CPUS390XState *env, struct TranslationBlock *tb) { - gen_intermediate_code_internal(env, tb, 1); + gen_intermediate_code_internal(s390_env_get_cpu(env), tb, true); } void restore_state_to_opc(CPUS390XState *env, TranslationBlock *tb, int pc_pos)