From 874a392b0d94765be36275f93715aa018cc9d814 Mon Sep 17 00:00:00 2001 From: Ludvig Liljenberg <4257730+ludfjig@users.noreply.github.com> Date: Thu, 30 Apr 2026 18:48:32 -0700 Subject: [PATCH 1/2] Move sandbox snapshot.rs into snapshot module dir Signed-off-by: Ludvig Liljenberg <4257730+ludfjig@users.noreply.github.com> --- src/hyperlight_host/src/sandbox/{snapshot.rs => snapshot/mod.rs} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename src/hyperlight_host/src/sandbox/{snapshot.rs => snapshot/mod.rs} (100%) diff --git a/src/hyperlight_host/src/sandbox/snapshot.rs b/src/hyperlight_host/src/sandbox/snapshot/mod.rs similarity index 100% rename from src/hyperlight_host/src/sandbox/snapshot.rs rename to src/hyperlight_host/src/sandbox/snapshot/mod.rs From 732641f7390f43e1961c6d9bc81a58c5c53c2d02 Mon Sep 17 00:00:00 2001 From: Ludvig Liljenberg <4257730+ludfjig@users.noreply.github.com> Date: Thu, 30 Apr 2026 18:50:33 -0700 Subject: [PATCH 2/2] Extract HyperlightVm apply_sregs helper Signed-off-by: Ludvig Liljenberg <4257730+ludfjig@users.noreply.github.com> --- .../src/hypervisor/hyperlight_vm/x86_64.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/hyperlight_host/src/hypervisor/hyperlight_vm/x86_64.rs b/src/hyperlight_host/src/hypervisor/hyperlight_vm/x86_64.rs index 857490600..16ac55ad3 100644 --- a/src/hyperlight_host/src/hypervisor/hyperlight_vm/x86_64.rs +++ b/src/hyperlight_host/src/hypervisor/hyperlight_vm/x86_64.rs @@ -346,6 +346,15 @@ impl HyperlightVm { self.vm.set_debug_regs(&CommonDebugRegs::default())?; self.vm.reset_xsave()?; + self.apply_sregs(cr3, sregs) + } + + /// Apply special registers and mark TLB for flush. + pub(crate) fn apply_sregs( + &mut self, + cr3: u64, + sregs: &CommonSpecialRegisters, + ) -> std::result::Result<(), RegisterError> { // Restore the full special registers from snapshot, but update CR3 // to point to the new (relocated) page tables let mut sregs = *sregs;