mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
hypervisor: emulator: Pass CPU context to instruction stream emulator
This is a precursor change to overall ioctl and hypercall reduction effort. The old (current) CPU state can be compared to the new to determine what has changed and avoid unnecessary register updates. Signed-off-by: Stanislav Kinsburskii <skinsburskii@linux.microsoft.com>
This commit is contained in:
committed by
Rob Bradford
parent
03252f5851
commit
5aba9b4308
@@ -715,14 +715,19 @@ impl cpu::Vcpu for MshvVcpu {
|
||||
map: (gva, gpa),
|
||||
};
|
||||
|
||||
let old_state = context
|
||||
.cpu_state(self.vp_index as usize)
|
||||
.map_err(|e| cpu::HypervisorCpuError::RunVcpu(e.into()))?;
|
||||
|
||||
// Create a new emulator.
|
||||
let mut emul = Emulator::new(&mut context);
|
||||
|
||||
// Emulate the trapped instruction, and only the first one.
|
||||
let new_state = emul
|
||||
.emulate_first_insn(
|
||||
self.vp_index as usize,
|
||||
.emulate_insn_stream(
|
||||
&old_state,
|
||||
&info.instruction_bytes[..insn_len],
|
||||
Some(1),
|
||||
)
|
||||
.map_err(|e| cpu::HypervisorCpuError::RunVcpu(e.into()))?;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user