[PATCH] Add trap-based ISA extension emulation

Benedikt Freisen b.freisen at gmx.net
Sun Oct 26 13:21:54 PDT 2025


This patch series seeks to add trap-based emulation functionality for various ISA extensions relevant to RVA22, RVB23 and RVA23.
The emulation functionality contained herein has been demonstrated to e.g. allow the VisionFive 2's JH7110 to run software using the RVA22U64 and RVB23U64 profiles, allow the Orange Pi RV2's Ky X1 (a SpacemiT K1 derivative) to run Ubuntu 25.10 (RVA23U64) in a docker container, and allow the Tenstorrent Blackhole's SiFive X280 (Gen. 1) to boot into Ubuntu 25.10.

The first patch merely fixes the tab alignment in riscv_encoding.h.

The second patch adds workarounds for decoder bugs in the C906 and C910, where FENCE and FENCE.I instructions with nonzero reserved fields are mistakenly treated as illegal instructions.

The third patch corrects the typedef of "s8" from "char" to "signed char", because "char" is implicitly unsigned on RISC-V.

To me, personally, these three look like uncontroversial improvements.

The fourth patch, the big one, adds the actual ISA extension emulation code.
For initial consideration, I am hereby submitting it "as-is", mainly to see whether there is even interest in having this kind of functionality in mainline OpenSBI.
If that turns out to be the case, this patch will need further iterations that, aside from incorporating your feedback, e.g. add configuration options for conditional compilation.

The fifth patch is included for documentary purposes only, not for merging.
It contains the section of my fork's README file that explains which extensions can be emulated. The information therein could also go somewhere else.




More information about the opensbi mailing list