OpenSBI Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Andreas Schwab <schwab@linux-m68k.org>
To: opensbi@lists.infradead.org
Subject: [PATCH] lib: sbi_illegal_insn: Emulate 'MZ'/c.li s4,-13 instruction
Date: Wed, 08 Nov 2023 22:55:18 +0100	[thread overview]
Message-ID: <874jhvc3ll.fsf@igel.home> (raw)
In-Reply-To: <20231108191310.49950-1-bjorn@kernel.org> ("Björn Töpel"'s message of "Wed, 8 Nov 2023 20:13:10 +0100")

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."


  reply	other threads:[~2023-11-08 21:55 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-08 19:13 [PATCH] lib: sbi_illegal_insn: Emulate 'MZ'/c.li s4,-13 instruction Björn Töpel
2023-11-08 21:55 ` Andreas Schwab [this message]
2023-11-09  0:02   ` Björn Töpel
2023-11-09  0:11     ` Jessica Clarke
2023-11-09  0:22       ` Björn Töpel
2023-11-09  4:04         ` Xiang W
2023-11-09  6:24           ` Jessica Clarke
2023-11-09  6:55             ` Xiang W
2023-11-09  7:00               ` Jessica Clarke
2023-11-09  7:10                 ` Xiang W
2023-11-09  7:19                   ` Jessica Clarke
2023-11-09  7:54                     ` Inochi Amaoto

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=874jhvc3ll.fsf@igel.home \
    --to=schwab@linux-m68k.org \
    --cc=opensbi@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox