From patchwork Fri Nov 23 14:45:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 151881 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp2211051ljp; Fri, 23 Nov 2018 06:49:52 -0800 (PST) X-Google-Smtp-Source: AJdET5fZKoWKyhHHZCtZVTCtmdejGbeFGAb+pZSzVz0wi45Wa8V0deiduyfavFTEiKIpaJny4abH X-Received: by 2002:a81:3594:: with SMTP id c142mr16955664ywa.234.1542984592399; Fri, 23 Nov 2018 06:49:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542984592; cv=none; d=google.com; s=arc-20160816; b=FT3rkhOFwwcS+bFPOUZX8C9RKCRPI5E45XS5uuAC0U+iYSOlbcP5tCdTXkRaYmiLWt NEpE3fe0LCMgQ+UCg3gnqs/pcykXbnMd6e8UYf3S5IlQ9TMOoDHwdRSrLqiolokYWsN4 uA4j5cHzKkR2u3ZecdjyY3TNdHoziYUXiCJQds9GAFROHiKmhuplAPu0FRgQ+AMtlgFJ RhAAienD5REQt7uX1NhQNI8meWOpBYK/Ex0oX44mqAGZXKpBHvJzUCTSPNtZsSYqLh6I TL8pVf1YF16I+cnoQZ5TBC4W07Mr2hrSkbUO3uqSno1HXSmN691Obe9sG3vMEzS1BjSj 8GcQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=LVTH7A9iopjvf2drxrX25J5edqtzezG4K/9PFSj6hBg=; b=MBB4MLbopKC+F5V4U41JpuIXO5D7SrpJQ2opVbbz3XCcaMsqbxA3V+9lSIoCpkZmjP UWW4maZUT6GB/H3tr6qgODl5DWeCW56w+myoJ+UjxX0v0tbniYZ8J3wNXfBBXs6JJXTq JTatzmI5US+81jjIwCGcARCblBiup6Guz7Ll6XeJlszabgqYboLObNYVeS8XdLKDwPnT BcVuNGLTvZTyAPdQj1GWJAC1keRACOEazd5/QIZ1TqRHG4VmWZ7nvbP2T4Dwv7cWpWP7 TXle+hx3dMEuVODffoS2kRNRsdu0J12OqCapI2Sgyq0jFyxXN7A60VsPTfy5+sgcZ2XH WeLg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=GXAQFiFf; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id t70si454770ywe.49.2018.11.23.06.49.52 for (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 23 Nov 2018 06:49:52 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=GXAQFiFf; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:52769 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gQCmF-0003qR-Fb for patch@linaro.org; Fri, 23 Nov 2018 09:49:51 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43813) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gQCig-0007yY-T5 for qemu-devel@nongnu.org; Fri, 23 Nov 2018 09:46:12 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gQCif-0003AS-Oc for qemu-devel@nongnu.org; Fri, 23 Nov 2018 09:46:10 -0500 Received: from mail-wm1-x343.google.com ([2a00:1450:4864:20::343]:38779) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gQCif-00038g-HQ for qemu-devel@nongnu.org; Fri, 23 Nov 2018 09:46:09 -0500 Received: by mail-wm1-x343.google.com with SMTP id k198so12261561wmd.3 for ; Fri, 23 Nov 2018 06:46:08 -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=LVTH7A9iopjvf2drxrX25J5edqtzezG4K/9PFSj6hBg=; b=GXAQFiFfHEr+5Kj6xpKsuBuDkpHG6NMlZ4VPMXf788gjNc+Oai1tJrOdV5N+5IHZ5F 56AIt0Fz37CfMmcZPKQAyNvxNhtq0arfOTAEq7ZkGVOgpnS8zlxJTQkuHhzmVgPYX6TK fpJM1L5cPGgpocBK1D6vMBnP7pVE4LM7Kp36c= 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=LVTH7A9iopjvf2drxrX25J5edqtzezG4K/9PFSj6hBg=; b=ubcomIvNgGxsSmgBHRNSAi61RGTQ0Kjj2kBkkUj5JIm/E+Jk0KZIm/TETU0YB1/f0X L7fK3ExqQIr8VpxMhzSnGU3qv/3I0luJZRIQbDp7PFM5fM071N/BUmVx7i1NELwUml3d 2k8R0euhMrwnMgclni1A2Xd6SeiTSd9Fix2lfX1MpMTWE8T5XHN6BTj0AIlmexxujeO0 StL8CD7B/oCXe1IpJiAWEatyxrcorjQmB2BuO4m1ulhCGJ1c1eqcYdWpXhs2+6MhvysS zWk4owKM3i7caJ3N2ziECmG1RU+EIg8bzoLE1MMvoz5fTzI+b8IAdyp2pFx2QNO0dXmz hq3A== X-Gm-Message-State: AA+aEWaBHiARpjzFPK4Y4wVvNMl9D/wNjCRoixVzu8C2nx//m65Zz1fO hliD2PLHBc33n68zSjtmVjX3ewf42irccQ== X-Received: by 2002:a1c:b7c1:: with SMTP id h184-v6mr14083142wmf.33.1542984367389; Fri, 23 Nov 2018 06:46:07 -0800 (PST) Received: from cloudburst.twiddle.net ([195.77.246.50]) by smtp.gmail.com with ESMTPSA id p74sm10339630wmd.29.2018.11.23.06.46.06 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 23 Nov 2018 06:46:06 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Fri, 23 Nov 2018 15:45:28 +0100 Message-Id: <20181123144558.5048-8-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20181123144558.5048-1-richard.henderson@linaro.org> References: <20181123144558.5048-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::343 Subject: [Qemu-devel] [PATCH for-4.0 v2 07/37] tcg/i386: Change TCG_REG_L[01] to not overlap function arguments 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: Alistair.Francis@wdc.com Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" We will shortly be forcing qemu_ld/st arguments into registers that match the function call abi of the host, which means that the temps must be elsewhere. Signed-off-by: Richard Henderson --- tcg/i386/tcg-target.inc.c | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) -- 2.17.2 Reviewed-by: Alex Bennée diff --git a/tcg/i386/tcg-target.inc.c b/tcg/i386/tcg-target.inc.c index 3234a8d8bf..07df4b2b12 100644 --- a/tcg/i386/tcg-target.inc.c +++ b/tcg/i386/tcg-target.inc.c @@ -121,12 +121,16 @@ static const int tcg_target_call_oarg_regs[] = { #define TCG_CT_CONST_I32 0x400 #define TCG_CT_CONST_WSZ 0x800 -/* Registers used with L constraint, which are the first argument - registers on x86_64, and two random call clobbered registers on - i386. */ +/* Registers used with L constraint, which are two random + * call clobbered registers. These should be free. + */ #if TCG_TARGET_REG_BITS == 64 -# define TCG_REG_L0 tcg_target_call_iarg_regs[0] -# define TCG_REG_L1 tcg_target_call_iarg_regs[1] +# define TCG_REG_L0 TCG_REG_RAX +# ifdef _WIN64 +# define TCG_REG_L1 TCG_REG_R10 +# else +# define TCG_REG_L1 TCG_REG_RDI +# endif #else # define TCG_REG_L0 TCG_REG_EAX # define TCG_REG_L1 TCG_REG_EDX @@ -1628,6 +1632,7 @@ static TCGReg tcg_out_tlb_load(TCGContext *s, TCGReg addrlo, TCGReg addrhi, unsigned a_mask = (1 << a_bits) - 1; unsigned s_mask = (1 << s_bits) - 1; target_ulong tlb_mask; + TCGReg base; if (TCG_TARGET_REG_BITS == 64) { if (TARGET_LONG_BITS == 64) { @@ -1674,7 +1679,12 @@ static TCGReg tcg_out_tlb_load(TCGContext *s, TCGReg addrlo, TCGReg addrhi, before the fastpath ADDQ below. For 64-bit guest and x32 host, MOVQ copies the entire guest address for the slow path, while truncation for the 32-bit host happens with the fastpath ADDL below. */ - tcg_out_mov(s, ttype, r1, addrlo); + if (TCG_TARGET_REG_BITS == 64) { + base = tcg_target_call_iarg_regs[1]; + } else { + base = r1; + } + tcg_out_mov(s, ttype, base, addrlo); /* jne slow_path */ tcg_out_opc(s, OPC_JCC_long + JCC_JNE, 0, 0, 0); @@ -1693,11 +1703,11 @@ static TCGReg tcg_out_tlb_load(TCGContext *s, TCGReg addrlo, TCGReg addrhi, /* TLB Hit. */ - /* add addend(r0), r1 */ - tcg_out_modrm_offset(s, OPC_ADD_GvEv + hrexw, r1, r0, + /* add addend(r0), base */ + tcg_out_modrm_offset(s, OPC_ADD_GvEv + hrexw, base, r0, offsetof(CPUTLBEntry, addend) - which); - return r1; + return base; } /*