Fixing atomic instructions in ELF translate. (#1582)

Fixes EVM test.
This commit is contained in:
Lucas Clemente Vella
2024-07-16 13:02:32 +01:00
committed by GitHub
parent bd4ac9c059
commit eb3bdfbe60

View File

@@ -898,11 +898,10 @@ impl TwoOrOneMapper<MaybeInstruction, HighLevelInsn> 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;
}