3 ms·
Cool, I still recognize the Instruction union as he based it on mine (libriscv). It's interesting to see how it has mutated across two implementations. Anyway,
by fwsgonzo 3y ago
Cool, I still recognize the Instruction union as he based it on mine (libriscv). It's interesting to see how it has mutated across two implementations. Anyway, this is overflowing with cool ideas.
I do see one minor nitpick though. The inlined host call needs to also use an "m" operand, otherwise the compiler could optimize out the actual data (making it a dead-store).
asm volatile("scall" : "+r"(a0) : "r"(a1), "r"(a7));
to
asm volatile("scall" : "+r"(a0) : "r"(a1), "m"(*a1), "r"(a7));
Usually, we want to cast a1 here to a fixed or variable-length array in order to inform the compiler of the size of the data, but here the size is known. I believe it's enough with a deref. If not, cast it like so:
*(uintptr_t(*)[13]) a1