From patchwork Thu Sep 7 18:50:56 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 111969 Delivered-To: patch@linaro.org Received: by 10.140.94.239 with SMTP id g102csp497687qge; Thu, 7 Sep 2017 11:55:41 -0700 (PDT) X-Received: by 10.80.159.136 with SMTP id c8mr219931edf.61.1504810541367; Thu, 07 Sep 2017 11:55:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1504810541; cv=none; d=google.com; s=arc-20160816; b=OIiwaKTWsY2cEsw4fHawS/sQFgVJIg8NXb3nTHlYGJA1KJCxvAOX0arJrrnGiNNbxd NxAbYRF8gNn2ICRuMAwcMuhbpG9M4sReMQ/qkJxjSDrUUjl//6eADshY+by2kdfxwg3p D3k3/tMV50/9EVC0mOhg+EBEk7aFEOqsTuQkYYS/5IGfsdn7Hej8vjoBpbmhonTeFTz7 eW1E8noa1TS24BRE1APUQExV8wb1kTxk2a1Y7PFmvktqQrG5HG8+iz9ZIGpPMvvYg9Nr jNvDKhvrfcj6J3Iv0+9nXN4JWUrC0FEu8CPCXu6pFE88fwAloPq/K1SAnreFLSGJWuxP lsOA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:references:in-reply-to :message-id:date:to:from:dkim-signature:arc-authentication-results; bh=4i80/mNJBgdsRZ6rI0oMRFx3xHTE62r5Hp+trlIew1s=; b=GJ7PP924MhOO/t7vH8QX0WP9MkVd6fDg091K/yzuSwcB33YfB5csRTARms3O6sZ+Tb Y69lJlyHfuRjwIB41ZttqmaXD4NuflxKahUg7suVXoftRQ/LOqMrlADwyKUceGtt2wnK ner0Ez+JNuJ0EVBY49Vu66LIuk9lrmlSzhsh1fKAHQlBXJOrj9/VBwjszyTsP5ZFfnCi CywdqDXMg/xBXRUhOmo/mHPVnPMAM5I678/ep06FPXIoCYl4uf9aGi2gk4c7PVe2ZLK/ OfnBN97/q7pSOAplSEtwadYiG8NEV0F6Y4y15QHE9Qc+BCU7oFvS3m79G9yOkrvC4VRu MIyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=U4JrNREy; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id s6si6310edk.292.2017.09.07.11.55.40 for (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 07 Sep 2017 11:55:41 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=U4JrNREy; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:41786 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dq1xk-0003qR-46 for patch@linaro.org; Thu, 07 Sep 2017 14:55:40 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54189) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dq1tQ-0000Dx-B1 for qemu-devel@nongnu.org; Thu, 07 Sep 2017 14:51:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dq1tK-0000Wa-7N for qemu-devel@nongnu.org; Thu, 07 Sep 2017 14:51:12 -0400 Received: from mail-pg0-x22e.google.com ([2607:f8b0:400e:c05::22e]:33555) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dq1tJ-0000W0-VB for qemu-devel@nongnu.org; Thu, 07 Sep 2017 14:51:06 -0400 Received: by mail-pg0-x22e.google.com with SMTP id t3so1011170pgt.0 for ; Thu, 07 Sep 2017 11:51:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=4i80/mNJBgdsRZ6rI0oMRFx3xHTE62r5Hp+trlIew1s=; b=U4JrNREynaBrJh9am2WUR74AJwRgjiPSL5k00YBPqoxbdQLa3S62Ika7zu++3JsdAc /WPA0Ozz6JSw8jJ18zuBzda1jYiZjElZXaS8K2Pudw5bj1AbsBvEYKE9X/qW1gBFJAk8 xmNt7DUno4H+gzt9fIEEBN6tZcyVp4/8yMmqo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=4i80/mNJBgdsRZ6rI0oMRFx3xHTE62r5Hp+trlIew1s=; b=rRs15+8e3DUepEm3OfbHa1LdqEZqWWXzz+zfhFG3Nbna8Vd3WpLX7Tb/+8cGJFvxv9 ZXq70CAkOkwNF/wVp6jnqd7Ry+aD2JPlawoM0w9wQjTbGVaEgG6+RsZasGGsr6Jfdqlg I2yrvu7ObGqgMT2g922cHhcVWJWamvnpwVqSX7+UqQCbvPM/G73g0g2hpyWI/0DjWiud r+s4QF7ubEU3MINbV9VDLy+g7lQGHORZ6rvtPYZEGx4lyKLHjiaLXmCVJqU9vttnsBSm 0YWcmpVBHl3ctU+v/irnxDYFfbf4YXhAVZySkRVxY6EcStjazHn7W3wIZtTHHXcbOXMr XXJg== X-Gm-Message-State: AHPjjUjBNxRLh9ZlA4ENRlB/+3Koq4jSPkfwl0U9JN7OHeX4bs5eiUjB Sf4j1xyJXB+EyApyAbloSg== X-Google-Smtp-Source: ADKCNb57dtXnGFCor03Cox8ncJNeJgxgl0aX8WZKcibrtsPz0r308SP28Y3FjSx4VgZHV++Uq6MN3A== X-Received: by 10.98.245.207 with SMTP id b76mr307435pfm.223.1504810264426; Thu, 07 Sep 2017 11:51:04 -0700 (PDT) Received: from pike.twiddle.net (97-126-108-236.tukw.qwest.net. [97.126.108.236]) by smtp.gmail.com with ESMTPSA id l74sm481401pfi.9.2017.09.07.11.51.02 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 07 Sep 2017 11:51:03 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Thu, 7 Sep 2017 11:50:56 -0700 Message-Id: <20170907185057.23421-5-richard.henderson@linaro.org> X-Mailer: git-send-email 2.13.5 In-Reply-To: <20170907185057.23421-1-richard.henderson@linaro.org> References: <20170907185057.23421-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c05::22e Subject: [Qemu-devel] [PATCH v2 4/5] target/sh4: Convert to DisasContextBase X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: aurelien@aurel32.net, Richard Henderson Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Signed-off-by: Richard Henderson --- target/sh4/translate.c | 146 ++++++++++++++++++++++++------------------------- 1 file changed, 73 insertions(+), 73 deletions(-) -- 2.13.5 diff --git a/target/sh4/translate.c b/target/sh4/translate.c index 5cda27cc0a..ed462bab12 100644 --- a/target/sh4/translate.c +++ b/target/sh4/translate.c @@ -33,19 +33,19 @@ typedef struct DisasContext { - struct TranslationBlock *tb; - target_ulong pc; - uint16_t opcode; - uint32_t tbflags; /* should stay unmodified during the TB translation */ - uint32_t envflags; /* should stay in sync with env->flags using TCG ops */ - DisasJumpType bstate; + DisasContextBase base; + + uint32_t tbflags; /* should stay unmodified during the TB translation */ + uint32_t envflags; /* should stay in sync with env->flags using TCG ops */ int memidx; int gbank; int fbank; uint32_t delayed_pc; - int singlestep_enabled; uint32_t features; - int has_movcal; + + uint16_t opcode; + + bool has_movcal; } DisasContext; #if defined(CONFIG_USER_ONLY) @@ -54,7 +54,7 @@ typedef struct DisasContext { #define IS_USER(ctx) (!(ctx->tbflags & (1u << SR_MD))) #endif -/* Target-specific values for ctx->bstate. */ +/* Target-specific values for ctx->base.is_jmp. */ /* We want to exit back to the cpu loop for some reason. Usually this is to recognize interrupts immediately. */ #define DISAS_STOP DISAS_TARGET_0 @@ -220,7 +220,7 @@ static void gen_write_sr(TCGv src) static inline void gen_save_cpu_state(DisasContext *ctx, bool save_pc) { if (save_pc) { - tcg_gen_movi_i32(cpu_pc, ctx->pc); + tcg_gen_movi_i32(cpu_pc, ctx->base.pc_next); } if (ctx->delayed_pc != (uint32_t) -1) { tcg_gen_movi_i32(cpu_delayed_pc, ctx->delayed_pc); @@ -238,11 +238,11 @@ static inline bool use_exit_tb(DisasContext *ctx) static inline bool use_goto_tb(DisasContext *ctx, target_ulong dest) { /* Use a direct jump if in same page and singlestep not enabled */ - if (unlikely(ctx->singlestep_enabled || use_exit_tb(ctx))) { + if (unlikely(ctx->base.singlestep_enabled || use_exit_tb(ctx))) { return false; } #ifndef CONFIG_USER_ONLY - return (ctx->tb->pc & TARGET_PAGE_MASK) == (dest & TARGET_PAGE_MASK); + return (ctx->base.tb->pc & TARGET_PAGE_MASK) == (dest & TARGET_PAGE_MASK); #else return true; #endif @@ -253,10 +253,10 @@ static void gen_goto_tb(DisasContext *ctx, int n, target_ulong dest) if (use_goto_tb(ctx, dest)) { tcg_gen_goto_tb(n); tcg_gen_movi_i32(cpu_pc, dest); - tcg_gen_exit_tb((uintptr_t)ctx->tb + n); + tcg_gen_exit_tb((uintptr_t)ctx->base.tb + n); } else { tcg_gen_movi_i32(cpu_pc, dest); - if (ctx->singlestep_enabled) { + if (ctx->base.singlestep_enabled) { gen_helper_debug(cpu_env); } else if (use_exit_tb(ctx)) { tcg_gen_exit_tb(0); @@ -264,7 +264,7 @@ static void gen_goto_tb(DisasContext *ctx, int n, target_ulong dest) tcg_gen_lookup_and_goto_ptr(cpu_pc); } } - ctx->bstate = DISAS_NORETURN; + ctx->base.is_jmp = DISAS_NORETURN; } static void gen_jump(DisasContext * ctx) @@ -274,14 +274,14 @@ static void gen_jump(DisasContext * ctx) delayed jump as immediate jump are conditinal jumps */ tcg_gen_mov_i32(cpu_pc, cpu_delayed_pc); tcg_gen_discard_i32(cpu_delayed_pc); - if (ctx->singlestep_enabled) { + if (ctx->base.singlestep_enabled) { gen_helper_debug(cpu_env); } else if (use_exit_tb(ctx)) { tcg_gen_exit_tb(0); } else { tcg_gen_lookup_and_goto_ptr(cpu_pc); } - ctx->bstate = DISAS_NORETURN; + ctx->base.is_jmp = DISAS_NORETURN; } else { gen_goto_tb(ctx, 0, ctx->delayed_pc); } @@ -311,8 +311,8 @@ static void gen_conditional_jump(DisasContext *ctx, target_ulong dest, tcg_gen_brcondi_i32(cond_not_taken, cpu_sr_t, 0, l1); gen_goto_tb(ctx, 0, dest); gen_set_label(l1); - gen_goto_tb(ctx, 1, ctx->pc + 2); - ctx->bstate = DISAS_NORETURN; + gen_goto_tb(ctx, 1, ctx->base.pc_next + 2); + ctx->base.is_jmp = DISAS_NORETURN; } /* Delayed conditional jump (bt or bf) */ @@ -335,12 +335,12 @@ static void gen_delayed_conditional_jump(DisasContext * ctx) gen_jump(ctx); gen_set_label(l1); - ctx->bstate = DISAS_NEXT; + ctx->base.is_jmp = DISAS_NEXT; return; } tcg_gen_brcondi_i32(TCG_COND_NE, ds, 0, l1); - gen_goto_tb(ctx, 1, ctx->pc + 2); + gen_goto_tb(ctx, 1, ctx->base.pc_next + 2); gen_set_label(l1); gen_jump(ctx); } @@ -477,7 +477,7 @@ static void _decode_opc(DisasContext * ctx) tcg_gen_mov_i32(cpu_delayed_pc, cpu_spc); ctx->envflags |= DELAY_SLOT_RTE; ctx->delayed_pc = (uint32_t) - 1; - ctx->bstate = DISAS_STOP; + ctx->base.is_jmp = DISAS_STOP; return; case 0x0058: /* sets */ tcg_gen_ori_i32(cpu_sr, cpu_sr, (1u << SR_S)); @@ -488,23 +488,23 @@ static void _decode_opc(DisasContext * ctx) case 0xfbfd: /* frchg */ CHECK_FPSCR_PR_0 tcg_gen_xori_i32(cpu_fpscr, cpu_fpscr, FPSCR_FR); - ctx->bstate = DISAS_STOP; + ctx->base.is_jmp = DISAS_STOP; return; case 0xf3fd: /* fschg */ CHECK_FPSCR_PR_0 tcg_gen_xori_i32(cpu_fpscr, cpu_fpscr, FPSCR_SZ); - ctx->bstate = DISAS_STOP; + ctx->base.is_jmp = DISAS_STOP; return; case 0xf7fd: /* fpchg */ CHECK_SH4A tcg_gen_xori_i32(cpu_fpscr, cpu_fpscr, FPSCR_PR); - ctx->bstate = DISAS_STOP; + ctx->base.is_jmp = DISAS_STOP; return; case 0x0009: /* nop */ return; case 0x001b: /* sleep */ CHECK_PRIVILEGED - tcg_gen_movi_i32(cpu_pc, ctx->pc + 2); + tcg_gen_movi_i32(cpu_pc, ctx->base.pc_next + 2); gen_helper_sleep(cpu_env); return; } @@ -533,21 +533,21 @@ static void _decode_opc(DisasContext * ctx) region (stored in R0) in the next TB. */ if (B11_8 == 15 && B7_0s < 0 && parallel_cpus) { ctx->envflags = deposit32(ctx->envflags, GUSA_SHIFT, 8, B7_0s); - ctx->bstate = DISAS_STOP; + ctx->base.is_jmp = DISAS_STOP; } #endif tcg_gen_movi_i32(REG(B11_8), B7_0s); return; case 0x9000: /* mov.w @(disp,PC),Rn */ { - TCGv addr = tcg_const_i32(ctx->pc + 4 + B7_0 * 2); + TCGv addr = tcg_const_i32(ctx->base.pc_next + 4 + B7_0 * 2); tcg_gen_qemu_ld_i32(REG(B11_8), addr, ctx->memidx, MO_TESW); tcg_temp_free(addr); } return; case 0xd000: /* mov.l @(disp,PC),Rn */ { - TCGv addr = tcg_const_i32((ctx->pc + 4 + B7_0 * 4) & ~3); + TCGv addr = tcg_const_i32((ctx->base.pc_next + 4 + B7_0 * 4) & ~3); tcg_gen_qemu_ld_i32(REG(B11_8), addr, ctx->memidx, MO_TESL); tcg_temp_free(addr); } @@ -557,13 +557,13 @@ static void _decode_opc(DisasContext * ctx) return; case 0xa000: /* bra disp */ CHECK_NOT_DELAY_SLOT - ctx->delayed_pc = ctx->pc + 4 + B11_0s * 2; + ctx->delayed_pc = ctx->base.pc_next + 4 + B11_0s * 2; ctx->envflags |= DELAY_SLOT; return; case 0xb000: /* bsr disp */ CHECK_NOT_DELAY_SLOT - tcg_gen_movi_i32(cpu_pr, ctx->pc + 4); - ctx->delayed_pc = ctx->pc + 4 + B11_0s * 2; + tcg_gen_movi_i32(cpu_pr, ctx->base.pc_next + 4); + ctx->delayed_pc = ctx->base.pc_next + 4 + B11_0s * 2; ctx->envflags |= DELAY_SLOT; return; } @@ -1190,22 +1190,22 @@ static void _decode_opc(DisasContext * ctx) return; case 0x8b00: /* bf label */ CHECK_NOT_DELAY_SLOT - gen_conditional_jump(ctx, ctx->pc + 4 + B7_0s * 2, false); + gen_conditional_jump(ctx, ctx->base.pc_next + 4 + B7_0s * 2, false); return; case 0x8f00: /* bf/s label */ CHECK_NOT_DELAY_SLOT tcg_gen_xori_i32(cpu_delayed_cond, cpu_sr_t, 1); - ctx->delayed_pc = ctx->pc + 4 + B7_0s * 2; + ctx->delayed_pc = ctx->base.pc_next + 4 + B7_0s * 2; ctx->envflags |= DELAY_SLOT_CONDITIONAL; return; case 0x8900: /* bt label */ CHECK_NOT_DELAY_SLOT - gen_conditional_jump(ctx, ctx->pc + 4 + B7_0s * 2, true); + gen_conditional_jump(ctx, ctx->base.pc_next + 4 + B7_0s * 2, true); return; case 0x8d00: /* bt/s label */ CHECK_NOT_DELAY_SLOT tcg_gen_mov_i32(cpu_delayed_cond, cpu_sr_t); - ctx->delayed_pc = ctx->pc + 4 + B7_0s * 2; + ctx->delayed_pc = ctx->base.pc_next + 4 + B7_0s * 2; ctx->envflags |= DELAY_SLOT_CONDITIONAL; return; case 0x8800: /* cmp/eq #imm,R0 */ @@ -1292,7 +1292,7 @@ static void _decode_opc(DisasContext * ctx) } return; case 0xc700: /* mova @(disp,PC),R0 */ - tcg_gen_movi_i32(REG(0), ((ctx->pc & 0xfffffffc) + 4 + B7_0 * 4) & ~3); + tcg_gen_movi_i32(REG(0), ((ctx->base.pc_next & 0xfffffffc) + 4 + B7_0 * 4) & ~3); return; case 0xcb00: /* or #imm,R0 */ tcg_gen_ori_i32(REG(0), REG(0), B7_0); @@ -1318,7 +1318,7 @@ static void _decode_opc(DisasContext * ctx) imm = tcg_const_i32(B7_0); gen_helper_trapa(cpu_env, imm); tcg_temp_free(imm); - ctx->bstate = DISAS_NORETURN; + ctx->base.is_jmp = DISAS_NORETURN; } return; case 0xc800: /* tst #imm,R0 */ @@ -1386,13 +1386,13 @@ static void _decode_opc(DisasContext * ctx) switch (ctx->opcode & 0xf0ff) { case 0x0023: /* braf Rn */ CHECK_NOT_DELAY_SLOT - tcg_gen_addi_i32(cpu_delayed_pc, REG(B11_8), ctx->pc + 4); + tcg_gen_addi_i32(cpu_delayed_pc, REG(B11_8), ctx->base.pc_next + 4); ctx->envflags |= DELAY_SLOT; ctx->delayed_pc = (uint32_t) - 1; return; case 0x0003: /* bsrf Rn */ CHECK_NOT_DELAY_SLOT - tcg_gen_movi_i32(cpu_pr, ctx->pc + 4); + tcg_gen_movi_i32(cpu_pr, ctx->base.pc_next + 4); tcg_gen_add_i32(cpu_delayed_pc, REG(B11_8), cpu_pr); ctx->envflags |= DELAY_SLOT; ctx->delayed_pc = (uint32_t) - 1; @@ -1415,7 +1415,7 @@ static void _decode_opc(DisasContext * ctx) return; case 0x400b: /* jsr @Rn */ CHECK_NOT_DELAY_SLOT - tcg_gen_movi_i32(cpu_pr, ctx->pc + 4); + tcg_gen_movi_i32(cpu_pr, ctx->base.pc_next + 4); tcg_gen_mov_i32(cpu_delayed_pc, REG(B11_8)); ctx->envflags |= DELAY_SLOT; ctx->delayed_pc = (uint32_t) - 1; @@ -1427,7 +1427,7 @@ static void _decode_opc(DisasContext * ctx) tcg_gen_andi_i32(val, REG(B11_8), 0x700083f3); gen_write_sr(val); tcg_temp_free(val); - ctx->bstate = DISAS_STOP; + ctx->base.is_jmp = DISAS_STOP; } return; case 0x4007: /* ldc.l @Rm+,SR */ @@ -1439,7 +1439,7 @@ static void _decode_opc(DisasContext * ctx) gen_write_sr(val); tcg_temp_free(val); tcg_gen_addi_i32(REG(B11_8), REG(B11_8), 4); - ctx->bstate = DISAS_STOP; + ctx->base.is_jmp = DISAS_STOP; } return; case 0x0002: /* stc SR,Rn */ @@ -1501,7 +1501,7 @@ static void _decode_opc(DisasContext * ctx) case 0x406a: /* lds Rm,FPSCR */ CHECK_FPU_ENABLED gen_helper_ld_fpscr(cpu_env, REG(B11_8)); - ctx->bstate = DISAS_STOP; + ctx->base.is_jmp = DISAS_STOP; return; case 0x4066: /* lds.l @Rm+,FPSCR */ CHECK_FPU_ENABLED @@ -1511,7 +1511,7 @@ static void _decode_opc(DisasContext * ctx) tcg_gen_addi_i32(REG(B11_8), REG(B11_8), 4); gen_helper_ld_fpscr(cpu_env, addr); tcg_temp_free(addr); - ctx->bstate = DISAS_STOP; + ctx->base.is_jmp = DISAS_STOP; } return; case 0x006a: /* sts FPSCR,Rn */ @@ -1835,7 +1835,7 @@ static void _decode_opc(DisasContext * ctx) } #if 0 fprintf(stderr, "unknown instruction 0x%04x at pc 0x%08x\n", - ctx->opcode, ctx->pc); + ctx->opcode, ctx->base.pc_next); fflush(stderr); #endif do_illegal: @@ -1847,7 +1847,7 @@ static void _decode_opc(DisasContext * ctx) gen_save_cpu_state(ctx, true); gen_helper_raise_illegal_instruction(cpu_env); } - ctx->bstate = DISAS_NORETURN; + ctx->base.is_jmp = DISAS_NORETURN; return; do_fpu_disabled: @@ -1857,7 +1857,7 @@ static void _decode_opc(DisasContext * ctx) } else { gen_helper_raise_fpu_disable(cpu_env); } - ctx->bstate = DISAS_NORETURN; + ctx->base.is_jmp = DISAS_NORETURN; return; } @@ -1909,8 +1909,8 @@ static int decode_gusa(DisasContext *ctx, CPUSH4State *env, int *pmax_insns) int mv_src, mt_dst, st_src, st_mop; TCGv op_arg; - uint32_t pc = ctx->pc; - uint32_t pc_end = ctx->tb->cs_base; + uint32_t pc = ctx->base.pc_next; + uint32_t pc_end = ctx->base.tb->cs_base; int backup = sextract32(ctx->tbflags, GUSA_SHIFT, 8); int max_insns = (pc_end - pc) / 2; int i; @@ -2240,7 +2240,7 @@ static int decode_gusa(DisasContext *ctx, CPUSH4State *env, int *pmax_insns) /* The entire region has been translated. */ ctx->envflags &= ~GUSA_MASK; - ctx->pc = pc_end; + ctx->base.pc_next = pc_end; return max_insns; fail: @@ -2253,13 +2253,13 @@ static int decode_gusa(DisasContext *ctx, CPUSH4State *env, int *pmax_insns) ctx->envflags |= GUSA_EXCLUSIVE; gen_save_cpu_state(ctx, false); gen_helper_exclusive(cpu_env); - ctx->bstate = DISAS_NORETURN; + ctx->base.is_jmp = DISAS_NORETURN; /* We're not executing an instruction, but we must report one for the purposes of accounting within the TB. We might as well report the - entire region consumed via ctx->pc so that it's immediately available - in the disassembly dump. */ - ctx->pc = pc_end; + entire region consumed via ctx->base.pc_next so that it's immediately + available in the disassembly dump. */ + ctx->base.pc_next = pc_end; return 1; } #endif @@ -2273,16 +2273,16 @@ void gen_intermediate_code(CPUState *cs, struct TranslationBlock *tb) int max_insns; pc_start = tb->pc; - ctx.pc = pc_start; + ctx.base.pc_next = pc_start; ctx.tbflags = (uint32_t)tb->flags; ctx.envflags = tb->flags & TB_FLAG_ENVFLAGS_MASK; - ctx.bstate = DISAS_NEXT; + ctx.base.is_jmp = DISAS_NEXT; ctx.memidx = (ctx.tbflags & (1u << SR_MD)) == 0 ? 1 : 0; /* We don't know if the delayed pc came from a dynamic or static branch, so assume it is a dynamic branch. */ ctx.delayed_pc = -1; /* use delayed pc from env pointer */ - ctx.tb = tb; - ctx.singlestep_enabled = cs->singlestep_enabled; + ctx.base.tb = tb; + ctx.base.singlestep_enabled = cs->singlestep_enabled; ctx.features = env->features; ctx.has_movcal = (ctx.tbflags & TB_FLAG_PENDING_MOVCA); ctx.gbank = ((ctx.tbflags & (1 << SR_MD)) && @@ -2297,11 +2297,11 @@ void gen_intermediate_code(CPUState *cs, struct TranslationBlock *tb) /* Since the ISA is fixed-width, we can bound by the number of instructions remaining on the page. */ - num_insns = -(ctx.pc | TARGET_PAGE_MASK) / 2; + num_insns = -(ctx.base.pc_next | TARGET_PAGE_MASK) / 2; max_insns = MIN(max_insns, num_insns); /* Single stepping means just that. */ - if (ctx.singlestep_enabled || singlestep) { + if (ctx.base.singlestep_enabled || singlestep) { max_insns = 1; } @@ -2314,22 +2314,22 @@ void gen_intermediate_code(CPUState *cs, struct TranslationBlock *tb) } #endif - while (ctx.bstate == DISAS_NEXT + while (ctx.base.is_jmp == DISAS_NEXT && num_insns < max_insns && !tcg_op_buf_full()) { - tcg_gen_insn_start(ctx.pc, ctx.envflags); + tcg_gen_insn_start(ctx.base.pc_next, ctx.envflags); num_insns++; - if (unlikely(cpu_breakpoint_test(cs, ctx.pc, BP_ANY))) { + if (unlikely(cpu_breakpoint_test(cs, ctx.base.pc_next, BP_ANY))) { /* We have hit a breakpoint - make sure PC is up-to-date */ gen_save_cpu_state(&ctx, true); gen_helper_debug(cpu_env); - ctx.bstate = DISAS_NORETURN; + ctx.base.is_jmp = DISAS_NORETURN; /* The address covered by the breakpoint must be included in [tb->pc, tb->pc + tb->size) in order to for it to be properly cleared -- thus we increment the PC here so that the logic setting tb->size below does the right thing. */ - ctx.pc += 2; + ctx.base.pc_next += 2; break; } @@ -2337,9 +2337,9 @@ void gen_intermediate_code(CPUState *cs, struct TranslationBlock *tb) gen_io_start(); } - ctx.opcode = cpu_lduw_code(env, ctx.pc); + ctx.opcode = cpu_lduw_code(env, ctx.base.pc_next); decode_opc(&ctx); - ctx.pc += 2; + ctx.base.pc_next += 2; } if (tb->cflags & CF_LAST_IO) { gen_io_end(); @@ -2350,10 +2350,10 @@ void gen_intermediate_code(CPUState *cs, struct TranslationBlock *tb) ctx.envflags &= ~GUSA_MASK; } - switch (ctx.bstate) { + switch (ctx.base.is_jmp) { case DISAS_STOP: gen_save_cpu_state(&ctx, true); - if (cs->singlestep_enabled) { + if (ctx.base.singlestep_enabled) { gen_helper_debug(cpu_env); } else { tcg_gen_exit_tb(0); @@ -2361,7 +2361,7 @@ void gen_intermediate_code(CPUState *cs, struct TranslationBlock *tb) break; case DISAS_NEXT: gen_save_cpu_state(&ctx, false); - gen_goto_tb(&ctx, 0, ctx.pc); + gen_goto_tb(&ctx, 0, ctx.base.pc_next); break; case DISAS_NORETURN: break; @@ -2371,7 +2371,7 @@ void gen_intermediate_code(CPUState *cs, struct TranslationBlock *tb) gen_tb_end(tb, num_insns); - tb->size = ctx.pc - pc_start; + tb->size = ctx.base.pc_next - pc_start; tb->icount = num_insns; #ifdef DEBUG_DISAS @@ -2379,7 +2379,7 @@ void gen_intermediate_code(CPUState *cs, struct TranslationBlock *tb) && qemu_log_in_addr_range(pc_start)) { qemu_log_lock(); qemu_log("IN:\n"); /* , lookup_symbol(pc_start)); */ - log_target_disas(cs, pc_start, ctx.pc - pc_start, 0); + log_target_disas(cs, pc_start, ctx.base.pc_next - pc_start, 0); qemu_log("\n"); qemu_log_unlock(); }