mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <>
Cc: Ahmad Fatoum <>
Subject: [PATCH master] RISC-V: interrupts: fix Zifencei emulation on rv64
Date: Fri,  3 Dec 2021 07:33:40 +0100	[thread overview]
Message-ID: <> (raw)

Zifencei emulaton was added for bare bones 32-bit targets, but the code
is there on 64-bit too. The instruction skip at the end of the function
skips 4 bytes, the size of an instruction on both rv32 and rv64. The
instruction decoder however assumes instructions are size(long) bytes,
which is 8 > 4 on rv64. Fix this.

Signed-off-by: Ahmad Fatoum <>
 arch/riscv/cpu/interrupts.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/riscv/cpu/interrupts.c b/arch/riscv/cpu/interrupts.c
index 0e8951b61968..1f2d7b885737 100644
--- a/arch/riscv/cpu/interrupts.c
+++ b/arch/riscv/cpu/interrupts.c
@@ -122,7 +122,7 @@ unsigned long handle_trap(struct pt_regs *regs)
 		goto skip;
 	if (regs->cause == 2) { /* illegal instruction */
-		switch(*(unsigned long *)regs->epc) {
+		switch(*(u32 *)regs->epc) {
 		case 0x0000100f: /* fence.i */
 			goto skip;

barebox mailing list

             reply	other threads:[~2021-12-03  6:35 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-03  6:33 Ahmad Fatoum [this message]
2021-12-13 22:13 ` Sascha Hauer

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:

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

  git send-email \ \ \ \

* 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