Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1187972imu; Tue, 11 Dec 2018 14:24:52 -0800 (PST) X-Google-Smtp-Source: AFSGD/UineuyJol815f264OkK1HIv2IgkeR0EAR3h5Ii2E0X5ndOg6DJkOHI94HTjZob6+/q7oSv X-Received: by 2002:a62:7504:: with SMTP id q4mr17686584pfc.180.1544567092407; Tue, 11 Dec 2018 14:24:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544567092; cv=none; d=google.com; s=arc-20160816; b=opWIo0KHQmBZ4QgSnFMPdGT29+FoDIoaLSvGcYTC9hs2I20uASRuR5c6SpzSXfwgf6 rDYjkC9g46S/2Q9nBAbygVFtLORdca5IkDpIKY0p8yxmBLsQNI3hmYsD2usbXrk5sTwE rIjBIJ9SPk/jmKfsOtMNPDbAZI3P5+dwKvoE8kwJDVPgnutIFH69oYQobsqZKDSeIaoQ fVtFjBzMoqaWOCZU1WD6rS+ousvUyTG6MDnRJGMcSsLCNYYVhWnFZPmvtPVI6H+bU6lW dLkcZwzTHRzbdcYe98rcFhuJ/diUkQtJ/YHQu2DNjrgqpmUUZrhf7UzCck4XQk/PoTg4 pAtQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=PbCAF2XcCAjQWK1b11rF+GVjG1oyepoSMGI1yKiTULM=; b=Tx0aKlILs1843OlbxE1sQEVdagV5/p2zPGVqvNurn42NsAOEti3/jnOByYZgQGejdw yfhZWMixXQzhshKA/t6iSKhZ4Cq7+RUkMz3c8RSf9d98YVLZntbECexKZHD9pMo0Tx2s O7jrdD3IjcVe23UJvdQ+LT8LZkqqj2jGDNmdi/qHSkFcKz/wNypH55vNfKasZOEPbKMd SGC8JEMlg6us8QsH+ogZ30xasdfurrM0RJ7F+GfHJI65rosuIksx1Hb3P8d46cIknFpE euxbTl3HrIneF9RmoiE8lv4a51frZuaKNgJ2U+PihyJhmdRWvPTn5NUdPvRd0X0XjLZH VyDg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=H4kconNm; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=alien8.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id bg7si13091080plb.149.2018.12.11.14.24.37; Tue, 11 Dec 2018 14:24:52 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=H4kconNm; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=alien8.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726355AbeLKWXe (ORCPT + 99 others); Tue, 11 Dec 2018 17:23:34 -0500 Received: from mail.skyhub.de ([5.9.137.197]:46202 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726202AbeLKWXb (ORCPT ); Tue, 11 Dec 2018 17:23:31 -0500 Received: from zn.tnic (p200300EC2BCD2B0010F6E1EC68D6BA6C.dip0.t-ipconnect.de [IPv6:2003:ec:2bcd:2b00:10f6:e1ec:68d6:ba6c]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id 45AFD1EC0BFC; Tue, 11 Dec 2018 23:23:30 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1544567010; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=PbCAF2XcCAjQWK1b11rF+GVjG1oyepoSMGI1yKiTULM=; b=H4kconNmMwqaWh5v6kq1qFO5UhvBZX0Pr+YzCwF6Q8jNd7YO0iJWPLCfmC9GeH3SWf+yWS 7OWmUG8rc5zQwFGROIttfH5lMxkDP4mgbGONDFYApSTS7RXZ0B992hdKOZD3BGfiP6Q8oc f+NNkdYG+nEfVMALV81mZS8tBwBw8oU= From: Borislav Petkov To: LKML Cc: X86 ML , Andy Lutomirski , "H. Peter Anvin" , Josh Poimboeuf , Peter Zijlstra , Tom Lendacky Subject: [RFC PATCH 1/4] x86/alternatives: Add macro comments Date: Tue, 11 Dec 2018 23:23:23 +0100 Message-Id: <20181211222326.14581-2-bp@alien8.de> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181211222326.14581-1-bp@alien8.de> References: <20181211222326.14581-1-bp@alien8.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Borislav Petkov ... so that when one stares at the .s output, one can find her way around the resulting asm magic. For example, ALTERNATIVE looks like this now: # ALT: oldnstr 661: ... 662: # ALT: padding .skip ... 663: .pushsection .altinstructions,"a" ... .popsection .pushsection .altinstr_replacement, "ax" # ALT: replacement 1 6641: ... 6651: .popsection Merge __OLDINSTR() into OLDINSTR(), while at it. No functional changes. Signed-off-by: Borislav Petkov --- arch/x86/include/asm/alternative.h | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/arch/x86/include/asm/alternative.h b/arch/x86/include/asm/alternative.h index d7faa16622d8..8d38b296a18a 100644 --- a/arch/x86/include/asm/alternative.h +++ b/arch/x86/include/asm/alternative.h @@ -87,13 +87,12 @@ static inline int alternatives_text_reserved(void *start, void *end) #define alt_total_slen alt_end_marker"b-661b" #define alt_rlen(num) e_replacement(num)"f-"b_replacement(num)"f" -#define __OLDINSTR(oldinstr, num) \ +#define OLDINSTR(oldinstr, num) \ + "# ALT: oldnstr\n" \ "661:\n\t" oldinstr "\n662:\n" \ + "# ALT: padding\n" \ ".skip -(((" alt_rlen(num) ")-(" alt_slen ")) > 0) * " \ - "((" alt_rlen(num) ")-(" alt_slen ")),0x90\n" - -#define OLDINSTR(oldinstr, num) \ - __OLDINSTR(oldinstr, num) \ + "((" alt_rlen(num) ")-(" alt_slen ")),0x90\n" \ alt_end_marker ":\n" /* @@ -109,7 +108,9 @@ static inline int alternatives_text_reserved(void *start, void *end) * additionally longer than the first replacement alternative. */ #define OLDINSTR_2(oldinstr, num1, num2) \ + "# ALT: oldinstr2\n" \ "661:\n\t" oldinstr "\n662:\n" \ + "# ALT: padding2\n" \ ".skip -((" alt_max_short(alt_rlen(num1), alt_rlen(num2)) " - (" alt_slen ")) > 0) * " \ "(" alt_max_short(alt_rlen(num1), alt_rlen(num2)) " - (" alt_slen ")), 0x90\n" \ alt_end_marker ":\n" @@ -122,8 +123,9 @@ static inline int alternatives_text_reserved(void *start, void *end) " .byte " alt_rlen(num) "\n" /* replacement len */ \ " .byte " alt_pad_len "\n" /* pad len */ -#define ALTINSTR_REPLACEMENT(newinstr, feature, num) /* replacement */ \ - b_replacement(num)":\n\t" newinstr "\n" e_replacement(num) ":\n\t" +#define ALTINSTR_REPLACEMENT(newinstr, feature, num) /* replacement */ \ + "# ALT: replacement " #num "\n" \ + b_replacement(num)":\n\t" newinstr "\n" e_replacement(num) ":\n" /* alternative assembly primitive: */ #define ALTERNATIVE(oldinstr, newinstr, feature) \ -- 2.19.1