fix VMCB reserved fields
Some checks failed
Check / Build ISO (nightly-2025-04-27) (push) Failing after 1m19s

This commit is contained in:
mii443
2025-08-31 00:07:06 +09:00
parent ce079a1067
commit cb006a8df8
4 changed files with 111 additions and 37 deletions

View File

@@ -90,11 +90,15 @@ pub struct RawVmcb {
pub intercept_tlbsync: bool,
pub intercept_bus_lock: bool,
pub intercept_idle_hlt: bool,
_reserved1: B25,
#[skip]
__: B25,
// 018h-03Bh
_reserved2: B128,
_reserved3: B128,
_reserved4: B32,
#[skip]
__: B128,
#[skip]
__: B128,
#[skip]
__: B32,
// 03Ch
pub pause_filter_threshold: B16,
// 03Eh
@@ -110,29 +114,35 @@ pub struct RawVmcb {
pub tlb_control: TlbControl,
pub allow_larger_rap: bool,
pub clear_rap_on_vmrun: bool,
_reserved5: B22,
#[skip]
__: B22,
// 060h
pub v_tpr: B8,
pub v_irq: bool,
pub vgif: bool,
pub v_nmi: bool,
pub v_nmi_mask: bool,
_reserved6: B3,
#[skip]
__: B3,
pub v_intr_prio: B4,
pub v_ign_tpr: bool,
_reserved7: B3,
#[skip]
__: B3,
pub v_intr_masking: bool,
pub amd_virtual_gif: bool,
pub v_nmi_enable: bool,
_reserved8: B3,
#[skip]
__: B3,
pub x2avic_enable: bool,
pub avic_enable: bool,
pub v_intr_vector: B8,
_reserved9: B24,
#[skip]
__: B24,
// 068h
pub interrupt_shadow: bool,
pub guest_interrupt_mask: bool,
_reserved10: B62,
#[skip]
__: B62,
// 070h
pub exit_code: B64,
// 078h
@@ -150,10 +160,12 @@ pub struct RawVmcb {
pub virtual_transparent_encryption: bool,
pub enable_read_only_guest_page_table: bool,
pub enable_invlpgb_and_tlbsync: bool,
_reserved11: B56,
#[skip]
__: B56,
// 098h
_reserved12: B12,
pub avic_apic_bar: B52,
#[skip]
__: B12,
// 0A0h
pub ghcb_gpa: B64,
// 0A8h
@@ -165,15 +177,54 @@ pub struct RawVmcb {
pub vmload_vmsave_virtualization_enable: bool,
pub ibs_virtualization_enable: bool,
pub pmc_virtualization_enable: bool,
_reserved13: B60,
#[skip]
__: B60,
// 0C0h
pub vmcb_clean_bits: B32,
_reserved14: B32,
#[skip]
__: B32,
// 0C8h
pub next_rip: B64,
// 0D0h
pub fetched_bytes: B8,
pub gutest_instruction_bytes: B120,
// 0E0h
pub avic_apic_backing_page_pointer: B52,
#[skip]
__: B12,
// 0E8-0EFh Reserved
#[skip]
__: B64,
#[skip]
__: B64,
#[skip]
__: B64,
#[skip]
__: B64,
// 0F0h
#[skip]
__: B12,
pub avic_logical_table_pointer: B40,
#[skip]
__: B12,
// 0F8h
pub avic_physical_max_index: B12,
pub avic_physical_table_pointer: B40,
#[skip]
__: B12,
// 100h-107h Reserved
#[skip]
__: B64,
// 108h
#[skip]
__: B12,
pub vmsa_pointer: B40,
#[skip]
__: B12,
// 110h
pub vmgexit_rax: B64,
// 118h
pub vmgexit_cpl: B8,
}
#[derive(Specifier, Debug, Clone, Copy, PartialEq, Eq)]

View File

@@ -28,7 +28,8 @@ pub struct XCR0 {
pub xtilecfg: bool,
pub xtiledata: bool,
pub apx: bool,
_reserved: B44,
#[skip]
__: B44,
}
pub fn set_xcr(vcpu: &mut IntelVCpu, index: u32, xcr: u64) -> Result<(), &'static str> {

View File

@@ -9,14 +9,17 @@ use crate::vmm::x86_64::intel::vmcs;
#[derive(Debug, Clone, Copy)]
pub struct PinBasedVmExecutionControls {
pub external_interrupt_exiting: bool,
_reserved1: B1,
#[skip]
__: B1,
pub interrupt_window_exiting: bool,
pub nmi_exiting: bool,
_reserved2: B1,
#[skip]
__: B1,
pub virtual_nmi: bool,
pub activate_vmx_preemption_timer: bool,
pub process_posted_interrupts: bool,
_reserved3: B24,
#[skip]
__: B24,
}
impl PinBasedVmExecutionControls {
@@ -36,21 +39,26 @@ impl PinBasedVmExecutionControls {
#[repr(u32)]
#[derive(Debug, Clone, Copy)]
pub struct PrimaryProcessorBasedVmExecutionControls {
_reserved1: B2,
#[skip]
__: B2,
pub interrupt_window: bool,
pub tsc_offsetting: bool,
_reserved2: B3,
#[skip]
__: B3,
pub hlt: bool,
_reserved3: B1,
#[skip]
__: B1,
pub invlpg: bool,
pub mwait: bool,
pub rdpmc: bool,
pub rdtsc: bool,
_reserved4: B2,
#[skip]
__: B2,
pub cr3load: bool,
pub cr3store: bool,
pub activate_teritary_controls: bool,
_reserved5: B1,
#[skip]
__: B1,
pub cr8load: bool,
pub cr8store: bool,
pub use_tpr_shadow: bool,
@@ -58,7 +66,8 @@ pub struct PrimaryProcessorBasedVmExecutionControls {
pub mov_dr: bool,
pub unconditional_io: bool,
pub use_io_bitmap: bool,
_reserved6: B1,
#[skip]
__: B1,
pub monitor_trap: bool,
pub use_msr_bitmap: bool,
pub monitor: bool,
@@ -114,7 +123,8 @@ pub struct SecondaryProcessorBasedVmExecutionControls {
pub enable_enclv: bool,
pub vmm_buslock_detect: bool,
pub instruction_timeout: bool,
_reserved: B1,
#[skip]
__: B1,
}
impl SecondaryProcessorBasedVmExecutionControls {
@@ -134,13 +144,16 @@ impl SecondaryProcessorBasedVmExecutionControls {
#[repr(u32)]
#[derive(Debug, Clone, Copy)]
pub struct EntryControls {
_reserved1: B2,
#[skip]
__: B2,
pub load_debug_controls: bool,
_reserved2: B6,
#[skip]
__: B6,
pub ia32e_mode_guest: bool,
pub entry_smm: bool,
pub deactivate_dualmonitor: bool,
_reserved3: B1,
#[skip]
__: B1,
pub load_perf_global_ctrl: bool,
pub load_ia32_pat: bool,
pub load_ia32_efer: bool,
@@ -151,7 +164,8 @@ pub struct EntryControls {
pub load_cet_state: bool,
pub load_guest_lbr_ctl: bool,
pub load_pkrs: bool,
_reserved4: B9,
#[skip]
__: B9,
}
impl EntryControls {
@@ -171,15 +185,20 @@ impl EntryControls {
#[repr(u32)]
#[derive(Debug, Clone, Copy)]
pub struct PrimaryExitControls {
_reserved1: B2,
#[skip]
__: B2,
pub save_debug: bool,
_reserved2: B6,
#[skip]
__: B6,
pub host_addr_space_size: bool,
_reserved3: B3,
#[skip]
__: B3,
pub load_perf_global_ctrl: bool,
_reserved4: B1,
#[skip]
__: B1,
pub ack_interrupt_onexit: bool,
_reserved5: B2,
#[skip]
__: B2,
pub save_ia32_pat: bool,
pub load_ia32_pat: bool,
pub save_ia32_efer: bool,
@@ -216,6 +235,7 @@ pub struct EntryIntrInfo {
pub vector: B8,
pub typ: B3,
pub ec_available: bool,
_reserved: B19,
#[skip]
__: B19,
pub valid: bool,
}

View File

@@ -26,14 +26,16 @@ pub struct SegmentRights {
pub desc_type: DescriptorType,
pub dpl: B2,
pub present: bool,
_reserved: B4,
#[skip]
__: B4,
pub avl: bool,
pub long: bool,
pub db: bool,
#[bits = 1]
pub granularity: Granularity,
pub unusable: bool,
_reserved2: B15,
#[skip]
__: B15,
}
impl Default for SegmentRights {