Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 26 Jul 2023 00:00:22 GMT
From:      Mike Karels <karels@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: d5d97bed4ab6 - main - arm64 lib32: prepare arm64 headers to redirect to arm
Message-ID:  <202307260000.36Q00MjE087396@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by karels:

URL: https://cgit.FreeBSD.org/src/commit/?id=d5d97bed4ab6bb63e97c8ff67b5b94ae37cd24fc

commit d5d97bed4ab6bb63e97c8ff67b5b94ae37cd24fc
Author:     Mike Karels <karels@FreeBSD.org>
AuthorDate: 2023-07-25 23:59:26 +0000
Commit:     Mike Karels <karels@FreeBSD.org>
CommitDate: 2023-07-25 23:59:26 +0000

    arm64 lib32: prepare arm64 headers to redirect to arm
    
    In order to compile lib32 libraries and other 32-bit code on arm64,
    <machine/foo.h> needs to be redirected to an arm header rather
    than arm64 when building with -m32.  Ifdef the arm64 headers that
    are installed in /usr/include/machine and used by user-level software
    (including references from /usr/include/*.h) so that if __arm__ is
    defined when including the arm64 version, <arm/foo.h> is included
    rather than using the rest of the file's contents.  Some arm headers
    had no arm64 equivalent; headers were added just to do the redirection.
    These files use #error if __arm__ is not defined to guard against
    confusion.  Also add an include/arm Makefile, and modify Makefiles
    as needed to install everything, including the arm files in
    /usr/include/arm.  fenv.h comes from lib/msun/arm/fenv.h.
    
    The new arm64 headers are:
        acle-compat.h
        cpuinfo.h
        sysreg.h
    
    Reviewed by:    jrtc27, imp
    Differential Revision:  https://reviews.freebsd.org/D40944
---
 include/Makefile                | 13 ++++++---
 include/arm/Makefile            | 60 +++++++++++++++++++++++++++++++++++++++++
 lib/msun/aarch64/fenv.h         |  6 +++++
 sys/arm64/include/_align.h      |  6 +++++
 sys/arm64/include/_inttypes.h   |  6 +++++
 sys/arm64/include/_limits.h     |  6 +++++
 sys/arm64/include/_stdint.h     |  6 +++++
 sys/arm64/include/_types.h      |  6 +++++
 sys/arm64/include/acle-compat.h |  5 ++++
 sys/arm64/include/armreg.h      |  6 +++++
 sys/arm64/include/asm.h         |  6 +++++
 sys/arm64/include/atomic.h      |  6 +++++
 sys/arm64/include/bus.h         |  6 +++++
 sys/arm64/include/counter.h     |  6 +++++
 sys/arm64/include/cpu.h         |  6 +++++
 sys/arm64/include/cpufunc.h     |  6 +++++
 sys/arm64/include/cpuinfo.h     |  5 ++++
 sys/arm64/include/efi.h         |  6 +++++
 sys/arm64/include/elf.h         |  6 +++++
 sys/arm64/include/exec.h        |  6 +++++
 sys/arm64/include/float.h       |  6 +++++
 sys/arm64/include/frame.h       |  6 +++++
 sys/arm64/include/ieeefp.h      |  6 +++++
 sys/arm64/include/param.h       |  6 +++++
 sys/arm64/include/pcb.h         |  6 +++++
 sys/arm64/include/pcpu.h        |  6 +++++
 sys/arm64/include/pcpu_aux.h    |  6 +++++
 sys/arm64/include/pmap.h        |  6 +++++
 sys/arm64/include/proc.h        |  6 +++++
 sys/arm64/include/profile.h     |  6 +++++
 sys/arm64/include/pte.h         |  6 +++++
 sys/arm64/include/reg.h         |  6 +++++
 sys/arm64/include/reloc.h       |  6 +++++
 sys/arm64/include/resource.h    |  6 +++++
 sys/arm64/include/runq.h        |  6 +++++
 sys/arm64/include/setjmp.h      |  6 +++++
 sys/arm64/include/sf_buf.h      |  6 +++++
 sys/arm64/include/signal.h      |  6 +++++
 sys/arm64/include/sysarch.h     |  6 +++++
 sys/arm64/include/sysreg.h      |  5 ++++
 sys/arm64/include/tls.h         |  6 +++++
 sys/arm64/include/ucontext.h    |  6 +++++
 sys/arm64/include/vdso.h        |  6 +++++
 sys/arm64/include/vfp.h         |  6 +++++
 sys/arm64/include/vmparam.h     |  6 +++++
 45 files changed, 324 insertions(+), 4 deletions(-)

diff --git a/include/Makefile b/include/Makefile
index 922337a87772..ce8c49d3a7cd 100644
--- a/include/Makefile
+++ b/include/Makefile
@@ -9,7 +9,12 @@ PACKAGE=runtime
 CLEANFILES= osreldate.h version
 SUBDIR= arpa protocols rpcsvc rpc xlocale
 .if ${MACHINE_CPUARCH} == "amd64"
-SUBDIR+=	i386
+SUBDIR+=		i386
+INCLUDE_SUBDIRS+=	i386
+.endif
+.if ${MACHINE_CPUARCH} == "aarch64"
+SUBDIR+=		arm
+INCLUDE_SUBDIRS+=	arm
 .endif
 SUBDIR_PARALLEL=
 INCS=	a.out.h ar.h assert.h bitstring.h byteswap.h \
@@ -353,10 +358,10 @@ compat:
 	mtree -deU ${NO_ROOT:D-W} ${MTREE_FOLLOWS_SYMLINKS} \
 	    -f ${SRCTOP}/etc/mtree/BSD.include.dist \
 	    -p ${SDESTDIR}${INCLUDEDIR} > /dev/null
-.if ${MACHINE_CPUARCH} == "amd64"
+.for d in ${INCLUDE_SUBDIRS}
 	${INSTALL} -d ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 755 \
-	    ${SDESTDIR}${INCLUDEDIR}/i386
-.endif
+	    ${SDESTDIR}${INCLUDEDIR}/${d}
+.endfor
 
 copies: .PHONY .META
 	cd ${SDESTDIR}${INCLUDEDIR}; find ${LDIRS} ${LSUBDIRS} ${LSUBSUBDIRS} crypto \
diff --git a/include/arm/Makefile b/include/arm/Makefile
new file mode 100644
index 000000000000..1f596763df77
--- /dev/null
+++ b/include/arm/Makefile
@@ -0,0 +1,60 @@
+# arm headers installed on arm64
+
+.PATH: ${SRCTOP}/sys/arm/include ${SRCTOP}/lib/msun/arm
+
+INCS=	_align.h \
+	_inttypes.h \
+	_limits.h \
+	_stdint.h \
+	_types.h \
+	acle-compat.h \
+	armreg.h \
+	asm.h \
+	atomic.h \
+	bus.h \
+	counter.h \
+	cpu.h \
+	cpufunc.h \
+	cpuinfo.h \
+	efi.h \
+	elf.h \
+	exec.h \
+	float.h \
+	frame.h \
+	ieeefp.h \
+	param.h \
+	pcb.h \
+	pcpu.h \
+	pmap.h \
+	proc.h \
+	profile.h \
+	pte.h \
+	reg.h \
+	reloc.h \
+	resource.h \
+	runq.h \
+	setjmp.h \
+	signal.h \
+	sysarch.h \
+	sysreg.h \
+	tls.h \
+	ucontext.h \
+	vdso.h \
+	vfp.h \
+	vmparam.h
+# These kernel-only headers are used by procstat's ZFS support.
+# This should be fixed.
+INCS+=	pcpu_aux.h \
+	sf_buf.h
+# from lib/msun/arm
+INCS+=	fenv.h
+INCSDIR=	${INCLUDEDIR}/arm
+
+beforeinstall: armdir
+META_TARGETS+=	armdir
+
+armdir:
+	${INSTALL} -d ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 755 \
+	    ${DESTDIR}${INCLUDEDIR}/arm
+
+.include <bsd.prog.mk>
diff --git a/lib/msun/aarch64/fenv.h b/lib/msun/aarch64/fenv.h
index 2a55db3a9545..80b3fdf4cc1b 100644
--- a/lib/msun/aarch64/fenv.h
+++ b/lib/msun/aarch64/fenv.h
@@ -26,6 +26,10 @@
  * $FreeBSD$
  */
 
+#ifdef __arm__
+#include <arm/fenv.h>
+#else /* __arm__ */
+
 #ifndef	_FENV_H_
 #define	_FENV_H_
 
@@ -244,3 +248,5 @@ fegetexcept(void)
 __END_DECLS
 
 #endif	/* !_FENV_H_ */
+
+#endif /* __arm__ */
diff --git a/sys/arm64/include/_align.h b/sys/arm64/include/_align.h
index 3844133ffb68..5c153779aca3 100644
--- a/sys/arm64/include/_align.h
+++ b/sys/arm64/include/_align.h
@@ -30,6 +30,10 @@
  * $FreeBSD$
  */
 
+#ifdef __arm__
+#include <arm/_align.h>
+#else /* !__arm__ */
+
 #ifndef _MACHINE__ALIGN_H_
 #define	_MACHINE__ALIGN_H_
 
@@ -42,3 +46,5 @@
 #define	_ALIGN(p)	(((u_long)(p) + _ALIGNBYTES) & ~_ALIGNBYTES)
 
 #endif /* !_MACHINE__ALIGN_H_ */
+
+#endif /* !__arm__ */
diff --git a/sys/arm64/include/_inttypes.h b/sys/arm64/include/_inttypes.h
index df1af0b25df0..4c21d47f6c51 100644
--- a/sys/arm64/include/_inttypes.h
+++ b/sys/arm64/include/_inttypes.h
@@ -30,6 +30,10 @@
  * $FreeBSD$
  */
 
+#ifdef __arm__
+#include <arm/_inttypes.h>
+#else /* !__arm__ */
+
 #ifndef _MACHINE__INTTYPES_H_
 #define	_MACHINE__INTTYPES_H_
 
@@ -211,3 +215,5 @@
 #define	SCNxPTR		"lx"	/* uintptr_t */
 
 #endif /* !_MACHINE__INTTYPES_H_ */
+
+#endif /* !__arm__ */
diff --git a/sys/arm64/include/_limits.h b/sys/arm64/include/_limits.h
index 39f0bcf0f5b2..d64a9afe1a1c 100644
--- a/sys/arm64/include/_limits.h
+++ b/sys/arm64/include/_limits.h
@@ -27,6 +27,10 @@
  * $FreeBSD$
  */
 
+#ifdef __arm__
+#include <arm/_limits.h>
+#else /* !__arm__ */
+
 #ifndef _MACHINE__LIMITS_H_
 #define	_MACHINE__LIMITS_H_
 
@@ -83,3 +87,5 @@
 #define	__MINSIGSTKSZ	(1024 * 4)
 
 #endif /* !_MACHINE__LIMITS_H_ */
+
+#endif /* !__arm__ */
diff --git a/sys/arm64/include/_stdint.h b/sys/arm64/include/_stdint.h
index d73a9c088b59..6c978befc8b2 100644
--- a/sys/arm64/include/_stdint.h
+++ b/sys/arm64/include/_stdint.h
@@ -30,6 +30,10 @@
  * $FreeBSD$
  */
 
+#ifdef __arm__
+#include <arm/_stdint.h>
+#else /* !__arm__ */
+
 #ifndef _MACHINE__STDINT_H_
 #define	_MACHINE__STDINT_H_
 
@@ -156,3 +160,5 @@
 #endif /* !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) */
 
 #endif /* !_MACHINE__STDINT_H_ */
+
+#endif /* !__arm__ */
diff --git a/sys/arm64/include/_types.h b/sys/arm64/include/_types.h
index 720900a270d4..69610b96fa3b 100644
--- a/sys/arm64/include/_types.h
+++ b/sys/arm64/include/_types.h
@@ -32,6 +32,10 @@
  * $FreeBSD$
  */
 
+#ifdef __arm__
+#include <arm/_types.h>
+#else /* !__arm__ */
+
 #ifndef _MACHINE__TYPES_H_
 #define	_MACHINE__TYPES_H_
 
@@ -67,3 +71,5 @@ typedef	unsigned int	___wchar_t;
 #define	__WCHAR_MAX	__UINT_MAX	/* max value for a wchar_t */
 
 #endif /* !_MACHINE__TYPES_H_ */
+
+#endif /* !__arm__ */
diff --git a/sys/arm64/include/acle-compat.h b/sys/arm64/include/acle-compat.h
new file mode 100644
index 000000000000..9954f27fd424
--- /dev/null
+++ b/sys/arm64/include/acle-compat.h
@@ -0,0 +1,5 @@
+#ifdef __arm__
+#include <arm/acle-compat.h>
+#else /* !__arm__ */
+#error Do not include this header, used only for 32-bit compatibility
+#endif /* !__arm__ */
diff --git a/sys/arm64/include/armreg.h b/sys/arm64/include/armreg.h
index b40dfb206f99..f20b7a8c710e 100644
--- a/sys/arm64/include/armreg.h
+++ b/sys/arm64/include/armreg.h
@@ -29,6 +29,10 @@
  * $FreeBSD$
  */
 
+#ifdef __arm__
+#include <arm/armreg.h>
+#else /* !__arm__ */
+
 #ifndef _MACHINE_ARMREG_H_
 #define	_MACHINE_ARMREG_H_
 
@@ -1994,3 +1998,5 @@
 #define	ZCR_LEN_BYTES(x)	((((x) & ZCR_LEN_MASK) + 1) * 16)
 
 #endif /* !_MACHINE_ARMREG_H_ */
+
+#endif /* !__arm__ */
diff --git a/sys/arm64/include/asm.h b/sys/arm64/include/asm.h
index b1d4ba50be9a..fbd09a5607c4 100644
--- a/sys/arm64/include/asm.h
+++ b/sys/arm64/include/asm.h
@@ -26,6 +26,10 @@
  * $FreeBSD$
  */
 
+#ifdef __arm__
+#include <arm/asm.h>
+#else /* !__arm__ */
+
 #ifndef _MACHINE_ASM_H_
 #define	_MACHINE_ASM_H_
 
@@ -113,3 +117,5 @@
 	isb
 
 #endif /* _MACHINE_ASM_H_ */
+
+#endif /* !__arm__ */
diff --git a/sys/arm64/include/atomic.h b/sys/arm64/include/atomic.h
index b14cd303da3a..172bf051edf3 100644
--- a/sys/arm64/include/atomic.h
+++ b/sys/arm64/include/atomic.h
@@ -26,6 +26,10 @@
  * $FreeBSD$
  */
 
+#ifdef __arm__
+#include <arm/atomic.h>
+#else /* !__arm__ */
+
 #ifndef	_MACHINE_ATOMIC_H_
 #define	_MACHINE_ATOMIC_H_
 
@@ -670,3 +674,5 @@ atomic_thread_fence_seq_cst(void)
 
 #endif /* KCSAN && !KCSAN_RUNTIME */
 #endif /* _MACHINE_ATOMIC_H_ */
+
+#endif /* !__arm__ */
diff --git a/sys/arm64/include/bus.h b/sys/arm64/include/bus.h
index 902be0db3b62..4a43a8fb94c2 100644
--- a/sys/arm64/include/bus.h
+++ b/sys/arm64/include/bus.h
@@ -65,6 +65,10 @@
  * $FreeBSD$
  */
 
+#ifdef __arm__
+#include <arm/bus.h>
+#else /* !__arm__ */
+
 #ifndef _MACHINE_BUS_H_
 #define	_MACHINE_BUS_H_
 
@@ -521,3 +525,5 @@ struct bus_space {
 #include <machine/bus_dma.h>
 
 #endif /* _MACHINE_BUS_H_ */
+
+#endif /* !__arm__ */
diff --git a/sys/arm64/include/counter.h b/sys/arm64/include/counter.h
index 7f747b525d9c..513f67ac7f90 100644
--- a/sys/arm64/include/counter.h
+++ b/sys/arm64/include/counter.h
@@ -26,6 +26,10 @@
  * $FreeBSD$
  */
 
+#ifdef __arm__
+#include <arm/counter.h>
+#else /* !__arm__ */
+
 #ifndef _MACHINE_COUNTER_H_
 #define	_MACHINE_COUNTER_H_
 
@@ -85,3 +89,5 @@ counter_u64_add(counter_u64_t c, int64_t inc)
 }
 
 #endif	/* ! _MACHINE_COUNTER_H_ */
+
+#endif /* !__arm__ */
diff --git a/sys/arm64/include/cpu.h b/sys/arm64/include/cpu.h
index 0bb320f2e0a0..6d83ef25793c 100644
--- a/sys/arm64/include/cpu.h
+++ b/sys/arm64/include/cpu.h
@@ -38,6 +38,10 @@
  * $FreeBSD$
  */
 
+#ifdef __arm__
+#include <arm/cpu.h>
+#else /* !__arm__ */
+
 #ifndef _MACHINE_CPU_H_
 #define	_MACHINE_CPU_H_
 
@@ -253,3 +257,5 @@ ADDRESS_TRANSLATE_FUNC(s1e1w)
 #endif
 
 #endif /* !_MACHINE_CPU_H_ */
+
+#endif /* !__arm__ */
diff --git a/sys/arm64/include/cpufunc.h b/sys/arm64/include/cpufunc.h
index f2de8a0e560c..b2ec5672aeb8 100644
--- a/sys/arm64/include/cpufunc.h
+++ b/sys/arm64/include/cpufunc.h
@@ -26,6 +26,10 @@
  * $FreeBSD$
  */
 
+#ifdef __arm__
+#include <arm/cpufunc.h>
+#else /* !__arm__ */
+
 #ifndef _MACHINE_CPUFUNC_H_
 #define	_MACHINE_CPUFUNC_H_
 
@@ -193,3 +197,5 @@ bool arm64_get_writable_addr(vm_offset_t, vm_offset_t *);
 
 #endif	/* _KERNEL */
 #endif	/* _MACHINE_CPUFUNC_H_ */
+
+#endif /* !__arm__ */
diff --git a/sys/arm64/include/cpuinfo.h b/sys/arm64/include/cpuinfo.h
new file mode 100644
index 000000000000..004f611ccf80
--- /dev/null
+++ b/sys/arm64/include/cpuinfo.h
@@ -0,0 +1,5 @@
+#ifdef __arm__
+#include <arm/cpuinfo.h>
+#else /* !__arm__ */
+#error Do not include this header, used only for 32-bit compatibility
+#endif /* !__arm__ */
diff --git a/sys/arm64/include/efi.h b/sys/arm64/include/efi.h
index 6db16e5b8291..3494c547362d 100644
--- a/sys/arm64/include/efi.h
+++ b/sys/arm64/include/efi.h
@@ -30,6 +30,10 @@
  * $FreeBSD$
  */
 
+#ifdef __arm__
+#include <arm/efi.h>
+#else /* !__arm__ */
+
 #ifndef __ARM64_INCLUDE_EFI_H_
 #define __ARM64_INCLUDE_EFI_H_
 
@@ -58,3 +62,5 @@ struct efirt_callinfo {
 };
 
 #endif /* __ARM64_INCLUDE_EFI_H_ */
+
+#endif /* !__arm__ */
diff --git a/sys/arm64/include/elf.h b/sys/arm64/include/elf.h
index 22e968c632bf..0399392b8fb6 100644
--- a/sys/arm64/include/elf.h
+++ b/sys/arm64/include/elf.h
@@ -26,6 +26,10 @@
  * $FreeBSD$
  */
 
+#ifdef __arm__
+#include <arm/elf.h>
+#else /* !__arm__ */
+
 #ifndef	_MACHINE_ELF_H_
 #define	_MACHINE_ELF_H_
 
@@ -180,3 +184,5 @@ __ElfType(Auxinfo);
 #endif
 
 #endif /* !_MACHINE_ELF_H_ */
+
+#endif /* !__arm__ */
diff --git a/sys/arm64/include/exec.h b/sys/arm64/include/exec.h
index da23dbe43a4f..00b6fc25f3a2 100644
--- a/sys/arm64/include/exec.h
+++ b/sys/arm64/include/exec.h
@@ -1 +1,7 @@
 /* $FreeBSD$ */
+
+#ifdef __arm__
+#include <arm/exec.h>
+#else /* !__arm__ */
+/* empty */
+#endif /* !__arm__ */
diff --git a/sys/arm64/include/float.h b/sys/arm64/include/float.h
index 0829f6f52aa9..0fe90637fda1 100644
--- a/sys/arm64/include/float.h
+++ b/sys/arm64/include/float.h
@@ -30,6 +30,10 @@
  * $FreeBSD$
  */
 
+#ifdef __arm__
+#include <arm/float.h>
+#else /* !__arm__ */
+
 #ifndef _MACHINE_FLOAT_H_
 #define	_MACHINE_FLOAT_H_
 
@@ -92,3 +96,5 @@ __END_DECLS
 #endif /* __ISO_C_VISIBLE >= 2011 */
 
 #endif /* _MACHINE_FLOAT_H_ */
+
+#endif /* !__arm__ */
diff --git a/sys/arm64/include/frame.h b/sys/arm64/include/frame.h
index c838193bee9e..7a841ff160f1 100644
--- a/sys/arm64/include/frame.h
+++ b/sys/arm64/include/frame.h
@@ -30,6 +30,10 @@
  * $FreeBSD$
  */
 
+#ifdef __arm__
+#include <arm/frame.h>
+#else /* !__arm__ */
+
 #ifndef _MACHINE_FRAME_H_
 #define	_MACHINE_FRAME_H_
 
@@ -77,3 +81,5 @@ struct sigframe32 {
 #endif /* !LOCORE */
 
 #endif /* !_MACHINE_FRAME_H_ */
+
+#endif /* !__arm__ */
diff --git a/sys/arm64/include/ieeefp.h b/sys/arm64/include/ieeefp.h
index 178721a65b1e..8c7166741c0c 100644
--- a/sys/arm64/include/ieeefp.h
+++ b/sys/arm64/include/ieeefp.h
@@ -4,6 +4,10 @@
  * $FreeBSD$
  */
 
+#ifdef __arm__
+#include <arm/ieeefp.h>
+#else /* !__arm__ */
+
 #ifndef _MACHINE_IEEEFP_H_
 #define	_MACHINE_IEEEFP_H_
 
@@ -41,3 +45,5 @@ extern fp_except_t fpsetmask(fp_except_t);
 __END_DECLS
 
 #endif /* _MACHINE_IEEEFP_H_ */
+
+#endif /* !__arm__ */
diff --git a/sys/arm64/include/param.h b/sys/arm64/include/param.h
index c94b797f8cca..a44fa3fcd9d2 100644
--- a/sys/arm64/include/param.h
+++ b/sys/arm64/include/param.h
@@ -30,6 +30,10 @@
  * $FreeBSD$
  */
 
+#ifdef __arm__
+#include <arm/param.h>
+#else /* !__arm__ */
+
 #ifndef _MACHINE_PARAM_H_
 #define	_MACHINE_PARAM_H_
 
@@ -130,3 +134,5 @@
 #define	pgtok(x)		((unsigned long)(x) * (PAGE_SIZE / 1024))
 
 #endif /* !_MACHINE_PARAM_H_ */
+
+#endif /* !__arm__ */
diff --git a/sys/arm64/include/pcb.h b/sys/arm64/include/pcb.h
index 85c92727ca43..8eb342ecd0bc 100644
--- a/sys/arm64/include/pcb.h
+++ b/sys/arm64/include/pcb.h
@@ -26,6 +26,10 @@
  * $FreeBSD$
  */
 
+#ifdef __arm__
+#include <arm/pcb.h>
+#else /* !__arm__ */
+
 #ifndef	_MACHINE_PCB_H_
 #define	_MACHINE_PCB_H_
 
@@ -87,3 +91,5 @@ int	savectx(struct pcb *pcb) __returns_twice;
 #endif /* !LOCORE */
 
 #endif /* !_MACHINE_PCB_H_ */
+
+#endif /* !__arm__ */
diff --git a/sys/arm64/include/pcpu.h b/sys/arm64/include/pcpu.h
index 38a8cd3c3e56..ebb72799d83f 100644
--- a/sys/arm64/include/pcpu.h
+++ b/sys/arm64/include/pcpu.h
@@ -27,6 +27,10 @@
  * $FreeBSD$
  */
 
+#ifdef __arm__
+#include <arm/pcpu.h>
+#else /* !__arm__ */
+
 #ifndef	_MACHINE_PCPU_H_
 #define	_MACHINE_PCPU_H_
 
@@ -89,3 +93,5 @@ get_curthread(void)
 #endif	/* _KERNEL */
 
 #endif	/* !_MACHINE_PCPU_H_ */
+
+#endif /* !__arm__ */
diff --git a/sys/arm64/include/pcpu_aux.h b/sys/arm64/include/pcpu_aux.h
index 57637c50063a..fada4ed65fb5 100644
--- a/sys/arm64/include/pcpu_aux.h
+++ b/sys/arm64/include/pcpu_aux.h
@@ -30,6 +30,10 @@
  * $FreeBSD$
  */
 
+#ifdef __arm__
+#include <arm/pcpu_aux.h>
+#else /* !__arm__ */
+
 #ifndef _MACHINE_PCPU_AUX_H_
 #define	_MACHINE_PCPU_AUX_H_
 
@@ -50,3 +54,5 @@ _Static_assert(PAGE_SIZE % sizeof(struct pcpu) == 0, "fix pcpu size");
 extern struct pcpu pcpu0;
 
 #endif	/* _MACHINE_PCPU_AUX_H_ */
+
+#endif /* !__arm__ */
diff --git a/sys/arm64/include/pmap.h b/sys/arm64/include/pmap.h
index b855a811d3c0..5af90e6a3ca7 100644
--- a/sys/arm64/include/pmap.h
+++ b/sys/arm64/include/pmap.h
@@ -33,6 +33,10 @@
  * $FreeBSD$
  */
 
+#ifdef __arm__
+#include <arm/pmap.h>
+#else /* !__arm__ */
+
 #ifndef _MACHINE_PMAP_H_
 #define	_MACHINE_PMAP_H_
 
@@ -198,3 +202,5 @@ void	pmap_san_bootstrap(struct arm64_bootparams *);
 #endif	/* !LOCORE */
 
 #endif	/* !_MACHINE_PMAP_H_ */
+
+#endif /* !__arm__ */
diff --git a/sys/arm64/include/proc.h b/sys/arm64/include/proc.h
index eb5fe806088a..9538c3ea1e4a 100644
--- a/sys/arm64/include/proc.h
+++ b/sys/arm64/include/proc.h
@@ -31,6 +31,10 @@
  * $FreeBSD$
  */
 
+#ifdef __arm__
+#include <arm/proc.h>
+#else /* !__arm__ */
+
 #ifndef	_MACHINE_PROC_H_
 #define	_MACHINE_PROC_H_
 
@@ -75,3 +79,5 @@ struct mdproc {
 #define	KINFO_PROC32_SIZE 816
 
 #endif /* !_MACHINE_PROC_H_ */
+
+#endif /* !__arm__ */
diff --git a/sys/arm64/include/profile.h b/sys/arm64/include/profile.h
index f898e2707d65..0f077e4ba6ed 100644
--- a/sys/arm64/include/profile.h
+++ b/sys/arm64/include/profile.h
@@ -31,6 +31,10 @@
  * $FreeBSD$
  */
 
+#ifdef __arm__
+#include <arm/profile.h>
+#else /* !__arm__ */
+
 #ifndef _MACHINE_PROFILE_H_
 #define	_MACHINE_PROFILE_H_
 
@@ -89,3 +93,5 @@ mcount(uintfptr_t frompc)
 #endif /* !_KERNEL */
 
 #endif /* !_MACHINE_PROFILE_H_ */
+
+#endif /* !__arm__ */
diff --git a/sys/arm64/include/pte.h b/sys/arm64/include/pte.h
index c320d71bb0f6..f51ac49a5d5d 100644
--- a/sys/arm64/include/pte.h
+++ b/sys/arm64/include/pte.h
@@ -30,6 +30,10 @@
  * $FreeBSD$
  */
 
+#ifdef __arm__
+#include <arm/pte.h>
+#else /* !__arm__ */
+
 #ifndef _MACHINE_PTE_H_
 #define	_MACHINE_PTE_H_
 
@@ -188,3 +192,5 @@ typedef	uint64_t	pt_entry_t;		/* page table entry */
 #endif /* !_MACHINE_PTE_H_ */
 
 /* End of pte.h */
+
+#endif /* !__arm__ */
diff --git a/sys/arm64/include/reg.h b/sys/arm64/include/reg.h
index 4e8ca4f4e834..027c02a59903 100644
--- a/sys/arm64/include/reg.h
+++ b/sys/arm64/include/reg.h
@@ -30,6 +30,10 @@
  * $FreeBSD$
  */
 
+#ifdef __arm__
+#include <arm/reg.h>
+#else /* !__arm__ */
+
 #ifndef	_MACHINE_REG_H_
 #define	_MACHINE_REG_H_
 
@@ -91,3 +95,5 @@ struct arm64_addr_mask {
 #define	__HAVE_REG32
 
 #endif /* !_MACHINE_REG_H_ */
+
+#endif /* !__arm__ */
diff --git a/sys/arm64/include/reloc.h b/sys/arm64/include/reloc.h
index da23dbe43a4f..b6e2eb6f775c 100644
--- a/sys/arm64/include/reloc.h
+++ b/sys/arm64/include/reloc.h
@@ -1 +1,7 @@
 /* $FreeBSD$ */
+
+#ifdef __arm__
+#include <arm/reloc.h>
+#else /* !__arm__ */
+/* empty */
+#endif /* !__arm__ */
diff --git a/sys/arm64/include/resource.h b/sys/arm64/include/resource.h
index aef4fad4516d..82d36fe6beb7 100644
--- a/sys/arm64/include/resource.h
+++ b/sys/arm64/include/resource.h
@@ -29,6 +29,10 @@
  * $FreeBSD$
  */
 
+#ifdef __arm__
+#include <arm/resource.h>
+#else /* !__arm__ */
+
 #ifndef _MACHINE_RESOURCE_H_
 #define	_MACHINE_RESOURCE_H_	1
 
@@ -47,3 +51,5 @@
 #endif
 
 #endif /* !_MACHINE_RESOURCE_H_ */
+
+#endif /* !__arm__ */
diff --git a/sys/arm64/include/runq.h b/sys/arm64/include/runq.h
index eaeb824a6698..0dfd55d3b726 100644
--- a/sys/arm64/include/runq.h
+++ b/sys/arm64/include/runq.h
@@ -26,6 +26,10 @@
  * $FreeBSD$
  */
 
+#ifdef __arm__
+#include <arm/runq.h>
+#else /* !__arm__ */
+
 #ifndef	_MACHINE_RUNQ_H_
 #define	_MACHINE_RUNQ_H_
 
@@ -44,3 +48,5 @@
 typedef	unsigned long	rqb_word_t;
 
 #endif
+
+#endif /* !__arm__ */
diff --git a/sys/arm64/include/setjmp.h b/sys/arm64/include/setjmp.h
index af11a246cd3f..a88452a55015 100644
--- a/sys/arm64/include/setjmp.h
+++ b/sys/arm64/include/setjmp.h
@@ -30,6 +30,10 @@
  * $FreeBSD$
  */
 
+#ifdef __arm__
+#include <arm/setjmp.h>
+#else /* !__arm__ */
+
 #ifndef _MACHINE_SETJMP_H_
 #define	_MACHINE_SETJMP_H_
 
@@ -71,3 +75,5 @@ typedef struct _jmp_buf { __int128_t _jb[_JBLEN + 1]; } jmp_buf[1];
 #endif /* __ASSEMBLER__ */
 
 #endif /* !_MACHINE_SETJMP_H_ */
+
+#endif /* !__arm__ */
diff --git a/sys/arm64/include/sf_buf.h b/sys/arm64/include/sf_buf.h
index 59f9009bd086..7e99ae379b8a 100644
--- a/sys/arm64/include/sf_buf.h
+++ b/sys/arm64/include/sf_buf.h
@@ -26,6 +26,10 @@
  * $FreeBSD$
  */
 
+#ifdef __arm__
+#include <arm/sf_buf.h>
+#else /* !__arm__ */
+
 #ifndef _MACHINE_SF_BUF_H_
 #define	_MACHINE_SF_BUF_H_
 
@@ -49,3 +53,5 @@ sf_buf_page(struct sf_buf *sf)
 	return ((vm_page_t)sf);
 }
 #endif /* !_MACHINE_SF_BUF_H_ */
+
+#endif /* !__arm__ */
diff --git a/sys/arm64/include/signal.h b/sys/arm64/include/signal.h
index 6c8ac5cabab5..2684a89952d7 100644
--- a/sys/arm64/include/signal.h
+++ b/sys/arm64/include/signal.h
@@ -32,6 +32,10 @@
  * $FreeBSD$
  */
 
+#ifdef __arm__
+#include <arm/signal.h>
+#else /* !__arm__ */
+
 #ifndef	_MACHINE_SIGNAL_H_
 #define	_MACHINE_SIGNAL_H_
 
@@ -48,3 +52,5 @@ struct sigcontext {
 #endif
 
 #endif /* !_MACHINE_SIGNAL_H_ */
+
+#endif /* !__arm__ */
diff --git a/sys/arm64/include/sysarch.h b/sys/arm64/include/sysarch.h
index 4d6c547fd3df..22248cf1b867 100644
--- a/sys/arm64/include/sysarch.h
+++ b/sys/arm64/include/sysarch.h
@@ -30,6 +30,10 @@
  * $FreeBSD$
  */
 
+#ifdef __arm__
+#include <arm/sysarch.h>
+#else /* !__arm__ */
+
 /*
  * Architecture specific syscalls (arm64)
  */
@@ -45,3 +49,5 @@ __END_DECLS
 #endif
 
 #endif /* !_MACHINE_SYSARCH_H_ */
+
+#endif /* !__arm__ */
diff --git a/sys/arm64/include/sysreg.h b/sys/arm64/include/sysreg.h
new file mode 100644
index 000000000000..4ec435f9dcc1
--- /dev/null
+++ b/sys/arm64/include/sysreg.h
@@ -0,0 +1,5 @@
+#ifdef __arm__
+#include <arm/sysreg.h>
+#else /* !__arm__ */
+#error Do not include this header, used only for 32-bit compatibility
+#endif /* !__arm__ */
diff --git a/sys/arm64/include/tls.h b/sys/arm64/include/tls.h
index a3ec7f7952e8..c9db2bdfd708 100644
--- a/sys/arm64/include/tls.h
+++ b/sys/arm64/include/tls.h
@@ -28,6 +28,10 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+#ifdef __arm__
+#include <arm/tls.h>
+#else /* !__arm__ */
+
 #ifndef _MACHINE_TLS_H_
 #define	_MACHINE_TLS_H_
 
@@ -53,3 +57,5 @@ _tcb_get(void)
 }
 
 #endif /* !_MACHINE_TLS_H_ */
+
+#endif /* !__arm__ */
diff --git a/sys/arm64/include/ucontext.h b/sys/arm64/include/ucontext.h
index edb4cf8e63e3..d0b9296fe514 100644
--- a/sys/arm64/include/ucontext.h
+++ b/sys/arm64/include/ucontext.h
@@ -30,6 +30,10 @@
  * $FreeBSD$
  */
 
+#ifdef __arm__
+#include <arm/ucontext.h>
+#else /* !__arm__ */
+
 #ifndef _MACHINE_UCONTEXT_H_
 #define	_MACHINE_UCONTEXT_H_
 
@@ -86,3 +90,5 @@ typedef struct __mcontext32_vfp {
 #endif /* COMPAT_FREEBSD32 */
 
 #endif	/* !_MACHINE_UCONTEXT_H_ */
+
+#endif /* !__arm__ */
diff --git a/sys/arm64/include/vdso.h b/sys/arm64/include/vdso.h
index fef74df39663..f84c980077ab 100644
--- a/sys/arm64/include/vdso.h
+++ b/sys/arm64/include/vdso.h
@@ -25,6 +25,10 @@
  * $FreeBSD$
  */
 
+#ifdef __arm__
+#include <arm/vdso.h>
+#else /* !__arm__ */
+
 #ifndef _MACHINE_VDSO_H_
 #define	_MACHINE_VDSO_H_
 
@@ -37,3 +41,5 @@
 #define	VDSO_TIMEHANDS_MD32	VDSO_TIMEHANDS_MD
*** 46 LINES SKIPPED ***



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202307260000.36Q00MjE087396>