Skip to content

Conversation

danbugs
Copy link
Contributor

@danbugs danbugs commented Jul 11, 2025

Fixes #685 and updates CI to ensure Windows builds successfully without default features.


Btw, to validate this fix, I tested running Nanvix (which uses --no-default-features) on Windows as a guest. This revealed that additional register setup was needed in hyperv_windows.rs:

  • Mirror the CS register setup used with default features, except without the L bit
  • Explicitly set the Limit parameter for CS to 0xFFFF (required when paging isn't initialized)

These changes ensure Windows Hyper-V properly initializes guest VMs that don't use the init-paging feature. Same idea for Linux Hyper-V too.

ludfjig
ludfjig previously approved these changes Jul 11, 2025
Copy link
Contributor

@ludfjig ludfjig left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! I think we should strive to set the same registers on all hypervisors, so we don't rely on any inherent defaults of a particular hv. Thoughts?

@danbugs
Copy link
Contributor Author

danbugs commented Jul 11, 2025

Looks good! I think we should strive to set the same registers on all hypervisors, so we don't rely on any inherent defaults of a particular hv. Thoughts?

Probably a good idea—we should also avoid relying on Default and be a little more explicit. For example, on KVM, the default CS register (excluding base & selector fields) looks like this:

CS: limit=0xffff, type=0xa, s=1, dpl=0, p=1, avl=0, l=0, db=0, g=0

This is exactly the setup we needed w/o default-features to run a workload like Nanvix and why it worked from the get go. But, on WHP, Default just zeroes out everything :|

Might be a good work item for #469?

@danbugs danbugs force-pushed the init-paging-windows-fix branch from 2c28574 to 85e2184 Compare July 11, 2025 18:20
syntactically
syntactically previously approved these changes Jul 11, 2025
dblnz
dblnz previously approved these changes Jul 14, 2025
Copy link
Contributor

@dblnz dblnz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

I agree that we need a common way of setting the registers for all the Hypervisors, independent of the features enabled.

marosset
marosset previously approved these changes Jul 14, 2025
@danbugs danbugs dismissed stale reviews from marosset, dblnz, and syntactically via 97b3e43 July 14, 2025 21:36
@danbugs danbugs force-pushed the init-paging-windows-fix branch from 97b3e43 to 27c01ea Compare July 14, 2025 22:23
@danbugs danbugs merged commit 27c01ea into hyperlight-dev:main Jul 15, 2025
33 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bugfix For PRs that fix bugs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

hyperlight_host doesn't build on Windows without init-paging feature enabled
5 participants