Skip to content

arch: refactor to support windows#675

Open
lstocchi wants to merge 4 commits into
containers:mainfrom
lstocchi:arch_crate_win
Open

arch: refactor to support windows#675
lstocchi wants to merge 4 commits into
containers:mainfrom
lstocchi:arch_crate_win

Conversation

@lstocchi
Copy link
Copy Markdown
Contributor

This PR just contains commits related to the arch crate.
I've refactor it to share common code with Windows and keep linux-only code in the linux folder and windows in windows as done in the rest of the project.
The linux implementation did not change. The windows one copies what's done on linux.

@lstocchi lstocchi force-pushed the arch_crate_win branch 2 times, most recently from e44af52 to 09f5154 Compare May 13, 2026 14:54
lstocchi added 4 commits May 20, 2026 19:01
Introduce a hypervisor-agnostic SegmentDescriptor struct and rename kvm_segment_from_gdt to segment_from_gdt. The KVM backend uses a kvm_segment_from conversion helper, proving the agnostic struct works before adding the Windows path.

Signed-off-by: lstocchi <lstocchi@redhat.com>
Move the logic that calculates GDT/IDT and page tables into compute_segments() and compute_page_tables() functions that return hypervisor-agnostic BootSegments and BootPageTables structs. Existing KVM setup functions now delegate to these.

Signed-off-by: lstocchi <lstocchi@redhat.com>
Update Cargo.toml with conditional dependencies and vm-memory git rev. Introduce src/arch/src/x86_64/linux/ and windows/ folder structures. Move existing Linux/KVM code to linux/ and add platform re-exports with cfg(target_os) conditional compilation.

Signed-off-by: lstocchi <lstocchi@redhat.com>
Add the WHP-specific register, segment, and MSR configuration in
src/arch/src/x86_64/windows/. Uses structured WHV_REGISTER_VALUE writes
for FP registers and proper WHP register name mapping for MSRs. Includes
the get_page_size helper for Windows.

Signed-off-by: lstocchi <lstocchi@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant