From: dave.patel@riscstar.com
To: opensbi@lists.infradead.org
Cc: Scott Bambrough <scott@riscstar.com>,
Dave Patel <dave.patel@riscstar.com>,
Ray Mao <raymond.mao@riscstar.com>,
Robin Randhawa <robin.randhawa@sifive.com>,
Anup Patel <anup.patel@qti.qualcomm.com>,
Samuel Holland <samuel.holland@sifive.com>,
Anup Patel <anuppate@qti.qualcomm.com>,
Dhaval <dhaval@rivosinc.com>, Peter Lin <peter.lin@sifive.com>
Subject: [PATCH] Trap and Emulate changes
Date: Wed, 11 Feb 2026 10:00:10 +0000 [thread overview]
Message-ID: <20260211100010.4082-1-dave.patel@riscstar.com> (raw)
From: Dave Patel <dave.patel@riscstar.com>
Signed-off-by: Dave Patel <dave.patel@riscstar.com>
---
lib/sbi/sbi_illegal_insn.c | 25 ++++++++++++++++++++++++-
1 file changed, 24 insertions(+), 1 deletion(-)
diff --git a/lib/sbi/sbi_illegal_insn.c b/lib/sbi/sbi_illegal_insn.c
index fa82264a..88079e39 100644
--- a/lib/sbi/sbi_illegal_insn.c
+++ b/lib/sbi/sbi_illegal_insn.c
@@ -110,10 +110,33 @@ static int system_opcode_insn(ulong insn, struct sbi_trap_regs *regs)
return 0;
}
+static int sbi_get_emulated_irq_insn(ulong insn, struct sbi_trap_regs *regs)
+{
+ ulong rs1_val = GET_RS1(insn, regs);
+ ulong rs2_val = GET_RS2(insn, regs);
+ //ulong prev_mode = sbi_mstatus_prev_mode(regs->mstatus);
+ ulong irq_val;
+
+ /*
+ // This is were the emualted irq vlaue is fetched
+ if (prev_mode == PRV_S && sbi_emulate_irq_read(&irq_val))
+ return truly_illegal_insn(insn, regs);
+ */
+
+ // For testing
+ irq_val = rs1_val + rs2_val;
+
+ SET_RD(insn, regs, irq_val);
+
+ regs->mepc += 4;
+
+ return 0;
+}
+
static const illegal_insn_func illegal_insn_table[32] = {
truly_illegal_insn, /* 0 */
truly_illegal_insn, /* 1 */
- truly_illegal_insn, /* 2 */
+ sbi_get_emulated_irq_insn, /* 2 */
misc_mem_opcode_insn, /* 3 */
truly_illegal_insn, /* 4 */
truly_illegal_insn, /* 5 */
--
2.43.0
--
opensbi mailing list
opensbi@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/opensbi
next reply other threads:[~2026-02-11 10:00 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-11 10:00 dave.patel [this message]
2026-02-12 14:58 ` [PATCH] Trap and Emulate changes Anup Patel
[not found] ` <CAL2H45cQm_O-K-6weC-xeGNB0+yCHjQe1msS+JwHdKLKecM5CA@mail.gmail.com>
2026-02-12 15:40 ` Anup Patel
2026-02-12 16:04 ` Raymond Mao
[not found] ` <CAEigVW8cs7=f0xk-QZN2vKTTg-=dU9eoof=RrMHqzj9t8Yi=4Q@mail.gmail.com>
2026-02-12 16:13 ` Anup Patel
-- strict thread matches above, loose matches on Subject: below --
2026-02-10 10:31 dave.patel
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=20260211100010.4082-1-dave.patel@riscstar.com \
--to=dave.patel@riscstar.com \
--cc=anup.patel@qti.qualcomm.com \
--cc=anuppate@qti.qualcomm.com \
--cc=dhaval@rivosinc.com \
--cc=opensbi@lists.infradead.org \
--cc=peter.lin@sifive.com \
--cc=raymond.mao@riscstar.com \
--cc=robin.randhawa@sifive.com \
--cc=samuel.holland@sifive.com \
--cc=scott@riscstar.com \
/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