Skip to content

Commit fd88dcb

Browse files
committed
virt_mshv_vtl: preserve CR2 when injecting TDX page faults
Copy the pending exception's fault address to the runner's shared CR2 state before injecting a page fault. Leave CR2 unchanged for other exceptions so descriptor operand faults reach the guest with the correct faulting linear address.
1 parent bca5cfb commit fd88dcb

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

  • openhcl/virt_mshv_vtl/src/processor/tdx

‎openhcl/virt_mshv_vtl/src/processor/tdx/mod.rs‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -675,6 +675,10 @@ impl HardwareIsolatedBacking for TdxBacked {
675675
vtl: GuestVtl,
676676
event: HvX64PendingExceptionEvent,
677677
) {
678+
if event.vector() == u16::from(x86defs::Exception::PAGE_FAULT.0) {
679+
this.runner.set_cr2(event.exception_parameter());
680+
}
681+
678682
let new_intr = InterruptionInformation::new()
679683
.with_valid(true)
680684
.with_deliver_error_code(event.deliver_error_code())

0 commit comments

Comments
 (0)