diff mbox series

[v3,12/12] x86/asm: consolidate ASM_EXTABLE_* macros

Message ID 1545062607-8599-13-git-send-email-yamada.masahiro@socionext.com
State New
Headers show
Series x86, kbuild: revert macrofying inline assembly code | expand

Commit Message

Masahiro Yamada Dec. 17, 2018, 4:03 p.m. UTC
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 <yamada.masahiro@socionext.com>

---

 arch/x86/include/asm/asm.h | 57 ++++++++++++----------------------------------
 1 file changed, 15 insertions(+), 42 deletions(-)

-- 
2.7.4
diff mbox series

Patch

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