sim: riscv: Fix crash during instruction decoding

The match_never() function has been removed and thus step_once() crashes
during instruction decoding. Fixed it by checking for null pointer before
invoking function attached to match_func member of riscv_opcode structure
This commit is contained in:
Jaydeep Patil
2024-01-11 05:28:21 +00:00
committed by Mike Frysinger
parent 8fed036bef
commit b783d068d9

View File

@@ -1040,7 +1040,7 @@ void step_once (SIM_CPU *cpu)
for (; op->name; op++)
{
/* Does the opcode match? */
if (! op->match_func (op, iw))
if (! op->match_func || ! op->match_func (op, iw))
continue;
/* Is this a pseudo-instruction and may we print it as such? */
if (op->pinfo & INSN_ALIAS)