Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp911490pxb; Thu, 9 Sep 2021 15:12:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzdfEfSQxcgkkkhVbwquqQTRdFrk7uVinAoHioqWRmtDd+MWN4JDnE2UCBSNy1e75pte44o X-Received: by 2002:a92:6605:: with SMTP id a5mr3763355ilc.17.1631225526272; Thu, 09 Sep 2021 15:12:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631225526; cv=none; d=google.com; s=arc-20160816; b=JNu6RJPAobFFFFnwe5UFLAgkqXAg1nwwZ1WYPDS/JKI3m96eqdNS8fZ3P7bXXLKc3N Tpsf3XHQw245EQ61LO2Yux3CdFcCZ/jty67x2ji1WEpf2MRxxO/2p7m6IWDQ06q1QtXS TyAEjtpvkVt8vhYEhNHJRztlTGSMhWiMZRC7TuiIluwPpC436/2DQlc9PXjLOaWTuTDw ebkQB3fAux0fnB3kjo8F30jxAqh57pLgLM44Q57VOAUyDjuGAChuGhGsTIKWQydvRay8 I5XOn/lardmmHPZyd3o+fnotoQMX4cp4HANATv0la/D2fypmuPaBDFD14A1FGkL8zNiQ aVFw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-filter; bh=Yj10jMDgE21CotwexBht+qnc1+Xh+HUHPDT1ZPipEPA=; b=CqCcio1LzA0ITwhN3uryaCz5SaoC78Sy/kiNX9ypNw5dHYDzzX0yBlCHIjq0gTKeBf FBR7GqkOKjjY85pw4pk3mqdbUCC/pn9YcYKPu6T/A7mBr2wfX3bnkMO9f1oGAzUz/bnr i3LrYWXPB5sqU0HHeZ5zYvUycKrCMBABsTRckHDRuvOj/7mOPTXxWJq3JXaotZbFx4zm EFQsZXctEY3zEH9spRiY9rsaSibt2n3SQGRVx5C2MvxxpGLhM9mvgMsc3ztrN1+rQA/r hLz2LGOJLyBExMf/QKnTXflFK08uQq0j2lh9kbvVPfGxME0JRRwrRptGKAFOKaPSPaMi yItg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@zytor.com header.s=2021083001 header.b=HvVu4vEW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zytor.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b11si3173318ilj.16.2021.09.09.15.11.38; Thu, 09 Sep 2021 15:12:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@zytor.com header.s=2021083001 header.b=HvVu4vEW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zytor.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343934AbhIIWJ6 (ORCPT + 99 others); Thu, 9 Sep 2021 18:09:58 -0400 Received: from terminus.zytor.com ([198.137.202.136]:43815 "EHLO mail.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231819AbhIIWJ5 (ORCPT ); Thu, 9 Sep 2021 18:09:57 -0400 Received: from tazenda.hos.anvin.org ([IPv6:2601:646:8600:3c70:7285:c2ff:fefb:fd4]) (authenticated bits=0) by mail.zytor.com (8.16.1/8.15.2) with ESMTPSA id 189M8Rx2240627 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Thu, 9 Sep 2021 15:08:38 -0700 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.zytor.com 189M8Rx2240627 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zytor.com; s=2021083001; t=1631225319; bh=Yj10jMDgE21CotwexBht+qnc1+Xh+HUHPDT1ZPipEPA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HvVu4vEWnWsYTT3cwGpzthFC0DVuAe5+LKeMg7QI8WfMVpY4y0/AyzubR3TV29R+b LSjfRWTcOQt19FFYCIfl56BxiUeSMtnatJlTXhSC5S9IxEw3/fJaGN6C85WwL/6eV/ IVAB65IA391BPvb1/zrfCOo54ANqWH/NGL0C5Y9yWE3Sa/krxUEpE2UfqbVQKMbgPk 9WDpUxzj5JDrriVg82UN8HpQDU92eUQ6uXGVeKY6z7yfGCFTm5L73Ed8CNynXtpHZF jjcO4tDSVlCYtkQ8lPXFnroLsj0irSO20W9AlylTkQoMZcmkX3kStRTWBKVeQDbxvW KOFo6QIPz/9Kw== From: "H. Peter Anvin (Intel)" To: Thomas Gleixner , Ingo Molnar , Borislav Petkov , Andy Lutomirski Cc: Linux Kernel Mailing List , x86@kernel.org, "H. Peter Anvin (Intel)" Subject: [PATCH v2 1/2] x86/asm: add _ASM_RIP() macro for x86-64 (%rip) suffix Date: Thu, 9 Sep 2021 15:08:17 -0700 Message-Id: <20210909220818.417312-2-hpa@zytor.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210909220818.417312-1-hpa@zytor.com> References: <20210908171716.3340120-1-hpa@zytor.com> <20210909220818.417312-1-hpa@zytor.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add a macro _ASM_RIP() to add a (%rip) suffix on 64 bits only. This is useful for immediate memory references using e.g. an "i" constraint where one doesn't want gcc to possibly use a register indirection as it may in the case of an "m" constraint. Signed-off-by: H. Peter Anvin (Intel) --- arch/x86/include/asm/asm.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/arch/x86/include/asm/asm.h b/arch/x86/include/asm/asm.h index 3ad3da9a7d97..c5a19ccda0fe 100644 --- a/arch/x86/include/asm/asm.h +++ b/arch/x86/include/asm/asm.h @@ -6,11 +6,13 @@ # define __ASM_FORM(x, ...) x,## __VA_ARGS__ # define __ASM_FORM_RAW(x, ...) x,## __VA_ARGS__ # define __ASM_FORM_COMMA(x, ...) x,## __VA_ARGS__, +# define __ASM_REGPFX % #else #include # define __ASM_FORM(x, ...) " " __stringify(x,##__VA_ARGS__) " " # define __ASM_FORM_RAW(x, ...) __stringify(x,##__VA_ARGS__) # define __ASM_FORM_COMMA(x, ...) " " __stringify(x,##__VA_ARGS__) "," +# define __ASM_REGPFX %% #endif #define _ASM_BYTES(x, ...) __ASM_FORM(.byte x,##__VA_ARGS__ ;) @@ -49,6 +51,9 @@ #define _ASM_SI __ASM_REG(si) #define _ASM_DI __ASM_REG(di) +/* Adds a (%rip) suffix on 64 bits only; for immediate memory references */ +#define _ASM_RIP(x) __ASM_SEL_RAW(x, x (__ASM_REGPFX rip)) + #ifndef __x86_64__ /* 32 bit */ -- 2.31.1