File tree Expand file tree Collapse file tree
src/hyperlight_host/src/hypervisor Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -365,14 +365,18 @@ impl HyperlightVm {
365365 ) -> std:: result:: Result < ( ) , RegisterError > {
366366 #[ cfg( not( feature = "nanvix-unstable" ) ) ]
367367 {
368+ // Restore the full special registers from snapshot, but update CR3
369+ // to point to the new (relocated) page tables
368370 let mut sregs = * sregs;
369371 sregs. cr3 = cr3;
370372 self . pending_tlb_flush = true ;
371373 self . vm . set_sregs ( & sregs) ?;
372374 }
373375 #[ cfg( feature = "nanvix-unstable" ) ]
374376 {
375- let _ = ( cr3, sregs) ;
377+ let _ = ( cr3, sregs) ; // suppress unused warnings
378+ // TODO: This is probably not correct.
379+ // Let's deal with it when we clean up the nanvix-unstable feature
376380 self . vm
377381 . set_sregs ( & CommonSpecialRegisters :: standard_real_mode_defaults ( ) ) ?;
378382 }
Original file line number Diff line number Diff line change @@ -94,6 +94,7 @@ impl SurrogateProcess {
9494 Ok ( oe. get ( ) . surrogate_base )
9595 }
9696 Entry :: Vacant ( ve) => {
97+ // Derive the page protection from the mapping type
9798 let page_protection = match mapping {
9899 SurrogateMapping :: SandboxMemory => PAGE_READWRITE ,
99100 SurrogateMapping :: ReadOnlyFile => PAGE_READONLY ,
@@ -122,6 +123,9 @@ impl SurrogateProcess {
122123 ) ;
123124 }
124125
126+ // Only set guard pages for SandboxMemory mappings.
127+ // File-backed read-only mappings do not need guard pages
128+ // because the host does not write to them.
125129 if * mapping == SurrogateMapping :: SandboxMemory {
126130 let mut unused_out_old_prot_flags = PAGE_PROTECTION_FLAGS ( 0 ) ;
127131
You can’t perform that action at this time.
0 commit comments