git: 228a3e73e169 - main - riscv: Recognise B extension for AT_HWCAP

From: Jessica Clarke <jrtc27_at_FreeBSD.org>
Date: Thu, 22 Aug 2024 19:36:58 UTC
The branch main has been updated by jrtc27:

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

commit 228a3e73e16983bc7f985b24ef20909500792d3c
Author:     Jessica Clarke <jrtc27@FreeBSD.org>
AuthorDate: 2024-08-22 19:36:44 +0000
Commit:     Jessica Clarke <jrtc27@FreeBSD.org>
CommitDate: 2024-08-22 19:36:44 +0000

    riscv: Recognise B extension for AT_HWCAP
    
    This was ratified earlier this year as an alias for Zba_Zbb_Zbs. Whilst
    we don't currently export multi-letter extensions, we can still export
    this alias in AT_HWCAP.
    
    Reviewed by:    mhorne
    MFC after:      1 month
    Differential Revision:  https://reviews.freebsd.org/D46277
---
 sys/riscv/include/elf.h    | 1 +
 sys/riscv/riscv/identcpu.c | 1 +
 2 files changed, 2 insertions(+)

diff --git a/sys/riscv/include/elf.h b/sys/riscv/include/elf.h
index ff0f36d2efe6..a14d6859902b 100644
--- a/sys/riscv/include/elf.h
+++ b/sys/riscv/include/elf.h
@@ -82,5 +82,6 @@ __ElfType(Auxinfo);
 #define	HWCAP_ISA_C		HWCAP_ISA_BIT('c')
 #define	HWCAP_ISA_G		\
     (HWCAP_ISA_I | HWCAP_ISA_M | HWCAP_ISA_A | HWCAP_ISA_F | HWCAP_ISA_D)
+#define	HWCAP_ISA_B		HWCAP_ISA_BIT('b')
 
 #endif /* !_MACHINE_ELF_H_ */
diff --git a/sys/riscv/riscv/identcpu.c b/sys/riscv/riscv/identcpu.c
index c681edfff47b..203edb3689bc 100644
--- a/sys/riscv/riscv/identcpu.c
+++ b/sys/riscv/riscv/identcpu.c
@@ -245,6 +245,7 @@ parse_riscv_isa(struct cpu_desc *desc, char *isa, int len)
 	while (i < len) {
 		switch(isa[i]) {
 		case 'a':
+		case 'b':
 		case 'c':
 		case 'd':
 		case 'f':