Skip to content

Conversation

ludfjig
Copy link
Contributor

@ludfjig ludfjig commented Sep 30, 2025

This is PR 2/3 in a bigger effort to remove duplicate code accross drivers.

depends on #907 which must be merged first, will mark this PR as read then

This PR introduces

  • Vm trait. It's a minimal trait for common functionality of a minimal Vm. It abstracts over differences in kvm, mshv, whp. This traits only knows things like set/get registers, run, but nothing about guest functions or hyperlight specifics.
  • HyperlightVm struct. This is a struct that contains the dyn Vm above, as well as things like guest_ptr, rsp, memory-regions, gdb connections, etc. You can think of this as replacing the previous Hypervisor trait (but now it's just 1 struct to avoid duplicate code). HyperlightVm knows about initialization, dispatching guest calls, debugging etc, which Vm trait doesn't.

Closes #465

@ludfjig ludfjig force-pushed the vm_trait_new branch 3 times, most recently from 81f0d54 to 62fad87 Compare October 22, 2025 19:44
@ludfjig ludfjig added the kind/refactor For PRs that restructure or remove code without adding new functionality. label Oct 22, 2025
@ludfjig ludfjig force-pushed the vm_trait_new branch 5 times, most recently from c11e77b to e208d66 Compare October 22, 2025 20:53
Signed-off-by: Ludvig Liljenberg <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/refactor For PRs that restructure or remove code without adding new functionality.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Rethink driver API

1 participant