mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2025-01-22 04:25:21 +00:00
hypervisor: x86: emulator: set IP properly for newly fetched stream
The default value of IP is zero. If the decoder's state not set properly, then the guest state is going to be wrong. Signed-off-by: Wei Liu <liuwe@microsoft.com>
This commit is contained in:
parent
9f3bea3e3f
commit
1eb4133034
@ -588,6 +588,7 @@ impl<'a, T: CpuStateManager> Emulator<'a, T> {
|
|||||||
// Once we have the new stream, we must create a new decoder
|
// Once we have the new stream, we must create a new decoder
|
||||||
// and emulate one last instruction from the last decoded IP.
|
// and emulate one last instruction from the last decoded IP.
|
||||||
decoder = Decoder::new(64, &fetched_insn_stream, DecoderOptions::NONE);
|
decoder = Decoder::new(64, &fetched_insn_stream, DecoderOptions::NONE);
|
||||||
|
decoder.set_ip(last_decoded_ip);
|
||||||
decoder.decode_out(&mut insn);
|
decoder.decode_out(&mut insn);
|
||||||
if decoder.last_error() != DecoderError::None {
|
if decoder.last_error() != DecoderError::None {
|
||||||
return Err(EmulationError::InstructionFetchingError(anyhow!(
|
return Err(EmulationError::InstructionFetchingError(anyhow!(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user