From nobody Wed Nov 5 18:27:51 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; dkim=fail spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1496682788116222.7522842342463; Mon, 5 Jun 2017 10:13:08 -0700 (PDT) Received: from localhost ([::1]:34448 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dHvYv-0007Dx-LQ for importer@patchew.org; Mon, 05 Jun 2017 13:13:05 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56857) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dHvFV-0004fk-H6 for qemu-devel@nongnu.org; Mon, 05 Jun 2017 12:53:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dHvFU-0003tb-MQ for qemu-devel@nongnu.org; Mon, 05 Jun 2017 12:53:01 -0400 Received: from mail-qt0-x243.google.com ([2607:f8b0:400d:c0d::243]:34363) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dHvFU-0003t2-Hm for qemu-devel@nongnu.org; Mon, 05 Jun 2017 12:53:00 -0400 Received: by mail-qt0-x243.google.com with SMTP id o21so13466588qtb.1 for ; Mon, 05 Jun 2017 09:53:00 -0700 (PDT) Received: from bigtime.twiddle.net.com ([2602:47:d954:1500:5e51:4fff:fe40:9c64]) by smtp.gmail.com with ESMTPSA id c6sm1637044qtb.56.2017.06.05.09.52.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 05 Jun 2017 09:52:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=QWI3EsJMI7bg+mvP3DG7GDFKalifGvS6M9zhEOgUQQo=; b=ki4cL71hMR5z8QjvSfbAJ781UibjmOiVihzQCDcZX8vb0S/hklPPOpqOiAeJ4lt+ly SuWey1HPMnB3F4KFrcb7bgRuNGaA72wiZucn9RRUQ5qSSxEfSZ4TjRPle2wTfRquiRKO a+R6xBrQmaSFX//cnjXjM4o+eQCY7FW1JiSk7IW++erS8Sj6+bMHGMlgNvVuKEUDF/Xb OGkVnQEI+MGP0Rc25OngASGnQP50W37WciBdwLameQu8J+5+iANESgG0Rns+hguV+Atp D+SX/DACOcmRD60mGXehCwOvZnJW8p5Fi/Ns8fIfq9k3riQstnIBQ3xoSSNvOniRAJQ7 CuAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=QWI3EsJMI7bg+mvP3DG7GDFKalifGvS6M9zhEOgUQQo=; b=DeJvMbgqr7zhZkmeIYHzE61vbeKI97Gve0O7rlYTE0ILMGXkPcpW/f8kFHmmKblFCt 3IBSWCYVXxn3AvYyQRkdMrTXnJZe+XmffyYbWWzcxRvfc1IPlciBM3fnN3RqQ0P1coKX 3/rNotpW6GLe8dqFS/hUDLuDl90GVWpQMCuPfjttBS5ZZ2ELgkVwn4Hz4F01NnlXG3Z1 hdq6VhD3dz7k56eMSp8mFZIYl3gv3xjQjF6Gy3IG2B/nvbcObVLzWgvdZfWi9Ziej7iH GG3JJxXoTVrSG4XVBRW1uxVEDomQoxYszHeUcninRHEm8FWV184mHKCqW1Ihl2bV+f/8 /WzA== X-Gm-Message-State: AODbwcDDx7MmVL1tOrXsvP/7q90JnzWpm8Ij2uRJB1nrUa1cSjwsVmcz cQKmTyXHvc1Bi0R5OPE= X-Received: by 10.200.41.135 with SMTP id 7mr24305095qts.85.1496681579797; Mon, 05 Jun 2017 09:52:59 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Mon, 5 Jun 2017 09:52:24 -0700 Message-Id: <20170605165233.4135-18-rth@twiddle.net> X-Mailer: git-send-email 2.9.4 In-Reply-To: <20170605165233.4135-1-rth@twiddle.net> References: <20170605165233.4135-1-rth@twiddle.net> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400d:c0d::243 Subject: [Qemu-devel] [PULL 17/26] tcg/arm: Implement goto_ptr 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@linaro.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Richard Henderson --- tcg/arm/tcg-target.h | 2 +- tcg/arm/tcg-target.inc.c | 25 +++++++++++++++++++++---- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/tcg/arm/tcg-target.h b/tcg/arm/tcg-target.h index c114df7..5ef1086 100644 --- a/tcg/arm/tcg-target.h +++ b/tcg/arm/tcg-target.h @@ -123,7 +123,7 @@ extern bool use_idiv_instructions; #define TCG_TARGET_HAS_mulsh_i32 0 #define TCG_TARGET_HAS_div_i32 use_idiv_instructions #define TCG_TARGET_HAS_rem_i32 0 -#define TCG_TARGET_HAS_goto_ptr 0 +#define TCG_TARGET_HAS_goto_ptr 1 =20 enum { TCG_AREG0 =3D TCG_REG_R6, diff --git a/tcg/arm/tcg-target.inc.c b/tcg/arm/tcg-target.inc.c index 590c57d..9f5cb66 100644 --- a/tcg/arm/tcg-target.inc.c +++ b/tcg/arm/tcg-target.inc.c @@ -1655,8 +1655,14 @@ static inline void tcg_out_op(TCGContext *s, TCGOpco= de opc, =20 switch (opc) { case INDEX_op_exit_tb: - tcg_out_movi32(s, COND_AL, TCG_REG_R0, args[0]); - tcg_out_goto(s, COND_AL, tb_ret_addr); + /* Reuse the zeroing that exists for goto_ptr. */ + a0 =3D args[0]; + if (a0 =3D=3D 0) { + tcg_out_goto(s, COND_AL, s->code_gen_epilogue); + } else { + tcg_out_movi32(s, COND_AL, TCG_REG_R0, args[0]); + tcg_out_goto(s, COND_AL, tb_ret_addr); + } break; case INDEX_op_goto_tb: if (s->tb_jmp_insn_offset) { @@ -1671,6 +1677,9 @@ static inline void tcg_out_op(TCGContext *s, TCGOpcod= e opc, } s->tb_jmp_reset_offset[args[0]] =3D tcg_current_code_size(s); break; + case INDEX_op_goto_ptr: + tcg_out_bx(s, COND_AL, args[0]); + break; case INDEX_op_br: tcg_out_goto_label(s, COND_AL, arg_label(args[0])); break; @@ -1961,6 +1970,7 @@ static const TCGTargetOpDef arm_op_defs[] =3D { { INDEX_op_exit_tb, { } }, { INDEX_op_goto_tb, { } }, { INDEX_op_br, { } }, + { INDEX_op_goto_ptr, { "r" } }, =20 { INDEX_op_ld8u_i32, { "r", "r" } }, { INDEX_op_ld8s_i32, { "r", "r" } }, @@ -2136,9 +2146,16 @@ static void tcg_target_qemu_prologue(TCGContext *s) tcg_out_mov(s, TCG_TYPE_PTR, TCG_AREG0, tcg_target_call_iarg_regs[0]); =20 tcg_out_bx(s, COND_AL, tcg_target_call_iarg_regs[1]); - tb_ret_addr =3D s->code_ptr; =20 - /* Epilogue. We branch here via tb_ret_addr. */ + /* + * Return path for goto_ptr. Set return value to 0, a-la exit_tb, + * and fall through to the rest of the epilogue. + */ + s->code_gen_epilogue =3D s->code_ptr; + tcg_out_movi(s, TCG_TYPE_PTR, TCG_REG_R0, 0); + + /* TB epilogue */ + tb_ret_addr =3D s->code_ptr; tcg_out_dat_rI(s, COND_AL, ARITH_ADD, TCG_REG_CALL_STACK, TCG_REG_CALL_STACK, stack_addend, 1); =20 --=20 2.9.4