Skip to content

Commit 111afc1

Browse files
pathakraulavpatel
authored andcommitted
lib: sbi_illegal_insn: Fix FENCE.TSO emulation infinite trap loop
In case of missing "FENCE.TSO" instruction implementation, opensbi can emulate the "FENCE.TSO" with "FENCE RW,RW", but mepc was not incremented to continue from the next instruction causing infinite trap. Fixes: cb8271c ("lib: sbi_illegal_insn: Add emulation for fence.tso") Signed-off-by: Rahul Pathak <[email protected]> Reviewed-by: Andrew Jones <[email protected]> Reviewed-by: Xiang W <[email protected]> Reviewed-by: Samuel Holland <[email protected]>
1 parent a69eb6c commit 111afc1

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

lib/sbi/sbi_illegal_insn.c

+1
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ static int misc_mem_opcode_insn(ulong insn, struct sbi_trap_regs *regs)
4040
/* Errata workaround: emulate `fence.tso` as `fence rw, rw`. */
4141
if ((insn & INSN_MASK_FENCE_TSO) == INSN_MATCH_FENCE_TSO) {
4242
smp_mb();
43+
regs->mepc += 4;
4344
return 0;
4445
}
4546

0 commit comments

Comments
 (0)