From patchwork Mon Oct 13 16:27:02 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bastian Koppelmann X-Patchwork-Id: 399223 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 6B5481400DD for ; Tue, 14 Oct 2014 02:28:12 +1100 (EST) Received: from localhost ([::1]:34035 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XdhXd-0003Ez-Qp for incoming@patchwork.ozlabs.org; Mon, 13 Oct 2014 11:28:09 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34648) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XdhWt-00028G-97 for qemu-devel@nongnu.org; Mon, 13 Oct 2014 11:27:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XdhWm-000206-Fe for qemu-devel@nongnu.org; Mon, 13 Oct 2014 11:27:23 -0400 Received: from mail.uni-paderborn.de ([131.234.142.9]:34379) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XdhWm-000202-9O for qemu-devel@nongnu.org; Mon, 13 Oct 2014 11:27:16 -0400 From: Bastian Koppelmann To: qemu-devel@nongnu.org Date: Mon, 13 Oct 2014 17:27:02 +0100 Message-Id: <1413217624-14415-4-git-send-email-kbastian@mail.uni-paderborn.de> X-Mailer: git-send-email 2.1.2 In-Reply-To: <1413217624-14415-1-git-send-email-kbastian@mail.uni-paderborn.de> References: <1413217624-14415-1-git-send-email-kbastian@mail.uni-paderborn.de> X-IMT-Spam-Score: 0.0 () X-PMX-Version: 6.1.1.2430161, Antispam-Engine: 2.7.2.2107409, Antispam-Data: 2014.10.13.151519 X-IMT-Authenticated-Sender: uid=kbastian,ou=People,o=upb,c=de X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 131.234.142.9 Cc: peter.maydell@linaro.org, rth@twiddle.net Subject: [Qemu-devel] [PATCH v3 3/5] target-tricore: Add instructions of B opcode format X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Add instructions of B opcode format. Signed-off-by: Bastian Koppelmann Reviewed-by: Richard Henderson --- target-tricore/translate.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/target-tricore/translate.c b/target-tricore/translate.c index fc89a43..830bcd0 100644 --- a/target-tricore/translate.c +++ b/target-tricore/translate.c @@ -116,6 +116,8 @@ void tricore_cpu_dump_state(CPUState *cs, FILE *f, } while (0) #define EA_ABS_FORMAT(con) (((con & 0x3C000) << 14) + (con & 0x3FFF)) +#define EA_B_ABSOLUT(con) (((offset & 0xf00000) << 8) | \ + ((offset & 0x0fffff) << 1)) /* Functions for load/save to/from memory */ @@ -492,6 +494,7 @@ static void gen_compute_branch(DisasContext *ctx, uint32_t opc, int r1, case OPC1_32_B_J: gen_goto_tb(ctx, 0, ctx->pc + offset * 2); break; + case OPC1_32_B_CALL: case OPC1_16_SB_CALL: gen_helper_1arg(call, ctx->next_pc); gen_goto_tb(ctx, 0, ctx->pc + offset * 2); @@ -567,6 +570,20 @@ static void gen_compute_branch(DisasContext *ctx, uint32_t opc, int r1, gen_helper_ret(cpu_env); tcg_gen_exit_tb(0); break; +/* B-format */ + case OPC1_32_B_CALLA: + gen_helper_1arg(call, ctx->next_pc); + gen_goto_tb(ctx, 0, EA_B_ABSOLUT(offset)); + break; + case OPC1_32_B_JLA: + tcg_gen_movi_tl(cpu_gpr_a[11], ctx->next_pc); + case OPC1_32_B_JA: + gen_goto_tb(ctx, 0, EA_B_ABSOLUT(offset)); + break; + case OPC1_32_B_JL: + tcg_gen_movi_tl(cpu_gpr_a[11], ctx->next_pc); + gen_goto_tb(ctx, 0, ctx->pc + offset * 2); + break; default: printf("Branch Error at %x\n", ctx->pc); } @@ -1403,6 +1420,16 @@ static void decode_32Bit_opc(CPUTriCoreState *env, DisasContext *ctx) tcg_temp_free(temp); tcg_temp_free(temp2); break; +/* B-format */ + case OPC1_32_B_CALL: + case OPC1_32_B_CALLA: + case OPC1_32_B_J: + case OPC1_32_B_JA: + case OPC1_32_B_JL: + case OPC1_32_B_JLA: + address = MASK_OP_B_DISP24(ctx->opcode); + gen_compute_branch(ctx, op1, 0, 0, 0, address); + break; } }