From patchwork Tue Apr 25 07:53:53 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 9697671 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 3C744601D3 for ; Tue, 25 Apr 2017 07:58:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4C6E82845E for ; Tue, 25 Apr 2017 07:58:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 40240285E9; Tue, 25 Apr 2017 07:58:37 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id A62DA2845E for ; Tue, 25 Apr 2017 07:58:36 +0000 (UTC) Received: from localhost ([::1]:47572 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d2vMp-0002aY-Ow for patchwork-qemu-devel@patchwork.kernel.org; Tue, 25 Apr 2017 03:58:35 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33779) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d2vIg-0008GL-L2 for qemu-devel@nongnu.org; Tue, 25 Apr 2017 03:54:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d2vIf-0000kP-Np for qemu-devel@nongnu.org; Tue, 25 Apr 2017 03:54:18 -0400 Received: from out4-smtp.messagingengine.com ([66.111.4.28]:59409) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1d2vIc-0000fA-Lc; Tue, 25 Apr 2017 03:54:14 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 1575E21F2A; Tue, 25 Apr 2017 03:54:04 -0400 (EDT) Received: from frontend1 ([10.202.2.160]) by compute4.internal (MEProxy); Tue, 25 Apr 2017 03:54:05 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h=cc :date:from:in-reply-to:message-id:references:subject:to :x-me-sender:x-me-sender:x-sasl-enc:x-sasl-enc; s=mesmtp; bh=/Ge s7kaRl2H45QkqlVXDFxmcCa9/8GTJAgj2GV6eheU=; b=IOh8Fkc/8WNsTqsWOI/ rrZl7fzwQ4pnYqV8INbQBsln/TqUJgYdAJwIMFC1Q86JzQFefvN7N8fpC47octjA 72VN4mqsq9X/B0vGfcIbV2X80KqZ3Wj451DfysTW2mZOONp12rHsEK+oLeM/RgCs gNRXDYYM/Sv5mOcYAzGfDLgY= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc :x-sasl-enc; s=fm1; bh=/Ges7kaRl2H45QkqlVXDFxmcCa9/8GTJAgj2GV6eh eU=; b=p0UcyGJK1YIrbFVDU6W0ve+KRlZ0KNhYZkKCh3ycDtF7oYh64fnUEzsws mbCT2U7ZUIapkJUw25LChEqUrLDzbiBpORT95tHBfn452GL+5fbFS00Ky2+pGPjN DNKE+bQ4b0jTC/ug7gaNSCjCMCMaqSeYYxFZFUQGkgGXV+I17YdDEdG8ZEdmiDoZ Cb5L9EVLTLGCYSbYBkTuawha1l3VOsLut12J8XV7LEBg4lt/I2/A8OStmZzLDTNn 9HtunkyfUxk6twXRIm8jGuPXB6IDUcWeIkOta5rIKArPQlVG9ZGRotnwnUMfR+Kv hyr3zzLpUtZojYVC3wsZxqdqpO2Jg== X-ME-Sender: X-Sasl-enc: McDlbYoRN8fnhXF92z9R3HgI4wlwRuVbhondrqX23xnS 1493106844 Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 88FC57E43A; Tue, 25 Apr 2017 03:54:04 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Tue, 25 Apr 2017 03:53:53 -0400 Message-Id: <1493106839-10438-8-git-send-email-cota@braap.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1493106839-10438-1-git-send-email-cota@braap.org> References: <1493106839-10438-1-git-send-email-cota@braap.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.111.4.28 Subject: [Qemu-devel] [PATCH v2 07/13] tcg/i386: implement goto_ptr op 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: Peter Maydell , Eduardo Habkost , Peter Crosthwaite , Stefan Weil , Alexander Graf , alex.bennee@linaro.org, qemu-arm@nongnu.org, Pranith Kumar , Paolo Bonzini , Aurelien Jarno , Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Emilio G. Cota --- tcg/i386/tcg-target.h | 2 +- tcg/i386/tcg-target.inc.c | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/tcg/i386/tcg-target.h b/tcg/i386/tcg-target.h index 59d9835..73a15f7 100644 --- a/tcg/i386/tcg-target.h +++ b/tcg/i386/tcg-target.h @@ -107,7 +107,7 @@ extern bool have_popcnt; #define TCG_TARGET_HAS_muls2_i32 1 #define TCG_TARGET_HAS_muluh_i32 0 #define TCG_TARGET_HAS_mulsh_i32 0 -#define TCG_TARGET_HAS_goto_ptr 0 +#define TCG_TARGET_HAS_goto_ptr 1 #if TCG_TARGET_REG_BITS == 64 #define TCG_TARGET_HAS_extrl_i64_i32 0 diff --git a/tcg/i386/tcg-target.inc.c b/tcg/i386/tcg-target.inc.c index 5918008..f6fb03e 100644 --- a/tcg/i386/tcg-target.inc.c +++ b/tcg/i386/tcg-target.inc.c @@ -1906,6 +1906,14 @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode opc, } s->tb_jmp_reset_offset[a0] = tcg_current_code_size(s); break; + case INDEX_op_goto_ptr: + /* save target address into new register */ + tcg_out_mov(s, TCG_TYPE_PTR, TCG_REG_EDX, a0); + /* set return value to 0 */ + tgen_arithr(s, ARITH_XOR, TCG_REG_EAX, TCG_REG_EAX); + /* jmp to the target address (could be epilogue) */ + tcg_out_modrm(s, OPC_GRP5, EXT5_JMPN_Ev, TCG_REG_EDX); + break; case INDEX_op_br: tcg_out_jxx(s, JCC_JMP, arg_label(a0), 0); break; @@ -2277,6 +2285,7 @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode opc, static const TCGTargetOpDef *tcg_target_op_def(TCGOpcode op) { + static const TCGTargetOpDef ri = { .args_ct_str = { "ri" } }; static const TCGTargetOpDef ri_r = { .args_ct_str = { "ri", "r" } }; static const TCGTargetOpDef re_r = { .args_ct_str = { "re", "r" } }; static const TCGTargetOpDef qi_r = { .args_ct_str = { "qi", "r" } }; @@ -2324,6 +2333,9 @@ static const TCGTargetOpDef *tcg_target_op_def(TCGOpcode op) case INDEX_op_st_i64: return &re_r; + case INDEX_op_goto_ptr: + return &ri; + case INDEX_op_add_i32: case INDEX_op_add_i64: return &r_r_re; @@ -2569,6 +2581,7 @@ static void tcg_target_qemu_prologue(TCGContext *s) /* TB epilogue */ tb_ret_addr = s->code_ptr; + s->code_gen_epilogue = s->code_ptr; tcg_out_addi(s, TCG_REG_CALL_STACK, stack_addend);