From: Masahiro Yamada <yamada.masahiro@socionext.com>
To: x86@kernel.org, Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
"H . Peter Anvin" <hpa@zytor.com>
Cc: Richard Biener <rguenther@suse.de>,
Segher Boessenkool <segher@kernel.crashing.org>,
Peter Zijlstra <peterz@infradead.org>,
Juergen Gross <jgross@suse.com>,
Josh Poimboeuf <jpoimboe@redhat.com>,
Kees Cook <keescook@chromium.org>,
Linus Torvalds <torvalds@linux-foundation.org>,
Masahiro Yamada <yamada.masahiro@socionext.com>,
Yonghong Song <yhs@fb.com>,
linux-kernel@vger.kernel.org,
Arnaldo Carvalho de Melo <acme@redhat.com>,
Nadav Amit <namit@vmware.com>, Jann Horn <jannh@google.com>
Subject: [PATCH v3 03/12] Revert "x86/extable: Macrofy inline assembly code to work around GCC inlining bugs"
Date: Tue, 18 Dec 2018 01:03:18 +0900 [thread overview]
Message-ID: <1545062607-8599-4-git-send-email-yamada.masahiro@socionext.com> (raw)
In-Reply-To: <1545062607-8599-1-git-send-email-yamada.masahiro@socionext.com>
This reverts commit 0474d5d9d2f7f3b11262f7bf87d0e7314ead9200.
The in-kernel workarounds will be replaced with GCC's new
"asm inline" syntax.
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
---
I blindly reverted here, but I will clean it up
in a different way later.
arch/x86/include/asm/asm.h | 53 +++++++++++++++++++++++++++++-----------------
arch/x86/kernel/macros.S | 1 -
2 files changed, 33 insertions(+), 21 deletions(-)
diff --git a/arch/x86/include/asm/asm.h b/arch/x86/include/asm/asm.h
index 21b0867..6467757b 100644
--- a/arch/x86/include/asm/asm.h
+++ b/arch/x86/include/asm/asm.h
@@ -120,25 +120,12 @@
/* Exception table entry */
#ifdef __ASSEMBLY__
# define _ASM_EXTABLE_HANDLE(from, to, handler) \
- ASM_EXTABLE_HANDLE from to handler
-
-.macro ASM_EXTABLE_HANDLE from:req to:req handler:req
- .pushsection "__ex_table","a"
- .balign 4
- .long (\from) - .
- .long (\to) - .
- .long (\handler) - .
+ .pushsection "__ex_table","a" ; \
+ .balign 4 ; \
+ .long (from) - . ; \
+ .long (to) - . ; \
+ .long (handler) - . ; \
.popsection
-.endm
-#else /* __ASSEMBLY__ */
-
-# define _ASM_EXTABLE_HANDLE(from, to, handler) \
- "ASM_EXTABLE_HANDLE from=" #from " to=" #to \
- " handler=\"" #handler "\"\n\t"
-
-/* For C file, we already have NOKPROBE_SYMBOL macro */
-
-#endif /* __ASSEMBLY__ */
# define _ASM_EXTABLE(from, to) \
_ASM_EXTABLE_HANDLE(from, to, ex_handler_default)
@@ -161,7 +148,6 @@
_ASM_PTR (entry); \
.popsection
-#ifdef __ASSEMBLY__
.macro ALIGN_DESTINATION
/* check for bad alignment of destination */
movl %edi,%ecx
@@ -185,7 +171,34 @@
_ASM_EXTABLE_UA(100b, 103b)
_ASM_EXTABLE_UA(101b, 103b)
.endm
-#endif /* __ASSEMBLY__ */
+
+#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__
/*
diff --git a/arch/x86/kernel/macros.S b/arch/x86/kernel/macros.S
index 7baa40d..71d8b71 100644
--- a/arch/x86/kernel/macros.S
+++ b/arch/x86/kernel/macros.S
@@ -11,4 +11,3 @@
#include <asm/alternative-asm.h>
#include <asm/bug.h>
#include <asm/paravirt.h>
-#include <asm/asm.h>
--
2.7.4
next prev parent reply other threads:[~2018-12-17 16:11 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-17 16:03 [PATCH v3 00/12] x86, kbuild: revert macrofying inline assembly code Masahiro Yamada
2018-12-17 16:03 ` [PATCH v3 01/12] Revert "x86/jump-labels: Macrofy inline assembly code to work around GCC inlining bugs" Masahiro Yamada
2018-12-17 16:03 ` [PATCH v3 02/12] Revert "x86/cpufeature: " Masahiro Yamada
2018-12-17 16:03 ` Masahiro Yamada [this message]
2018-12-17 16:03 ` [PATCH v3 04/12] Revert "x86/paravirt: Work around GCC inlining bugs when compiling paravirt ops" Masahiro Yamada
2018-12-17 16:03 ` [PATCH v3 05/12] Revert "x86/bug: Macrofy the BUG table section handling, to work around GCC inlining bugs" Masahiro Yamada
2018-12-17 16:03 ` [PATCH v3 06/12] Revert "x86/alternatives: Macrofy lock prefixes " Masahiro Yamada
2018-12-17 16:03 ` [PATCH v3 07/12] Revert "x86/refcount: Work around GCC inlining bug" Masahiro Yamada
2018-12-17 16:03 ` [PATCH v3 08/12] Revert "x86/objtool: Use asm macros to work around GCC inlining bugs" Masahiro Yamada
2018-12-17 16:03 ` [PATCH v3 09/12] Revert "kbuild/Makefile: Prepare for using macros in inline assembly code to work around asm() related " Masahiro Yamada
2018-12-17 16:03 ` [PATCH v3 10/12] linux/linkage: add ASM() macro to reduce duplication between C/ASM code Masahiro Yamada
2018-12-17 16:03 ` [PATCH v3 11/12] x86/alternatives: consolidate LOCK_PREFIX macro Masahiro Yamada
2018-12-17 16:03 ` [PATCH v3 12/12] x86/asm: consolidate ASM_EXTABLE_* macros Masahiro Yamada
2018-12-18 19:43 ` [PATCH v3 00/12] x86, kbuild: revert macrofying inline assembly code Nadav Amit
2018-12-19 3:19 ` Masahiro Yamada
2018-12-19 11:20 ` Ingo Molnar
2018-12-19 14:33 ` Masahiro Yamada
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1545062607-8599-4-git-send-email-yamada.masahiro@socionext.com \
--to=yamada.masahiro@socionext.com \
--cc=acme@redhat.com \
--cc=bp@alien8.de \
--cc=hpa@zytor.com \
--cc=jannh@google.com \
--cc=jgross@suse.com \
--cc=jpoimboe@redhat.com \
--cc=keescook@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=namit@vmware.com \
--cc=peterz@infradead.org \
--cc=rguenther@suse.de \
--cc=segher@kernel.crashing.org \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.org \
--cc=x86@kernel.org \
--cc=yhs@fb.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).