From nobody Sat Sep 28 22:16:18 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1610051973; cv=none; d=zohomail.com; s=zohoarc; b=iSakIODIkXsUssN8IrjlUwR+q+VQpIEV4UgyIg6fY0buMJb+0t0npv+6rsqm/c8Ke0cB0nawtqZaYwvmHWSso0VuGc3TwGLfO13GL8GFJ/JAs/UKyM3SS7XuVlYK85FUxJ4k68LRRkvuO4WsjXSt3KSWDbyMja+RagmgWHK6kiM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610051973; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=5vS8wJ/iNPyRl3pgmKuFkCd5a4WmbW3WD3BdbgSErfg=; b=jSUYOEBLJYUVT/+iCJMgjv7QbYf6L4ZEqRtiMB2voLQJIEETST7ZZyodKdkjpKNAeHbdowNAbt92BgF6qBZwLANvJtqLQTDhPVnMM76OtsTAqRbS8NGX/p2FYlYU3Y95rdhJYfv4R5H6X3YhO/nuY4EV0YVj5/GbzlDlVuplTR4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1610051973498442.32421234762603; Thu, 7 Jan 2021 12:39:33 -0800 (PST) Received: from localhost ([::1]:35240 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kxc4A-0006r5-Dc for importer@patchew.org; Thu, 07 Jan 2021 15:39:30 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:48356) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kxbh6-0001Nt-61 for qemu-devel@nongnu.org; Thu, 07 Jan 2021 15:15:40 -0500 Received: from mail-pl1-x636.google.com ([2607:f8b0:4864:20::636]:36164) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kxbh3-0001ea-N4 for qemu-devel@nongnu.org; Thu, 07 Jan 2021 15:15:39 -0500 Received: by mail-pl1-x636.google.com with SMTP id j1so4165206pld.3 for ; Thu, 07 Jan 2021 12:15:37 -0800 (PST) Received: from localhost.localdomain (rrcs-173-197-107-21.west.biz.rr.com. [173.197.107.21]) by smtp.gmail.com with ESMTPSA id v6sm6516265pfi.31.2021.01.07.12.15.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Jan 2021 12:15: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 :mime-version:content-transfer-encoding; bh=5vS8wJ/iNPyRl3pgmKuFkCd5a4WmbW3WD3BdbgSErfg=; b=iSfwg+owDfwgoLHj9v6crVpM3LXFewuxozctCyLg4vC2uir/Hq/Usk4vPtb+rWo2Pe SNCpU7i+3CIWHu9Klt/bYvSog0vTI/C0Ga0zKAcqwIDv9QfummrgyKYPuQsI8ldFZZUK JouM+Y0JDVTXCNpfERVSGTgXikP5pes5q6h8JYlfd3bMCzHZYGgPlg1VFgme9qzUG2vH RrRnCnehw941d06ad0CCYqPH84BPWxT6PZ9orCqSOpuQqgGLAThWZ5F1bsqc+bE3oYtw w6xdIpzKHv1qZB2iswqQoH9mcrWOx2QircArcU7/XrXFJX+/eFV2m6IgBQf5av8GOqI/ kdxA== 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=5vS8wJ/iNPyRl3pgmKuFkCd5a4WmbW3WD3BdbgSErfg=; b=ks7LklHnouKO1MwNC/qyv9z/HvuHihZGu0qKHa9R1JO5NLeih4F37pEcvE+mgWqbYN eHrlhqfn0fy0uSzlevHZYQO5SVoDhfg+/492AmfFuEO/t8+uMC0SmJkgcU1E1dhFy7qC k02Y4wbpiuwC5xj+/IMtsMleU6mJqoWyRHmLIbgJpe5tBd0XWwVkKtBtvo8mjXC06hnF EK8uQ4nuTThimQOnk3Bnp8Enx0n/hDWlpCxexpO0fztF8uzunnx4YXt7s29nnHkrWOMr 2GD0kuAlrJqH2Blq5BEH3wPXTezgz/LMaEwvmKJMzQ2h8cegTG6EoltNUUcV1lZIkKgL 9LMQ== X-Gm-Message-State: AOAM533YG9JEHxkS4IkcMoSaauQJlmCSuPkkZ5V55UW37AYi2/PWFZXa H5vDBOC00vbglVqS/P7hs8pBy4omUvgq+Q== X-Google-Smtp-Source: ABdhPJwOl7yu98TJM+J/xcumW2DeoF8OIYumqjGJJiR3FQSlplZp0dDZ2kgrPmSlxRTHx/OmHldWTg== X-Received: by 2002:a17:902:854b:b029:db:c725:edcd with SMTP id d11-20020a170902854bb02900dbc725edcdmr534548plo.64.1610050536144; Thu, 07 Jan 2021 12:15:36 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 25/47] tcg/i386: Support split-wx code generation Date: Thu, 7 Jan 2021 10:14:26 -1000 Message-Id: <20210107201448.1152301-26-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210107201448.1152301-1-richard.henderson@linaro.org> References: <20210107201448.1152301-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::636; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x636.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, Joelle van Dyne Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Type: text/plain; charset="utf-8" Reviewed-by: Joelle van Dyne Signed-off-by: Richard Henderson --- tcg/i386/tcg-target.h | 2 +- tcg/i386/tcg-target.c.inc | 20 +++++++++++--------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/tcg/i386/tcg-target.h b/tcg/i386/tcg-target.h index 73aa45a665..cb1b138b66 100644 --- a/tcg/i386/tcg-target.h +++ b/tcg/i386/tcg-target.h @@ -235,6 +235,6 @@ static inline void tb_target_set_jmp_target(uintptr_t t= c_ptr, uintptr_t jmp_rx, #define TCG_TARGET_NEED_LDST_LABELS #endif #define TCG_TARGET_NEED_POOL_LABELS -#define TCG_TARGET_SUPPORT_MIRROR 0 +#define TCG_TARGET_SUPPORT_MIRROR 1 =20 #endif diff --git a/tcg/i386/tcg-target.c.inc b/tcg/i386/tcg-target.c.inc index d272975ff1..34bf0b9a35 100644 --- a/tcg/i386/tcg-target.c.inc +++ b/tcg/i386/tcg-target.c.inc @@ -164,7 +164,7 @@ static bool have_lzcnt; # define have_lzcnt 0 #endif =20 -static tcg_insn_unit *tb_ret_addr; +static const tcg_insn_unit *tb_ret_addr; =20 static bool patch_reloc(tcg_insn_unit *code_ptr, int type, intptr_t value, intptr_t addend) @@ -172,7 +172,7 @@ static bool patch_reloc(tcg_insn_unit *code_ptr, int ty= pe, value +=3D addend; switch(type) { case R_386_PC32: - value -=3D (uintptr_t)code_ptr; + value -=3D (uintptr_t)tcg_splitwx_to_rx(code_ptr); if (value !=3D (int32_t)value) { return false; } @@ -181,7 +181,7 @@ static bool patch_reloc(tcg_insn_unit *code_ptr, int ty= pe, tcg_patch32(code_ptr, value); break; case R_386_PC8: - value -=3D (uintptr_t)code_ptr; + value -=3D (uintptr_t)tcg_splitwx_to_rx(code_ptr); if (value !=3D (int8_t)value) { return false; } @@ -1015,7 +1015,7 @@ static void tcg_out_movi(TCGContext *s, TCGType type, } =20 /* Try a 7 byte pc-relative lea before the 10 byte movq. */ - diff =3D arg - ((uintptr_t)s->code_ptr + 7); + diff =3D tcg_pcrel_diff(s, (const void *)arg) - 7; if (diff =3D=3D (int32_t)diff) { tcg_out_opc(s, OPC_LEA | P_REXW, ret, 0, 0); tcg_out8(s, (LOWREGMASK(ret) << 3) | 5); @@ -1624,7 +1624,7 @@ static inline void tcg_out_call(TCGContext *s, const = tcg_insn_unit *dest) tcg_out_branch(s, 1, dest); } =20 -static void tcg_out_jmp(TCGContext *s, tcg_insn_unit *dest) +static void tcg_out_jmp(TCGContext *s, const tcg_insn_unit *dest) { tcg_out_branch(s, 0, dest); } @@ -1795,7 +1795,8 @@ static void add_qemu_ldst_label(TCGContext *s, bool i= s_ld, bool is_64, label->datahi_reg =3D datahi; label->addrlo_reg =3D addrlo; label->addrhi_reg =3D addrhi; - label->raddr =3D raddr; + /* TODO: Cast goes away when all hosts converted */ + label->raddr =3D (void *)tcg_splitwx_to_rx(raddr); label->label_ptr[0] =3D label_ptr[0]; if (TARGET_LONG_BITS > TCG_TARGET_REG_BITS) { label->label_ptr[1] =3D label_ptr[1]; @@ -2253,7 +2254,7 @@ static inline void tcg_out_op(TCGContext *s, TCGOpcod= e opc, /* jump displacement must be aligned for atomic patching; * see if we need to add extra nops before jump */ - gap =3D tcg_pcrel_diff(s, QEMU_ALIGN_PTR_UP(s->code_ptr + 1, 4= )); + gap =3D QEMU_ALIGN_PTR_UP(s->code_ptr + 1, 4) - s->code_ptr; if (gap !=3D 1) { tcg_out_nopn(s, gap - 1); } @@ -3803,11 +3804,12 @@ static void tcg_target_qemu_prologue(TCGContext *s) * Return path for goto_ptr. Set return value to 0, a-la exit_tb, * and fall through to the rest of the epilogue. */ - tcg_code_gen_epilogue =3D s->code_ptr; + /* TODO: Cast goes away when all hosts converted */ + tcg_code_gen_epilogue =3D (void *)tcg_splitwx_to_rx(s->code_ptr); tcg_out_movi(s, TCG_TYPE_REG, TCG_REG_EAX, 0); =20 /* TB epilogue */ - tb_ret_addr =3D s->code_ptr; + tb_ret_addr =3D tcg_splitwx_to_rx(s->code_ptr); =20 tcg_out_addi(s, TCG_REG_CALL_STACK, stack_addend); =20 --=20 2.25.1