From patchwork Mon Dec 17 16:03:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 154008 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp2636414ljp; Mon, 17 Dec 2018 08:08:07 -0800 (PST) X-Google-Smtp-Source: AFSGD/UXa5y5LUrMp6fo50XcXQXSvNOw6/XBBmBIt5tnmSxPX5c74oMeOGITJBEAQcEoRClAK4ti X-Received: by 2002:a63:9402:: with SMTP id m2mr12166256pge.93.1545062886933; Mon, 17 Dec 2018 08:08:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545062886; cv=none; d=google.com; s=arc-20160816; b=WzCMrm9xUqvQi5ZPcBLiURg373GE+09hIccI8N6FOh6jIlWstleMfOipxnaWRpkA9C xCAs2hvtE4zrhVGjr7ilyGXOe10mFPUdkuWpKWQ8BOKqjkY1ZJQkojUmU6KW0NPMQ1VO 1PIijYTyH0GFW0g53NCD/Py089Y9l0vLw+/mA3apYM3oqVH+xBVey01AE+nFd7OGWe/w BUuQqzEgljD73mc9Y/veFeR9l8MdNoIu8J2Mcki0tho+6GqiWnIpzjAgr+vB3JtcF6QQ QwAUrBdBSZN5h4VM4ixVNnD9uj4BUcgKSCB71X7Sgpcy3ULOqHRNObKAoFKNmG/DnWN+ Tx6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:dkim-filter; bh=x/KQxi9+ntHpo7b3spoLqqCNx8iz55GVWCoL7isyaps=; b=TGgfVzasXXzFFEP0bWoSDberQGTT3equxR12oXJ+XVjp2EVhf6hQfj5WLtRHuOm2dm C7at4W8nruayVfQfXRzZs/y8C20uXAGsl3/9TCSmF2suHJJ9OgwcD5Z9HalC93Qfp9tc hbbfKjI+wtxiaZzVDgWs97xDqzM1RAJARd6IfuIarp7i2INI90AZxMKOlWqZ9stMAwNy s7ITD5sAK3hKrPkLKhOlp3RT+mlkXE3R5aT3pGD0YsJ7OxaXc3Qe/5BiS2FFdxaX32uf GzVdUVirLW/qNlDqLWE3ovBwhFVIfrQUP2eQ4epQtZkrW+oXAUCQBnXVb40bKldAulfq hyDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=IZLqzfz7; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m19si10320539pls.437.2018.12.17.08.08.06; Mon, 17 Dec 2018 08:08:06 -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=@nifty.com header.s=dec2015msa header.b=IZLqzfz7; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388182AbeLQQIE (ORCPT + 31 others); Mon, 17 Dec 2018 11:08:04 -0500 Received: from conuserg-07.nifty.com ([210.131.2.74]:61874 "EHLO conuserg-07.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727279AbeLQQID (ORCPT ); Mon, 17 Dec 2018 11:08:03 -0500 Received: from grover.tkatk1.zaq.ne.jp (zaqdadce369.zaq.ne.jp [218.220.227.105]) (authenticated) by conuserg-07.nifty.com with ESMTP id wBHG3bRp008119; Tue, 18 Dec 2018 01:03:56 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-07.nifty.com wBHG3bRp008119 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1545062637; bh=x/KQxi9+ntHpo7b3spoLqqCNx8iz55GVWCoL7isyaps=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IZLqzfz7V0GW9pfJ5UnzRYH8Xk/+//PqcZXdl7IFAO+xhowqoQQGUH3nxlo6GDcBQ xne7Xpw0Zb+6d6K2pN4rQYZGc3b+FuATeCqlSw5BZ7QHitzhJkm5Uyjtnzps+LEyW+ 2RU62YXl9cXOK6ifslTv8DxzXKYtldWP4jTfkH5oYXkGkhnq9bMqLdtsSk4XW6k4Pu GBsULmDgm0qBYydXoAXR5h6e8M2aoNKxJIfXzKp8YSpxlsb5o0w/UFdxyQeX9H1Ics Nb+byTkTF08h80ANnleavUGFJPk8ekzh+WYVCWmfggwq2OBk7elg/+ZQSIl03miSbQ jKOu+gRqiOWDw== X-Nifty-SrcIP: [218.220.227.105] From: Masahiro Yamada To: x86@kernel.org, Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H . Peter Anvin" Cc: Richard Biener , Segher Boessenkool , Peter Zijlstra , Juergen Gross , Josh Poimboeuf , Kees Cook , Linus Torvalds , Masahiro Yamada , linux-kernel@vger.kernel.org, Arnaldo Carvalho de Melo , Nadav Amit , Jann Horn Subject: [PATCH v3 12/12] x86/asm: consolidate ASM_EXTABLE_* macros Date: Tue, 18 Dec 2018 01:03:27 +0900 Message-Id: <1545062607-8599-13-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1545062607-8599-1-git-send-email-yamada.masahiro@socionext.com> References: <1545062607-8599-1-git-send-email-yamada.masahiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org These macros are used by .c and .S files. Let's unify the definition by using ASM() macro. This was previously cleaned up by 0474d5d9d2f7 ("x86/extable: Macrofy inline assembly code to work around GCC inlining bugs"). Now, I am refactoring the code without using the macros approach. Signed-off-by: Masahiro Yamada --- arch/x86/include/asm/asm.h | 57 ++++++++++++---------------------------------- 1 file changed, 15 insertions(+), 42 deletions(-) -- 2.7.4 diff --git a/arch/x86/include/asm/asm.h b/arch/x86/include/asm/asm.h index 6467757b..cff3b0a 100644 --- a/arch/x86/include/asm/asm.h +++ b/arch/x86/include/asm/asm.h @@ -118,36 +118,36 @@ #endif /* Exception table entry */ -#ifdef __ASSEMBLY__ -# define _ASM_EXTABLE_HANDLE(from, to, handler) \ - .pushsection "__ex_table","a" ; \ - .balign 4 ; \ - .long (from) - . ; \ - .long (to) - . ; \ - .long (handler) - . ; \ - .popsection - -# define _ASM_EXTABLE(from, to) \ +#define _ASM_EXTABLE_HANDLE(from, to, handler) \ +ASM( .pushsection "__ex_table","a" ; )\ +ASM( .balign 4 ; )\ +ASM( .long (from) - . ; )\ +ASM( .long (to) - . ; )\ +ASM( .long (handler) - . ; )\ +ASM( .popsection ) + +#define _ASM_EXTABLE(from, to) \ _ASM_EXTABLE_HANDLE(from, to, ex_handler_default) -# define _ASM_EXTABLE_UA(from, to) \ +#define _ASM_EXTABLE_UA(from, to) \ _ASM_EXTABLE_HANDLE(from, to, ex_handler_uaccess) -# define _ASM_EXTABLE_FAULT(from, to) \ +#define _ASM_EXTABLE_FAULT(from, to) \ _ASM_EXTABLE_HANDLE(from, to, ex_handler_fault) -# define _ASM_EXTABLE_EX(from, to) \ +#define _ASM_EXTABLE_EX(from, to) \ _ASM_EXTABLE_HANDLE(from, to, ex_handler_ext) -# define _ASM_EXTABLE_REFCOUNT(from, to) \ +#define _ASM_EXTABLE_REFCOUNT(from, to) \ _ASM_EXTABLE_HANDLE(from, to, ex_handler_refcount) -# define _ASM_NOKPROBE(entry) \ +#define _ASM_NOKPROBE(entry) \ .pushsection "_kprobe_blacklist","aw" ; \ _ASM_ALIGN ; \ _ASM_PTR (entry); \ .popsection +#ifdef __ASSEMBLY__ .macro ALIGN_DESTINATION /* check for bad alignment of destination */ movl %edi,%ecx @@ -173,34 +173,7 @@ .endm #else -# define _EXPAND_EXTABLE_HANDLE(x) #x -# define _ASM_EXTABLE_HANDLE(from, to, handler) \ - " .pushsection \"__ex_table\",\"a\"\n" \ - " .balign 4\n" \ - " .long (" #from ") - .\n" \ - " .long (" #to ") - .\n" \ - " .long (" _EXPAND_EXTABLE_HANDLE(handler) ") - .\n" \ - " .popsection\n" - -# define _ASM_EXTABLE(from, to) \ - _ASM_EXTABLE_HANDLE(from, to, ex_handler_default) - -# define _ASM_EXTABLE_UA(from, to) \ - _ASM_EXTABLE_HANDLE(from, to, ex_handler_uaccess) - -# define _ASM_EXTABLE_FAULT(from, to) \ - _ASM_EXTABLE_HANDLE(from, to, ex_handler_fault) - -# define _ASM_EXTABLE_EX(from, to) \ - _ASM_EXTABLE_HANDLE(from, to, ex_handler_ext) - -# define _ASM_EXTABLE_REFCOUNT(from, to) \ - _ASM_EXTABLE_HANDLE(from, to, ex_handler_refcount) - -/* For C file, we already have NOKPROBE_SYMBOL macro */ -#endif -#ifndef __ASSEMBLY__ /* * This output constraint should be used for any inline asm which has a "call" * instruction. Otherwise the asm may be inserted before the frame pointer