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 across drivers.

depends on #907 which must be merged first, will mark this PR as ready 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, gdb-debugging etc, guest-tracing, which Vm trait doesn't.
  • Simplifies and refactors some cancellation stuff relating to kill() without changing behavior

Closes #465, #904

@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 17 times, most recently from 1562f26 to edc7f00 Compare October 24, 2025 20:15
@ludfjig ludfjig force-pushed the vm_trait_new branch 4 times, most recently from f6337f9 to 350b8e0 Compare October 28, 2025 18:05
@ludfjig ludfjig marked this pull request as ready for review October 28, 2025 18:39
Signed-off-by: Ludvig Liljenberg <4257730+ludfjig@users.noreply.github.com>
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