diff --git a/hypervisor/src/arch/x86/emulator/instructions/mod.rs b/hypervisor/src/arch/x86/emulator/instructions/mod.rs index 17eb4a7ea..aeb1a4574 100644 --- a/hypervisor/src/arch/x86/emulator/instructions/mod.rs +++ b/hypervisor/src/arch/x86/emulator/instructions/mod.rs @@ -12,6 +12,40 @@ use crate::arch::x86::Exception; use iced_x86::*; use std::collections::HashMap; +macro_rules! imm_op { + (u8, $insn:ident) => { + $insn.immediate8() + }; + + (u16, $insn:ident) => { + $insn.immediate16() + }; + + (u32, $insn:ident) => { + $insn.immediate32() + }; + + (u64, $insn:ident) => { + $insn.immediate64() + }; + + (u32tou64, $insn:ident) => { + $insn.immediate32to64() + }; + + (u8tou16, $insn:ident) => { + $insn.immediate8to16() + }; + + (u8tou32, $insn:ident) => { + $insn.immediate8to32() + }; + + (u8tou64, $insn:ident) => { + $insn.immediate8to64() + }; +} + pub mod mov; // Returns the linear a.k.a. virtual address for a memory operand. diff --git a/hypervisor/src/arch/x86/emulator/instructions/mov.rs b/hypervisor/src/arch/x86/emulator/instructions/mov.rs index f4317c044..7777c1572 100644 --- a/hypervisor/src/arch/x86/emulator/instructions/mov.rs +++ b/hypervisor/src/arch/x86/emulator/instructions/mov.rs @@ -144,40 +144,6 @@ macro_rules! mov_r_imm { }; } -macro_rules! imm_op { - (u8, $insn:ident) => { - $insn.immediate8() - }; - - (u16, $insn:ident) => { - $insn.immediate16() - }; - - (u32, $insn:ident) => { - $insn.immediate32() - }; - - (u64, $insn:ident) => { - $insn.immediate64() - }; - - (u32tou64, $insn:ident) => { - $insn.immediate32to64() - }; - - (u8tou16, $insn:ident) => { - $insn.immediate8to16() - }; - - (u8tou32, $insn:ident) => { - $insn.immediate8to32() - }; - - (u8tou64, $insn:ident) => { - $insn.immediate8to64() - }; -} - pub struct Mov_r8_rm8 {} impl InstructionHandler for Mov_r8_rm8 { mov_r_rm!(u8);