[PATCH] lib: sbi_illegal_insn: Emulate 'MZ'/c.li s4,-13 instruction

Andreas Schwab schwab at linux-m68k.org
Wed Nov 8 13:55:18 PST 2023


On Nov 08 2023, Björn Töpel wrote:

> +static int compressed_insn(ulong insn, struct sbi_trap_regs *regs)
> +{
> +	/* Only handle 'MZ'/c.li s4,-13/0x5a3d */
> +	if (!misa_extension('C') && (insn & 0xffff) == 0x5a4d) {
> +		regs->s4 = -13;
> +		regs->mepc += 4;

By skipping 4 bytes execution will resume in the middle of the next insn
(the jump around the header).

-- 
Andreas Schwab, schwab at linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."



More information about the opensbi mailing list