Commit 1213584
committed
refactor: address review feedback
Refactor i686 page table code to follow the same architecture-independent
API as amd64/aarch64, per reviewer feedback.
hyperlight_common changes:
- Extract shared page table iterators (modify_ptes, read_pte_if_present,
require_pte_exist, write_entry_updating) to vmem.rs with PTE_SHIFT
const generic for reuse across architectures.
- Implement i686/vmem.rs with proper map()/virt_to_phys() using the
shared iterators, replacing stubs and the host-side i686_guest
submodule that was in amd64/vmem.rs.
- Remove PAGE_USER from pte_for_table (PDEs are supervisor-only by
default); user-space PDEs get PAGE_USER via post-processing.
- Remove SCRATCH_TOP_PD_ROOTS_* and MAX_PD_ROOTS constants (replaced
by set_pt_root_finder callback).
hyperlight_host changes:
- Unify GuestPageTableBuffer<PTE_BYTES> for both architectures,
removing i686_pt::Builder, build_initial_i686_page_tables, and
compact_i686_snapshot (~500 lines removed from snapshot.rs).
- Add root_offset to GuestPageTableBuffer for targeting per-process
PDs, with finalize_multi_root() to replicate kernel PDEs, map
scratch, and set PAGE_USER across all roots.
- Snapshot::new uses filtered_mappings with root-index tagging for
per-process PD isolation in a single pass (no double PT walk).
- Add set_pt_root_finder callback on MultiUseSandbox, replacing the
scratch-based PD roots bookkeeping.
- Add CR0 named constants (CR0_PE, CR0_ET, CR0_WP, CR0_PG).
- Add compaction_kind() helper to deduplicate kind conversion.
- Add 5 i686 unit tests for map/virt_to_phys.
- Detailed comments on separate_pt_bytes explaining the map_file_cow
GPA overlap constraint.1 parent 8fcb7ea commit 1213584
11 files changed
Lines changed: 1031 additions & 1344 deletions
File tree
- src
- hyperlight_common/src
- arch
- aarch64
- amd64
- i686
- hyperlight_host/src
- hypervisor
- hyperlight_vm
- regs/x86_64
- mem
- sandbox
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
47 | | - | |
48 | | - | |
| 47 | + | |
49 | 48 | | |
50 | 49 | | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
51 | 60 | | |
52 | | - | |
| |||
0 commit comments