Commit 24a295e4 authored by Thomas Huth's avatar Thomas Huth Committed by Ingo Molnar
Browse files

x86/headers: Replace __ASSEMBLY__ with __ASSEMBLER__ in non-UAPI headers



While the GCC and Clang compilers already define __ASSEMBLER__
automatically when compiling assembly code, __ASSEMBLY__ is a
macro that only gets defined by the Makefiles in the kernel.

This can be very confusing when switching between userspace
and kernelspace coding, or when dealing with UAPI headers that
rather should use __ASSEMBLER__ instead. So let's standardize on
the __ASSEMBLER__ macro that is provided by the compilers now.

This is mostly a mechanical patch (done with a simple "sed -i"
statement), with some manual tweaks in <asm/frame.h>, <asm/hw_irq.h>
and <asm/setup.h> that mentioned this macro in comments with some
missing underscores.

Signed-off-by: default avatarThomas Huth <thuth@redhat.com>
Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: Juergen Gross <jgross@suse.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Kees Cook <keescook@chromium.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Link: https://lore.kernel.org/r/20250314071013.1575167-38-thuth@redhat.com
parent 8a141be3
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -16,7 +16,7 @@

#define STACK_SIZE	1024	/* Minimum number of bytes for stack */

#ifndef __ASSEMBLY__
#ifndef __ASSEMBLER__

#include <linux/stdarg.h>
#include <linux/types.h>
@@ -327,6 +327,6 @@ void probe_cards(int unsafe);
/* video-vesa.c */
void vesa_store_edid(void);

#endif /* __ASSEMBLY__ */
#endif /* __ASSEMBLER__ */

#endif /* BOOT_BOOT_H */
+1 −1
Original line number Diff line number Diff line
@@ -7,7 +7,7 @@
 * vDSO uses a dedicated handler the addresses are relative to the overall
 * exception table, not each individual entry.
 */
#ifdef __ASSEMBLY__
#ifdef __ASSEMBLER__
#define _ASM_VDSO_EXTABLE_HANDLE(from, to)	\
	ASM_VDSO_EXTABLE_HANDLE from to

+3 −3
Original line number Diff line number Diff line
@@ -15,7 +15,7 @@
#define ALT_DIRECT_CALL(feature) ((ALT_FLAG_DIRECT_CALL << ALT_FLAGS_SHIFT) | (feature))
#define ALT_CALL_ALWAYS		ALT_DIRECT_CALL(X86_FEATURE_ALWAYS)

#ifndef __ASSEMBLY__
#ifndef __ASSEMBLER__

#include <linux/stddef.h>

@@ -277,7 +277,7 @@ static inline int alternatives_text_reserved(void *start, void *end)
void BUG_func(void);
void nop_func(void);

#else /* __ASSEMBLY__ */
#else /* __ASSEMBLER__ */

#ifdef CONFIG_SMP
	.macro LOCK_PREFIX
@@ -360,6 +360,6 @@ void nop_func(void);
	ALTERNATIVE_2 oldinstr, newinstr_no, X86_FEATURE_ALWAYS,	\
	newinstr_yes, ft_flags

#endif /* __ASSEMBLY__ */
#endif /* __ASSEMBLER__ */

#endif /* _ASM_X86_ALTERNATIVE_H */
+5 −5
Original line number Diff line number Diff line
@@ -2,7 +2,7 @@
#ifndef _ASM_X86_ASM_H
#define _ASM_X86_ASM_H

#ifdef __ASSEMBLY__
#ifdef __ASSEMBLER__
# define __ASM_FORM(x, ...)		x,## __VA_ARGS__
# define __ASM_FORM_RAW(x, ...)		x,## __VA_ARGS__
# define __ASM_FORM_COMMA(x, ...)	x,## __VA_ARGS__,
@@ -113,7 +113,7 @@

#endif

#ifndef __ASSEMBLY__
#ifndef __ASSEMBLER__
#ifndef __pic__
static __always_inline __pure void *rip_rel_ptr(void *p)
{
@@ -144,7 +144,7 @@ static __always_inline __pure void *rip_rel_ptr(void *p)
# include <asm/extable_fixup_types.h>

/* Exception table entry */
#ifdef __ASSEMBLY__
#ifdef __ASSEMBLER__

# define _ASM_EXTABLE_TYPE(from, to, type)			\
	.pushsection "__ex_table","a" ;				\
@@ -164,7 +164,7 @@ static __always_inline __pure void *rip_rel_ptr(void *p)
#  define _ASM_NOKPROBE(entry)
# endif

#else /* ! __ASSEMBLY__ */
#else /* ! __ASSEMBLER__ */

# define DEFINE_EXTABLE_TYPE_REG \
	".macro extable_type_reg type:req reg:req\n"						\
@@ -232,7 +232,7 @@ static __always_inline __pure void *rip_rel_ptr(void *p)
 */
register unsigned long current_stack_pointer asm(_ASM_SP);
#define ASM_CALL_CONSTRAINT "+r" (current_stack_pointer)
#endif /* __ASSEMBLY__ */
#endif /* __ASSEMBLER__ */

#define _ASM_EXTABLE(from, to)					\
	_ASM_EXTABLE_TYPE(from, to, EX_TYPE_DEFAULT)
+1 −1
Original line number Diff line number Diff line
@@ -74,7 +74,7 @@
# define BOOT_STACK_SIZE	0x1000
#endif

#ifndef __ASSEMBLY__
#ifndef __ASSEMBLER__
extern unsigned int output_len;
extern const unsigned long kernel_text_size;
extern const unsigned long kernel_total_size;
Loading