From fe5064d532011bea705693594015d70c5ce2d726 Mon Sep 17 00:00:00 2001 From: Johannes Stoelp Date: Wed, 13 Dec 2023 00:10:30 +0100 Subject: asm: add push/pop insn --- src/insn/pop.rs | 14 ++++++++++++++ src/insn/push.rs | 14 ++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 src/insn/pop.rs create mode 100644 src/insn/push.rs (limited to 'src/insn') diff --git a/src/insn/pop.rs b/src/insn/pop.rs new file mode 100644 index 0000000..c8cc5b5 --- /dev/null +++ b/src/insn/pop.rs @@ -0,0 +1,14 @@ +use super::Pop; +use crate::{Asm, Reg16, Reg64}; + +impl Pop for Asm { + fn pop(&mut self, op1: Reg64) { + self.encode_r(0x8f, 0x0, op1); + } +} + +impl Pop for Asm { + fn pop(&mut self, op1: Reg16) { + self.encode_r(0x8f, 0x0, op1); + } +} diff --git a/src/insn/push.rs b/src/insn/push.rs new file mode 100644 index 0000000..8554dcb --- /dev/null +++ b/src/insn/push.rs @@ -0,0 +1,14 @@ +use super::Push; +use crate::{Asm, Reg16, Reg64}; + +impl Push for Asm { + fn push(&mut self, op1: Reg64) { + self.encode_r(0xff, 0x6, op1); + } +} + +impl Push for Asm { + fn push(&mut self, op1: Reg16) { + self.encode_r(0xff, 0x6, op1); + } +} -- cgit v1.2.3