From eb3bdfbe60bcd8285292e4b612b9d22a15e87571 Mon Sep 17 00:00:00 2001 From: Lucas Clemente Vella Date: Tue, 16 Jul 2024 13:02:32 +0100 Subject: [PATCH] Fixing atomic instructions in ELF translate. (#1582) Fixes EVM test. --- riscv/src/elf.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/riscv/src/elf.rs b/riscv/src/elf.rs index 95451de61..075bc31df 100644 --- a/riscv/src/elf.rs +++ b/riscv/src/elf.rs @@ -898,11 +898,10 @@ impl TwoOrOneMapper for InstructionLifter<'_> { }, }; - // For some reason, atomic instructions come with the immediate set to - // zero instead of None (maybe to mimic assembly syntax? Who knows). We - // must fix this: + // The acquire and release bits of an atomic instructions are decoded as + // the immediate value, but we don't need the bits and an immediate is + // not expected, so we must remove it. if let Extensions::A = insn.extension { - assert!(matches!(imm, HighLevelImmediate::Value(0))); imm = HighLevelImmediate::None; }