Skip to content

Commit 37fead5

Browse files
committed
[feat] inject exception vector to guest VM in handle_exception_nmi
1 parent 8b8705b commit 37fead5

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/vmx/vcpu.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ impl<H: AxVCpuHal> VmxVcpu<H> {
378378
let mut formattor = IntelFormatter::new();
379379
formattor.format(&instr, &mut output);
380380

381-
debug!("Decoded instruction @Intel formatter: {}", output);
381+
warn!("Decoded instruction @Intel formatter: {}", output);
382382
Ok(())
383383
}
384384
}
@@ -1046,7 +1046,7 @@ impl<H: AxVCpuHal> VmxVcpu<H> {
10461046

10471047
fn handle_exception_nmi(&mut self, exit_info: &VmxExitInfo) -> AxResult {
10481048
let intr_info = interrupt_exit_info()?;
1049-
info!(
1049+
warn!(
10501050
"VM exit: Exception or NMI @ RIP({:#x}, {}): {:#x?}",
10511051
exit_info.guest_rip, exit_info.exit_instruction_length, intr_info
10521052
);
@@ -1063,7 +1063,10 @@ impl<H: AxVCpuHal> VmxVcpu<H> {
10631063
NON_MASKABLE_INTERRUPT => unsafe {
10641064
core::arch::asm!("int {}", const NON_MASKABLE_INTERRUPT)
10651065
},
1066-
v => panic!("Unhandled Guest Exception: #{:#x}", v),
1066+
v => {
1067+
warn!("Unhandled Guest Exception: #{:#x}, inject to user", v);
1068+
self.queue_event(v, intr_info.err_code);
1069+
}
10671070
}
10681071
Ok(())
10691072
}

0 commit comments

Comments
 (0)