From nobody Fri May 17 06:43:19 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=mail.uni-paderborn.de ARC-Seal: i=1; a=rsa-sha256; t=1591024437; cv=none; d=zohomail.com; s=zohoarc; b=L9kHYdRMwfop5w8jBqb4J3XVvhb6K/Ff+XOkKuBs20HTzdjVYKtuED3NzL3XLNuvAjJYHoEgD3qoxIILop8Am4ZKKdTh5PVIUnjEZKBDB4kF1Ut38qDtA/ZrMjL2Q4dmxgI1NlYWmrQhdQSOAQyqqDbDMZ5b6r2ROggdN4b7F+Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1591024437; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=zQ2ZbxZi2QkV1rcFsEXnNbWnbVQZ4muPXiXcMCPVsM4=; b=igNI2hh7vohRtFRHmZWphrxRx4a/QU9oQf20QPv0BnSsABuUie+So/JdurJyX0rVPUnosF+yB2niqddwtxBms585ws9zOAulQsbz8D6MpmFAKg/o0AX/D0u8GfKt5GNSFASpLlyUmXBAGQOEkySCIyMi84xzl5OY6ngppCnMFUw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1591024437395165.06227255313797; Mon, 1 Jun 2020 08:13:57 -0700 (PDT) Received: from localhost ([::1]:53268 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jfm8S-0001dv-4g for importer@patchew.org; Mon, 01 Jun 2020 11:13:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43618) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jfm6Z-0007wF-9r for qemu-devel@nongnu.org; Mon, 01 Jun 2020 11:11:59 -0400 Received: from nylar.uni-paderborn.de ([2001:638:502:c003::18]:42082) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jfm6X-0004e6-Pj for qemu-devel@nongnu.org; Mon, 01 Jun 2020 11:11:58 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mail.uni-paderborn.de; s=20170601; h=Content-Transfer-Encoding:MIME-Version :References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=zQ2ZbxZi2QkV1rcFsEXnNbWnbVQZ4muPXiXcMCPVsM4=; b=THikc3ZoMpQKxemHEefOj/wSiv PMClKurFH7aIMSwg2DTvElVgHbqOGt+D2qW5U3fA/HAqPzIXWpHE8hirL87i7J7I48Hyajkfn1PWj w1z+pfYIg87CDsy7AqFlbOErJgBP2rO9SIf8zAsZERb9ZenU3SpKLZ2Ypqjc0nieOPsk=; From: Bastian Koppelmann To: qemu-devel@nongnu.org Subject: [PULL 1/5] target/tricore: Don't save pc in generate_qemu_excp Date: Mon, 1 Jun 2020 17:11:15 +0200 Message-Id: <20200601151119.33196-2-kbastian@mail.uni-paderborn.de> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200601151119.33196-1-kbastian@mail.uni-paderborn.de> References: <20200601151119.33196-1-kbastian@mail.uni-paderborn.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-IMT-Spam-Score: 0.0 () X-Sophos-SenderHistory: ip=2a02:908:2214:e5bc::95d, fs=6661696, da=78633377, mc=164, sc=3, hc=161, sp=1, fso=6661696, re=0, sd=0, hd=0 X-PMX-Version: 6.4.9.2830568, Antispam-Engine: 2.7.2.2107409, Antispam-Data: 2020.6.1.150616, AntiVirus-Engine: 5.74.0, AntiVirus-Data: 2020.6.1.5740002 X-IMT-Authenticated-Sender: uid=kbastian,ou=People,o=upb,c=de Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2001:638:502:c003::18; envelope-from=kbastian@mail.uni-paderborn.de; helo=nylar.uni-paderborn.de X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -19 X-Spam_score: -2.0 X-Spam_bar: -- X-Spam_report: (-2.0 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" EXCP_DEBUG is the only user. If we encounter a jump in tricore-gdb it's target was overwritten by generate_qemu_excp() and we would never leave. Signed-off-by: Bastian Koppelmann Message-Id: <20200529072148.284037-2-kbastian@mail.uni-paderborn.de> --- target/tricore/translate.c | 1 - 1 file changed, 1 deletion(-) diff --git a/target/tricore/translate.c b/target/tricore/translate.c index 609d75ae8a..65a33e5ad8 100644 --- a/target/tricore/translate.c +++ b/target/tricore/translate.c @@ -3264,7 +3264,6 @@ static void generate_trap(DisasContext *ctx, int clas= s, int tin) static void generate_qemu_excp(DisasContext *ctx, int excp) { TCGv_i32 tmp =3D tcg_const_i32(excp); - gen_save_pc(ctx->base.pc_next); gen_helper_qemu_excp(cpu_env, tmp); ctx->base.is_jmp =3D DISAS_NORETURN; tcg_temp_free(tmp); --=20 2.26.2 From nobody Fri May 17 06:43:19 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=mail.uni-paderborn.de ARC-Seal: i=1; a=rsa-sha256; t=1591024483; cv=none; d=zohomail.com; s=zohoarc; b=iTwgPU3Z/QqBmV/3Xu4HgzAv/LOYNbku3w4VHJn/Z8Yq9Fmtcv9pggtPON5sI8/SRmuhd9jrWMukEXQCbaw5P0RYAfI+CufllRA7FpHEPaGlvpGO9azfDN9GAjEIhgT2YzIgC1sKbIClzHq/CDGAMRpRRXSHDM8wwQvl7RD/P9U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1591024483; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=DfKOQYDeZ7U18yGCOTOuiJ4LcUBsEFDpqvsgoFGvrvw=; b=krhyTlpkhzSWxkALu7YcHHWYUfL/eTFE2Ww0TV+LbYBZjOauEZ8RO0SJVlWoElNXBVoNmm/fTevXfibcfraQNXHGxv8OYMQFdvZPju5lNyLXOh3ToPSOjxeTcxlhWeHPvfX0m7GjnQw5UPpKYorp9z3gAHY+oY4zf+dKTexzP+c= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1591024483562602.9735162876887; Mon, 1 Jun 2020 08:14:43 -0700 (PDT) Received: from localhost ([::1]:56708 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jfm9C-00038J-4h for importer@patchew.org; Mon, 01 Jun 2020 11:14:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43626) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jfm6a-0007xW-0A for qemu-devel@nongnu.org; Mon, 01 Jun 2020 11:12:00 -0400 Received: from nylar.uni-paderborn.de ([2001:638:502:c003::18]:42098) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jfm6Y-0004eE-7S for qemu-devel@nongnu.org; Mon, 01 Jun 2020 11:11:59 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mail.uni-paderborn.de; s=20170601; h=Content-Transfer-Encoding:MIME-Version :References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=DfKOQYDeZ7U18yGCOTOuiJ4LcUBsEFDpqvsgoFGvrvw=; b=sHmeluWrKNDJioRz3l7G5C5iNS DWPfbdc90fNyM4XQuWp6pmajyzXgK4k6qu0MIpTAZWQUAvmqoT64n4m+pjjuatbfM0DfEbaIRrgYI Eqw1RxWQ8jVPr+2rolyoaJwTuuZlaKWAExBnF7p6YhEtBO40bW9YmSyabY052fOPxp88=; From: Bastian Koppelmann To: qemu-devel@nongnu.org Subject: [PULL 2/5] target/tricore: Move translate feature check to ctx Date: Mon, 1 Jun 2020 17:11:16 +0200 Message-Id: <20200601151119.33196-3-kbastian@mail.uni-paderborn.de> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200601151119.33196-1-kbastian@mail.uni-paderborn.de> References: <20200601151119.33196-1-kbastian@mail.uni-paderborn.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-IMT-Spam-Score: 0.0 () X-PMX-Version: 6.4.9.2830568, Antispam-Engine: 2.7.2.2107409, Antispam-Data: 2020.6.1.150018, AntiVirus-Engine: 5.74.0, AntiVirus-Data: 2020.6.1.5740002 X-Sophos-SenderHistory: ip=2a02:908:2214:e5bc::95d, fs=6661697, da=78633378, mc=165, sc=3, hc=162, sp=1, fso=6661697, re=0, sd=0, hd=0 X-IMT-Authenticated-Sender: uid=kbastian,ou=People,o=upb,c=de Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2001:638:502:c003::18; envelope-from=kbastian@mail.uni-paderborn.de; helo=nylar.uni-paderborn.de X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -19 X-Spam_score: -2.0 X-Spam_bar: -- X-Spam_report: (-2.0 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andreas Konopik , peter.maydell@linaro.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" this allows us to remove the references to env from ctx. This also fixes a segfault that was due to the unititalized ctx->env ptr. Reported-by: Andreas Konopik Signed-off-by: Bastian Koppelmann Message-Id: <20200529072148.284037-3-kbastian@mail.uni-paderborn.de> --- target/tricore/translate.c | 60 +++++++++++++++++++++----------------- 1 file changed, 33 insertions(+), 27 deletions(-) diff --git a/target/tricore/translate.c b/target/tricore/translate.c index 65a33e5ad8..608f72d384 100644 --- a/target/tricore/translate.c +++ b/target/tricore/translate.c @@ -66,14 +66,19 @@ static const char *regnames_d[] =3D { =20 typedef struct DisasContext { DisasContextBase base; - CPUTriCoreState *env; target_ulong pc_succ_insn; uint32_t opcode; /* Routine used to access memory */ int mem_idx; uint32_t hflags, saved_hflags; + uint64_t features; } DisasContext; =20 +static int has_feature(DisasContext *ctx, int feature) +{ + return (ctx->features & (1ULL << feature)) !=3D 0; +} + enum { MODE_LL =3D 0, MODE_LU =3D 1, @@ -370,7 +375,7 @@ static void gen_swapmsk(DisasContext *ctx, int reg, TCG= v ea) These makros also specify in which ISA version the csfr was introduced.= */ #define R(ADDRESS, REG, FEATURE) \ case ADDRESS: \ - if (tricore_feature(ctx->env, FEATURE)) { \ + if (has_feature(ctx, FEATURE)) { \ tcg_gen_ld_tl(ret, cpu_env, offsetof(CPUTriCoreState, REG)); \ } \ break; @@ -395,7 +400,7 @@ static inline void gen_mfcr(DisasContext *ctx, TCGv ret= , int32_t offset) since no execption occurs */ #define A(ADDRESS, REG, FEATURE) R(ADDRESS, REG, FEATURE) \ case ADDRESS: \ - if (tricore_feature(ctx->env, FEATURE)) { \ + if (has_feature(ctx, FEATURE)) { \ tcg_gen_st_tl(r1, cpu_env, offsetof(CPUTriCoreState, REG)); \ } \ break; @@ -3158,7 +3163,7 @@ gen_dvinit_b(DisasContext *ctx, TCGv rl, TCGv rh, TCG= v r1, TCGv r2) { TCGv_i64 ret =3D tcg_temp_new_i64(); =20 - if (!tricore_feature(ctx->env, TRICORE_FEATURE_131)) { + if (!has_feature(ctx, TRICORE_FEATURE_131)) { gen_helper_dvinit_b_13(ret, cpu_env, r1, r2); } else { gen_helper_dvinit_b_131(ret, cpu_env, r1, r2); @@ -3173,7 +3178,7 @@ gen_dvinit_h(DisasContext *ctx, TCGv rl, TCGv rh, TCG= v r1, TCGv r2) { TCGv_i64 ret =3D tcg_temp_new_i64(); =20 - if (!tricore_feature(ctx->env, TRICORE_FEATURE_131)) { + if (!has_feature(ctx, TRICORE_FEATURE_131)) { gen_helper_dvinit_h_13(ret, cpu_env, r1, r2); } else { gen_helper_dvinit_h_131(ret, cpu_env, r1, r2); @@ -3655,7 +3660,7 @@ static void decode_src_opc(DisasContext *ctx, int op1) tcg_gen_movi_tl(cpu_gpr_a[r1], const4); break; case OPC1_16_SRC_MOV_E: - if (tricore_feature(ctx->env, TRICORE_FEATURE_16)) { + if (has_feature(ctx, TRICORE_FEATURE_16)) { tcg_gen_movi_tl(cpu_gpr_d[r1], const4); tcg_gen_sari_tl(cpu_gpr_d[r1+1], cpu_gpr_d[r1], 31); } else { @@ -4106,7 +4111,7 @@ static void decode_16Bit_opc(DisasContext *ctx) break; case OPC1_16_SBC_JEQ2: case OPC1_16_SBC_JNE2: - if (tricore_feature(ctx->env, TRICORE_FEATURE_16)) { + if (has_feature(ctx, TRICORE_FEATURE_16)) { address =3D MASK_OP_SBC_DISP4(ctx->opcode); const16 =3D MASK_OP_SBC_CONST4_SEXT(ctx->opcode); gen_compute_branch(ctx, op1, 0, 0, const16, address); @@ -4124,7 +4129,7 @@ static void decode_16Bit_opc(DisasContext *ctx) /* SBR-format */ case OPC1_16_SBR_JEQ2: case OPC1_16_SBR_JNE2: - if (tricore_feature(ctx->env, TRICORE_FEATURE_16)) { + if (has_feature(ctx, TRICORE_FEATURE_16)) { r1 =3D MASK_OP_SBR_S2(ctx->opcode); address =3D MASK_OP_SBR_DISP4(ctx->opcode); gen_compute_branch(ctx, op1, r1, 0, 0, address); @@ -4704,13 +4709,13 @@ static void decode_bo_addrmode_post_pre_base(DisasC= ontext *ctx) break; case OPC2_32_BO_CACHEI_WI_SHORTOFF: case OPC2_32_BO_CACHEI_W_SHORTOFF: - if (!tricore_feature(ctx->env, TRICORE_FEATURE_131)) { + if (!has_feature(ctx, TRICORE_FEATURE_131)) { generate_trap(ctx, TRAPC_INSN_ERR, TIN2_IOPC); } break; case OPC2_32_BO_CACHEI_W_POSTINC: case OPC2_32_BO_CACHEI_WI_POSTINC: - if (tricore_feature(ctx->env, TRICORE_FEATURE_131)) { + if (has_feature(ctx, TRICORE_FEATURE_131)) { tcg_gen_addi_tl(cpu_gpr_a[r2], cpu_gpr_a[r2], off10); } else { generate_trap(ctx, TRAPC_INSN_ERR, TIN2_IOPC); @@ -4718,7 +4723,7 @@ static void decode_bo_addrmode_post_pre_base(DisasCon= text *ctx) break; case OPC2_32_BO_CACHEI_W_PREINC: case OPC2_32_BO_CACHEI_WI_PREINC: - if (tricore_feature(ctx->env, TRICORE_FEATURE_131)) { + if (has_feature(ctx, TRICORE_FEATURE_131)) { tcg_gen_addi_tl(cpu_gpr_a[r2], cpu_gpr_a[r2], off10); } else { generate_trap(ctx, TRAPC_INSN_ERR, TIN2_IOPC); @@ -5372,7 +5377,7 @@ static void decode_bol_opc(DisasContext *ctx, int32_t= op1) tcg_gen_addi_tl(cpu_gpr_a[r1], cpu_gpr_a[r2], address); break; case OPC1_32_BOL_ST_A_LONGOFF: - if (tricore_feature(ctx->env, TRICORE_FEATURE_16)) { + if (has_feature(ctx, TRICORE_FEATURE_16)) { gen_offset_st(ctx, cpu_gpr_a[r1], cpu_gpr_a[r2], address, MO_L= EUL); } else { generate_trap(ctx, TRAPC_INSN_ERR, TIN2_IOPC); @@ -5382,42 +5387,42 @@ static void decode_bol_opc(DisasContext *ctx, int32= _t op1) gen_offset_st(ctx, cpu_gpr_d[r1], cpu_gpr_a[r2], address, MO_LEUL); break; case OPC1_32_BOL_LD_B_LONGOFF: - if (tricore_feature(ctx->env, TRICORE_FEATURE_16)) { + if (has_feature(ctx, TRICORE_FEATURE_16)) { gen_offset_ld(ctx, cpu_gpr_d[r1], cpu_gpr_a[r2], address, MO_S= B); } else { generate_trap(ctx, TRAPC_INSN_ERR, TIN2_IOPC); } break; case OPC1_32_BOL_LD_BU_LONGOFF: - if (tricore_feature(ctx->env, TRICORE_FEATURE_16)) { + if (has_feature(ctx, TRICORE_FEATURE_16)) { gen_offset_ld(ctx, cpu_gpr_d[r1], cpu_gpr_a[r2], address, MO_U= B); } else { generate_trap(ctx, TRAPC_INSN_ERR, TIN2_IOPC); } break; case OPC1_32_BOL_LD_H_LONGOFF: - if (tricore_feature(ctx->env, TRICORE_FEATURE_16)) { + if (has_feature(ctx, TRICORE_FEATURE_16)) { gen_offset_ld(ctx, cpu_gpr_d[r1], cpu_gpr_a[r2], address, MO_L= ESW); } else { generate_trap(ctx, TRAPC_INSN_ERR, TIN2_IOPC); } break; case OPC1_32_BOL_LD_HU_LONGOFF: - if (tricore_feature(ctx->env, TRICORE_FEATURE_16)) { + if (has_feature(ctx, TRICORE_FEATURE_16)) { gen_offset_ld(ctx, cpu_gpr_d[r1], cpu_gpr_a[r2], address, MO_L= EUW); } else { generate_trap(ctx, TRAPC_INSN_ERR, TIN2_IOPC); } break; case OPC1_32_BOL_ST_B_LONGOFF: - if (tricore_feature(ctx->env, TRICORE_FEATURE_16)) { + if (has_feature(ctx, TRICORE_FEATURE_16)) { gen_offset_st(ctx, cpu_gpr_d[r1], cpu_gpr_a[r2], address, MO_S= B); } else { generate_trap(ctx, TRAPC_INSN_ERR, TIN2_IOPC); } break; case OPC1_32_BOL_ST_H_LONGOFF: - if (tricore_feature(ctx->env, TRICORE_FEATURE_16)) { + if (has_feature(ctx, TRICORE_FEATURE_16)) { gen_offset_st(ctx, cpu_gpr_d[r1], cpu_gpr_a[r2], address, MO_L= ESW); } else { generate_trap(ctx, TRAPC_INSN_ERR, TIN2_IOPC); @@ -6022,7 +6027,7 @@ static void decode_rlc_opc(DisasContext *ctx, tcg_gen_movi_tl(cpu_gpr_d[r2], const16); break; case OPC1_32_RLC_MOV_64: - if (tricore_feature(ctx->env, TRICORE_FEATURE_16)) { + if (has_feature(ctx, TRICORE_FEATURE_16)) { CHECK_REG_PAIR(r2); tcg_gen_movi_tl(cpu_gpr_d[r2], const16); tcg_gen_movi_tl(cpu_gpr_d[r2+1], const16 >> 15); @@ -6248,7 +6253,7 @@ static void decode_rr_accumulator(DisasContext *ctx) tcg_gen_mov_tl(cpu_gpr_d[r3], cpu_gpr_d[r2]); break; case OPC2_32_RR_MOV_64: - if (tricore_feature(ctx->env, TRICORE_FEATURE_16)) { + if (has_feature(ctx, TRICORE_FEATURE_16)) { temp =3D tcg_temp_new(); =20 CHECK_REG_PAIR(r3); @@ -6262,7 +6267,7 @@ static void decode_rr_accumulator(DisasContext *ctx) } break; case OPC2_32_RR_MOVS_64: - if (tricore_feature(ctx->env, TRICORE_FEATURE_16)) { + if (has_feature(ctx, TRICORE_FEATURE_16)) { CHECK_REG_PAIR(r3); tcg_gen_mov_tl(cpu_gpr_d[r3], cpu_gpr_d[r2]); tcg_gen_sari_tl(cpu_gpr_d[r3 + 1], cpu_gpr_d[r2], 31); @@ -6602,7 +6607,7 @@ static void decode_rr_divide(DisasContext *ctx) tcg_gen_shri_tl(temp3, cpu_gpr_d[r1], 8); /* reset av */ tcg_gen_movi_tl(cpu_PSW_AV, 0); - if (!tricore_feature(ctx->env, TRICORE_FEATURE_131)) { + if (!has_feature(ctx, TRICORE_FEATURE_131)) { /* overflow =3D (abs(D[r3+1]) >=3D abs(D[r2])) */ tcg_gen_abs_tl(temp, temp3); tcg_gen_abs_tl(temp2, cpu_gpr_d[r2]); @@ -6635,7 +6640,7 @@ static void decode_rr_divide(DisasContext *ctx) tcg_gen_shri_tl(temp3, cpu_gpr_d[r1], 16); /* reset av */ tcg_gen_movi_tl(cpu_PSW_AV, 0); - if (!tricore_feature(ctx->env, TRICORE_FEATURE_131)) { + if (!has_feature(ctx, TRICORE_FEATURE_131)) { /* overflow =3D (abs(D[r3+1]) >=3D abs(D[r2])) */ tcg_gen_abs_tl(temp, temp3); tcg_gen_abs_tl(temp2, cpu_gpr_d[r2]); @@ -6698,14 +6703,14 @@ static void decode_rr_divide(DisasContext *ctx) gen_unpack(cpu_gpr_d[r3], cpu_gpr_d[r3+1], cpu_gpr_d[r1]); break; case OPC2_32_RR_CRC32: - if (tricore_feature(ctx->env, TRICORE_FEATURE_161)) { + if (has_feature(ctx, TRICORE_FEATURE_161)) { gen_helper_crc32(cpu_gpr_d[r3], cpu_gpr_d[r1], cpu_gpr_d[r2]); } else { generate_trap(ctx, TRAPC_INSN_ERR, TIN2_IOPC); } break; case OPC2_32_RR_DIV: - if (tricore_feature(ctx->env, TRICORE_FEATURE_16)) { + if (has_feature(ctx, TRICORE_FEATURE_16)) { GEN_HELPER_RR(divide, cpu_gpr_d[r3], cpu_gpr_d[r3+1], cpu_gpr_= d[r1], cpu_gpr_d[r2]); } else { @@ -6713,7 +6718,7 @@ static void decode_rr_divide(DisasContext *ctx) } break; case OPC2_32_RR_DIV_U: - if (tricore_feature(ctx->env, TRICORE_FEATURE_16)) { + if (has_feature(ctx, TRICORE_FEATURE_16)) { GEN_HELPER_RR(divide_u, cpu_gpr_d[r3], cpu_gpr_d[r3+1], cpu_gpr_d[r1], cpu_gpr_d[r2]); } else { @@ -8411,7 +8416,7 @@ static void decode_sys_interrupts(DisasContext *ctx) gen_helper_svlcx(cpu_env); break; case OPC2_32_SYS_RESTORE: - if (tricore_feature(ctx->env, TRICORE_FEATURE_16)) { + if (has_feature(ctx, TRICORE_FEATURE_16)) { if ((ctx->hflags & TRICORE_HFLAG_KUU) =3D=3D TRICORE_HFLAG_SM = || (ctx->hflags & TRICORE_HFLAG_KUU) =3D=3D TRICORE_HFLAG_UM1= ) { tcg_gen_deposit_tl(cpu_ICR, cpu_ICR, cpu_gpr_d[r1], 8, 1); @@ -8792,6 +8797,7 @@ static void tricore_tr_init_disas_context(DisasContex= tBase *dcbase, CPUTriCoreState *env =3D cs->env_ptr; ctx->mem_idx =3D cpu_mmu_index(env, false); ctx->hflags =3D (uint32_t)ctx->base.tb->flags; + ctx->features =3D env->features; } =20 static void tricore_tr_tb_start(DisasContextBase *db, CPUState *cpu) --=20 2.26.2 From nobody Fri May 17 06:43:19 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=mail.uni-paderborn.de ARC-Seal: i=1; a=rsa-sha256; t=1591024506; cv=none; d=zohomail.com; s=zohoarc; b=XI/3FqSL1xfPFZb2WEvrhI0qj3a2W9L0ah0T4zdVDADDaXw1TTgCNINBuQOXjkrttfZcCobNbdN1zBdH75Ek2BSJfy3fBoBEwoxHaU8tj4FiX0Hz5nWiED1XfaQndMqLG3O8KRdEwxTG5NCJbzIXVA/MBHTBIc+TPoP/QAPnFPU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1591024506; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=+2UOkjd4CYCT0BLOA2BBvzwcj+w8vK3L2EhivhzfVUg=; b=eKfG8VS1UE/a1emODpRpBisZ/eZqUELHyoHdR4x+6mhaA5atqSv5wV9KlBHfYRbR/OkRUxIPD50JI2lM3SA3J45oxwr4jCvZtXXpiNra58EUS27vsa9I0vKRGRXH4av/Khq38mSkf+HMgnPbmYicbIRYe/BJs+WefINTvut5AbA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1591024506125721.2610841854389; Mon, 1 Jun 2020 08:15:06 -0700 (PDT) Received: from localhost ([::1]:57994 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jfm9Y-0003lq-Sd for importer@patchew.org; Mon, 01 Jun 2020 11:15:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43620) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jfm6Z-0007xC-Pl for qemu-devel@nongnu.org; Mon, 01 Jun 2020 11:11:59 -0400 Received: from nylar.uni-paderborn.de ([2001:638:502:c003::18]:42106) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jfm6X-0004eI-Ko for qemu-devel@nongnu.org; Mon, 01 Jun 2020 11:11:59 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mail.uni-paderborn.de; s=20170601; h=Content-Transfer-Encoding:MIME-Version :References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=+2UOkjd4CYCT0BLOA2BBvzwcj+w8vK3L2EhivhzfVUg=; b=csGvDCFOBgXzQ58yxrkKWBu79y qJEiXXJlNjQSZNtUcTAjb00PciwGyGN4aidlvE6dnhGFHZN849iDGvXmmQnudocE34UkZzzVyPmUL STRKeGwdNbw+hHxgFx9jjNmzi9MlOW6nd3o7XshcxubOR+7SbMsrwYc0y2DhfrtJMv/0=; From: Bastian Koppelmann To: qemu-devel@nongnu.org Subject: [PULL 3/5] target/tricore: Raise EXCP_DEBUG in gen_goto_tb() for singlestep Date: Mon, 1 Jun 2020 17:11:17 +0200 Message-Id: <20200601151119.33196-4-kbastian@mail.uni-paderborn.de> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200601151119.33196-1-kbastian@mail.uni-paderborn.de> References: <20200601151119.33196-1-kbastian@mail.uni-paderborn.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-IMT-Spam-Score: 0.0 () X-PMX-Version: 6.4.9.2830568, Antispam-Engine: 2.7.2.2107409, Antispam-Data: 2020.6.1.150018, AntiVirus-Engine: 5.74.0, AntiVirus-Data: 2020.6.1.5740002 X-Sophos-SenderHistory: ip=2a02:908:2214:e5bc::95d, fs=6661699, da=78633380, mc=166, sc=3, hc=163, sp=1, fso=6661699, re=0, sd=0, hd=0 X-IMT-Authenticated-Sender: uid=kbastian,ou=People,o=upb,c=de Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2001:638:502:c003::18; envelope-from=kbastian@mail.uni-paderborn.de; helo=nylar.uni-paderborn.de X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -19 X-Spam_score: -2.0 X-Spam_bar: -- X-Spam_report: (-2.0 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" this is needed for remote gdb connections. Signed-off-by: Bastian Koppelmann Message-Id: <20200529072148.284037-4-kbastian@mail.uni-paderborn.de> --- target/tricore/translate.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/target/tricore/translate.c b/target/tricore/translate.c index 608f72d384..7752630ac1 100644 --- a/target/tricore/translate.c +++ b/target/tricore/translate.c @@ -3238,6 +3238,14 @@ static inline bool use_goto_tb(DisasContext *ctx, ta= rget_ulong dest) #endif } =20 +static void generate_qemu_excp(DisasContext *ctx, int excp) +{ + TCGv_i32 tmp =3D tcg_const_i32(excp); + gen_helper_qemu_excp(cpu_env, tmp); + ctx->base.is_jmp =3D DISAS_NORETURN; + tcg_temp_free(tmp); +} + static inline void gen_goto_tb(DisasContext *ctx, int n, target_ulong dest) { if (use_goto_tb(ctx, dest)) { @@ -3247,7 +3255,7 @@ static inline void gen_goto_tb(DisasContext *ctx, int= n, target_ulong dest) } else { gen_save_pc(dest); if (ctx->base.singlestep_enabled) { - /* raise exception debug */ + generate_qemu_excp(ctx, EXCP_DEBUG); } tcg_gen_exit_tb(NULL, 0); } @@ -3266,14 +3274,6 @@ static void generate_trap(DisasContext *ctx, int cla= ss, int tin) tcg_temp_free(tintemp); } =20 -static void generate_qemu_excp(DisasContext *ctx, int excp) -{ - TCGv_i32 tmp =3D tcg_const_i32(excp); - gen_helper_qemu_excp(cpu_env, tmp); - ctx->base.is_jmp =3D DISAS_NORETURN; - tcg_temp_free(tmp); -} - static inline void gen_branch_cond(DisasContext *ctx, TCGCond cond, TCGv r= 1, TCGv r2, int16_t address) { --=20 2.26.2 From nobody Fri May 17 06:43:19 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=mail.uni-paderborn.de ARC-Seal: i=1; a=rsa-sha256; t=1591024403; cv=none; d=zohomail.com; s=zohoarc; b=QIqtuTefMIJohGicOBt3T0XyeMCQKusHWVB8rz/8oE5DJ1T2wKxpciyDny+Mp1R+VoTAPvxzZN4KHn+18kq2TUKk3jgA/v3x16IzI+4fiZaO7TJP8Q8VDs4SbbeoFr2wBvyhM2uY6R0doNEOZ3mFQNP5miNcfwysMbG6MPKdLA8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1591024403; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=tMc0vnjbQXPQUNrgS179VaVHVjpu/SGBHlmCv2j3lZg=; b=VdOtSdPyiIsxzALG2R/F6z8Zqn2LX02gHZNN6Ot7m2pabFtSN4qK/z7VrB8fwTOcwDTvij+W2EDCLmXLxwpn309QiwMFP7OhjfwLJnQ8ttlqp0nHDsQGvATXBV90tr4QnKZvkUtmokXc6GShwJUyQZIUAJvrSb870pL3Ectupds= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1591024402992407.4116089306332; Mon, 1 Jun 2020 08:13:22 -0700 (PDT) Received: from localhost ([::1]:51250 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jfm7s-0000rG-Qs for importer@patchew.org; Mon, 01 Jun 2020 11:13:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43624) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jfm6Z-0007xI-QX for qemu-devel@nongnu.org; Mon, 01 Jun 2020 11:11:59 -0400 Received: from nylar.uni-paderborn.de ([2001:638:502:c003::18]:42152) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jfm6Z-0004eT-0m for qemu-devel@nongnu.org; Mon, 01 Jun 2020 11:11:59 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mail.uni-paderborn.de; s=20170601; h=Content-Transfer-Encoding:MIME-Version :References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=tMc0vnjbQXPQUNrgS179VaVHVjpu/SGBHlmCv2j3lZg=; b=cgv60H+sw/mqfEuOJFlhQoMHXR LsIwwHFwBZLhJ00pVCcFqLJ+znWrR0etSXo9Ka6uppoY2QKHAdo7LcBnmwWTERBpwt++jFpAKNbRH 3djvk4NbLntXWycug6cCmTXT0ktcLytS8bDjpnMbVRRnlItmPDJZxdU+NREoaUc8w/xY=; From: Bastian Koppelmann To: qemu-devel@nongnu.org Subject: [PULL 4/5] target/tricore: Implement tricore_cpu_get_phys_page_debug Date: Mon, 1 Jun 2020 17:11:18 +0200 Message-Id: <20200601151119.33196-5-kbastian@mail.uni-paderborn.de> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200601151119.33196-1-kbastian@mail.uni-paderborn.de> References: <20200601151119.33196-1-kbastian@mail.uni-paderborn.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-IMT-Spam-Score: 0.0 () X-Sophos-SenderHistory: ip=2a02:908:2214:e5bc::95d, fs=6661700, da=78633381, mc=167, sc=3, hc=164, sp=1, fso=6661700, re=0, sd=0, hd=0 X-PMX-Version: 6.4.9.2830568, Antispam-Engine: 2.7.2.2107409, Antispam-Data: 2020.6.1.150616, AntiVirus-Engine: 5.74.0, AntiVirus-Data: 2020.6.1.5740001 X-IMT-Authenticated-Sender: uid=kbastian,ou=People,o=upb,c=de Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2001:638:502:c003::18; envelope-from=kbastian@mail.uni-paderborn.de; helo=nylar.uni-paderborn.de X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -19 X-Spam_score: -2.0 X-Spam_bar: -- X-Spam_report: (-2.0 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" this also removes tricore_cpu_get_phys_page_attrs_debug() as it was a temporary fix from b190f477e29c7cd03a8fee49c96d27f160e3f5b0. Signed-off-by: Bastian Koppelmann Message-Id: <20200529072148.284037-5-kbastian@mail.uni-paderborn.de> --- target/tricore/cpu.c | 10 +--------- target/tricore/helper.c | 13 +++++++++++++ 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/target/tricore/cpu.c b/target/tricore/cpu.c index 743b404a95..c8c1e9e7d5 100644 --- a/target/tricore/cpu.c +++ b/target/tricore/cpu.c @@ -23,14 +23,6 @@ #include "exec/exec-all.h" #include "qemu/error-report.h" =20 -static hwaddr tricore_cpu_get_phys_page_attrs_debug(CPUState *cpu, vaddr a= ddr, - MemTxAttrs *attrs) -{ - error_report("function cpu_get_phys_page_attrs_debug not " - "implemented, aborting"); - return -1; -} - static inline void set_feature(CPUTriCoreState *env, int feature) { env->features |=3D 1ULL << feature; @@ -161,7 +153,7 @@ static void tricore_cpu_class_init(ObjectClass *c, void= *data) cc->dump_state =3D tricore_cpu_dump_state; cc->set_pc =3D tricore_cpu_set_pc; cc->synchronize_from_tb =3D tricore_cpu_synchronize_from_tb; - cc->get_phys_page_attrs_debug =3D tricore_cpu_get_phys_page_attrs_debu= g; + cc->get_phys_page_debug =3D tricore_cpu_get_phys_page_debug; cc->tcg_initialize =3D tricore_tcg_init; cc->tlb_fill =3D tricore_cpu_tlb_fill; } diff --git a/target/tricore/helper.c b/target/tricore/helper.c index d5db7b2c03..7715293263 100644 --- a/target/tricore/helper.c +++ b/target/tricore/helper.c @@ -42,6 +42,19 @@ static int get_physical_address(CPUTriCoreState *env, hw= addr *physical, =20 return ret; } + +hwaddr tricore_cpu_get_phys_page_debug(CPUState *cs, vaddr addr) +{ + TriCoreCPU *cpu =3D TRICORE_CPU(cs); + hwaddr phys_addr; + int prot; + int mmu_idx =3D cpu_mmu_index(&cpu->env, false); + + if (get_physical_address(&cpu->env, &phys_addr, &prot, addr, 0, mmu_id= x)) { + return -1; + } + return phys_addr; +} #endif =20 /* TODO: Add exeption support*/ --=20 2.26.2 From nobody Fri May 17 06:43:19 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=mail.uni-paderborn.de ARC-Seal: i=1; a=rsa-sha256; t=1591024581; cv=none; d=zohomail.com; s=zohoarc; b=gycO/hB5C6XR3AL8Z4x1xOdBNdYK4nn2rQCFjiYH+37uTr/GH6cfpmVejTGLxnJLhowenAI7kvPdIm+PLWCcbxVGSdIP+R47GpwrELAipSn0O+3B2LnpzB+lBBk4b1Pn9xb9lOqUGSU2dwe02wCK8oH1lnpOOlpM0pxwIuQYOig= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1591024581; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=V/c+MHuXRGQoa6l+3o/Exko0a30lx0QAEoMWOnT4ljk=; b=fmm2GOVgr4AnraY46qGgBGh56EWc+znkL0tOkSMMO/6l/nJZ4FbyyKrA9sKppuMFP+KhLnbydpGC51xLIf1DD/ACrzoT2n6P42gDh6SfqxoK8KGMQOgX+zU17YF5iynzCzIjvQvXloJwxmyWFqiTmBFg/q4XtDa+ePuyfu+ASeM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1591024581770731.605988540816; Mon, 1 Jun 2020 08:16:21 -0700 (PDT) Received: from localhost ([::1]:60682 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jfmAm-0004ug-JO for importer@patchew.org; Mon, 01 Jun 2020 11:16:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43634) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jfm6b-00080F-OT for qemu-devel@nongnu.org; Mon, 01 Jun 2020 11:12:01 -0400 Received: from nylar.uni-paderborn.de ([2001:638:502:c003::18]:42208) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jfm6a-0004et-Jl for qemu-devel@nongnu.org; Mon, 01 Jun 2020 11:12:01 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mail.uni-paderborn.de; s=20170601; h=Content-Transfer-Encoding:Content-Type :MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Sender:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=V/c+MHuXRGQoa6l+3o/Exko0a30lx0QAEoMWOnT4ljk=; b=iRT4KmY+coreVY2jsYVTt4Orfl XGxwH0mIIiqxwZCyc5Qg1cCJ6eWhqeECKIODP+5skcFrqMymvgxD4C4IOpM+cku/GSAHUy5zsZQpf NaObC4nEe5mL/zLLu7TrTKaCTLhE62m++ZlNpkaiMKTncFt+UimBbMEhGuq1KxEZMnT4=; From: Bastian Koppelmann To: qemu-devel@nongnu.org Subject: [PULL 5/5] target/tricore: Implement gdbstub Date: Mon, 1 Jun 2020 17:11:19 +0200 Message-Id: <20200601151119.33196-6-kbastian@mail.uni-paderborn.de> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200601151119.33196-1-kbastian@mail.uni-paderborn.de> References: <20200601151119.33196-1-kbastian@mail.uni-paderborn.de> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-IMT-Spam-Score: 0.0 () X-Sophos-SenderHistory: ip=2a02:908:2214:e5bc::95d, fs=6661702, da=78633383, mc=168, sc=3, hc=165, sp=1, fso=6661702, re=0, sd=0, hd=0 X-PMX-Version: 6.4.9.2830568, Antispam-Engine: 2.7.2.2107409, Antispam-Data: 2020.6.1.150616, AntiVirus-Engine: 5.74.0, AntiVirus-Data: 2020.6.1.5740002 X-IMT-Authenticated-Sender: uid=kbastian,ou=People,o=upb,c=de Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2001:638:502:c003::18; envelope-from=kbastian@mail.uni-paderborn.de; helo=nylar.uni-paderborn.de X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -19 X-Spam_score: -2.0 X-Spam_bar: -- X-Spam_report: (-2.0 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, =?UTF-8?q?Alex=20Benn=C3=A9e?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Acked-by: Alex Benn=C3=A9e Signed-off-by: Bastian Koppelmann Message-Id: <20200529072148.284037-6-kbastian@mail.uni-paderborn.de> --- target/tricore/Makefile.objs | 2 +- target/tricore/cpu.c | 10 +++ target/tricore/cpu.h | 2 + target/tricore/gdbstub.c | 139 +++++++++++++++++++++++++++++++++++ 4 files changed, 152 insertions(+), 1 deletion(-) create mode 100644 target/tricore/gdbstub.c diff --git a/target/tricore/Makefile.objs b/target/tricore/Makefile.objs index 7a05670718..281b55f08d 100644 --- a/target/tricore/Makefile.objs +++ b/target/tricore/Makefile.objs @@ -1 +1 @@ -obj-y +=3D translate.o helper.o cpu.o op_helper.o fpu_helper.o +obj-y +=3D translate.o helper.o cpu.o op_helper.o fpu_helper.o gdbstub.o diff --git a/target/tricore/cpu.c b/target/tricore/cpu.c index c8c1e9e7d5..2f2e5b029f 100644 --- a/target/tricore/cpu.c +++ b/target/tricore/cpu.c @@ -28,6 +28,11 @@ static inline void set_feature(CPUTriCoreState *env, int= feature) env->features |=3D 1ULL << feature; } =20 +static gchar *tricore_gdb_arch_name(CPUState *cs) +{ + return g_strdup("tricore"); +} + static void tricore_cpu_set_pc(CPUState *cs, vaddr value) { TriCoreCPU *cpu =3D TRICORE_CPU(cs); @@ -150,6 +155,11 @@ static void tricore_cpu_class_init(ObjectClass *c, voi= d *data) cc->class_by_name =3D tricore_cpu_class_by_name; cc->has_work =3D tricore_cpu_has_work; =20 + cc->gdb_read_register =3D tricore_cpu_gdb_read_register; + cc->gdb_write_register =3D tricore_cpu_gdb_write_register; + cc->gdb_num_core_regs =3D 44; + cc->gdb_arch_name =3D tricore_gdb_arch_name; + cc->dump_state =3D tricore_cpu_dump_state; cc->set_pc =3D tricore_cpu_set_pc; cc->synchronize_from_tb =3D tricore_cpu_synchronize_from_tb; diff --git a/target/tricore/cpu.h b/target/tricore/cpu.h index 8c014fad07..b82349d1b1 100644 --- a/target/tricore/cpu.h +++ b/target/tricore/cpu.h @@ -353,6 +353,8 @@ enum { =20 uint32_t psw_read(CPUTriCoreState *env); void psw_write(CPUTriCoreState *env, uint32_t val); +int tricore_cpu_gdb_read_register(CPUState *cs, GByteArray *mem_buf, int n= ); +int tricore_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n); =20 void fpu_set_state(CPUTriCoreState *env); =20 diff --git a/target/tricore/gdbstub.c b/target/tricore/gdbstub.c new file mode 100644 index 0000000000..0f4e612a04 --- /dev/null +++ b/target/tricore/gdbstub.c @@ -0,0 +1,139 @@ +/* + * TriCore gdb server stub + * + * Copyright (c) 2019 Bastian Koppelmann, Paderborn University + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see . + */ + +#include "qemu/osdep.h" +#include "qemu-common.h" +#include "exec/gdbstub.h" + + +#define LCX_REGNUM 32 +#define FCX_REGNUM 33 +#define PCXI_REGNUM 34 +#define TRICORE_PSW_REGNUM 35 +#define TRICORE_PC_REGNUM 36 +#define ICR_REGNUM 37 +#define ISP_REGNUM 38 +#define BTV_REGNUM 39 +#define BIV_REGNUM 40 +#define SYSCON_REGNUM 41 +#define PMUCON0_REGNUM 42 +#define DMUCON_REGNUM 43 + +static uint32_t tricore_cpu_gdb_read_csfr(CPUTriCoreState *env, int n) +{ + switch (n) { + case LCX_REGNUM: + return env->LCX; + case FCX_REGNUM: + return env->FCX; + case PCXI_REGNUM: + return env->PCXI; + case TRICORE_PSW_REGNUM: + return psw_read(env); + case TRICORE_PC_REGNUM: + return env->PC; + case ICR_REGNUM: + return env->ICR; + case ISP_REGNUM: + return env->ISP; + case BTV_REGNUM: + return env->BTV; + case BIV_REGNUM: + return env->BIV; + case SYSCON_REGNUM: + return env->SYSCON; + case PMUCON0_REGNUM: + return 0; /* PMUCON0 */ + case DMUCON_REGNUM: + return 0; /* DMUCON0 */ + default: + return 0; + } +} + +static void tricore_cpu_gdb_write_csfr(CPUTriCoreState *env, int n, + uint32_t val) +{ + switch (n) { + case LCX_REGNUM: + env->LCX =3D val; + break; + case FCX_REGNUM: + env->FCX =3D val; + break; + case PCXI_REGNUM: + env->PCXI =3D val; + break; + case TRICORE_PSW_REGNUM: + psw_write(env, val); + break; + case TRICORE_PC_REGNUM: + env->PC =3D val; + break; + case ICR_REGNUM: + env->ICR =3D val; + break; + case ISP_REGNUM: + env->ISP =3D val; + break; + case BTV_REGNUM: + env->BTV =3D val; + break; + case BIV_REGNUM: + env->BIV =3D val; + break; + case SYSCON_REGNUM: + env->SYSCON =3D val; + break; + } +} + + +int tricore_cpu_gdb_read_register(CPUState *cs, GByteArray *mem_buf, int n) +{ + TriCoreCPU *cpu =3D TRICORE_CPU(cs); + CPUTriCoreState *env =3D &cpu->env; + + if (n < 16) { /* data registers */ + return gdb_get_reg32(mem_buf, env->gpr_d[n]); + } else if (n < 32) { /* address registers */ + return gdb_get_reg32(mem_buf, env->gpr_a[n - 16]); + } else { /* csfr */ + return gdb_get_reg32(mem_buf, tricore_cpu_gdb_read_csfr(env, n)); + } + return 0; +} + +int tricore_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n) +{ + TriCoreCPU *cpu =3D TRICORE_CPU(cs); + CPUTriCoreState *env =3D &cpu->env; + uint32_t tmp; + + tmp =3D ldl_p(mem_buf); + + if (n < 16) { /* data registers */ + env->gpr_d[n] =3D tmp; + } else if (n < 32) { /* address registers */ + env->gpr_d[n - 16] =3D tmp; + } else { + tricore_cpu_gdb_write_csfr(env, n, tmp); + } + return 4; +} --=20 2.26.2