Skip to content

Commit

Permalink
polkavm-assembler: add xchg_mem
Browse files Browse the repository at this point in the history
  • Loading branch information
koute committed Jan 16, 2025
1 parent 9a4902c commit 96bfd33
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions crates/polkavm-assembler/src/amd64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1419,6 +1419,12 @@ pub mod inst {
None,
(fmt.write_fmt(core::format_args!("cmov{} {}, {}", self.0.suffix(), self.2.name_from(self.1), self.3.display_without_prefix(Size::from(self.1))))),

// https://www.felixcloutier.com/x86/xchg
xchg_mem(RegSize, Reg, MemOp) =>
Inst::new(0x87).rex_64b_if(matches!(self.0, RegSize::R64)).modrm_reg(self.1).mem(self.2).encode(),
None,
(fmt.write_fmt(core::format_args!("xchg {}, {}", self.1.name_from(self.0), self.2))),

// https://www.felixcloutier.com/x86/add
add(Operands) =>
alu_impl(0x00, 0x02, 0b000, self.0),
Expand Down Expand Up @@ -2384,6 +2390,7 @@ mod tests {
syscall,
test,
ud2,
xchg_mem,
xor,
}

Expand Down

0 comments on commit 96bfd33

Please sign in to comment.