* [PATCH master] RISC-V: interrupts: fix Zifencei emulation on rv64
@ 2021-12-03 6:33 Ahmad Fatoum
2021-12-13 22:13 ` Sascha Hauer
0 siblings, 1 reply; 2+ messages in thread
From: Ahmad Fatoum @ 2021-12-03 6:33 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
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 <ahmad@a3f.at>
---
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;
default:
--
2.33.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH master] RISC-V: interrupts: fix Zifencei emulation on rv64
2021-12-03 6:33 [PATCH master] RISC-V: interrupts: fix Zifencei emulation on rv64 Ahmad Fatoum
@ 2021-12-13 22:13 ` Sascha Hauer
0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2021-12-13 22:13 UTC (permalink / raw)
To: Ahmad Fatoum; +Cc: barebox
On Fri, Dec 03, 2021 at 07:33:40AM +0100, Ahmad Fatoum wrote:
> 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 <ahmad@a3f.at>
> ---
> arch/riscv/cpu/interrupts.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Applied, thanks
Sascha
>
> 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;
> default:
> --
> 2.33.0
>
>
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
>
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-12-13 22:39 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-03 6:33 [PATCH master] RISC-V: interrupts: fix Zifencei emulation on rv64 Ahmad Fatoum
2021-12-13 22:13 ` Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox