mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2025-02-01 17:35:19 +00:00
hypervisor: mshv: implement fetching instructions in emulator
Signed-off-by: Wei Liu <liuwe@microsoft.com>
This commit is contained in:
parent
67f22b6aa4
commit
5fec858130
@ -6,13 +6,14 @@
|
||||
use crate::arch::emulator::{PlatformEmulator, PlatformError};
|
||||
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
use crate::arch::x86::emulator::{Emulator, EmulatorCpuState};
|
||||
use crate::arch::x86::emulator::{CpuStateManager, Emulator, EmulatorCpuState};
|
||||
use crate::cpu;
|
||||
use crate::cpu::Vcpu;
|
||||
use crate::hypervisor;
|
||||
use crate::vec_with_array_field;
|
||||
use crate::vm::{self, InterruptSourceConfig, VmOps};
|
||||
use crate::HypervisorType;
|
||||
use iced_x86::Register;
|
||||
use mshv_bindings::*;
|
||||
use mshv_ioctls::{set_registers_64, InterruptRequest, Mshv, NoDatamatch, VcpuFd, VmFd, VmType};
|
||||
use std::any::Any;
|
||||
@ -1636,8 +1637,11 @@ impl<'a> PlatformEmulator for MshvEmulatorContext<'a> {
|
||||
self.translate(gva)
|
||||
}
|
||||
|
||||
fn fetch(&self, _ip: u64, _instruction_bytes: &mut [u8]) -> Result<(), PlatformError> {
|
||||
Err(PlatformError::MemoryReadFailure(anyhow!("unimplemented")))
|
||||
fn fetch(&self, ip: u64, instruction_bytes: &mut [u8]) -> Result<(), PlatformError> {
|
||||
let rip =
|
||||
self.cpu_state(self.vcpu.vp_index as usize)?
|
||||
.linearize(Register::CS, ip, false)?;
|
||||
self.read_memory(rip, instruction_bytes)
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user