opensbi
opensbi copied to clipboard
Platform-specific illegal-instruction handling?
Dear maintainers,
As you can see in platform/andes/ae350/platform.c, we created a few SBI calls just for reading/writing custom CSRs on the platform, which is not ideal as such CSRs increases. Meanwhile, trap-emulate normal CSR read/write just work in the generic flow.
I wonder if we can expand illegal-instruction handling a little bit, so that a platform can register its own handler? Two viable options I can think of are 1) in system_opcode_insn, with something like
if (unlikely(platform_illegal_insn))
platform_illegal_insn(insn, regs);
or 2) in sbi_illegal_insn_handler, parse the NON-STANDARD CSR number and go to platform handler.
Any comments will be appreciated.