opensbi icon indicating copy to clipboard operation
opensbi copied to clipboard

Platform-specific illegal-instruction handling?

Open NonerKao opened this issue 4 years ago • 0 comments

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.

NonerKao avatar Aug 24 '21 03:08 NonerKao