static void handle_illegal_instruction(trapframe_t* tf) { tf->insn = *(uint16_t*)tf->epc; int len = insn_len(tf->insn); if (len == 4) tf->insn |= ((uint32_t)*(uint16_t*)(tf->epc + 2) << 16); else kassert(len == 2); dump_tf(tf); panic("An illegal instruction was executed!"); }
static void handle_illegal_instruction(trapframe_t* tf) { tf->insn = *(uint16_t*)tf->epc; int len = insn_len(tf->insn); if (len == 4) tf->insn |= ((uint32_t)*(uint16_t*)(tf->epc + 2) << 16); else kassert(len == 2); // supply 0 for unimplemented uarch counters if ((tf->insn & (MASK_CSRRS | 0xcc0U<<20)) == (MATCH_CSRRS | 0xcc0U<<20)) { tf->gpr[(tf->insn >> 7) & 0x1f] = 0; tf->epc += 4; return; }