mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2024-12-22 13:45:20 +00:00
hypervisor: emulator: Fix logic bug in MockVMM
emulate_first_insn() really means we want only the first instruction to be emulated. Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
This commit is contained in:
parent
1ac4c42a84
commit
251434862f
@ -525,7 +525,7 @@ mod tests {
|
||||
0x48, 0x8b, 0x58, 0x10, // mov rbx, qword ptr [rax+10h]
|
||||
];
|
||||
let mut vmm = MockVMM::new(ip, hashmap![], Some((rax + displacement, &memory)));
|
||||
vmm.emulate_first_insn(cpu_id, &insn);
|
||||
vmm.emulate_insn(cpu_id, &insn, Some(2));
|
||||
|
||||
let rbx: u64 = vmm
|
||||
.cpu_state(cpu_id)
|
||||
@ -554,7 +554,7 @@ mod tests {
|
||||
|
||||
let mut vmm = MockVMM::new(ip, hashmap![], Some((rax + displacement, &memory)));
|
||||
// Only run the first instruction.
|
||||
vmm.emulate_insn(cpu_id, &insn, Some(1));
|
||||
vmm.emulate_first_insn(cpu_id, &insn);
|
||||
|
||||
assert_eq!(ip + 7 as u64, vmm.cpu_state(cpu_id).unwrap().ip());
|
||||
|
||||
|
@ -665,7 +665,7 @@ mod mock_vmm {
|
||||
}
|
||||
|
||||
pub fn emulate_first_insn(&mut self, cpu_id: usize, insn: &[u8]) {
|
||||
self.emulate_insn(cpu_id, insn, None)
|
||||
self.emulate_insn(cpu_id, insn, Some(1))
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user