Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp1749798pxb; Fri, 10 Sep 2021 13:02:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxGIZC9NA3q1WIr3UHkmK6BnLNZEMKSiEuj9rR0f6WKTE2Ww9UXscZ19IxyKA0kn15NgU1I X-Received: by 2002:a17:906:9b87:: with SMTP id dd7mr11571913ejc.99.1631304128211; Fri, 10 Sep 2021 13:02:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631304128; cv=none; d=google.com; s=arc-20160816; b=D69VT1Xrco0ATfpV+5vy1nvrZ5bDWycZ2ueM6CnZ8ppkGwrMDDqakYh5dLL9d5u1fD Zv7f1ljpm4UCULBCnYselSNhZDaDBgf+s0YB+Qx4IHUarBdEswTBdBmXMn/IQWJjTixX 1UlgQhiYekGLAiXmO0S0QFUUZb8jihHcQ+HKlxE6p/lJ6Wo380TsSFnV0BDpJy86aO3L 0ZeBVu+L6l+iHILNJKWPhFb6VhHMpCsR8NLyyqA05ZBLyrulxaz3/Bt/myMoaip1+6mu mBY2rCkknr6bpzHL46qoQQ8nZJC1rwa6eSCS4H4VBzwyzDGVseZvNMGVcb4B5PpWBn1u L+kA== 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=74rbdo5FDm4GT5p8GTPN1ulsTmu28cxhyReiv3yjfOM=; b=fykn5CZ0nmMtdi51Mr5PL2WEMvvt/ZHDyUiJBBTuQy4OgyrwKpyzN4rIqrSpGPzf9B tjK7iIaBHDlEE4xuo+7gvn9P+w/XMM/QJX+iHKjGlqPbsteu1s+GZGmQ29uIz7x9rBhs ME8CLnF2/C6F/Z/cV+I4bb0FqR5sJyLUSV1jzSlcdcEtLmsXAHlNy/jf1NOAtw+jvONR cdLpRx/XeQaW6VtucQRZmRIwmNx61Ld/hOsJLc9ALb+2y0wuqNFOYck3jqu/U4Zywt7z KYovA3UmXnjSI0Th+GhUGlI8fzTDKJA4ze10XaD75GdMq2zfyO9cNHbFZx+BnyMIZRcA k5Xg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@zytor.com header.s=2021083001 header.b=nU6YGVkd; 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 qb33si6233485ejc.453.2021.09.10.13.01.42; Fri, 10 Sep 2021 13:02:08 -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=nU6YGVkd; 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 S233508AbhIJUBB (ORCPT + 99 others); Fri, 10 Sep 2021 16:01:01 -0400 Received: from terminus.zytor.com ([198.137.202.136]:45387 "EHLO mail.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232347AbhIJUAt (ORCPT ); Fri, 10 Sep 2021 16:00:49 -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 18AJxIMg517265 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Fri, 10 Sep 2021 12:59:27 -0700 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.zytor.com 18AJxIMg517265 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zytor.com; s=2021083001; t=1631303968; bh=74rbdo5FDm4GT5p8GTPN1ulsTmu28cxhyReiv3yjfOM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nU6YGVkdpBVY6dm+6K9b+Le3P+bnFB078fJb5gcZJZwrNIC6bHdyivIs+5738uEsU kjS2wC2lndTv5NkJpfVdiI+abbPM0H5Dw7G+Axv2N8ZuWZ5svZ9HiEDGLnXTyLAs4n V1gdPCCiTA80W9myIDvAmHYYCpj4hpjuZ1raJlMoupEr3lTushALmTOtQrnt59SB5L y1YHLk2ZpXrehlOvd2OFHeU7Ts9q7eW7znds/8J5OwQWXNpZSL5KMv89vStLFRUKJ1 dnY3ww1r+95CPvg+/zkjvhHDwsDOShq8+blfaWOQVyC6CAtpxfe0AjVn15JR62XwZL pLfZh64BKhvHA== From: "H. Peter Anvin (Intel)" To: Borislav Petkov , Ingo Molnar , Thomas Gleixner , Andy Lutomirski Cc: x86 mailing list , Linux Kernel Mailing List , "H. Peter Anvin (Intel)" Subject: [PATCH v3 1/2] x86/asm: add _ASM_RIP() macro for x86-64 (%rip) suffix Date: Fri, 10 Sep 2021 12:59:09 -0700 Message-Id: <20210910195910.2542662-3-hpa@zytor.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210910195910.2542662-1-hpa@zytor.com> References: <20210908171716.3340120-1-hpa@zytor.com> <20210910195910.2542662-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 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