@@ -5,7 +5,6 @@
*
* This work is licensed under the terms of the GNU LGPL, version 2.
*/
-#define __ASSEMBLY__
#include <auxinfo.h>
#include <asm/assembler.h>
#include <asm/thread_info.h>
@@ -5,7 +5,6 @@
*
* This work is licensed under the terms of the GNU GPL, version 2.
*/
-#define __ASSEMBLY__
#include <auxinfo.h>
#include <asm/asm-offsets.h>
#include <asm/assembler.h>
@@ -8,7 +8,7 @@
#ifndef _ASMARM_ARCH_GICV3_H_
#define _ASMARM_ARCH_GICV3_H_
-#ifndef __ASSEMBLY__
+#ifndef __ASSEMBLER__
#include <libcflat.h>
#include <asm/sysreg.h>
#include <asm/barrier.h>
@@ -61,5 +61,5 @@ static inline u64 gicv3_read_typer(const volatile void __iomem *addr)
return val;
}
-#endif /* !__ASSEMBLY__ */
+#endif /* !__ASSEMBLER__ */
#endif /* _ASMARM_ARCH_GICV3_H_ */
@@ -4,7 +4,7 @@
* arch/arm/mm/proc-v7.S.
*/
-#ifndef __ASSEMBLY__
+#ifndef __ASSEMBLER__
#error "Only include this from assembly code"
#endif
@@ -17,7 +17,7 @@
#define GICC_ENABLE 0x1
#define GICC_IAR_INT_ID_MASK 0x3ff
-#ifndef __ASSEMBLY__
+#ifndef __ASSEMBLER__
#include <cpumask.h>
struct gicv2_data {
@@ -38,5 +38,5 @@ extern void gicv2_write_eoir(u32 irqstat);
extern void gicv2_ipi_send_single(int irq, int cpu);
extern void gicv2_ipi_send_mask(int irq, const cpumask_t *dest);
-#endif /* !__ASSEMBLY__ */
+#endif /* !__ASSEMBLER__ */
#endif /* _ASMARM_GIC_V2_H_ */
@@ -66,7 +66,7 @@
#include <asm/arch_gicv3.h>
-#ifndef __ASSEMBLY__
+#ifndef __ASSEMBLER__
#include <cpumask.h>
#include <asm/setup.h>
#include <asm/processor.h>
@@ -153,5 +153,5 @@ static inline u64 mpidr_uncompress(u32 compressed)
#define gicv3_lpi_get_config(intid) (gicv3_data.lpi_prop[LPI_OFFSET(intid)])
-#endif /* !__ASSEMBLY__ */
+#endif /* !__ASSEMBLER__ */
#endif /* _ASMARM_GIC_V3_H_ */
@@ -46,7 +46,7 @@
#define PPI(irq) ((irq) + 16)
#define SPI(irq) ((irq) + GIC_FIRST_SPI)
-#ifndef __ASSEMBLY__
+#ifndef __ASSEMBLER__
#include <cpumask.h>
enum gic_irq_state {
@@ -88,5 +88,5 @@ void gic_irq_set_clr_enable(int irq, bool enable);
#define gic_enable_irq(irq) gic_irq_set_clr_enable(irq, true)
#define gic_disable_irq(irq) gic_irq_set_clr_enable(irq, false)
-#endif /* !__ASSEMBLY__ */
+#endif /* !__ASSEMBLER__ */
#endif /* _ASMARM_GIC_H_ */
@@ -12,7 +12,7 @@
#define PAGE_SIZE (_AC(1,UL) << PAGE_SHIFT)
#define PAGE_MASK (~(PAGE_SIZE-1))
-#ifndef __ASSEMBLY__
+#ifndef __ASSEMBLER__
#define PAGE_ALIGN(addr) ALIGN(addr, PAGE_SIZE)
@@ -49,5 +49,5 @@ extern unsigned long __phys_to_virt(phys_addr_t addr);
extern void *__ioremap(phys_addr_t phys_addr, size_t size);
-#endif /* !__ASSEMBLY__ */
+#endif /* !__ASSEMBLER__ */
#endif /* _ASMARM_PAGE_H_ */
@@ -52,7 +52,7 @@
#define PSR_IT_MASK 0x0600fc00 /* If-Then execution state mask */
#define PSR_ENDIAN_MASK 0x00000200 /* Endianness state mask */
-#ifndef __ASSEMBLY__
+#ifndef __ASSEMBLER__
#include <libcflat.h>
struct pt_regs {
@@ -100,5 +100,5 @@ static inline unsigned long regs_get_register(struct pt_regs *regs,
return *(unsigned long *)((unsigned long)regs + offset);
}
-#endif /* !__ASSEMBLY__ */
+#endif /* !__ASSEMBLER__ */
#endif /* _ASMARM_PTRACE_H_ */
@@ -38,7 +38,7 @@
#define CR_AFE (1 << 29) /* Access flag enable */
#define CR_TE (1 << 30) /* Thumb exception enable */
-#ifndef __ASSEMBLY__
+#ifndef __ASSEMBLER__
#include <libcflat.h>
#define __ACCESS_CP15(CRn, Op1, CRm, Op2) \
@@ -60,6 +60,6 @@
#define __write_sysreg(v, r, w, c, t) asm volatile(w " " c : : "r" ((t)(v)))
#define write_sysreg(v, ...) __write_sysreg(v, __VA_ARGS__)
-#endif /* !__ASSEMBLY__ */
+#endif /* !__ASSEMBLER__ */
#endif /* _ASMARM_SYSREG_H_ */
@@ -22,7 +22,7 @@
#define THREAD_ALIGNMENT THREAD_SIZE
#endif
-#ifndef __ASSEMBLY__
+#ifndef __ASSEMBLER__
#include <asm/processor.h>
#include <alloc.h>
@@ -73,5 +73,5 @@ static inline struct thread_info *current_thread_info(void)
extern void thread_info_init(struct thread_info *ti, unsigned int flags);
-#endif /* !__ASSEMBLY__ */
+#endif /* !__ASSEMBLER__ */
#endif /* _ASMARM_THREAD_INFO_H_ */
@@ -10,7 +10,7 @@
#define ARCH_TIMER_CTL_IMASK (1 << 1)
#define ARCH_TIMER_CTL_ISTATUS (1 << 2)
-#ifndef __ASSEMBLY__
+#ifndef __ASSEMBLER__
struct timer_state {
struct {
@@ -29,5 +29,5 @@ extern struct timer_state __timer_state;
void timer_save_state(void);
-#endif /* !__ASSEMBLY__ */
+#endif /* !__ASSEMBLER__ */
#endif /* _ASMARM_TIMER_H_ */
@@ -10,7 +10,7 @@
#include <asm/sysreg.h>
-#ifndef __ASSEMBLY__
+#ifndef __ASSEMBLER__
#include <libcflat.h>
#include <asm/barrier.h>
@@ -54,5 +54,5 @@ static inline void gicv3_write_grpen1(u32 val)
#define gicv3_read_typer(c) readq(c)
-#endif /* !__ASSEMBLY__ */
+#endif /* !__ASSEMBLER__ */
#endif /* _ASMARM64_ARCH_GICV3_H_ */
@@ -8,7 +8,7 @@
* Copyright (C) 2012 ARM Ltd.
*/
-#ifndef __ASSEMBLY__
+#ifndef __ASSEMBLER__
#error "Only include this from assembly code"
#endif
@@ -37,7 +37,7 @@
#define PGTABLE_LEVELS \
(((VA_BITS - PAGE_SHIFT) + ((PAGE_SHIFT - 3) - 1)) / (PAGE_SHIFT - 3))
-#ifndef __ASSEMBLY__
+#ifndef __ASSEMBLER__
#define PAGE_ALIGN(addr) ALIGN(addr, PAGE_SIZE)
@@ -74,5 +74,5 @@ extern unsigned long __phys_to_virt(phys_addr_t addr);
extern void *__ioremap(phys_addr_t phys_addr, size_t size);
-#endif /* !__ASSEMBLY__ */
+#endif /* !__ASSEMBLER__ */
#endif /* _ASMARM64_PAGE_H_ */
@@ -6,7 +6,7 @@
* This work is licensed under the terms of the GNU LGPL, version 2.
*/
-#ifndef __ASSEMBLY__
+#ifndef __ASSEMBLER__
#include <asm/ptrace.h>
#include <asm/esr.h>
#include <asm/sysreg.h>
@@ -173,5 +173,5 @@ static inline bool system_supports_rndr(void)
return ((id_aa64isar0_el1 >> ID_AA64ISAR0_EL1_RNDR_SHIFT) & 0xf) != 0;
}
-#endif /* !__ASSEMBLY__ */
+#endif /* !__ASSEMBLER__ */
#endif /* _ASMARM64_PROCESSOR_H_ */
@@ -48,7 +48,7 @@
#define PSR_x 0x0000ff00 /* Extension */
#define PSR_c 0x000000ff /* Control */
-#ifndef __ASSEMBLY__
+#ifndef __ASSEMBLER__
#include <libcflat.h>
struct user_pt_regs {
@@ -95,5 +95,5 @@ struct pt_regs {
#define fast_interrupts_enabled(regs) \
(!((regs)->pstate & PSR_F_BIT))
-#endif /* !__ASSEMBLY__ */
+#endif /* !__ASSEMBLER__ */
#endif /* _ASMARM64_PTRACE_H_ */
@@ -13,7 +13,7 @@
#define sys_reg(op0, op1, crn, crm, op2) \
((((op0)&3)<<19)|((op1)<<16)|((crn)<<12)|((crm)<<8)|((op2)<<5))
-#ifdef __ASSEMBLY__
+#ifdef __ASSEMBLER__
.irp num,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30
.equ .L__reg_num_x\num, \num
.endr
@@ -71,7 +71,7 @@ asm(
" .inst 0xd5000000|(\\sreg)|(.L__reg_num_\\rt)\n"
" .endm\n"
);
-#endif /* __ASSEMBLY__ */
+#endif /* __ASSEMBLER__ */
#define ID_AA64ISAR0_EL1_RNDR_SHIFT 60
@@ -15,7 +15,7 @@
#define PAGE_SIZE (_AC(1,UL) << PAGE_SHIFT)
#define PAGE_MASK (~(PAGE_SIZE-1))
-#ifndef __ASSEMBLY__
+#ifndef __ASSEMBLER__
#define PAGE_ALIGN(addr) ALIGN(addr, PAGE_SIZE)
@@ -26,6 +26,6 @@
#define virt_to_pfn(kaddr) (__pa(kaddr) >> PAGE_SHIFT)
#define pfn_to_virt(pfn) __va((pfn) << PAGE_SHIFT)
-#endif /* !__ASSEMBLY__ */
+#endif /* !__ASSEMBLER__ */
#endif /* _ASM_GENERIC_PAGE_H_ */
@@ -7,7 +7,7 @@
#define AUXINFO_MMU_OFF (1 << 0)
-#ifndef __ASSEMBLY__
+#ifndef __ASSEMBLER__
struct auxinfo {
const char *progname;
unsigned long flags;
@@ -20,7 +20,7 @@
#ifndef _LIBCFLAT_H_
#define _LIBCFLAT_H_
-#ifndef __ASSEMBLY__
+#ifndef __ASSEMBLER__
#include <linux/compiler.h>
#include <stdarg.h>
@@ -155,7 +155,7 @@ do { \
void binstr(unsigned long x, char out[BINSTR_SZ]);
void print_binstr(unsigned long x);
-#endif /* !__ASSEMBLY__ */
+#endif /* !__ASSEMBLER__ */
#define SZ_256 (1 << 8)
#define SZ_4K (1 << 12)
@@ -7,7 +7,7 @@
* Copyright 2012 Kim Phillips, Freescale Semiconductor.
*/
-#ifndef __ASSEMBLY__
+#ifndef __ASSEMBLER__
struct fdt_header {
fdt32_t magic; /* magic word FDT_MAGIC */
@@ -6,7 +6,7 @@
#ifndef __LINUX_COMPILER_H
#define __LINUX_COMPILER_H
-#ifndef __ASSEMBLY__
+#ifndef __ASSEMBLER__
#define GCC_VERSION (__GNUC__ * 10000 \
+ __GNUC_MINOR__ * 100 \
@@ -121,5 +121,5 @@ static __always_inline void __write_once_size(volatile void *p, void *res, int s
__u.__val; \
})
-#endif /* !__ASSEMBLY__ */
+#endif /* !__ASSEMBLER__ */
#endif /* !__LINUX_COMPILER_H */
@@ -12,7 +12,7 @@
* leave it unchanged in asm.
*/
-#if defined(__ASSEMBLY__) || defined(__ASSEMBLER__)
+#ifdef __ASSEMBLER__
#define _AC(X,Y) X
#define _AT(T,X) X
#define __ASM_STR(X) X
@@ -34,7 +34,7 @@
#define KVMPPC_HCALL_BASE 0xf000
#define KVMPPC_H_RTAS (KVMPPC_HCALL_BASE + 0x0)
-#ifndef __ASSEMBLY__
+#ifndef __ASSEMBLER__
/*
* hcall_have_broken_sc1 checks if we're on a host with a broken sc1.
* Returns 0 if we're not.
@@ -49,5 +49,5 @@ extern int hcall_have_broken_sc1(void);
*/
extern unsigned long hcall(unsigned long nr, ...);
-#endif /* !__ASSEMBLY__ */
+#endif /* !__ASSEMBLER__ */
#endif /* _ASMPOWERPC_HCALL_H_ */
@@ -5,10 +5,10 @@
#include <asm/ptrace.h>
#include <asm/reg.h>
-#ifndef __ASSEMBLY__
+#ifndef __ASSEMBLER__
void handle_exception(int trap, void (*func)(struct pt_regs *, void *), void *);
void do_handle_exception(struct pt_regs *regs);
-#endif /* __ASSEMBLY__ */
+#endif /* __ASSEMBLER__ */
extern bool host_is_tcg;
extern bool host_is_kvm;
@@ -6,7 +6,7 @@
* This work is licensed under the terms of the GNU LGPL, version 2.
*/
-#ifndef __ASSEMBLY__
+#ifndef __ASSEMBLER__
#include <libcflat.h>
@@ -27,7 +27,7 @@ extern int rtas_call_unlocked(struct rtas_args *args, int token, int nargs, int
extern void rtas_power_off(void);
extern void rtas_stop_self(void);
-#endif /* __ASSEMBLY__ */
+#endif /* __ASSEMBLER__ */
#define RTAS_MSR_MASK 0xfffffffffffffffe
@@ -24,7 +24,7 @@
#endif
#define PAGE_MASK (~(PAGE_SIZE-1))
-#ifndef __ASSEMBLY__
+#ifndef __ASSEMBLER__
#define PAGE_ALIGN(addr) ALIGN(addr, PAGE_SIZE)
@@ -61,5 +61,5 @@ extern unsigned long __phys_to_virt(phys_addr_t addr);
extern void *__ioremap(phys_addr_t phys_addr, size_t size);
-#endif /* !__ASSEMBLY__ */
+#endif /* !__ASSEMBLER__ */
#endif /* _ASMPPC64_PAGE_H_ */
@@ -4,7 +4,7 @@
#define KERNEL_REDZONE_SIZE 288
#define STACK_FRAME_OVERHEAD 112 /* size of minimum stack frame */
-#ifndef __ASSEMBLY__
+#ifndef __ASSEMBLER__
#include <asm/reg.h>
@@ -36,6 +36,6 @@ static inline void regs_advance_insn(struct pt_regs *regs)
#define STACK_INT_FRAME_SIZE (sizeof(struct pt_regs) + \
STACK_FRAME_OVERHEAD + KERNEL_REDZONE_SIZE)
-#endif /* __ASSEMBLY__ */
+#endif /* __ASSEMBLER__ */
#endif /* _ASMPPC64_PTRACE_H_ */
@@ -4,7 +4,7 @@
* This work is licensed under the terms of the GNU LGPL, version 2.
*/
-#ifndef __ASSEMBLY__
+#ifndef __ASSEMBLER__
struct vpa {
uint32_t descriptor;
@@ -57,6 +57,6 @@ struct vpa {
uint8_t reserved10[96];
};
-#endif /* __ASSEMBLY__ */
+#endif /* __ASSEMBLER__ */
#endif /* _ASMPOWERPC_VPA_H_ */
@@ -2,7 +2,7 @@
#ifndef _ASMRISCV_BUG_H_
#define _ASMRISCV_BUG_H_
-#ifndef __ASSEMBLY__
+#ifndef __ASSEMBLER__
static inline void bug(void)
{
@@ -56,7 +56,7 @@
#define IP_TIP IE_TIE
-#ifndef __ASSEMBLY__
+#ifndef __ASSEMBLER__
#define csr_swap(csr, val) \
({ \
@@ -118,5 +118,5 @@
: "memory"); \
})
-#endif /* !__ASSEMBLY__ */
+#endif /* !__ASSEMBLER__ */
#endif /* _ASMRISCV_CSR_H_ */
@@ -2,7 +2,7 @@
#ifndef _ASMRISCV_PAGE_H_
#define _ASMRISCV_PAGE_H_
-#ifndef __ASSEMBLY__
+#ifndef __ASSEMBLER__
typedef unsigned long pgd_t;
typedef unsigned long pte_t;
@@ -14,7 +14,7 @@ typedef unsigned long pteval_t;
#define __pte(x) ((pte_t)(x))
#define __pgprot(x) ((pgprot_t)(x))
-#endif /* !__ASSEMBLY__ */
+#endif /* !__ASSEMBLER__ */
#include <asm-generic/page.h>
@@ -12,7 +12,7 @@
#define SBI_ERR_ALREADY_STARTED -7
#define SBI_ERR_ALREADY_STOPPED -8
-#ifndef __ASSEMBLY__
+#ifndef __ASSEMBLER__
#include <cpumask.h>
enum sbi_ext_id {
@@ -92,5 +92,5 @@ struct sbiret sbi_send_ipi_broadcast(void);
struct sbiret sbi_set_timer(unsigned long stime_value);
long sbi_probe(int ext);
-#endif /* !__ASSEMBLY__ */
+#endif /* !__ASSEMBLER__ */
#endif /* _ASMRISCV_SBI_H_ */
@@ -1,5 +1,4 @@
/* SPDX-License-Identifier: GPL-2.0 */
-#define __ASSEMBLY__
#include <asm/asm.h>
.section .text
@@ -5,7 +5,6 @@
*
* This work is licensed under the terms of the GNU LGPL, version 2.
*/
-#define __ASSEMBLY__
#include <asm/hcall.h>
#include <asm/ppc_asm.h>
#include <asm/rtas.h>
@@ -4,7 +4,6 @@
*
* Copyright (C) 2024, James Raphael Tiovalen <jamestiotio@gmail.com>
*/
-#define __ASSEMBLY__
#include <asm/asm.h>
#include <asm/csr.h>
Convert all non-x86 #ifdefs from __ASSEMBLY__ to __ASSEMBLER__, and remove all manual __ASSEMBLY__ #defines. __ASSEMBLY_ was inherited blindly from the Linux kernel, and must be manually defined, e.g. through build rules or with the aforementioned explicit #defines in assembly code. __ASSEMBLER__ on the other hand is automatically defined by the compiler when preprocessing assembly, i.e. doesn't require manually #defines for the code to function correctly. Ignore x86, as x86 doesn't actually rely on __ASSEMBLY__ at the moment, and is undergoing a parallel cleanup. Signed-off-by: Sean Christopherson <seanjc@google.com> --- Completely untested. This is essentially a "rage" patch after spending way, way too much time trying to understand why I couldn't include some __ASSEMBLY__ protected headers in x86 assembly files. arm/cstart.S | 1 - arm/cstart64.S | 1 - lib/arm/asm/arch_gicv3.h | 4 ++-- lib/arm/asm/assembler.h | 2 +- lib/arm/asm/gic-v2.h | 4 ++-- lib/arm/asm/gic-v3.h | 4 ++-- lib/arm/asm/gic.h | 4 ++-- lib/arm/asm/page.h | 4 ++-- lib/arm/asm/ptrace.h | 4 ++-- lib/arm/asm/sysreg.h | 4 ++-- lib/arm/asm/thread_info.h | 4 ++-- lib/arm/asm/timer.h | 4 ++-- lib/arm64/asm/arch_gicv3.h | 4 ++-- lib/arm64/asm/assembler.h | 2 +- lib/arm64/asm/page.h | 4 ++-- lib/arm64/asm/processor.h | 4 ++-- lib/arm64/asm/ptrace.h | 4 ++-- lib/arm64/asm/sysreg.h | 4 ++-- lib/asm-generic/page.h | 4 ++-- lib/auxinfo.h | 2 +- lib/libcflat.h | 4 ++-- lib/libfdt/fdt.h | 2 +- lib/linux/compiler.h | 4 ++-- lib/linux/const.h | 2 +- lib/powerpc/asm/hcall.h | 4 ++-- lib/powerpc/asm/processor.h | 4 ++-- lib/powerpc/asm/rtas.h | 4 ++-- lib/ppc64/asm/page.h | 4 ++-- lib/ppc64/asm/ptrace.h | 4 ++-- lib/ppc64/asm/vpa.h | 4 ++-- lib/riscv/asm/bug.h | 2 +- lib/riscv/asm/csr.h | 4 ++-- lib/riscv/asm/page.h | 4 ++-- lib/riscv/asm/sbi.h | 4 ++-- lib/riscv/setjmp.S | 1 - powerpc/cstart64.S | 1 - riscv/sbi-asm.S | 1 - 37 files changed, 58 insertions(+), 63 deletions(-) base-commit: f77fb696cfd0e4a5562cdca189be557946bf522f