mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2025-02-21 19:02:30 +00:00
hypervisor: x86: Add MOV to the emulator instruction map
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
This commit is contained in:
parent
fe5401223b
commit
0f4f30dbde
@ -77,3 +77,9 @@ impl<T: CpuStateManager> Default for InstructionMap<T> {
|
||||
Self::new()
|
||||
}
|
||||
}
|
||||
|
||||
macro_rules! insn_add {
|
||||
($insn_map:ident, $mnemonic:ident, $code:ident) => {
|
||||
$insn_map.add_insn(Code::$code, Box::new($mnemonic::$code {}));
|
||||
};
|
||||
}
|
||||
|
@ -13,6 +13,7 @@ use crate::x86_64::{SegmentRegister, SpecialRegisters, StandardRegisters};
|
||||
use iced_x86::*;
|
||||
use std::sync::{Arc, Mutex};
|
||||
|
||||
#[macro_use]
|
||||
mod instructions;
|
||||
|
||||
/// CpuStateManager manages an x86 CPU state.
|
||||
@ -357,6 +358,24 @@ impl<T: CpuStateManager> Emulator<T> {
|
||||
pub fn new(platform: Arc<Mutex<dyn PlatformEmulator<CpuState = T>>>) -> Emulator<T> {
|
||||
let mut insn_map = InstructionMap::<T>::new();
|
||||
|
||||
// MOV
|
||||
insn_add!(insn_map, mov, Mov_r8_imm8);
|
||||
insn_add!(insn_map, mov, Mov_r8_rm8);
|
||||
insn_add!(insn_map, mov, Mov_r16_imm16);
|
||||
insn_add!(insn_map, mov, Mov_r16_rm16);
|
||||
insn_add!(insn_map, mov, Mov_r32_imm32);
|
||||
insn_add!(insn_map, mov, Mov_r32_rm32);
|
||||
insn_add!(insn_map, mov, Mov_r64_imm64);
|
||||
insn_add!(insn_map, mov, Mov_r64_rm64);
|
||||
insn_add!(insn_map, mov, Mov_rm8_imm8);
|
||||
insn_add!(insn_map, mov, Mov_rm8_r8);
|
||||
insn_add!(insn_map, mov, Mov_rm16_imm16);
|
||||
insn_add!(insn_map, mov, Mov_rm16_r16);
|
||||
insn_add!(insn_map, mov, Mov_rm32_imm32);
|
||||
insn_add!(insn_map, mov, Mov_rm32_r32);
|
||||
insn_add!(insn_map, mov, Mov_rm64_imm32);
|
||||
insn_add!(insn_map, mov, Mov_rm64_r64);
|
||||
|
||||
Emulator {
|
||||
platform: Arc::clone(&platform),
|
||||
insn_map,
|
||||
|
Loading…
x
Reference in New Issue
Block a user