Skip to content

Commit ca0916f

Browse files
committed
Fix things
Signed-off-by: Ludvig Liljenberg <[email protected]>
1 parent de0acbf commit ca0916f

File tree

3 files changed

+10
-16
lines changed

3 files changed

+10
-16
lines changed

src/hyperlight_host/src/hypervisor/regs/fpu.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,8 +202,10 @@ impl From<&CommonFpu> for [(WHV_REGISTER_NAME, WHV_REGISTER_VALUE); 26] {
202202
}
203203
}
204204

205+
#[cfg(target_os = "windows")]
205206
pub(crate) const WHP_FPU_NAMES_LEN: usize = 26;
206207
#[expect(dead_code, reason = "Used in get_fpu, but get_fpu is currently unused")]
208+
#[cfg(target_os = "windows")]
207209
pub(crate) const WHP_FPU_NAMES: [WHV_REGISTER_NAME; WHP_FPU_NAMES_LEN] = [
208210
WHvX64RegisterFpMmx0,
209211
WHvX64RegisterFpMmx1,

src/hyperlight_host/src/hypervisor/regs/special_regs.rs

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ extern crate mshv_bindings3 as mshv_bindings;
88
#[cfg(mshv3)]
99
extern crate mshv_ioctls3 as mshv_ioctls;
1010

11+
#[cfg(target_os = "windows")]
1112
use std::collections::HashSet;
1213

1314
#[cfg(kvm)]
@@ -17,6 +18,7 @@ use mshv_bindings::{SegmentRegister, SpecialRegisters, TableRegister};
1718
#[cfg(target_os = "windows")]
1819
use windows::Win32::System::Hypervisor::*;
1920

21+
#[cfg(target_os = "windows")]
2022
use super::FromWhpRegisterError;
2123

2224
#[derive(Debug, Default, Copy, Clone, PartialEq)]
@@ -145,7 +147,9 @@ impl From<CommonSpecialRegisters> for kvm_sregs {
145147
}
146148
}
147149

150+
#[cfg(target_os = "windows")]
148151
pub(crate) const WHP_SREGS_NAMES_LEN: usize = 17;
152+
#[cfg(target_os = "windows")]
149153
pub(crate) const WHP_SREGS_NAMES: [WHV_REGISTER_NAME; WHP_SREGS_NAMES_LEN] = [
150154
WHvX64RegisterCs,
151155
WHvX64RegisterDs,
@@ -608,19 +612,4 @@ mod tests {
608612
FromWhpRegisterError::InvalidRegister(WHvX64RegisterRip.0)
609613
);
610614
}
611-
612-
#[test]
613-
fn temp() {
614-
let value = WHV_REGISTER_VALUE {
615-
Segment: WHV_X64_SEGMENT_REGISTER {
616-
Anonymous: WHV_X64_SEGMENT_REGISTER_0 {
617-
Attributes: 0b1011 | 1 << 4 | 1 << 7 | 1 << 13, // Type (11: Execute/Read, accessed) | L (64-bit mode) | P (present) | S (code segment)
618-
},
619-
..Default::default() // zero out the rest
620-
},
621-
};
622-
623-
let segment: CommonSegmentRegister = value.into();
624-
print!("{:#?}", segment);
625-
}
626615
}

src/hyperlight_host/src/hypervisor/regs/standard_regs.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,12 +174,15 @@ impl From<&CommonRegisters> for [(WHV_REGISTER_NAME, WHV_REGISTER_VALUE); 18] {
174174
}
175175
}
176176

177+
#[cfg(target_os = "windows")]
177178
use std::collections::HashSet;
178-
use std::convert::TryFrom;
179179

180+
#[cfg(target_os = "windows")]
180181
use super::FromWhpRegisterError;
181182

183+
#[cfg(target_os = "windows")]
182184
pub(crate) const WHP_REGS_NAMES_LEN: usize = 18;
185+
#[cfg(target_os = "windows")]
183186
pub(crate) const WHP_REGS_NAMES: [WHV_REGISTER_NAME; WHP_REGS_NAMES_LEN] = [
184187
WHvX64RegisterRax,
185188
WHvX64RegisterRbx,

0 commit comments

Comments
 (0)