From nobody Sat May 18 04:30:14 2024 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.zohomail.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; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1543614871463533.8505158430576; Fri, 30 Nov 2018 13:54:31 -0800 (PST) Received: from localhost ([::1]:34737 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gSqk2-000234-Dx for importer@patchew.org; Fri, 30 Nov 2018 16:54:30 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52470) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gSqi4-0007qG-6n for qemu-devel@nongnu.org; Fri, 30 Nov 2018 16:52:29 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gSqi2-0006Ea-9H for qemu-devel@nongnu.org; Fri, 30 Nov 2018 16:52:28 -0500 Received: from mail-pg1-x543.google.com ([2607:f8b0:4864:20::543]:43975) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gSqi2-00069c-2G for qemu-devel@nongnu.org; Fri, 30 Nov 2018 16:52:26 -0500 Received: by mail-pg1-x543.google.com with SMTP id v28so3044248pgk.10 for ; Fri, 30 Nov 2018 13:52:25 -0800 (PST) Received: from cloudburst.twiddle.net (97-113-170-180.tukw.qwest.net. [97.113.170.180]) by smtp.gmail.com with ESMTPSA id a18sm6973967pgj.30.2018.11.30.13.52.23 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 30 Nov 2018 13:52:23 -0800 (PST) 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 :mime-version:content-transfer-encoding; bh=NhEZSAJG05xqXtLacoC2PBUagTVyKddaBYmrH62y/sY=; b=SGDdVJDCpEKl5iDotnv/YA7RJ5xDbz69Uc9GS4WL6YlXLZNngPZXKF189/p2UfY16M eUpbTIFImgsat1fDUv6ye207Dxam0XZOejlGa9TWLuqb6LUpc++JQauL6APTCis/Pq1R E5x+AEr4Z1ZWzFuVY1AJJdouPBXVimcsTqaG4= 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:mime-version:content-transfer-encoding; bh=NhEZSAJG05xqXtLacoC2PBUagTVyKddaBYmrH62y/sY=; b=j0CpFpIG4cEmzR4wHUnpEUcxufp/zjqxwzr7IYfyfTUlK46oCqTMFxtpA2VHAJp/cX WvhdqI8h0vg0Xijf9gucOYP9P7Ewvq8aL1WMWkfg5yKnA62wf1iKwsgsuf4ih1YNfRPO qvHF79sx2C8SuyqeukykMF8444E5i061qffBpmKxzvMVrhYKFa7GsOv1pgZ6v9pyoqEC d2gaMAns5DTq1hNc4HZ3P9H+2iz9vJkqWnT5H3M7mEGGlyOzONvD79QDQ/jZwqD1ErJa vB1LUQLpD52gU4vhW9ry/OLu+/u/RKgHR09KOpqVxu2ETqnRogE4qhUkD1sjY+l0tUi7 9Cpw== X-Gm-Message-State: AA+aEWYN8+wu66icZQC+YpF3qmTrz6v8OZgGd+K2PE6nZ0DCo/7tb3T1 il+f0AMGtyIge7NXErTxIODrqScsfxg= X-Google-Smtp-Source: AFSGD/XcCp8B91j2cpTnwWE2iFLldpPzU3BpMa/ir+uYGDvKMx+pkPlmTw2jyGsxTAoSQTGjsoqhPQ== X-Received: by 2002:a63:a552:: with SMTP id r18mr6210983pgu.176.1543614744459; Fri, 30 Nov 2018 13:52:24 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Fri, 30 Nov 2018 13:52:06 -0800 Message-Id: <20181130215221.20554-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20181130215221.20554-1-richard.henderson@linaro.org> References: <20181130215221.20554-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::543 Subject: [Qemu-devel] [PATCH v3 01/16] tcg/i386: Always use %ebp for TCG_AREG0 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: alex.bennee@linaro.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) For x86_64, this can remove a REX prefix resulting in smaller code when manipulating globals of type i32, as we move them between backing store via cpu_env, aka TCG_AREG0. Reviewed-by: Alex Benn=C3=A9e Reviewed-by: Emilio G. Cota Signed-off-by: Richard Henderson --- tcg/i386/tcg-target.h | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/tcg/i386/tcg-target.h b/tcg/i386/tcg-target.h index 9fdf37f23c..7488c3d869 100644 --- a/tcg/i386/tcg-target.h +++ b/tcg/i386/tcg-target.h @@ -84,6 +84,8 @@ typedef enum { TCG_REG_RBP =3D TCG_REG_EBP, TCG_REG_RSI =3D TCG_REG_ESI, TCG_REG_RDI =3D TCG_REG_EDI, + + TCG_AREG0 =3D TCG_REG_EBP, } TCGReg; =20 /* used for function call generation */ @@ -194,12 +196,6 @@ extern bool have_avx2; #define TCG_TARGET_extract_i64_valid(ofs, len) \ (((ofs) =3D=3D 8 && (len) =3D=3D 8) || ((ofs) + (len)) =3D=3D 32) =20 -#if TCG_TARGET_REG_BITS =3D=3D 64 -# define TCG_AREG0 TCG_REG_R14 -#else -# define TCG_AREG0 TCG_REG_EBP -#endif - static inline void flush_icache_range(uintptr_t start, uintptr_t stop) { } --=20 2.17.2 From nobody Sat May 18 04:30:14 2024 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.zohomail.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; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1543615045101625.6426849201886; Fri, 30 Nov 2018 13:57:25 -0800 (PST) Received: from localhost ([::1]:34755 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gSqml-0004Na-QK for importer@patchew.org; Fri, 30 Nov 2018 16:57:19 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52487) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gSqi5-0007qk-5h for qemu-devel@nongnu.org; Fri, 30 Nov 2018 16:52:29 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gSqi3-0006Kl-PC for qemu-devel@nongnu.org; Fri, 30 Nov 2018 16:52:29 -0500 Received: from mail-pg1-x543.google.com ([2607:f8b0:4864:20::543]:39657) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gSqi3-0006HN-II for qemu-devel@nongnu.org; Fri, 30 Nov 2018 16:52:27 -0500 Received: by mail-pg1-x543.google.com with SMTP id w6so3050204pgl.6 for ; Fri, 30 Nov 2018 13:52:27 -0800 (PST) Received: from cloudburst.twiddle.net (97-113-170-180.tukw.qwest.net. [97.113.170.180]) by smtp.gmail.com with ESMTPSA id a18sm6973967pgj.30.2018.11.30.13.52.24 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 30 Nov 2018 13:52:24 -0800 (PST) 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 :mime-version:content-transfer-encoding; bh=Jrh4Y+SFq2jwiqT4wxhzL7fYXQ83Kj3wp2Zs2cGnVdE=; b=JuOU0n1aNDU7TXiUyZaTDQ2DKuP/SWA1tEVDszv/8QtT6WauDEDcnwzwM3oUDEXvlc 73HY42Y/1ZJxhuaTJYwn3n6ionEb5d/BBDfxuNqS2M0vQmJ2pMDLyWWrUl/bW4eujDYk FvTMIbBXKcMxTStKKiu2G0YnxxeMvdqe3PgEs= 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:mime-version:content-transfer-encoding; bh=Jrh4Y+SFq2jwiqT4wxhzL7fYXQ83Kj3wp2Zs2cGnVdE=; b=hNJug32PoGSfUF3OYbT+QWsHsF8B+WhrbktDyFU/e9F1CcPhPmIO433WYT8XTB5GQ4 h0kMBs0YFK9wOg8yPxYmETB8lmbIMEtGIZXDIk+TTdDQW+tFdpbbCljQHn6JRfQ5dvTz oP5GADAk6SFrLcc8n268Nyw1JVfX3CpBTW0DLpexzeI/gDjusDCxDmrQW7aykg32DX5q AqOLkpXn+1t/lsl3ahe/QCZmPS6RWiUGh4alsfKDHmg+bW5TY266amhPh2wKQbuKpdFK CWJLbi6N6H6VCWI2vqcuHbXxoAfsRPDAiCwaFq6ltNl8XOe9Azr0rX6WCLPEbPbS0P0J 8rDw== X-Gm-Message-State: AA+aEWZHjbYWjV68Z/XKFB8RoAFb5OmpzGeG+5fVvbL2OTUHetypbHAx +2omxpreAa7ZEOjOwvJN9P96zFfB5rE= X-Google-Smtp-Source: AFSGD/VR37Nwg68g/3Nz/sRg8ELawoqKa8D1jMV/t9NirUpz5+/8zIo126xz5lYpcSVPxlY66KBGTQ== X-Received: by 2002:a65:49cd:: with SMTP id t13mr6256330pgs.376.1543614745960; Fri, 30 Nov 2018 13:52:25 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Fri, 30 Nov 2018 13:52:07 -0800 Message-Id: <20181130215221.20554-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20181130215221.20554-1-richard.henderson@linaro.org> References: <20181130215221.20554-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::543 Subject: [Qemu-devel] [PATCH v3 02/16] tcg/i386: Move TCG_REG_CALL_STACK from define to enum 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: alex.bennee@linaro.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Reviewed-by: Alex Benn=C3=A9e Reviewed-by: Emilio G. Cota Signed-off-by: Richard Henderson --- tcg/i386/tcg-target.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tcg/i386/tcg-target.h b/tcg/i386/tcg-target.h index 7488c3d869..2441658865 100644 --- a/tcg/i386/tcg-target.h +++ b/tcg/i386/tcg-target.h @@ -86,10 +86,10 @@ typedef enum { TCG_REG_RDI =3D TCG_REG_EDI, =20 TCG_AREG0 =3D TCG_REG_EBP, + TCG_REG_CALL_STACK =3D TCG_REG_ESP } TCGReg; =20 /* used for function call generation */ -#define TCG_REG_CALL_STACK TCG_REG_ESP=20 #define TCG_TARGET_STACK_ALIGN 16 #if defined(_WIN64) #define TCG_TARGET_CALL_STACK_OFFSET 32 --=20 2.17.2 From nobody Sat May 18 04:30:14 2024 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.zohomail.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; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1543615045016417.77303869815546; Fri, 30 Nov 2018 13:57:25 -0800 (PST) Received: from localhost ([::1]:34754 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gSqml-0004Mu-S6 for importer@patchew.org; Fri, 30 Nov 2018 16:57:19 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52503) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gSqi6-0007rW-8U for qemu-devel@nongnu.org; Fri, 30 Nov 2018 16:52:31 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gSqi5-0006TI-Gm for qemu-devel@nongnu.org; Fri, 30 Nov 2018 16:52:30 -0500 Received: from mail-pf1-x444.google.com ([2607:f8b0:4864:20::444]:46740) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gSqi5-0006Nf-9g for qemu-devel@nongnu.org; Fri, 30 Nov 2018 16:52:29 -0500 Received: by mail-pf1-x444.google.com with SMTP id c73so3415644pfe.13 for ; Fri, 30 Nov 2018 13:52:29 -0800 (PST) Received: from cloudburst.twiddle.net (97-113-170-180.tukw.qwest.net. [97.113.170.180]) by smtp.gmail.com with ESMTPSA id a18sm6973967pgj.30.2018.11.30.13.52.26 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 30 Nov 2018 13:52:26 -0800 (PST) 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=yK0dG/0vrNxbKSba6n1ipzVAper4VICqvkqQD/UZX0Q=; b=Zd56Oa3avf/iuZ9p1V7ecewLJ39rsgu3lvWl5i9nUwwkJ9it5rDUgAV6NfyEPb8uwQ Y6KGZP7DHFiTtpEXiGJ78rAZ8G3YFKputE11RyZtB0mKAAiyvXXW0DqDGjcJbelbPcyg 4LODftLVfxHicd8w57QNYh+9jkAeEHP/ezfcE= 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=yK0dG/0vrNxbKSba6n1ipzVAper4VICqvkqQD/UZX0Q=; b=BzD157fU0cCZXrU/u9TWQdPVIuaOdAVfK6Q6b0WgvmCSmRxzyPv29hNDP94tpplco/ tkFZ3Knc9oEVJiRO6E64vGfpPKRPfmznPh5n7Ojy1Iyn3VocLLTvWF4GaFK1D7yh/SnG xo6w7jsiC3K24lXuK1R4eXtm8V9a8Q9qGn9O7112FUxwUe1fhw7/qxlee17vFK0fAhFV 1072OA3X0lHUT+20xK5W6Z9GTdCdTR0ifKx1ymVpzkb0RT5782V+qILpvdnFfKwUoRK2 7JHLtEoB5UgI3CFhLx4FIscoGYTJ7+B8AUuZU8uXZAXXcMbvsYVgieomU2iOSt5Wnn8A EcKQ== X-Gm-Message-State: AA+aEWaWZqgYv+vdal00i2khy7sEE1MOs1xJKAP/qGEiHgONuI8EC3eR PdDMrukrIayu37tE1rfKFvlvSVIEXn0= X-Google-Smtp-Source: AFSGD/WrTwOtTQLQvJPULOek89FPFfHzyAY7owqSjY0qgK148MYc/AWaNMX7vKkawansRSVFl7BPVg== X-Received: by 2002:a65:6684:: with SMTP id b4mr6210311pgw.55.1543614747222; Fri, 30 Nov 2018 13:52:27 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Fri, 30 Nov 2018 13:52:08 -0800 Message-Id: <20181130215221.20554-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20181130215221.20554-1-richard.henderson@linaro.org> References: <20181130215221.20554-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::444 Subject: [Qemu-devel] [PATCH v3 03/16] tcg/aarch64: Remove reloc_pc26_atomic 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: alex.bennee@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-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" It is unused since b68686bd4bfeb70040b4099df993dfa0b4f37b03. Signed-off-by: Richard Henderson Reviewed-by: Alex Benn=C3=A9e --- tcg/aarch64/tcg-target.inc.c | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/tcg/aarch64/tcg-target.inc.c b/tcg/aarch64/tcg-target.inc.c index 083592a4d7..a41b633960 100644 --- a/tcg/aarch64/tcg-target.inc.c +++ b/tcg/aarch64/tcg-target.inc.c @@ -87,18 +87,6 @@ static inline void reloc_pc26(tcg_insn_unit *code_ptr, t= cg_insn_unit *target) *code_ptr =3D deposit32(*code_ptr, 0, 26, offset); } =20 -static inline void reloc_pc26_atomic(tcg_insn_unit *code_ptr, - tcg_insn_unit *target) -{ - ptrdiff_t offset =3D target - code_ptr; - tcg_insn_unit insn; - tcg_debug_assert(offset =3D=3D sextract64(offset, 0, 26)); - /* read instruction, mask away previous PC_REL26 parameter contents, - set the proper offset, then write back the instruction. */ - insn =3D atomic_read(code_ptr); - atomic_set(code_ptr, deposit32(insn, 0, 26, offset)); -} - static inline void reloc_pc19(tcg_insn_unit *code_ptr, tcg_insn_unit *targ= et) { ptrdiff_t offset =3D target - code_ptr; --=20 2.17.2 From nobody Sat May 18 04:30:14 2024 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.zohomail.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; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1543615206086149.02753369846118; Fri, 30 Nov 2018 14:00:06 -0800 (PST) Received: from localhost ([::1]:34767 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gSqpR-00085N-3K for importer@patchew.org; Fri, 30 Nov 2018 17:00:05 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52514) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gSqi7-0007sI-0u for qemu-devel@nongnu.org; Fri, 30 Nov 2018 16:52:31 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gSqi6-0006Wr-37 for qemu-devel@nongnu.org; Fri, 30 Nov 2018 16:52:30 -0500 Received: from mail-pg1-x544.google.com ([2607:f8b0:4864:20::544]:44117) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gSqi5-0006RE-TF for qemu-devel@nongnu.org; Fri, 30 Nov 2018 16:52:30 -0500 Received: by mail-pg1-x544.google.com with SMTP id t13so3036035pgr.11 for ; Fri, 30 Nov 2018 13:52:29 -0800 (PST) Received: from cloudburst.twiddle.net (97-113-170-180.tukw.qwest.net. [97.113.170.180]) by smtp.gmail.com with ESMTPSA id a18sm6973967pgj.30.2018.11.30.13.52.27 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 30 Nov 2018 13:52:27 -0800 (PST) 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=Kwdiribgzx2Cbccg4TG0vd/ef0gMrNWExhCNQW0ga6s=; b=OmIBjvnm1G9nGS12ATFtW75Zmw2sdWzseKxscYWiH9Gt4d/n0IIyoTenXy4+VXYqTE hvIXxXRdo4PnfkFk0RJIVUoeSJG8h+9ct21XvQ1Bw8bx8bL+mJYiPwAAQ4zJkV/bkxSd FBqEmg8NQ8hk4L8+re/8k8/aMqapenpMZ+tXA= 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=Kwdiribgzx2Cbccg4TG0vd/ef0gMrNWExhCNQW0ga6s=; b=FaUNpnz3g0FvBkfJExHcKHQz4KbM9VklND4FftQUQBdjTMSSJ1DZuI+FB1cuMFJ6w1 +e4zCbEqMS5a4yFHN7NuhoBYiWz/z+F7aIaW8gMtgElCFeBMf3m5EmqRW2KzQb6eFJPb xN87+pw/Rlo5w/VoY2C00UVMh0O03Du76/QE/wdNz9cGRi7GWuW0DimuL7ah08eVHGgc xY5VfAd/HU/EAxfLzI8pEcnCGUWYxDyzBgEaNMpWI4MYa8XDDl1OH5I491D8gkwqJxjq 49wT1KOJY63P37zRcv6+3A3DX5uuxIXU99ig62NJfuSRG4ua3jLmKIiD+Z8kQ3c8F+/k UhOQ== X-Gm-Message-State: AA+aEWbQd1bCijvHUApS8WmopuhhPfIpUFSvJqt0e9WkvcqBwumwCx3d C5mD484CrtmnHQags3oGfHAFLE/Z02k= X-Google-Smtp-Source: AFSGD/XIhcbU1fwghTcx3ZjnJwsNyF0yn+76aP+xMVRehVMdZj1E47XiD4BHJ8PFpYJHZCL2CW+cmw== X-Received: by 2002:a62:ce0e:: with SMTP id y14mr7531215pfg.100.1543614748468; Fri, 30 Nov 2018 13:52:28 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Fri, 30 Nov 2018 13:52:09 -0800 Message-Id: <20181130215221.20554-5-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20181130215221.20554-1-richard.henderson@linaro.org> References: <20181130215221.20554-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::544 Subject: [Qemu-devel] [PATCH v3 04/16] tcg/aarch64: Fold away "noaddr" branch routines 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: alex.bennee@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-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" There are one use apiece for these. There is no longer a need for preserving branch offset operands, as we no longer re-translate. Signed-off-by: Richard Henderson Reviewed-by: Alex Benn=C3=A9e --- tcg/aarch64/tcg-target.inc.c | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-) diff --git a/tcg/aarch64/tcg-target.inc.c b/tcg/aarch64/tcg-target.inc.c index a41b633960..28de0226fb 100644 --- a/tcg/aarch64/tcg-target.inc.c +++ b/tcg/aarch64/tcg-target.inc.c @@ -1129,23 +1129,6 @@ static inline void tcg_out_goto_long(TCGContext *s, = tcg_insn_unit *target) } } =20 -static inline void tcg_out_goto_noaddr(TCGContext *s) -{ - /* We pay attention here to not modify the branch target by reading fr= om - the buffer. This ensure that caches and memory are kept coherent du= ring - retranslation. Mask away possible garbage in the high bits for the - first translation, while keeping the offset bits for retranslation.= */ - uint32_t old =3D tcg_in32(s); - tcg_out_insn(s, 3206, B, old); -} - -static inline void tcg_out_goto_cond_noaddr(TCGContext *s, TCGCond c) -{ - /* See comments in tcg_out_goto_noaddr. */ - uint32_t old =3D tcg_in32(s) >> 5; - tcg_out_insn(s, 3202, B_C, c, old); -} - static inline void tcg_out_callr(TCGContext *s, TCGReg reg) { tcg_out_insn(s, 3207, BLR, reg); @@ -1192,7 +1175,7 @@ static inline void tcg_out_goto_label(TCGContext *s, = TCGLabel *l) { if (!l->has_value) { tcg_out_reloc(s, s->code_ptr, R_AARCH64_JUMP26, l, 0); - tcg_out_goto_noaddr(s); + tcg_out_insn(s, 3206, B, 0); } else { tcg_out_goto(s, l->u.value_ptr); } @@ -1523,7 +1506,7 @@ static void tcg_out_tlb_read(TCGContext *s, TCGReg ad= dr_reg, TCGMemOp opc, =20 /* If not equal, we jump to the slow path. */ *label_ptr =3D s->code_ptr; - tcg_out_goto_cond_noaddr(s, TCG_COND_NE); + tcg_out_insn(s, 3202, B_C, TCG_COND_NE, 0); } =20 #endif /* CONFIG_SOFTMMU */ --=20 2.17.2 From nobody Sat May 18 04:30:15 2024 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.zohomail.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; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1543615202160916.6370567898156; Fri, 30 Nov 2018 14:00:02 -0800 (PST) Received: from localhost ([::1]:34766 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gSqpN-00081m-3Q for importer@patchew.org; Fri, 30 Nov 2018 17:00:01 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52525) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gSqi7-0007tB-Vr for qemu-devel@nongnu.org; Fri, 30 Nov 2018 16:52:32 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gSqi7-0006dK-6l for qemu-devel@nongnu.org; Fri, 30 Nov 2018 16:52:31 -0500 Received: from mail-pg1-x544.google.com ([2607:f8b0:4864:20::544]:41099) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gSqi7-0006ZR-0l for qemu-devel@nongnu.org; Fri, 30 Nov 2018 16:52:31 -0500 Received: by mail-pg1-x544.google.com with SMTP id 70so3049087pgh.8 for ; Fri, 30 Nov 2018 13:52:30 -0800 (PST) Received: from cloudburst.twiddle.net (97-113-170-180.tukw.qwest.net. [97.113.170.180]) by smtp.gmail.com with ESMTPSA id a18sm6973967pgj.30.2018.11.30.13.52.28 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 30 Nov 2018 13:52:28 -0800 (PST) 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=7h4GXNb91zOPDnh2Ls29pcZk2e9bcCSLu7mxmI+kTHY=; b=gdgib4ynRoD6RjnI2p99XVxiTAUlPOIxzI1KDvQCJB0qCUcr8bdQh84d79NWooSNlG LFDp4cRSCknFiWUNUDDLvBsKrbiDjKSlxLkjRsdRZ40uPYVq5B1p79PVF/lbuhGVnjEF /h8xG6HsDuT3AvdQrkzuAcAnFE0whp2n7aWwo= 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=7h4GXNb91zOPDnh2Ls29pcZk2e9bcCSLu7mxmI+kTHY=; b=UdehJm0Q1s4eDL8D+nx4hqsignaS73i12XUuSQ0avfAZ3XP1AWmkDfgw5B+cdNBXLR 55NTxKBaj8LjS6i/YLfYTQdKlojJpmnCwb7aqqi0wUeu+82y0iPaSMVUNedLVsKBr0EN nqreiYU3gce7OfFmYjMuUtsp/DChRRDLsm73C4KV1Gz4oPVXcbSkiuYPu/9lrGUq5Hb+ XnYrxUkpjH5BM+Jw0aY9760w1Bza3CiQ/wzBi4rPXer7koqNKMUFvBFH0WBV76Vj+b/n v25iAZ0QdCsdlTKysbD9PgvEtBMrHCV8MNqK+9S7XkNk62ayTGFgEazRmWeIk1np+W5m bk/g== X-Gm-Message-State: AA+aEWYLWIJsgeq8XF0Dt0G1HYNCFvy83kqNiJQw85mN+JziyEVSk8gG YUwb6u8ehBkSQrSsTHsZbmtyHMatiso= X-Google-Smtp-Source: AFSGD/VTH+TUUYrcO+4jh1H29XJjarKv8H9IKLy5VBjRvfOqeXF5dXvZzanSvd9sOej4HMdy79ZJwg== X-Received: by 2002:a63:ca0a:: with SMTP id n10mr6216565pgi.258.1543614749731; Fri, 30 Nov 2018 13:52:29 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Fri, 30 Nov 2018 13:52:10 -0800 Message-Id: <20181130215221.20554-6-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20181130215221.20554-1-richard.henderson@linaro.org> References: <20181130215221.20554-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::544 Subject: [Qemu-devel] [PATCH v3 05/16] tcg/arm: Remove reloc_pc24_atomic 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: alex.bennee@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-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" It is unused since 3fb53fb4d12f2e7833bd1659e6013237b130ef20. Signed-off-by: Richard Henderson Reviewed-by: Alex Benn=C3=A9e --- tcg/arm/tcg-target.inc.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/tcg/arm/tcg-target.inc.c b/tcg/arm/tcg-target.inc.c index e1fbf465cb..1142eb13ad 100644 --- a/tcg/arm/tcg-target.inc.c +++ b/tcg/arm/tcg-target.inc.c @@ -193,14 +193,6 @@ static inline void reloc_pc24(tcg_insn_unit *code_ptr,= tcg_insn_unit *target) *code_ptr =3D (*code_ptr & ~0xffffff) | (offset & 0xffffff); } =20 -static inline void reloc_pc24_atomic(tcg_insn_unit *code_ptr, tcg_insn_uni= t *target) -{ - ptrdiff_t offset =3D (tcg_ptr_byte_diff(target, code_ptr) - 8) >> 2; - tcg_insn_unit insn =3D atomic_read(code_ptr); - tcg_debug_assert(offset =3D=3D sextract32(offset, 0, 24)); - atomic_set(code_ptr, deposit32(insn, 0, 24, offset)); -} - static void patch_reloc(tcg_insn_unit *code_ptr, int type, intptr_t value, intptr_t addend) { --=20 2.17.2 From nobody Sat May 18 04:30:15 2024 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.zohomail.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; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 154361537061363.52952579631699; Fri, 30 Nov 2018 14:02:50 -0800 (PST) Received: from localhost ([::1]:34790 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gSqs5-0001se-Ed for importer@patchew.org; Fri, 30 Nov 2018 17:02:49 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52544) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gSqi9-0007uc-A4 for qemu-devel@nongnu.org; Fri, 30 Nov 2018 16:52:36 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gSqi8-0006jP-Fn for qemu-devel@nongnu.org; Fri, 30 Nov 2018 16:52:33 -0500 Received: from mail-pg1-x542.google.com ([2607:f8b0:4864:20::542]:35350) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gSqi8-0006gh-AU for qemu-devel@nongnu.org; Fri, 30 Nov 2018 16:52:32 -0500 Received: by mail-pg1-x542.google.com with SMTP id s198so3064150pgs.2 for ; Fri, 30 Nov 2018 13:52:32 -0800 (PST) Received: from cloudburst.twiddle.net (97-113-170-180.tukw.qwest.net. [97.113.170.180]) by smtp.gmail.com with ESMTPSA id a18sm6973967pgj.30.2018.11.30.13.52.29 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 30 Nov 2018 13:52:30 -0800 (PST) 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=ozCrCOAJZo+64UxjSymZwYWwMBonWg+ae4lW/HzfewQ=; b=OLY9h4BkZX5FoL5s4AblhxA06BVeddoasC+m2i0V3bYJzUSXgOczZ5AuDDKpe5EjAN iXZRgpGz8D8iwp8ZwPlUn3OOodCVejFqO+XS37jqfYxyf5u5SQwZJzmyMJw6YxDMf3Z1 OboiEu1VOnQttxYR5U7+2tPJzcF6cOWLbBcY8= 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=ozCrCOAJZo+64UxjSymZwYWwMBonWg+ae4lW/HzfewQ=; b=E2L3Ktn3MNA+xsxk/KmNOmYTr+7rV0Uwc1TNu9p9DeAl/M83Y84KoM1wdibn7te2gs Ti8DLnlQQuA4kFFTXjjd1zW/WR/A0iR/m6M1QxdglCY8s+0TcHLBrRNsb9hvq/78LFle WaBiRzaU+37xUKohrGOArdqX9CWBcKWJ93w4Y8Z/Jjlw5mjQWqUdbFdOrSARmE6lUwsc QCxqQp7VJiWFQ9PFAVEDYb2cHySOkmso1zgJbfGmYDxNgatxURxLfPDdm9bdEUGfzV0J flgHmN/U2dc8shTsJFAQmM9uu0TUep2mOBJQIOrIhkee38YhBgKNqjuMlqRM3bgBDqU7 iCyQ== X-Gm-Message-State: AA+aEWZHrxU1qqtrS1GrANo8R15s+jojN4bKM3oRG8R+WVHWFI954MO5 jcd2PcEgPqCDFceLmV78DLfWCurrkI0= X-Google-Smtp-Source: AFSGD/VDeu0GTSFlr7vCkIwiPynRZNy1JdZ4H198XW2CkKfnEJNbuuK/uoXyWNvMCRiVKVISteStxA== X-Received: by 2002:a63:1904:: with SMTP id z4mr5976595pgl.135.1543614750891; Fri, 30 Nov 2018 13:52:30 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Fri, 30 Nov 2018 13:52:11 -0800 Message-Id: <20181130215221.20554-7-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20181130215221.20554-1-richard.henderson@linaro.org> References: <20181130215221.20554-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::542 Subject: [Qemu-devel] [PATCH v3 06/16] tcg/arm: Fold away "noaddr" branch routines 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: alex.bennee@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-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" There are one use apiece for these. There is no longer a need for preserving branch offset operands, as we no longer re-translate. Signed-off-by: Richard Henderson Reviewed-by: Alex Benn=C3=A9e --- tcg/arm/tcg-target.inc.c | 22 +++------------------- 1 file changed, 3 insertions(+), 19 deletions(-) diff --git a/tcg/arm/tcg-target.inc.c b/tcg/arm/tcg-target.inc.c index 1142eb13ad..1651f00281 100644 --- a/tcg/arm/tcg-target.inc.c +++ b/tcg/arm/tcg-target.inc.c @@ -366,22 +366,6 @@ static inline void tcg_out_b(TCGContext *s, int cond, = int32_t offset) (((offset - 8) >> 2) & 0x00ffffff)); } =20 -static inline void tcg_out_b_noaddr(TCGContext *s, int cond) -{ - /* We pay attention here to not modify the branch target by masking - the corresponding bytes. This ensure that caches and memory are - kept coherent during retranslation. */ - tcg_out32(s, deposit32(*s->code_ptr, 24, 8, (cond << 4) | 0x0a)); -} - -static inline void tcg_out_bl_noaddr(TCGContext *s, int cond) -{ - /* We pay attention here to not modify the branch target by masking - the corresponding bytes. This ensure that caches and memory are - kept coherent during retranslation. */ - tcg_out32(s, deposit32(*s->code_ptr, 24, 8, (cond << 4) | 0x0b)); -} - static inline void tcg_out_bl(TCGContext *s, int cond, int32_t offset) { tcg_out32(s, (cond << 28) | 0x0b000000 | @@ -1082,7 +1066,7 @@ static inline void tcg_out_goto_label(TCGContext *s, = int cond, TCGLabel *l) tcg_out_goto(s, cond, l->u.value_ptr); } else { tcg_out_reloc(s, s->code_ptr, R_ARM_PC24, l, 0); - tcg_out_b_noaddr(s, cond); + tcg_out_b(s, cond, 0); } } =20 @@ -1628,7 +1612,7 @@ static void tcg_out_qemu_ld(TCGContext *s, const TCGA= rg *args, bool is64) /* This a conditional BL only to load a pointer within this opcode int= o LR for the slow path. We will not be using the value for a tail call.= */ label_ptr =3D s->code_ptr; - tcg_out_bl_noaddr(s, COND_NE); + tcg_out_bl(s, COND_NE, 0); =20 tcg_out_qemu_ld_index(s, opc, datalo, datahi, addrlo, addend); =20 @@ -1760,7 +1744,7 @@ static void tcg_out_qemu_st(TCGContext *s, const TCGA= rg *args, bool is64) =20 /* The conditional call must come last, as we're going to return here.= */ label_ptr =3D s->code_ptr; - tcg_out_bl_noaddr(s, COND_NE); + tcg_out_bl(s, COND_NE, 0); =20 add_qemu_ldst_label(s, false, oi, datalo, datahi, addrlo, addrhi, s->code_ptr, label_ptr); --=20 2.17.2 From nobody Sat May 18 04:30:15 2024 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.zohomail.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; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1543614920520844.7489469002494; Fri, 30 Nov 2018 13:55:20 -0800 (PST) Received: from localhost ([::1]:34739 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gSqkp-0002i7-HB for importer@patchew.org; Fri, 30 Nov 2018 16:55:19 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52569) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gSqiC-0007zl-Fk for qemu-devel@nongnu.org; Fri, 30 Nov 2018 16:52:37 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gSqi9-0006qS-KR for qemu-devel@nongnu.org; Fri, 30 Nov 2018 16:52:36 -0500 Received: from mail-pf1-x444.google.com ([2607:f8b0:4864:20::444]:36944) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gSqi9-0006lu-EA for qemu-devel@nongnu.org; Fri, 30 Nov 2018 16:52:33 -0500 Received: by mail-pf1-x444.google.com with SMTP id y126so3440178pfb.4 for ; Fri, 30 Nov 2018 13:52:33 -0800 (PST) Received: from cloudburst.twiddle.net (97-113-170-180.tukw.qwest.net. [97.113.170.180]) by smtp.gmail.com with ESMTPSA id a18sm6973967pgj.30.2018.11.30.13.52.31 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 30 Nov 2018 13:52:31 -0800 (PST) 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=SdEJC75HoX+aaLFVYPRT91luz3tIvq+5jmKsSfMgW5w=; b=bBqYqc9eN4KuSEn8KaKm6OyqW0hOTSjHoQ78Z91gv0RKgrgV6Nv2dnVAbrT4DF2/JT N8b4gTDxHFKxzECCr1NciuWAZZgJoujrY5IoS96JMrjXGprihzHfaU2K83S9iSO6o1C4 y/rAMufZaA16X9zN38Uf4OtrDgohy9vZSAplQ= 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=SdEJC75HoX+aaLFVYPRT91luz3tIvq+5jmKsSfMgW5w=; b=TxntZEgHVsMfZUYgWbkanBQPv5MHHq+yUNKhGjPrgCPAxsNQXd0at3KfOnrXkeHNbo gg1t/5nUtmwl42oeG6IdV3GAG9fBi69KcG7Lntt6WLmaThXK0SGakOl1EaFgvdcGVHFH zmUvVz3irLSibomOfxz6toyYS/XAuCCoTsham3ym3AFWxKcRAkGGrTf6RWkeXIeP/eif EkL5yTlmwtsiPaIJK4UZQ3zVcPkHaWPIJzRQebsKy9p0zGEL6BRnT0DoHIOyII0YrAD6 74BWGO9DpEBCXitK3kNS7CZFPZ9H0q1za2FGiS9Z5JUyWCWbb572NBBKE6Jpts1HhXo4 uEgQ== X-Gm-Message-State: AA+aEWZqpRWZNQgpX33iTBBDnNJ379InA3Yjft1509YQwUQvM/amJ2gh t/jdxeZtIBR33U8azRVKT/z6qzlbB4Y= X-Google-Smtp-Source: AFSGD/XDj6mzzsFdTCu9d08dCjvOnpokK09etNH5dp6RBDLmhXyCnbD15dESrgAiZX8F57IsjJOSGw== X-Received: by 2002:a63:561b:: with SMTP id k27mr6174371pgb.271.1543614752085; Fri, 30 Nov 2018 13:52:32 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Fri, 30 Nov 2018 13:52:12 -0800 Message-Id: <20181130215221.20554-8-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20181130215221.20554-1-richard.henderson@linaro.org> References: <20181130215221.20554-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::444 Subject: [Qemu-devel] [PATCH v3 07/16] tcg/ppc: Fold away "noaddr" branch routines 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: alex.bennee@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-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" There is no longer a need for preserving branch offset operands, as we no longer re-translate. Signed-off-by: Richard Henderson Reviewed-by: Alex Benn=C3=A9e --- tcg/ppc/tcg-target.inc.c | 25 +++++++------------------ 1 file changed, 7 insertions(+), 18 deletions(-) diff --git a/tcg/ppc/tcg-target.inc.c b/tcg/ppc/tcg-target.inc.c index c2f729ee8f..2e2a22f579 100644 --- a/tcg/ppc/tcg-target.inc.c +++ b/tcg/ppc/tcg-target.inc.c @@ -210,18 +210,6 @@ static void reloc_pc14(tcg_insn_unit *pc, tcg_insn_uni= t *target) *pc =3D (*pc & ~0xfffc) | reloc_pc14_val(pc, target); } =20 -static inline void tcg_out_b_noaddr(TCGContext *s, int insn) -{ - unsigned retrans =3D *s->code_ptr & 0x3fffffc; - tcg_out32(s, insn | retrans); -} - -static inline void tcg_out_bc_noaddr(TCGContext *s, int insn) -{ - unsigned retrans =3D *s->code_ptr & 0xfffc; - tcg_out32(s, insn | retrans); -} - /* parse target specific constraints */ static const char *target_parse_constraint(TCGArgConstraint *ct, const char *ct_str, TCGType typ= e) @@ -1179,11 +1167,11 @@ static void tcg_out_setcond(TCGContext *s, TCGType = type, TCGCond cond, static void tcg_out_bc(TCGContext *s, int bc, TCGLabel *l) { if (l->has_value) { - tcg_out32(s, bc | reloc_pc14_val(s->code_ptr, l->u.value_ptr)); + bc |=3D reloc_pc14_val(s->code_ptr, l->u.value_ptr); } else { tcg_out_reloc(s, s->code_ptr, R_PPC_REL14, l, 0); - tcg_out_bc_noaddr(s, bc); } + tcg_out32(s, bc); } =20 static void tcg_out_brcond(TCGContext *s, TCGCond cond, @@ -1771,7 +1759,7 @@ static void tcg_out_qemu_ld(TCGContext *s, const TCGA= rg *args, bool is_64) =20 /* Load a pointer into the current opcode w/conditional branch-link. */ label_ptr =3D s->code_ptr; - tcg_out_bc_noaddr(s, BC | BI(7, CR_EQ) | BO_COND_FALSE | LK); + tcg_out32(s, BC | BI(7, CR_EQ) | BO_COND_FALSE | LK); =20 rbase =3D TCG_REG_R3; #else /* !CONFIG_SOFTMMU */ @@ -1846,7 +1834,7 @@ static void tcg_out_qemu_st(TCGContext *s, const TCGA= rg *args, bool is_64) =20 /* Load a pointer into the current opcode w/conditional branch-link. */ label_ptr =3D s->code_ptr; - tcg_out_bc_noaddr(s, BC | BI(7, CR_EQ) | BO_COND_FALSE | LK); + tcg_out32(s, BC | BI(7, CR_EQ) | BO_COND_FALSE | LK); =20 rbase =3D TCG_REG_R3; #else /* !CONFIG_SOFTMMU */ @@ -2044,13 +2032,14 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc= , const TCGArg *args, case INDEX_op_br: { TCGLabel *l =3D arg_label(args[0]); + uint32_t insn =3D B; =20 if (l->has_value) { - tcg_out_b(s, 0, l->u.value_ptr); + insn |=3D reloc_pc24_val(s->code_ptr, l->u.value_ptr); } else { tcg_out_reloc(s, s->code_ptr, R_PPC_REL24, l, 0); - tcg_out_b_noaddr(s, B); } + tcg_out32(s, insn); } break; case INDEX_op_ld8u_i32: --=20 2.17.2 From nobody Sat May 18 04:30:15 2024 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.zohomail.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; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1543615374226748.7906838432323; Fri, 30 Nov 2018 14:02:54 -0800 (PST) Received: from localhost ([::1]:34789 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gSqs1-0001oR-WC for importer@patchew.org; Fri, 30 Nov 2018 17:02:46 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52567) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gSqiC-0007zi-F2 for qemu-devel@nongnu.org; Fri, 30 Nov 2018 16:52:37 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gSqiA-0006vo-Tn for qemu-devel@nongnu.org; Fri, 30 Nov 2018 16:52:36 -0500 Received: from mail-pg1-x543.google.com ([2607:f8b0:4864:20::543]:41099) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gSqiA-0006tK-O9 for qemu-devel@nongnu.org; Fri, 30 Nov 2018 16:52:34 -0500 Received: by mail-pg1-x543.google.com with SMTP id 70so3049139pgh.8 for ; Fri, 30 Nov 2018 13:52:34 -0800 (PST) Received: from cloudburst.twiddle.net (97-113-170-180.tukw.qwest.net. [97.113.170.180]) by smtp.gmail.com with ESMTPSA id a18sm6973967pgj.30.2018.11.30.13.52.32 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 30 Nov 2018 13:52:32 -0800 (PST) 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=meIomQO1GtN3dMIndLu+UFeHsb6xbjxNIqoRJl4bs4M=; b=JR4ASTrdv+nh4SdxVNJz3aDFiriHArQBIgOYh0tCofkYO+l9q+QLuOphY+AlGXoDu+ 3+ADPDIgcSTyqlxTM/KzhxBkDXAKeqCNM5q3ixpPq1am5Zp+UuqQ/cTnQ7LjUNOL941m Je26snvROIh5sl07huJ6rbiBXLntouwMfAeoM= 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=meIomQO1GtN3dMIndLu+UFeHsb6xbjxNIqoRJl4bs4M=; b=Cb7amY84A04s5Qw5lfbZtn9yPHnApy9MQenA7yCO3HghvzcLzEMSFdyJH5ngA6RVvt fOmNjN5aJS/4C/KxTsjOTrarQgf9/ruWMqTI+tPgU1M2SN3De2PIMkEmqqA/t4n7g43o +EO91WLv6BnoF08kOGck4Gw6lC/LpuULAX+dhZRKXTsEp62BWydL6rRm7KoHYWzGzc8U 6pKUhhsX38+R+EX7JzVUbJtN/jfXPJdqK+vPPSvt0IRbv90zJfIt+h+RU9DdI2c1iD3I n4HODSyYfLoWNp5+mfRhp/toTYCwo8Kn7mYZ3aagswTCCpC7YuDPSUslfReDnnubEGaE rh+w== X-Gm-Message-State: AA+aEWbuYLvldxtRHIGyfKMotEPfGT1g0k7XDDfG56t+IGk9XMDTZ5lH B31JbOtzCjstwTkluP6yI5diAUuKapc= X-Google-Smtp-Source: AFSGD/WrqdaKm/AX8Udkm/TUwOMLpxixkPYuyv1v7MDF/R/BzptiEkpKqXNZiBLIBm9OVbKwyAe6Kg== X-Received: by 2002:a63:9306:: with SMTP id b6mr5941075pge.36.1543614753448; Fri, 30 Nov 2018 13:52:33 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Fri, 30 Nov 2018 13:52:13 -0800 Message-Id: <20181130215221.20554-9-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20181130215221.20554-1-richard.henderson@linaro.org> References: <20181130215221.20554-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::543 Subject: [Qemu-devel] [PATCH v3 08/16] tcg/s390: Remove retranslation code 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: alex.bennee@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-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" There is no longer a need for preserving branch offset operands, as we no longer re-translate. Signed-off-by: Richard Henderson Reviewed-by: Alex Benn=C3=A9e --- tcg/s390/tcg-target.inc.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/tcg/s390/tcg-target.inc.c b/tcg/s390/tcg-target.inc.c index 17c435ade5..96c344142e 100644 --- a/tcg/s390/tcg-target.inc.c +++ b/tcg/s390/tcg-target.inc.c @@ -1329,13 +1329,11 @@ static void tgen_branch(TCGContext *s, int cc, TCGL= abel *l) static void tgen_compare_branch(TCGContext *s, S390Opcode opc, int cc, TCGReg r1, TCGReg r2, TCGLabel *l) { - intptr_t off; + intptr_t off =3D 0; =20 if (l->has_value) { off =3D l->u.value_ptr - s->code_ptr; } else { - /* We need to keep the offset unchanged for retranslation. */ - off =3D s->code_ptr[1]; tcg_out_reloc(s, s->code_ptr + 1, R_390_PC16DBL, l, 2); } =20 @@ -1347,13 +1345,11 @@ static void tgen_compare_branch(TCGContext *s, S390= Opcode opc, int cc, static void tgen_compare_imm_branch(TCGContext *s, S390Opcode opc, int cc, TCGReg r1, int i2, TCGLabel *l) { - tcg_target_long off; + tcg_target_long off =3D 0; =20 if (l->has_value) { off =3D l->u.value_ptr - s->code_ptr; } else { - /* We need to keep the offset unchanged for retranslation. */ - off =3D s->code_ptr[1]; tcg_out_reloc(s, s->code_ptr + 1, R_390_PC16DBL, l, 2); } =20 @@ -1696,7 +1692,6 @@ static void tcg_out_qemu_ld(TCGContext* s, TCGReg dat= a_reg, TCGReg addr_reg, =20 base_reg =3D tcg_out_tlb_read(s, addr_reg, opc, mem_index, 1); =20 - /* We need to keep the offset unchanged for retranslation. */ tcg_out16(s, RI_BRC | (S390_CC_NE << 4)); label_ptr =3D s->code_ptr; s->code_ptr +=3D 1; @@ -1724,7 +1719,6 @@ static void tcg_out_qemu_st(TCGContext* s, TCGReg dat= a_reg, TCGReg addr_reg, =20 base_reg =3D tcg_out_tlb_read(s, addr_reg, opc, mem_index, 0); =20 - /* We need to keep the offset unchanged for retranslation. */ tcg_out16(s, RI_BRC | (S390_CC_NE << 4)); label_ptr =3D s->code_ptr; s->code_ptr +=3D 1; --=20 2.17.2 From nobody Sat May 18 04:30:15 2024 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.zohomail.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; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 154361488225480.17889157483899; Fri, 30 Nov 2018 13:54:42 -0800 (PST) Received: from localhost ([::1]:34738 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gSqkD-0002CP-6r for importer@patchew.org; Fri, 30 Nov 2018 16:54:41 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52587) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gSqiD-00080O-5L for qemu-devel@nongnu.org; Fri, 30 Nov 2018 16:52:37 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gSqiC-00073H-7z for qemu-devel@nongnu.org; Fri, 30 Nov 2018 16:52:37 -0500 Received: from mail-pg1-x542.google.com ([2607:f8b0:4864:20::542]:44116) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gSqiC-0006zg-07 for qemu-devel@nongnu.org; Fri, 30 Nov 2018 16:52:36 -0500 Received: by mail-pg1-x542.google.com with SMTP id t13so3036117pgr.11 for ; Fri, 30 Nov 2018 13:52:35 -0800 (PST) Received: from cloudburst.twiddle.net (97-113-170-180.tukw.qwest.net. [97.113.170.180]) by smtp.gmail.com with ESMTPSA id a18sm6973967pgj.30.2018.11.30.13.52.33 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 30 Nov 2018 13:52:33 -0800 (PST) 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=X3YLeFs2jpUp2Y5o6LtVDE7iCuweZxuSy32euV7GYJ4=; b=gb6JyEWUTFLnTOBLXftOkvOebHpzjvyRAKU5wX1sDYz/OKcMAzWi9DQcdukdUoYXVH Bpq9eMUw+ha4JVE/Wv/eK4WPTVD2bwCAjzOd6kyi2SU8ue7zoAbcA0rlBu/Bdnxjo9Im pgLGSQe9WMqZNrnBRhAG/1ZBQa6ryrzVxei14= 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=X3YLeFs2jpUp2Y5o6LtVDE7iCuweZxuSy32euV7GYJ4=; b=hcOa5Bg/q9Yi1nuDBmWu7ujmO0/VaieWVMfEfnv7kx+eUXcbX9u9XcYqwsEs2JIBrf 73T6v7adHhAqBjDeDCSIk/+pCN8YIa4siiZa9jYUVyQkvEJRZoqBl5PXMgud4WKzBXIP 8jXew8deUwuKG8LbnSv0bZ80yr7rTPnMarqFg7WTaLbV7sMs9dn7mfVuIiARCaU+E1vz DRZWViP07o9Yplqd+JW9nApZUY90oEzQulTfYmnIm6mFcPdaHJ7g3YxT+uC6ohopFaaT Dc6MUtsvfOWGzYhRDHW4Co7Mr+WMDyDDh45sWlDsq/NgfRb96+zST4/3jLaZvpxX8GcI OQmQ== X-Gm-Message-State: AA+aEWYt4/y2HW1jiTzExuKJJTIs5lumzg1+iS2ZiGFKeTQZYYOQ5aUr rNL9GEW94S6nfjpMf5q2o9bI/i2vEo4= X-Google-Smtp-Source: AFSGD/V0azR5Eu2OoEfZ+xS/Ac+phdQpjYSNUWQfkkvcGdnitiDsaDsMNGPWOwdzEpHPP+o9aqjhMQ== X-Received: by 2002:a63:f241:: with SMTP id d1mr6230166pgk.2.1543614754603; Fri, 30 Nov 2018 13:52:34 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Fri, 30 Nov 2018 13:52:14 -0800 Message-Id: <20181130215221.20554-10-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20181130215221.20554-1-richard.henderson@linaro.org> References: <20181130215221.20554-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::542 Subject: [Qemu-devel] [PATCH v3 09/16] tcg/sparc: Remove retranslation code 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: alex.bennee@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-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" There is no longer a need for preserving branch offset operands, as we no longer re-translate. Signed-off-by: Richard Henderson Reviewed-by: Alex Benn=C3=A9e --- tcg/sparc/tcg-target.inc.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/tcg/sparc/tcg-target.inc.c b/tcg/sparc/tcg-target.inc.c index 04bdc3df5e..671a04c54b 100644 --- a/tcg/sparc/tcg-target.inc.c +++ b/tcg/sparc/tcg-target.inc.c @@ -639,13 +639,11 @@ static void tcg_out_bpcc0(TCGContext *s, int scond, i= nt flags, int off19) =20 static void tcg_out_bpcc(TCGContext *s, int scond, int flags, TCGLabel *l) { - int off19; + int off19 =3D 0; =20 if (l->has_value) { off19 =3D INSN_OFF19(tcg_pcrel_diff(s, l->u.value_ptr)); } else { - /* Make sure to preserve destinations during retranslation. */ - off19 =3D *s->code_ptr & INSN_OFF19(-1); tcg_out_reloc(s, s->code_ptr, R_SPARC_WDISP19, l, 0); } tcg_out_bpcc0(s, scond, flags, off19); @@ -685,13 +683,11 @@ static void tcg_out_brcond_i64(TCGContext *s, TCGCond= cond, TCGReg arg1, { /* For 64-bit signed comparisons vs zero, we can avoid the compare. */ if (arg2 =3D=3D 0 && !is_unsigned_cond(cond)) { - int off16; + int off16 =3D 0; =20 if (l->has_value) { off16 =3D INSN_OFF16(tcg_pcrel_diff(s, l->u.value_ptr)); } else { - /* Make sure to preserve destinations during retranslation. */ - off16 =3D *s->code_ptr & INSN_OFF16(-1); tcg_out_reloc(s, s->code_ptr, R_SPARC_WDISP16, l, 0); } tcg_out32(s, INSN_OP(0) | INSN_OP2(3) | BPR_PT | INSN_RS1(arg1) --=20 2.17.2 From nobody Sat May 18 04:30:15 2024 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.zohomail.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; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1543615520837924.0524994796749; Fri, 30 Nov 2018 14:05:20 -0800 (PST) Received: from localhost ([::1]:34806 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gSquU-0004wy-Je for importer@patchew.org; Fri, 30 Nov 2018 17:05:18 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52603) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gSqiE-00081Z-7z for qemu-devel@nongnu.org; Fri, 30 Nov 2018 16:52:39 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gSqiD-00078G-FH for qemu-devel@nongnu.org; Fri, 30 Nov 2018 16:52:38 -0500 Received: from mail-pl1-x643.google.com ([2607:f8b0:4864:20::643]:45290) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gSqiD-00074K-9c for qemu-devel@nongnu.org; Fri, 30 Nov 2018 16:52:37 -0500 Received: by mail-pl1-x643.google.com with SMTP id a14so3408303plm.12 for ; Fri, 30 Nov 2018 13:52:37 -0800 (PST) Received: from cloudburst.twiddle.net (97-113-170-180.tukw.qwest.net. [97.113.170.180]) by smtp.gmail.com with ESMTPSA id a18sm6973967pgj.30.2018.11.30.13.52.34 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 30 Nov 2018 13:52:35 -0800 (PST) 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=ic9yGA2IXubLUWfhTU5XIR+gEPgnKoDxdXyZYSEXZTY=; b=Qx2z6GhKoY/vdSNyKgeQw8eF38a6Uv46Bm47oIrTrtnPMLUJ/pT7lTo2YFIES43jvL lk5CZ4x+9x6xWysXJb7/tSKTomO/o6j20wdb61inoI4pa9jt4Z21Cuuj5JYJrycG7Z6x 7OEOzF2o71anqi6aAIAA3J4A/gs3Nk38p8sxs= 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=ic9yGA2IXubLUWfhTU5XIR+gEPgnKoDxdXyZYSEXZTY=; b=C+fMR3Bwn5igy3YBZW2TqHRT9W22Pd3OoH1h1Y3ISoQmkjRQgPMHniVYj8/mekYiR+ +uEx9d90gNpGfHCor80Xrk1OwasQilBTps7Juz4toq3XHMy71syX5AOsjV/gs7FvgX5i 9hdF5goYUQkIhJOM45OiWvHAPYkXi3Z4xySMG+Oprz+ymmF95h8VhjnfqRbdsP6OBIj+ nyMUDFGPrfDIBjwxwnJcCV5An36RRuKN6qHHNt0N7eMQ4WzAJHargxUNpI/w1rq7rTSC Cl2dHPm4cGeHv4mhYeqrFX8qv0DlDPVeHPzD/Dq+/k6/065AzQlujOItz0qA7agsutON FRZw== X-Gm-Message-State: AA+aEWYz2ZATEwwBxhou9Kb9EavnKcUvFdfasjFpNl4g71ulCRXnZ8As 8wiYmxNKXUp8tnWpWV101+S/EaRZAtQ= X-Google-Smtp-Source: AFSGD/X6xZ/kggplj2bCd3SrWEsZyu2vFKCcdrog4w7A+wM3MHToRIu3Ier8Ig6rI+lOXxaQx4qWMA== X-Received: by 2002:a17:902:8d8e:: with SMTP id v14mr7203167plo.133.1543614755937; Fri, 30 Nov 2018 13:52:35 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Fri, 30 Nov 2018 13:52:15 -0800 Message-Id: <20181130215221.20554-11-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20181130215221.20554-1-richard.henderson@linaro.org> References: <20181130215221.20554-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::643 Subject: [Qemu-devel] [PATCH v3 10/16] tcg/mips: Remove retranslation code 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: alex.bennee@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-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" There is no longer a need for preserving branch offset operands, as we no longer re-translate. Signed-off-by: Richard Henderson Reviewed-by: Alex Benn=C3=A9e --- tcg/mips/tcg-target.inc.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/tcg/mips/tcg-target.inc.c b/tcg/mips/tcg-target.inc.c index cff525373b..e21cb1ae28 100644 --- a/tcg/mips/tcg-target.inc.c +++ b/tcg/mips/tcg-target.inc.c @@ -483,12 +483,7 @@ static inline void tcg_out_opc_bf64(TCGContext *s, MIP= SInsn opc, MIPSInsn opm, static inline void tcg_out_opc_br(TCGContext *s, MIPSInsn opc, TCGReg rt, TCGReg rs) { - /* We pay attention here to not modify the branch target by reading - the existing value and using it again. This ensure that caches and - memory are kept coherent during retranslation. */ - uint16_t offset =3D (uint16_t)*s->code_ptr; - - tcg_out_opc_imm(s, opc, rt, rs, offset); + tcg_out_opc_imm(s, opc, rt, rs, 0); } =20 /* --=20 2.17.2 From nobody Sat May 18 04:30:15 2024 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.zohomail.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; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 154361552092240.31391135603678; Fri, 30 Nov 2018 14:05:20 -0800 (PST) Received: from localhost ([::1]:34804 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gSquQ-0004s6-49 for importer@patchew.org; Fri, 30 Nov 2018 17:05:14 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52631) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gSqiG-00083i-9W for qemu-devel@nongnu.org; Fri, 30 Nov 2018 16:52:41 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gSqiE-0007Di-Vk for qemu-devel@nongnu.org; Fri, 30 Nov 2018 16:52:40 -0500 Received: from mail-pf1-x441.google.com ([2607:f8b0:4864:20::441]:33624) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gSqiE-0007AU-Ko for qemu-devel@nongnu.org; Fri, 30 Nov 2018 16:52:38 -0500 Received: by mail-pf1-x441.google.com with SMTP id c123so3445730pfb.0 for ; Fri, 30 Nov 2018 13:52:38 -0800 (PST) Received: from cloudburst.twiddle.net (97-113-170-180.tukw.qwest.net. [97.113.170.180]) by smtp.gmail.com with ESMTPSA id a18sm6973967pgj.30.2018.11.30.13.52.35 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 30 Nov 2018 13:52:36 -0800 (PST) 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=bIJsO02EdAHYmyrYupqznrCBCKJ/dVp4YRl5j0gjjEg=; b=gNx+yLzA7M6mDDDUPfXCtDO62Zk3CoklfHOItl/Q2dTcRGEAJ4QQ10LzoavjUiAuGE eflsPneU5XyhQwB87FosfkckzBZX3s5klnc0UkWmrrHYLIVWhy0p8aOTHy13eRedgw68 sI5yyiq1OwGQQwhFtpfqpzfiV7BDWiAnW26EA= 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=bIJsO02EdAHYmyrYupqznrCBCKJ/dVp4YRl5j0gjjEg=; b=r8tunDCr3XXQCMlF9D4k0Mtdr6LhGTLGtgi9grh0XRrLQLaVLMoEBrT8db9N98VXbH EceU/JffDx+qi2HlWFe0lPd+IOM3+0vZiiIgBEHyFKcdHLjX9+05HokcJkpKKf24FPFI jm3I9pkLtHPmSjWvRvzt1fFFNgcQsZXEbL0AwdO/RFie9oialiGW8aT1/z8Ot9US11P8 C1+W3kauyrbguh/FyjpEeBnrsK2SLdufbm/auT5+XELs7dwMdJqKh+aF2KUqCMHQnJNl LJwjgS1sFD4IbjuxtwS8g7M++ZlauZWIVy/jiM247Ie6/dWJL5SF3TWW1IcOyQGXn77E KxfA== X-Gm-Message-State: AA+aEWbM5uz3gEK/t3BxKNARVQbfGaPOf6faKE8iD1+8a3KyNGJaXewO 7nbTL7w/rTLsWScUgLc8K4qs5fr+eWM= X-Google-Smtp-Source: AFSGD/U63mW9pRLo9wckHqcUqTCU3ZVpxTG/mhmafXsYpTH5yJEvvH9TqHLmi4uPmFJRgy6h+7UpYA== X-Received: by 2002:a63:1c09:: with SMTP id c9mr6124301pgc.200.1543614757112; Fri, 30 Nov 2018 13:52:37 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Fri, 30 Nov 2018 13:52:16 -0800 Message-Id: <20181130215221.20554-12-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20181130215221.20554-1-richard.henderson@linaro.org> References: <20181130215221.20554-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::441 Subject: [Qemu-devel] [PATCH v3 11/16] tcg: Return success from patch_reloc 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: alex.bennee@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-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" This will move the assert for success from within (subroutines of) patch_reloc into the callers. It will also let new code do something different when a relocation is out of range. For the moment, all backends are trivially converted to return true. Signed-off-by: Richard Henderson Reviewed-by: Alex Benn=C3=A9e --- tcg/aarch64/tcg-target.inc.c | 3 ++- tcg/arm/tcg-target.inc.c | 3 ++- tcg/i386/tcg-target.inc.c | 3 ++- tcg/mips/tcg-target.inc.c | 3 ++- tcg/ppc/tcg-target.inc.c | 3 ++- tcg/s390/tcg-target.inc.c | 3 ++- tcg/sparc/tcg-target.inc.c | 5 +++-- tcg/tcg.c | 8 +++++--- tcg/tci/tcg-target.inc.c | 3 ++- 9 files changed, 22 insertions(+), 12 deletions(-) diff --git a/tcg/aarch64/tcg-target.inc.c b/tcg/aarch64/tcg-target.inc.c index 28de0226fb..16f08c59c4 100644 --- a/tcg/aarch64/tcg-target.inc.c +++ b/tcg/aarch64/tcg-target.inc.c @@ -94,7 +94,7 @@ static inline void reloc_pc19(tcg_insn_unit *code_ptr, tc= g_insn_unit *target) *code_ptr =3D deposit32(*code_ptr, 5, 19, offset); } =20 -static inline void patch_reloc(tcg_insn_unit *code_ptr, int type, +static inline bool patch_reloc(tcg_insn_unit *code_ptr, int type, intptr_t value, intptr_t addend) { tcg_debug_assert(addend =3D=3D 0); @@ -109,6 +109,7 @@ static inline void patch_reloc(tcg_insn_unit *code_ptr,= int type, default: tcg_abort(); } + return true; } =20 #define TCG_CT_CONST_AIMM 0x100 diff --git a/tcg/arm/tcg-target.inc.c b/tcg/arm/tcg-target.inc.c index 1651f00281..deefa20fbf 100644 --- a/tcg/arm/tcg-target.inc.c +++ b/tcg/arm/tcg-target.inc.c @@ -193,7 +193,7 @@ static inline void reloc_pc24(tcg_insn_unit *code_ptr, = tcg_insn_unit *target) *code_ptr =3D (*code_ptr & ~0xffffff) | (offset & 0xffffff); } =20 -static void patch_reloc(tcg_insn_unit *code_ptr, int type, +static bool patch_reloc(tcg_insn_unit *code_ptr, int type, intptr_t value, intptr_t addend) { tcg_debug_assert(addend =3D=3D 0); @@ -229,6 +229,7 @@ static void patch_reloc(tcg_insn_unit *code_ptr, int ty= pe, } else { g_assert_not_reached(); } + return true; } =20 #define TCG_CT_CONST_ARM 0x100 diff --git a/tcg/i386/tcg-target.inc.c b/tcg/i386/tcg-target.inc.c index 436195894b..5c88f1f36b 100644 --- a/tcg/i386/tcg-target.inc.c +++ b/tcg/i386/tcg-target.inc.c @@ -167,7 +167,7 @@ static bool have_lzcnt; =20 static tcg_insn_unit *tb_ret_addr; =20 -static void patch_reloc(tcg_insn_unit *code_ptr, int type, +static bool patch_reloc(tcg_insn_unit *code_ptr, int type, intptr_t value, intptr_t addend) { value +=3D addend; @@ -191,6 +191,7 @@ static void patch_reloc(tcg_insn_unit *code_ptr, int ty= pe, default: tcg_abort(); } + return true; } =20 #if TCG_TARGET_REG_BITS =3D=3D 64 diff --git a/tcg/mips/tcg-target.inc.c b/tcg/mips/tcg-target.inc.c index e21cb1ae28..a06ff257fa 100644 --- a/tcg/mips/tcg-target.inc.c +++ b/tcg/mips/tcg-target.inc.c @@ -168,12 +168,13 @@ static inline void reloc_26(tcg_insn_unit *pc, tcg_in= sn_unit *target) *pc =3D deposit32(*pc, 0, 26, reloc_26_val(pc, target)); } =20 -static void patch_reloc(tcg_insn_unit *code_ptr, int type, +static bool patch_reloc(tcg_insn_unit *code_ptr, int type, intptr_t value, intptr_t addend) { tcg_debug_assert(type =3D=3D R_MIPS_PC16); tcg_debug_assert(addend =3D=3D 0); reloc_pc16(code_ptr, (tcg_insn_unit *)value); + return true; } =20 #define TCG_CT_CONST_ZERO 0x100 diff --git a/tcg/ppc/tcg-target.inc.c b/tcg/ppc/tcg-target.inc.c index 2e2a22f579..860b0d36e1 100644 --- a/tcg/ppc/tcg-target.inc.c +++ b/tcg/ppc/tcg-target.inc.c @@ -513,7 +513,7 @@ static const uint32_t tcg_to_isel[] =3D { [TCG_COND_GTU] =3D ISEL | BC_(7, CR_GT), }; =20 -static void patch_reloc(tcg_insn_unit *code_ptr, int type, +static bool patch_reloc(tcg_insn_unit *code_ptr, int type, intptr_t value, intptr_t addend) { tcg_insn_unit *target; @@ -548,6 +548,7 @@ static void patch_reloc(tcg_insn_unit *code_ptr, int ty= pe, default: g_assert_not_reached(); } + return true; } =20 static void tcg_out_mem_long(TCGContext *s, int opi, int opx, TCGReg rt, diff --git a/tcg/s390/tcg-target.inc.c b/tcg/s390/tcg-target.inc.c index 96c344142e..68a4c60394 100644 --- a/tcg/s390/tcg-target.inc.c +++ b/tcg/s390/tcg-target.inc.c @@ -366,7 +366,7 @@ static void * const qemu_st_helpers[16] =3D { static tcg_insn_unit *tb_ret_addr; uint64_t s390_facilities; =20 -static void patch_reloc(tcg_insn_unit *code_ptr, int type, +static bool patch_reloc(tcg_insn_unit *code_ptr, int type, intptr_t value, intptr_t addend) { intptr_t pcrel2; @@ -393,6 +393,7 @@ static void patch_reloc(tcg_insn_unit *code_ptr, int ty= pe, default: g_assert_not_reached(); } + return true; } =20 /* parse target specific constraints */ diff --git a/tcg/sparc/tcg-target.inc.c b/tcg/sparc/tcg-target.inc.c index 671a04c54b..cadda770c4 100644 --- a/tcg/sparc/tcg-target.inc.c +++ b/tcg/sparc/tcg-target.inc.c @@ -291,7 +291,7 @@ static inline int check_fit_i32(int32_t val, unsigned i= nt bits) # define check_fit_ptr check_fit_i32 #endif =20 -static void patch_reloc(tcg_insn_unit *code_ptr, int type, +static bool patch_reloc(tcg_insn_unit *code_ptr, int type, intptr_t value, intptr_t addend) { uint32_t insn =3D *code_ptr; @@ -328,12 +328,13 @@ static void patch_reloc(tcg_insn_unit *code_ptr, int = type, /* Note that we're abusing this reloc type for our own needs. */ code_ptr[0] =3D deposit32(code_ptr[0], 0, 22, value >> 10); code_ptr[1] =3D deposit32(code_ptr[1], 0, 10, value); - return; + return true; default: g_assert_not_reached(); } =20 *code_ptr =3D insn; + return true; } =20 /* parse target specific constraints */ diff --git a/tcg/tcg.c b/tcg/tcg.c index e85133ef05..54f1272187 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -66,7 +66,7 @@ static void tcg_target_init(TCGContext *s); static const TCGTargetOpDef *tcg_target_op_def(TCGOpcode); static void tcg_target_qemu_prologue(TCGContext *s); -static void patch_reloc(tcg_insn_unit *code_ptr, int type, +static bool patch_reloc(tcg_insn_unit *code_ptr, int type, intptr_t value, intptr_t addend); =20 /* The CIE and FDE header definitions will be common to all hosts. */ @@ -268,7 +268,8 @@ static void tcg_out_reloc(TCGContext *s, tcg_insn_unit = *code_ptr, int type, /* FIXME: This may break relocations on RISC targets that modify instruction fields in place. The caller may not have=20 written the initial value. */ - patch_reloc(code_ptr, type, l->u.value, addend); + bool ok =3D patch_reloc(code_ptr, type, l->u.value, addend); + tcg_debug_assert(ok); } else { /* add a new relocation entry */ r =3D tcg_malloc(sizeof(TCGRelocation)); @@ -288,7 +289,8 @@ static void tcg_out_label(TCGContext *s, TCGLabel *l, t= cg_insn_unit *ptr) tcg_debug_assert(!l->has_value); =20 for (r =3D l->u.first_reloc; r !=3D NULL; r =3D r->next) { - patch_reloc(r->ptr, r->type, value, r->addend); + bool ok =3D patch_reloc(r->ptr, r->type, value, r->addend); + tcg_debug_assert(ok); } =20 l->has_value =3D 1; diff --git a/tcg/tci/tcg-target.inc.c b/tcg/tci/tcg-target.inc.c index 62ed097254..0015a98485 100644 --- a/tcg/tci/tcg-target.inc.c +++ b/tcg/tci/tcg-target.inc.c @@ -369,7 +369,7 @@ static const char *const tcg_target_reg_names[TCG_TARGE= T_NB_REGS] =3D { }; #endif =20 -static void patch_reloc(tcg_insn_unit *code_ptr, int type, +static bool patch_reloc(tcg_insn_unit *code_ptr, int type, intptr_t value, intptr_t addend) { /* tcg_out_reloc always uses the same type, addend. */ @@ -381,6 +381,7 @@ static void patch_reloc(tcg_insn_unit *code_ptr, int ty= pe, } else { tcg_patch64(code_ptr, value); } + return true; } =20 /* Parse target specific constraints. */ --=20 2.17.2 From nobody Sat May 18 04:30:15 2024 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.zohomail.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; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1543615152617531.0673596281373; Fri, 30 Nov 2018 13:59:12 -0800 (PST) Received: from localhost ([::1]:34765 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gSqoZ-0006IP-HF for importer@patchew.org; Fri, 30 Nov 2018 16:59:11 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52639) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gSqiG-00084J-TV for qemu-devel@nongnu.org; Fri, 30 Nov 2018 16:52:41 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gSqiG-0007JR-19 for qemu-devel@nongnu.org; Fri, 30 Nov 2018 16:52:40 -0500 Received: from mail-pf1-x432.google.com ([2607:f8b0:4864:20::432]:32815) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gSqiF-0007FD-S4 for qemu-devel@nongnu.org; Fri, 30 Nov 2018 16:52:39 -0500 Received: by mail-pf1-x432.google.com with SMTP id c123so3445760pfb.0 for ; Fri, 30 Nov 2018 13:52:39 -0800 (PST) Received: from cloudburst.twiddle.net (97-113-170-180.tukw.qwest.net. [97.113.170.180]) by smtp.gmail.com with ESMTPSA id a18sm6973967pgj.30.2018.11.30.13.52.37 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 30 Nov 2018 13:52:37 -0800 (PST) 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=GOgCwhgioTfHog8ldoFAvX8MpaX1vaR4nHbQUwijngY=; b=MrRugxC9vNXjs4tZMLfEqwLGi4bN/YaVCoO1l8fBe5EX3wA8xf6qLpeGOSJyS5eivK /MASbkwqwRmpXUnoSA41mR8AA2KlTuQ+JE1/LhxBUpk2Zm+bNsMEq//7p6IVMyyMgv0n mP3gfJEGj6Caf1smRqvt1cKx3D6XopF4+EBgw= 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=GOgCwhgioTfHog8ldoFAvX8MpaX1vaR4nHbQUwijngY=; b=kElnswYJIMKimkQ0Xh4RFQbmLnIJBwMAbju613c9DieukSpaOFNVKHUcjsR9tDyFFY qdw7eACvYHdH+wp5cY5tqtkA/d3lFqZLoDW0r43ys0rj3QuMfQRGRta9Tc40A2O12a9o ZrLi+H/OURr4V/QLsg4TtlbbEyJcPUBBFRB4nQ31SQc5MP035vCQ7yc/xDNuBD6S2Rkb zLg+4l/HWu8BhFc1Wmj2dBakmHs93RUliUWfpZYGgqrWFjCcBPPAtOQKiuDAKJmA6RUs KUv5XVQFCQ4W2jhH9aJ29CZRuq9xgb26SnAKhb6vPr6PcX6qy8VV0AH8wvT+t5g0V1Po 2l/w== X-Gm-Message-State: AA+aEWZ34equ2oq7zFP5X3aqqpSH4imV5ELbOBkMBABamuiTxzH/5S2v AyfuRrgXvohyRuncAjYcLLlaMJ/rMSo= X-Google-Smtp-Source: AFSGD/UPhQRvRZEkBJQseVVGlHywW/3vvk2lApymQEv/fK1vKwzjVfg4oM1trjyqtIVDYDG0nVC9zA== X-Received: by 2002:a63:9402:: with SMTP id m2mr5940328pge.93.1543614758349; Fri, 30 Nov 2018 13:52:38 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Fri, 30 Nov 2018 13:52:17 -0800 Message-Id: <20181130215221.20554-13-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20181130215221.20554-1-richard.henderson@linaro.org> References: <20181130215221.20554-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::432 Subject: [Qemu-devel] [PATCH v3 12/16] tcg/i386: Return false on failure from patch_reloc 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: alex.bennee@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-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Richard Henderson Reviewed-by: Alex Benn=C3=A9e --- tcg/i386/tcg-target.inc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tcg/i386/tcg-target.inc.c b/tcg/i386/tcg-target.inc.c index 5c88f1f36b..28192f4608 100644 --- a/tcg/i386/tcg-target.inc.c +++ b/tcg/i386/tcg-target.inc.c @@ -175,7 +175,7 @@ static bool patch_reloc(tcg_insn_unit *code_ptr, int ty= pe, case R_386_PC32: value -=3D (uintptr_t)code_ptr; if (value !=3D (int32_t)value) { - tcg_abort(); + return false; } /* FALLTHRU */ case R_386_32: @@ -184,7 +184,7 @@ static bool patch_reloc(tcg_insn_unit *code_ptr, int ty= pe, case R_386_PC8: value -=3D (uintptr_t)code_ptr; if (value !=3D (int8_t)value) { - tcg_abort(); + return false; } tcg_patch8(code_ptr, value); break; --=20 2.17.2 From nobody Sat May 18 04:30:15 2024 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.zohomail.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; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1543615697445749.3934184793422; Fri, 30 Nov 2018 14:08:17 -0800 (PST) Received: from localhost ([::1]:34827 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gSqxL-0007GH-Sc for importer@patchew.org; Fri, 30 Nov 2018 17:08:15 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52671) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gSqiI-00085d-3T for qemu-devel@nongnu.org; Fri, 30 Nov 2018 16:52:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gSqiH-0007OY-2F for qemu-devel@nongnu.org; Fri, 30 Nov 2018 16:52:41 -0500 Received: from mail-pf1-x441.google.com ([2607:f8b0:4864:20::441]:36942) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gSqiG-0007LI-Rj for qemu-devel@nongnu.org; Fri, 30 Nov 2018 16:52:40 -0500 Received: by mail-pf1-x441.google.com with SMTP id y126so3440292pfb.4 for ; Fri, 30 Nov 2018 13:52:40 -0800 (PST) Received: from cloudburst.twiddle.net (97-113-170-180.tukw.qwest.net. [97.113.170.180]) by smtp.gmail.com with ESMTPSA id a18sm6973967pgj.30.2018.11.30.13.52.38 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 30 Nov 2018 13:52:38 -0800 (PST) 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=eJKadJ6i9Y63+G17ntxH+k/+gALzfm5eMAE//c6fykE=; b=P+drhfdJUDErF2VWFZANoaBB6hVLcri0xlu3dCswKOs+mQZ8XPTV90YM/+CsRIlzDD N6Nx1pJUmUHTQy2HXndViIpgsj8nSeKKvkdFuLzg8M9Kn+39LqvJY+mWeh1lq6azTqA8 d87wuyBtsGYnkg4zuiC+tm5mTIErvrfLXP3Yc= 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=eJKadJ6i9Y63+G17ntxH+k/+gALzfm5eMAE//c6fykE=; b=CzHy2tM5oEt0IGz0RAHWcwoG548uQEc5ATp+eFsOIrLyoDO5WBO5kdclH8KyuAY6e0 2+LkupxTXOYAlEotXBCialkkQSFK20miYR3/Uk5Cuvqsu5QR6YybcZDtQKZPVKofbVEr XA974E5WhvYD6xuP8NT4LmacOgnTkGpwEil939Fnls3b+ttyND41C+qow31Ks9ClSQWu 8b9Tkm//GB7IZJkfG8F+9R60v9QEaG46PloRedG4P/ot/bxbIQtUUoRJeuRxhaYSxNT9 eN0SJ2fkM2kIRf5OznUikdLLbjfrydEI0EzhckR5zwkzmvva952yCEjhrl07nSGnXkN3 RgVw== X-Gm-Message-State: AA+aEWb2WDUjWGEbw7seXJWZKWIGmzfKBYeUkVRLZDnunVjT8TAd3nSV oGbeKkgpOJdy4L4Clwuh+kvl4BiqBP4= X-Google-Smtp-Source: AFSGD/XXlM9n0GE+VRWBwv4NsgQfHFg9JZjWPe/iocVCQuM9GifiWhBQ5GfRHFBNIRFmJN6cpAfAsg== X-Received: by 2002:a63:fd0a:: with SMTP id d10mr6289709pgh.164.1543614759450; Fri, 30 Nov 2018 13:52:39 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Fri, 30 Nov 2018 13:52:18 -0800 Message-Id: <20181130215221.20554-14-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20181130215221.20554-1-richard.henderson@linaro.org> References: <20181130215221.20554-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::441 Subject: [Qemu-devel] [PATCH v3 13/16] tcg/aarch64: Return false on failure from patch_reloc 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: alex.bennee@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-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" This does require an extra two checks within the slow paths to replace the assert that we're moving. Signed-off-by: Richard Henderson Reviewed-by: Alex Benn=C3=A9e --- tcg/aarch64/tcg-target.inc.c | 35 ++++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/tcg/aarch64/tcg-target.inc.c b/tcg/aarch64/tcg-target.inc.c index 16f08c59c4..77f0ca4d5e 100644 --- a/tcg/aarch64/tcg-target.inc.c +++ b/tcg/aarch64/tcg-target.inc.c @@ -78,20 +78,26 @@ static const int tcg_target_call_oarg_regs[1] =3D { #define TCG_REG_GUEST_BASE TCG_REG_X28 #endif =20 -static inline void reloc_pc26(tcg_insn_unit *code_ptr, tcg_insn_unit *targ= et) +static inline bool reloc_pc26(tcg_insn_unit *code_ptr, tcg_insn_unit *targ= et) { ptrdiff_t offset =3D target - code_ptr; - tcg_debug_assert(offset =3D=3D sextract64(offset, 0, 26)); - /* read instruction, mask away previous PC_REL26 parameter contents, - set the proper offset, then write back the instruction. */ - *code_ptr =3D deposit32(*code_ptr, 0, 26, offset); + if (offset =3D=3D sextract64(offset, 0, 26)) { + /* read instruction, mask away previous PC_REL26 parameter content= s, + set the proper offset, then write back the instruction. */ + *code_ptr =3D deposit32(*code_ptr, 0, 26, offset); + return true; + } + return false; } =20 -static inline void reloc_pc19(tcg_insn_unit *code_ptr, tcg_insn_unit *targ= et) +static inline bool reloc_pc19(tcg_insn_unit *code_ptr, tcg_insn_unit *targ= et) { ptrdiff_t offset =3D target - code_ptr; - tcg_debug_assert(offset =3D=3D sextract64(offset, 0, 19)); - *code_ptr =3D deposit32(*code_ptr, 5, 19, offset); + if (offset =3D=3D sextract64(offset, 0, 19)) { + *code_ptr =3D deposit32(*code_ptr, 5, 19, offset); + return true; + } + return false; } =20 static inline bool patch_reloc(tcg_insn_unit *code_ptr, int type, @@ -101,15 +107,12 @@ static inline bool patch_reloc(tcg_insn_unit *code_pt= r, int type, switch (type) { case R_AARCH64_JUMP26: case R_AARCH64_CALL26: - reloc_pc26(code_ptr, (tcg_insn_unit *)value); - break; + return reloc_pc26(code_ptr, (tcg_insn_unit *)value); case R_AARCH64_CONDBR19: - reloc_pc19(code_ptr, (tcg_insn_unit *)value); - break; + return reloc_pc19(code_ptr, (tcg_insn_unit *)value); default: tcg_abort(); } - return true; } =20 #define TCG_CT_CONST_AIMM 0x100 @@ -1387,7 +1390,8 @@ static void tcg_out_qemu_ld_slow_path(TCGContext *s, = TCGLabelQemuLdst *lb) TCGMemOp opc =3D get_memop(oi); TCGMemOp size =3D opc & MO_SIZE; =20 - reloc_pc19(lb->label_ptr[0], s->code_ptr); + bool ok =3D reloc_pc19(lb->label_ptr[0], s->code_ptr); + tcg_debug_assert(ok); =20 tcg_out_mov(s, TCG_TYPE_PTR, TCG_REG_X0, TCG_AREG0); tcg_out_mov(s, TARGET_LONG_BITS =3D=3D 64, TCG_REG_X1, lb->addrlo_reg); @@ -1409,7 +1413,8 @@ static void tcg_out_qemu_st_slow_path(TCGContext *s, = TCGLabelQemuLdst *lb) TCGMemOp opc =3D get_memop(oi); TCGMemOp size =3D opc & MO_SIZE; =20 - reloc_pc19(lb->label_ptr[0], s->code_ptr); + bool ok =3D reloc_pc19(lb->label_ptr[0], s->code_ptr); + tcg_debug_assert(ok); =20 tcg_out_mov(s, TCG_TYPE_PTR, TCG_REG_X0, TCG_AREG0); tcg_out_mov(s, TARGET_LONG_BITS =3D=3D 64, TCG_REG_X1, lb->addrlo_reg); --=20 2.17.2 From nobody Sat May 18 04:30:15 2024 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.zohomail.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; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1543615054914649.4767258242853; Fri, 30 Nov 2018 13:57:34 -0800 (PST) Received: from localhost ([::1]:34756 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gSqmz-0004YB-Mq for importer@patchew.org; Fri, 30 Nov 2018 16:57:33 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52700) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gSqiL-0008BT-Tu for qemu-devel@nongnu.org; Fri, 30 Nov 2018 16:52:46 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gSqiI-0007Uw-Cg for qemu-devel@nongnu.org; Fri, 30 Nov 2018 16:52:45 -0500 Received: from mail-pf1-x442.google.com ([2607:f8b0:4864:20::442]:33625) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gSqiI-0007Rn-7P for qemu-devel@nongnu.org; Fri, 30 Nov 2018 16:52:42 -0500 Received: by mail-pf1-x442.google.com with SMTP id c123so3445805pfb.0 for ; Fri, 30 Nov 2018 13:52:42 -0800 (PST) Received: from cloudburst.twiddle.net (97-113-170-180.tukw.qwest.net. [97.113.170.180]) by smtp.gmail.com with ESMTPSA id a18sm6973967pgj.30.2018.11.30.13.52.39 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 30 Nov 2018 13:52:40 -0800 (PST) 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=8d6/+vDMAvBZgsrjYW7C4rNaADj256qJL0tBGY8IUpM=; b=EpGO1L28KpxiPJuzMayFrp+B5mRHRhs/jMBtgTcNox7cBMT4aQIs4Ua4ZttoVSE2JM h7bkL9MKdznGWwUtcJo5p9T3GB2bXVmFuzFm6ir3I+zNf0amZ4hD/PLmH8u4v00g1Kgw VxLCpi2FtXs0gJD6CtLw55KXYF82oBwAIk8aM= 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=8d6/+vDMAvBZgsrjYW7C4rNaADj256qJL0tBGY8IUpM=; b=axAyY6/m6Rf87Z0gcZqnWNoqVWwKLMVVO2VmRG3UbUTX+hCSsl5KwLNBLe+QF8lKAS BCDVr9S5nye+z0AZAIRmyGhgHRbLQmOJrBKABkabcTFVRSbGcYK+zVyLcx0CTX4C+bT/ 2GRyUNEUNyvl9AaIMg6xqTDvH/fZu7ztJtIP0pHl2NU9vSc8QEDVhHG8NjbkvjpLzIit gDkoD7fujYqkhmEwKVJ5spBtTwNihPtfkOoQA+DijKAkzFwdZaOM03w0yelPeHaUmHCq negvNLv39hthkl2nyhWkxe8COklTBFjUR/tXkafv/DoHv7gwX+5J51fO6osFUjISM/fa 8F8w== X-Gm-Message-State: AA+aEWZBoJ6NOQ68QdYwaJD4flPbn9b92oN+1HfL1mPafSziat0Mjjig /pExzms0ojPUUrGfyqyz4cW14EKMi3I= X-Google-Smtp-Source: AFSGD/U4O6q3xyryIwfYzoZ6+a/agBWwxwsXToWTJRuME0q6fMVssPPm8UOuzXQwSsD3logzhXO/uA== X-Received: by 2002:a63:2d82:: with SMTP id t124mr6168883pgt.260.1543614760759; Fri, 30 Nov 2018 13:52:40 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Fri, 30 Nov 2018 13:52:19 -0800 Message-Id: <20181130215221.20554-15-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20181130215221.20554-1-richard.henderson@linaro.org> References: <20181130215221.20554-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::442 Subject: [Qemu-devel] [PATCH v3 14/16] tcg/arm: Return false on failure from patch_reloc 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: alex.bennee@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-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" This does require an extra two checks within the slow paths to replace the assert that we're moving. Signed-off-by: Richard Henderson Reviewed-by: Alex Benn=C3=A9e --- tcg/arm/tcg-target.inc.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/tcg/arm/tcg-target.inc.c b/tcg/arm/tcg-target.inc.c index deefa20fbf..49f57d655e 100644 --- a/tcg/arm/tcg-target.inc.c +++ b/tcg/arm/tcg-target.inc.c @@ -187,10 +187,14 @@ static const uint8_t tcg_cond_to_arm_cond[] =3D { [TCG_COND_GTU] =3D COND_HI, }; =20 -static inline void reloc_pc24(tcg_insn_unit *code_ptr, tcg_insn_unit *targ= et) +static inline bool reloc_pc24(tcg_insn_unit *code_ptr, tcg_insn_unit *targ= et) { ptrdiff_t offset =3D (tcg_ptr_byte_diff(target, code_ptr) - 8) >> 2; - *code_ptr =3D (*code_ptr & ~0xffffff) | (offset & 0xffffff); + if (offset =3D=3D sextract32(offset, 0, 24)) { + *code_ptr =3D (*code_ptr & ~0xffffff) | (offset & 0xffffff); + return true; + } + return false; } =20 static bool patch_reloc(tcg_insn_unit *code_ptr, int type, @@ -199,7 +203,7 @@ static bool patch_reloc(tcg_insn_unit *code_ptr, int ty= pe, tcg_debug_assert(addend =3D=3D 0); =20 if (type =3D=3D R_ARM_PC24) { - reloc_pc24(code_ptr, (tcg_insn_unit *)value); + return reloc_pc24(code_ptr, (tcg_insn_unit *)value); } else if (type =3D=3D R_ARM_PC13) { intptr_t diff =3D value - (uintptr_t)(code_ptr + 2); tcg_insn_unit insn =3D *code_ptr; @@ -213,7 +217,11 @@ static bool patch_reloc(tcg_insn_unit *code_ptr, int t= ype, } else { int rd =3D extract32(insn, 12, 4); int rt =3D rd =3D=3D TCG_REG_PC ? TCG_REG_TMP : rd; - assert(diff >=3D 0x1000 && diff < 0x100000); + + if (diff < 0x1000 || diff >=3D 0x100000) { + return false; + } + /* add rt, pc, #high */ *code_ptr++ =3D ((insn & 0xf0000000) | (1 << 25) | ARITH_ADD | (TCG_REG_PC << 16) | (rt << 12) @@ -1372,7 +1380,8 @@ static void tcg_out_qemu_ld_slow_path(TCGContext *s, = TCGLabelQemuLdst *lb) TCGMemOp opc =3D get_memop(oi); void *func; =20 - reloc_pc24(lb->label_ptr[0], s->code_ptr); + bool ok =3D reloc_pc24(lb->label_ptr[0], s->code_ptr); + tcg_debug_assert(ok); =20 argreg =3D tcg_out_arg_reg32(s, TCG_REG_R0, TCG_AREG0); if (TARGET_LONG_BITS =3D=3D 64) { @@ -1432,7 +1441,8 @@ static void tcg_out_qemu_st_slow_path(TCGContext *s, = TCGLabelQemuLdst *lb) TCGMemOpIdx oi =3D lb->oi; TCGMemOp opc =3D get_memop(oi); =20 - reloc_pc24(lb->label_ptr[0], s->code_ptr); + bool ok =3D reloc_pc24(lb->label_ptr[0], s->code_ptr); + tcg_debug_assert(ok); =20 argreg =3D TCG_REG_R0; argreg =3D tcg_out_arg_reg32(s, argreg, TCG_AREG0); --=20 2.17.2 From nobody Sat May 18 04:30:15 2024 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.zohomail.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; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1543615317533329.38596750624345; Fri, 30 Nov 2018 14:01:57 -0800 (PST) Received: from localhost ([::1]:34788 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gSqrE-0001Gx-BN for importer@patchew.org; Fri, 30 Nov 2018 17:01:56 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52701) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gSqiL-0008BX-UA for qemu-devel@nongnu.org; Fri, 30 Nov 2018 16:52:46 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gSqiJ-0007cP-Jf for qemu-devel@nongnu.org; Fri, 30 Nov 2018 16:52:45 -0500 Received: from mail-pg1-x542.google.com ([2607:f8b0:4864:20::542]:35352) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gSqiJ-0007XU-Dn for qemu-devel@nongnu.org; Fri, 30 Nov 2018 16:52:43 -0500 Received: by mail-pg1-x542.google.com with SMTP id s198so3064345pgs.2 for ; Fri, 30 Nov 2018 13:52:43 -0800 (PST) Received: from cloudburst.twiddle.net (97-113-170-180.tukw.qwest.net. [97.113.170.180]) by smtp.gmail.com with ESMTPSA id a18sm6973967pgj.30.2018.11.30.13.52.40 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 30 Nov 2018 13:52:41 -0800 (PST) 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=bmUmb8zTaahVnT4oIhk8zyyRNcm/80ZCLJTuwVNXCf8=; b=KEtaNMs2TsPv8UqimAS6HAQc6Qi5a/W2i45sjrFZtuHnr1lnzDKNEOHm2ocWbjkbD1 mkfWpwaX+R/SBK0eYB+XtbMUxvxxU72GUC6GfJMjcZg+mjwVFZbnBeoqitDY4M5/sUnC rr6O08+RYSl4Q1Nxh1HzETSNf8fECRsPBg0qk= 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=bmUmb8zTaahVnT4oIhk8zyyRNcm/80ZCLJTuwVNXCf8=; b=Ei3efNrDYAvSwWCYG8cTqzVYmPyV6XV69PWjBe/TovuiKrrflCWw+b+yr6M68gVG7s mfdD7uSNNjYSixGf8TnJHiAITIFuPtZsaAXx1rFNLrePXu5CO1ZJbyk1AH9CtCENULeM XDtNSTfunXJi7tRWoxp4LhJN26vt3VL7y+Qt9rFyd3qdjC0dwANOsxx+or5Bc9kW06L9 NNanyl/WT67m8oWF7TQJImtm4w3F0TCbb37krm5q+jEmaJYMhcNRAT3F6KO+5llRRXxY euH7bAMpRsv1dmTdXJPDaTeIRPzeuSMIozJN8BDsA9sJTbwce1RSJ0eZSI535PISBQ/D eZfQ== X-Gm-Message-State: AA+aEWb0CfbysIMJAmOArGTJ96ZlcxQiWfcyBCzFVIxv6plVz+3IyyRK m1asA20U6zS+bE4d6OoispoyrsKQsg4= X-Google-Smtp-Source: AFSGD/UBWiSfxKpJvLJ+SSfx9NSoXNVNR0HFKpN6oLbgRt88wlYyenhwGceYqXTbDQSN9BNFP/pSjw== X-Received: by 2002:a63:5f95:: with SMTP id t143mr6237306pgb.395.1543614761989; Fri, 30 Nov 2018 13:52:41 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Fri, 30 Nov 2018 13:52:20 -0800 Message-Id: <20181130215221.20554-16-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20181130215221.20554-1-richard.henderson@linaro.org> References: <20181130215221.20554-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::542 Subject: [Qemu-devel] [PATCH v3 15/16] tcg/ppc: Return false on failure from patch_reloc 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: alex.bennee@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-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" The reloc_pc{14,24}_val routines retain their asserts. Use these directly within the slow paths. Signed-off-by: Richard Henderson Reviewed-by: Alex Benn=C3=A9e --- tcg/ppc/tcg-target.inc.c | 32 +++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/tcg/ppc/tcg-target.inc.c b/tcg/ppc/tcg-target.inc.c index 860b0d36e1..8c1cfdd7ac 100644 --- a/tcg/ppc/tcg-target.inc.c +++ b/tcg/ppc/tcg-target.inc.c @@ -193,9 +193,14 @@ static uint32_t reloc_pc24_val(tcg_insn_unit *pc, tcg_= insn_unit *target) return disp & 0x3fffffc; } =20 -static void reloc_pc24(tcg_insn_unit *pc, tcg_insn_unit *target) +static bool reloc_pc24(tcg_insn_unit *pc, tcg_insn_unit *target) { - *pc =3D (*pc & ~0x3fffffc) | reloc_pc24_val(pc, target); + ptrdiff_t disp =3D tcg_ptr_byte_diff(target, pc); + if (in_range_b(disp)) { + *pc =3D (*pc & ~0x3fffffc) | (disp & 0x3fffffc); + return true; + } + return false; } =20 static uint16_t reloc_pc14_val(tcg_insn_unit *pc, tcg_insn_unit *target) @@ -205,9 +210,14 @@ static uint16_t reloc_pc14_val(tcg_insn_unit *pc, tcg_= insn_unit *target) return disp & 0xfffc; } =20 -static void reloc_pc14(tcg_insn_unit *pc, tcg_insn_unit *target) +static bool reloc_pc14(tcg_insn_unit *pc, tcg_insn_unit *target) { - *pc =3D (*pc & ~0xfffc) | reloc_pc14_val(pc, target); + ptrdiff_t disp =3D tcg_ptr_byte_diff(target, pc); + if (disp =3D=3D (int16_t) disp) { + *pc =3D (*pc & ~0xfffc) | (disp & 0xfffc); + return true; + } + return false; } =20 /* parse target specific constraints */ @@ -524,11 +534,9 @@ static bool patch_reloc(tcg_insn_unit *code_ptr, int t= ype, =20 switch (type) { case R_PPC_REL14: - reloc_pc14(code_ptr, target); - break; + return reloc_pc14(code_ptr, target); case R_PPC_REL24: - reloc_pc24(code_ptr, target); - break; + return reloc_pc24(code_ptr, target); case R_PPC_ADDR16: /* We are abusing this relocation type. This points to a pair of insns, addis + load. If the displacement is small, we @@ -540,7 +548,9 @@ static bool patch_reloc(tcg_insn_unit *code_ptr, int ty= pe, } else { int16_t lo =3D value; int hi =3D value - lo; - assert(hi + lo =3D=3D value); + if (hi + lo !=3D value) { + return false; + } code_ptr[0] =3D deposit32(code_ptr[0], 0, 16, hi >> 16); code_ptr[1] =3D deposit32(code_ptr[1], 0, 16, lo); } @@ -1638,7 +1648,7 @@ static void tcg_out_qemu_ld_slow_path(TCGContext *s, = TCGLabelQemuLdst *lb) TCGMemOp opc =3D get_memop(oi); TCGReg hi, lo, arg =3D TCG_REG_R3; =20 - reloc_pc14(lb->label_ptr[0], s->code_ptr); + **lb->label_ptr |=3D reloc_pc14_val(*lb->label_ptr, s->code_ptr); =20 tcg_out_mov(s, TCG_TYPE_PTR, arg++, TCG_AREG0); =20 @@ -1683,7 +1693,7 @@ static void tcg_out_qemu_st_slow_path(TCGContext *s, = TCGLabelQemuLdst *lb) TCGMemOp s_bits =3D opc & MO_SIZE; TCGReg hi, lo, arg =3D TCG_REG_R3; =20 - reloc_pc14(lb->label_ptr[0], s->code_ptr); + **lb->label_ptr |=3D reloc_pc14_val(*lb->label_ptr, s->code_ptr); =20 tcg_out_mov(s, TCG_TYPE_PTR, arg++, TCG_AREG0); =20 --=20 2.17.2 From nobody Sat May 18 04:30:15 2024 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.zohomail.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; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1543615218615549.2345990043517; Fri, 30 Nov 2018 14:00:18 -0800 (PST) Received: from localhost ([::1]:34768 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gSqpd-0008Gn-Dp for importer@patchew.org; Fri, 30 Nov 2018 17:00:17 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52703) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gSqiL-0008Ba-US for qemu-devel@nongnu.org; Fri, 30 Nov 2018 16:52:46 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gSqiK-0007ib-Kb for qemu-devel@nongnu.org; Fri, 30 Nov 2018 16:52:45 -0500 Received: from mail-pf1-x442.google.com ([2607:f8b0:4864:20::442]:34160) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gSqiK-0007eq-Ex for qemu-devel@nongnu.org; Fri, 30 Nov 2018 16:52:44 -0500 Received: by mail-pf1-x442.google.com with SMTP id h3so3443759pfg.1 for ; Fri, 30 Nov 2018 13:52:44 -0800 (PST) Received: from cloudburst.twiddle.net (97-113-170-180.tukw.qwest.net. [97.113.170.180]) by smtp.gmail.com with ESMTPSA id a18sm6973967pgj.30.2018.11.30.13.52.42 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 30 Nov 2018 13:52:42 -0800 (PST) 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=bdn6ft2Vb9uaum1Y6rFdWVXmAAedWixPu3DebQxWV5c=; b=RN0E9CxHim+2Gvl+OSSRIz426QSNxo/wTFIwBcIw7JJAbkb90m1s2tlUNOW2Dvn/Bi tWKniyA/rZS7FND6W17scFYmrwcIL6QAiApwdrf1SqG23nSGjqW4t3JEICB3bkexf1BW foVHcqgdMvO98/FE71hgZPBC0xglQz78vWecE= 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=bdn6ft2Vb9uaum1Y6rFdWVXmAAedWixPu3DebQxWV5c=; b=DzFDmQQGFJu+A18z8cRQss77MxUgzXeiXrgiaRCQ3wqXsnMr3IK/3VnFUdJP5Wr0Y2 VhwzL4jd5x+VfPxhqmSJe+EsFZ49gxxnXNczWpEMD0+ZDQP03A/8PzG9RtS0oIJrKVE7 uoS1ecsOj/2A+N3l+x/QPPjvVl0MlG/oze5GVOaFjEPo5VMQyBUdmBCbxpJq3cvsFtjb TnnbCUc+NXG6i3T9DaKFGrL1lnkg8P5HHvWCrEmqjaRMSN05i5uJrqCjIyP+kiPX4oQZ VxYuYSuViMHbC9IQmznrJCVr1oDhC2n3ey9TG+SexjS8Vb9m6NLygoc9hDKz2vsonhzb sUyg== X-Gm-Message-State: AA+aEWYdyDS+6ePVdY3scinsJdyaRKrBUFwbvZA0AXvqQZ3OBdPwa9hL +Zr9wqn+xmoRM2eq9wS+HKShGv/P1FQ= X-Google-Smtp-Source: AFSGD/VGpJnvlcwrQTBhRGvtWbtJPp2jlKvuGqlOW3olGlPBNpFabs24B2E1HgpMXbIirHO+IYeHbA== X-Received: by 2002:a62:7796:: with SMTP id s144mr7199375pfc.26.1543614763258; Fri, 30 Nov 2018 13:52:43 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Fri, 30 Nov 2018 13:52:21 -0800 Message-Id: <20181130215221.20554-17-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20181130215221.20554-1-richard.henderson@linaro.org> References: <20181130215221.20554-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::442 Subject: [Qemu-devel] [PATCH v3 16/16] tcg/s390x: Return false on failure from patch_reloc 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: alex.bennee@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-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" This does require an extra two checks within the slow paths to replace the assert that we're moving. Also add two checks within existing functions that lacked any kind of assert for out of range branch. Signed-off-by: Richard Henderson Reviewed-by: Alex Benn=C3=A9e --- tcg/s390/tcg-target.inc.c | 34 +++++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/tcg/s390/tcg-target.inc.c b/tcg/s390/tcg-target.inc.c index 68a4c60394..39ecf609a1 100644 --- a/tcg/s390/tcg-target.inc.c +++ b/tcg/s390/tcg-target.inc.c @@ -377,23 +377,29 @@ static bool patch_reloc(tcg_insn_unit *code_ptr, int = type, =20 switch (type) { case R_390_PC16DBL: - assert(pcrel2 =3D=3D (int16_t)pcrel2); - tcg_patch16(code_ptr, pcrel2); + if (pcrel2 =3D=3D (int16_t)pcrel2) { + tcg_patch16(code_ptr, pcrel2); + return true; + } break; case R_390_PC32DBL: - assert(pcrel2 =3D=3D (int32_t)pcrel2); - tcg_patch32(code_ptr, pcrel2); + if (pcrel2 =3D=3D (int32_t)pcrel2) { + tcg_patch32(code_ptr, pcrel2); + return true; + } break; case R_390_20: - assert(value =3D=3D sextract64(value, 0, 20)); - old =3D *(uint32_t *)code_ptr & 0xf00000ff; - old |=3D ((value & 0xfff) << 16) | ((value & 0xff000) >> 4); - tcg_patch32(code_ptr, old); + if (value =3D=3D sextract64(value, 0, 20)) { + old =3D *(uint32_t *)code_ptr & 0xf00000ff; + old |=3D ((value & 0xfff) << 16) | ((value & 0xff000) >> 4); + tcg_patch32(code_ptr, old); + return true; + } break; default: g_assert_not_reached(); } - return true; + return false; } =20 /* parse target specific constraints */ @@ -1334,6 +1340,7 @@ static void tgen_compare_branch(TCGContext *s, S390Op= code opc, int cc, =20 if (l->has_value) { off =3D l->u.value_ptr - s->code_ptr; + tcg_debug_assert(off =3D=3D (int16_t)off); } else { tcg_out_reloc(s, s->code_ptr + 1, R_390_PC16DBL, l, 2); } @@ -1350,6 +1357,7 @@ static void tgen_compare_imm_branch(TCGContext *s, S3= 90Opcode opc, int cc, =20 if (l->has_value) { off =3D l->u.value_ptr - s->code_ptr; + tcg_debug_assert(off =3D=3D (int16_t)off); } else { tcg_out_reloc(s, s->code_ptr + 1, R_390_PC16DBL, l, 2); } @@ -1615,7 +1623,9 @@ static void tcg_out_qemu_ld_slow_path(TCGContext *s, = TCGLabelQemuLdst *lb) TCGMemOpIdx oi =3D lb->oi; TCGMemOp opc =3D get_memop(oi); =20 - patch_reloc(lb->label_ptr[0], R_390_PC16DBL, (intptr_t)s->code_ptr, 2); + bool ok =3D patch_reloc(lb->label_ptr[0], R_390_PC16DBL, + (intptr_t)s->code_ptr, 2); + tcg_debug_assert(ok); =20 tcg_out_mov(s, TCG_TYPE_PTR, TCG_REG_R2, TCG_AREG0); if (TARGET_LONG_BITS =3D=3D 64) { @@ -1636,7 +1646,9 @@ static void tcg_out_qemu_st_slow_path(TCGContext *s, = TCGLabelQemuLdst *lb) TCGMemOpIdx oi =3D lb->oi; TCGMemOp opc =3D get_memop(oi); =20 - patch_reloc(lb->label_ptr[0], R_390_PC16DBL, (intptr_t)s->code_ptr, 2); + bool ok =3D patch_reloc(lb->label_ptr[0], R_390_PC16DBL, + (intptr_t)s->code_ptr, 2); + tcg_debug_assert(ok); =20 tcg_out_mov(s, TCG_TYPE_PTR, TCG_REG_R2, TCG_AREG0); if (TARGET_LONG_BITS =3D=3D 64) { --=20 2.17.2