mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2025-02-22 11:22:26 +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()
|
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 iced_x86::*;
|
||||||
use std::sync::{Arc, Mutex};
|
use std::sync::{Arc, Mutex};
|
||||||
|
|
||||||
|
#[macro_use]
|
||||||
mod instructions;
|
mod instructions;
|
||||||
|
|
||||||
/// CpuStateManager manages an x86 CPU state.
|
/// 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> {
|
pub fn new(platform: Arc<Mutex<dyn PlatformEmulator<CpuState = T>>>) -> Emulator<T> {
|
||||||
let mut insn_map = InstructionMap::<T>::new();
|
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 {
|
Emulator {
|
||||||
platform: Arc::clone(&platform),
|
platform: Arc::clone(&platform),
|
||||||
insn_map,
|
insn_map,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user