On 27.01.2023 14:59, Oleksii Kurochko wrote: > +int is_valid_bugaddr(uint32_t insn) > +{ > + if ((insn & INSN_LENGTH_MASK) == INSN_LENGTH_32) > + return (insn == BUG_INSN_32); > + else > + return ((insn & COMPRESSED_INSN_MASK) == BUG_INSN_16); > +} > + > void do_trap(struct cpu_user_regs *cpu_regs) > { > + register_t pc = cpu_regs->sepc; > + uint32_t instr = *(uint32_t *)pc; > + > + if (is_valid_bugaddr(instr)) > + if (!do_bug_frame(cpu_regs, pc)) return; > + > do_unexpected_trap(cpu_regs); > }
One more remark, style related: Even if some of the additions you're making are temporary, it'll be better if you have everything in Xen style. That'll reduce the risk of someone copying bad style from adjacent code, and it'll also avoid people like me thinking whether to comment and request an adjustment, or whether to assume that it's temporary code and will get changed again anyway. Jan