Skip to content

Conversation

@ludfjig
Copy link
Contributor

@ludfjig ludfjig commented Nov 25, 2025

Move sregs default values to its own file and removes some old extern crate usages

@ludfjig ludfjig added the kind/refactor For PRs that restructure or remove code without adding new functionality. label Nov 25, 2025
@ludfjig ludfjig marked this pull request as ready for review November 25, 2025 18:51
@danbugs danbugs requested a review from Copilot November 25, 2025 19:08
danbugs
danbugs previously approved these changes Nov 25, 2025
Copy link
Contributor

@danbugs danbugs left a comment

Choose a reason for hiding this comment

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

LGTM

Copilot finished reviewing on behalf of danbugs November 25, 2025 19:10
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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.rs to hypervisor/regs/special_regs.rs
  • Created standard_64bit_defaults() and standard_real_mode_defaults() methods on CommonSpecialRegisters to encapsulate default register configurations
  • Removed extern crate declarations for mshv_bindings and mshv_ioctls from 7 files
  • Updated import in hyperv_linux.rs debug module from super::mshv_bindings to mshv_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>
@ludfjig ludfjig enabled auto-merge (squash) November 25, 2025 20:10
@ludfjig ludfjig merged commit bfbd008 into hyperlight-dev:main Nov 25, 2025
42 checks passed
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.

2 participants