Move sregs to its own file#1043
Merged
ludfjig merged 1 commit intohyperlight-dev:mainfrom Nov 25, 2025
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors the special register (sregs) initialization code by moving default values and constants from mod.rs to special_regs.rs, and removes obsolete Rust 2015-style extern crate declarations throughout the codebase. The changes improve code organization by consolidating related functionality while modernizing the import style to Rust 2018+ conventions.
Key changes:
- Moved CR0, CR4, and EFER constants from
hypervisor/mod.rstohypervisor/regs/special_regs.rs - Created
standard_64bit_defaults()andstandard_real_mode_defaults()methods onCommonSpecialRegistersto encapsulate default register configurations - Removed
extern cratedeclarations formshv_bindingsandmshv_ioctlsfrom 7 files - Updated import in
hyperv_linux.rsdebug module fromsuper::mshv_bindingstomshv_bindings
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
src/hyperlight_host/src/mem/memory_region.rs |
Removed obsolete extern crate declarations for mshv crates |
src/hyperlight_host/src/hypervisor/regs/standard_regs.rs |
Removed obsolete extern crate declarations for mshv crates |
src/hyperlight_host/src/hypervisor/regs/special_regs.rs |
Added CR0/CR4/EFER constants and two new methods for default register configurations |
src/hyperlight_host/src/hypervisor/regs/fpu.rs |
Removed obsolete extern crate declarations for mshv crates |
src/hyperlight_host/src/hypervisor/mod.rs |
Refactored setup_initial_sregs() to use new default methods; removed constants and unused import; contains bug with CR3 not being set |
src/hyperlight_host/src/hypervisor/hyperv_linux.rs |
Removed obsolete extern crate declarations; updated import path in debug module |
src/hyperlight_host/src/hypervisor/gdb/mshv_debug.rs |
Removed obsolete extern crate declarations for mshv crates |
src/hyperlight_host/src/error.rs |
Removed obsolete extern crate declaration for mshv_ioctls |
Signed-off-by: Ludvig Liljenberg <4257730+ludfjig@users.noreply.github.com>
danbugs
approved these changes
Nov 25, 2025
vshailesh
pushed a commit
to vshailesh/hyperlight
that referenced
this pull request
Dec 7, 2025
Signed-off-by: Ludvig Liljenberg <4257730+ludfjig@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Move sregs default values to its own file and removes some old
extern crateusages