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

Björn Töpel bjorn at kernel.org
Wed Nov 8 16:02:51 PST 2023


Hi Andreas!

On Wed, 8 Nov 2023 at 22:55, Andreas Schwab <schwab at linux-m68k.org> wrote:
>
> 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).

This is in a non-C environment -- "!misa_extension('C')", so we're not
jumping into the middle of the next insn.

Note that the Linux kernel needs the change pointed out in this patch,
to build w/o C.


Björn



More information about the opensbi mailing list