Open akiroz opened 1 month ago
Looks like there are three modes of interrupts https://clang.llvm.org/docs/AttributeReference.html#interrupt-risc-v
LLVM implements them as function attributes rather than calling conventions, I'm guessing we would add InterruptUser
, InterruptSupervisor
and InterruptMachine
and have Interrupt
alias InterruptMachine
.
Zig Version
0.13.0
Steps to Reproduce and Observed Behavior
Currently compiling this function for riscv targets will yield the following error:
irq routines in riscv requires a different
mret
instruction at the end and this is achieved in C as in the following:for which LLVM generates the following code:
I dont know enough about zig/llvm internals to know if the zig
callconv(.Interrupt)
has anything to do with the way C's attributes are handled wrt llvm but it'll be useful to be able to implement riscv irq routines in pure zig.Expected Behavior
Able to use
callconv(.Interrupt)
on riscv targets.