]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
riscv: improve parsing of riscv,isa property strings
authorMitchell Horne <mhorne@FreeBSD.org>
Fri, 28 Oct 2022 16:28:08 +0000 (13:28 -0300)
committerMitchell Horne <mhorne@FreeBSD.org>
Fri, 28 Oct 2022 16:28:08 +0000 (13:28 -0300)
commit701923e2a4105be606c5263181b6eb6f546f1a84
tree26897688f4c820c3afd1f8bb26276eda7549234c
parent5723d13811dbecd3277d919bb1f259d52b890717
riscv: improve parsing of riscv,isa property strings

This code was originally written under the assumption that the ISA
string would only contain single-letter extensions. The RISC-V
specification has extended its description of the format quite a bit,
allowing for much longer ISA strings containing multi-letter extension
names.

Newer versions of QEMU (7.1.0) will append to the riscv,isa property
indicating the presence of multi-letter standard extensions such as
Zfencei. This triggers a KASSERT about the expected length of the
string, preventing boot.

Increase the size of the isa array significantly, and teach the code
to parse (skip over) multi-letter extensions, and optional extension
version numbers. We currently ignore them completely, but this will
change in the future as we start supporting supervisor-level extensions.

MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D36601
sys/riscv/include/elf.h
sys/riscv/riscv/identcpu.c