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
2 changed files with 3 additions and 3 deletions
|
|
@ -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…
Add table
Add a link
Reference in a new issue