mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2024-10-27 23:23:09 +00:00
hypervisor: emulator: drop InstructionMap
It is not needed anymore. Signed-off-by: Wei Liu <liuwe@microsoft.com>
This commit is contained in:
parent
ab89b48143
commit
c352b59857
@ -10,7 +10,6 @@ use crate::arch::emulator::{EmulationError, PlatformEmulator, PlatformError};
|
|||||||
use crate::arch::x86::emulator::CpuStateManager;
|
use crate::arch::x86::emulator::CpuStateManager;
|
||||||
use crate::arch::x86::Exception;
|
use crate::arch::x86::Exception;
|
||||||
use iced_x86::*;
|
use iced_x86::*;
|
||||||
use std::collections::HashMap;
|
|
||||||
|
|
||||||
macro_rules! imm_op {
|
macro_rules! imm_op {
|
||||||
(u8, $insn:ident) => {
|
(u8, $insn:ident) => {
|
||||||
@ -83,38 +82,6 @@ pub trait InstructionHandler<T: CpuStateManager> {
|
|||||||
) -> Result<(), EmulationError<Exception>>;
|
) -> Result<(), EmulationError<Exception>>;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct InstructionMap<T: CpuStateManager> {
|
|
||||||
pub instructions: HashMap<Code, Box<dyn InstructionHandler<T> + Sync + Send>>,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<T: CpuStateManager> InstructionMap<T> {
|
|
||||||
pub fn new() -> InstructionMap<T> {
|
|
||||||
InstructionMap {
|
|
||||||
instructions: HashMap::new(),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn add_insn(
|
|
||||||
&mut self,
|
|
||||||
insn: Code,
|
|
||||||
insn_handler: Box<dyn InstructionHandler<T> + Sync + Send>,
|
|
||||||
) {
|
|
||||||
self.instructions.insert(insn, insn_handler);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<T: CpuStateManager> Default for InstructionMap<T> {
|
|
||||||
fn default() -> Self {
|
|
||||||
Self::new()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
macro_rules! insn_add {
|
|
||||||
($insn_map:ident, $mnemonic:ident, $code:ident) => {
|
|
||||||
$insn_map.add_insn(Code::$code, Box::new($mnemonic::$code {}));
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
macro_rules! insn_format {
|
macro_rules! insn_format {
|
||||||
($insn:ident) => {{
|
($insn:ident) => {{
|
||||||
let mut output = String::new();
|
let mut output = String::new();
|
||||||
|
Loading…
Reference in New Issue
Block a user