The branch main has been updated by kib:

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

commit 5a2bbacea56f40e91c5371d5d6a210afd797fd3b
Author:     Konstantin Belousov <[email protected]>
AuthorDate: 2023-11-16 21:06:36 +0000
Commit:     Konstantin Belousov <[email protected]>
CommitDate: 2023-11-21 11:55:59 +0000

    FEATURE compat_freebsd_32bit: only report on arm64 when support is present
    
    depending on hardware support for aarch32.
    
    Reviewed by:    markj
    Sponsored by:   The FreeBSD Foundation
    MFC after:      1 week
    Differential revision:  https://reviews.freebsd.org/D42641
---
 sys/arm64/arm64/elf32_machdep.c       |  2 ++
 sys/compat/freebsd32/freebsd32_misc.c | 13 ++++++++++++-
 sys/compat/freebsd32/freebsd32_util.h |  2 ++
 3 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/sys/arm64/arm64/elf32_machdep.c b/sys/arm64/arm64/elf32_machdep.c
index 4acb68b09108..de0ee9607ad1 100644
--- a/sys/arm64/arm64/elf32_machdep.c
+++ b/sys/arm64/arm64/elf32_machdep.c
@@ -160,6 +160,8 @@ register_elf32_brand(void *arg)
        if (ID_AA64PFR0_EL0_VAL(READ_SPECIALREG(id_aa64pfr0_el1)) ==
            ID_AA64PFR0_EL0_64_32) {
                elf32_insert_brand_entry(&freebsd32_brand_info);
+       } else {
+               compat_freebsd_32bit = 0;
        }
 }
 SYSINIT(elf32, SI_SUB_EXEC, SI_ORDER_FIRST, register_elf32_brand, NULL);
diff --git a/sys/compat/freebsd32/freebsd32_misc.c 
b/sys/compat/freebsd32/freebsd32_misc.c
index c26e7b97e717..d9266f57ac94 100644
--- a/sys/compat/freebsd32/freebsd32_misc.c
+++ b/sys/compat/freebsd32/freebsd32_misc.c
@@ -123,7 +123,18 @@
 #include <compat/freebsd32/freebsd32_signal.h>
 #include <compat/freebsd32/freebsd32_proto.h>
 
-FEATURE(compat_freebsd_32bit, "Compatible with 32-bit FreeBSD");
+int compat_freebsd_32bit = 1;
+
+static void
+register_compat32_feature(void *arg)
+{
+       if (!compat_freebsd_32bit)
+               return;
+
+       FEATURE_ADD("compat_freebsd_32bit", "Compatible with 32-bit FreeBSD");
+}
+SYSINIT(freebsd32, SI_SUB_EXEC, SI_ORDER_ANY, register_compat32_feature,
+    NULL);
 
 struct ptrace_io_desc32 {
        int             piod_op;
diff --git a/sys/compat/freebsd32/freebsd32_util.h 
b/sys/compat/freebsd32/freebsd32_util.h
index 67f0c099792a..c32c7a2ef4c1 100644
--- a/sys/compat/freebsd32/freebsd32_util.h
+++ b/sys/compat/freebsd32/freebsd32_util.h
@@ -122,4 +122,6 @@ struct image_args;
 int freebsd32_exec_copyin_args(struct image_args *args, const char *fname,
            enum uio_seg segflg, uint32_t *argv, uint32_t *envv);
 
+extern int compat_freebsd_32bit;
+
 #endif /* !_COMPAT_FREEBSD32_FREEBSD32_UTIL_H_ */

Reply via email to