This commit is contained in:
@ -18,20 +18,20 @@ impl VCpu for AMDVCpu {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn write_memory(&mut self, addr: u64, data: u8) -> Result<(), &'static str> {
|
||||
fn write_memory(&mut self, _addr: u64, _data: u8) -> Result<(), &'static str> {
|
||||
unimplemented!("AMDVCpu::write_memory is not implemented yet");
|
||||
}
|
||||
|
||||
fn write_memory_ranged(
|
||||
&mut self,
|
||||
addr_start: u64,
|
||||
addr_end: u64,
|
||||
data: u8,
|
||||
_addr_start: u64,
|
||||
_addr_end: u64,
|
||||
_data: u8,
|
||||
) -> Result<(), &'static str> {
|
||||
unimplemented!("AMDVCpu::write_memory_ranged is not implemented yet");
|
||||
}
|
||||
|
||||
fn read_memory(&mut self, addr: u64) -> Result<u8, &'static str> {
|
||||
fn read_memory(&mut self, _addr: u64) -> Result<u8, &'static str> {
|
||||
unimplemented!("AMDVCpu::read_memory is not implemented yet");
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,4 @@
|
||||
use crate::vmm::x86_64::{
|
||||
common,
|
||||
intel::{vmcs, vmwrite},
|
||||
};
|
||||
use crate::vmm::x86_64::{common, intel::vmcs};
|
||||
|
||||
pub fn setup_exec_controls() -> Result<(), &'static str> {
|
||||
let basic_msr = common::read_msr(0x480);
|
||||
@ -15,7 +12,7 @@ pub fn setup_exec_controls() -> Result<(), &'static str> {
|
||||
raw_pin_exec_ctrl |= (reserved_bits & 0xFFFFFFFF) as u32;
|
||||
raw_pin_exec_ctrl &= (reserved_bits >> 32) as u32;
|
||||
|
||||
let mut pin_exec_ctrl = vmcs::controls::PinBasedVmExecutionControls::from(raw_pin_exec_ctrl);
|
||||
let pin_exec_ctrl = vmcs::controls::PinBasedVmExecutionControls::from(raw_pin_exec_ctrl);
|
||||
//pin_exec_ctrl.set_external_interrupt_exiting(false);
|
||||
|
||||
pin_exec_ctrl.write()?;
|
||||
|
@ -1,3 +1,5 @@
|
||||
#![allow(non_camel_case_types)]
|
||||
#![allow(non_snake_case)]
|
||||
use modular_bitfield::bitfield;
|
||||
use raw_cpuid::cpuid;
|
||||
|
||||
|
@ -1,6 +1,8 @@
|
||||
#![allow(non_snake_case)]
|
||||
|
||||
use modular_bitfield::{
|
||||
bitfield,
|
||||
prelude::{B1, B3, B4, B52, B53},
|
||||
prelude::{B1, B3, B4, B52},
|
||||
};
|
||||
use x86_64::{
|
||||
structures::paging::{FrameAllocator, PhysFrame, Size4KiB},
|
||||
@ -37,6 +39,7 @@ impl EPT {
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub fn map_2m(
|
||||
&mut self,
|
||||
gpa: u64,
|
||||
@ -291,7 +294,7 @@ pub struct EPTP {
|
||||
pub level: B3,
|
||||
pub dirty_accessed: bool,
|
||||
pub enforce_access_rights: bool,
|
||||
reserved: B4,
|
||||
_reserved: B4,
|
||||
pub phys: B52,
|
||||
}
|
||||
|
||||
@ -325,7 +328,7 @@ pub struct EntryBase {
|
||||
pub accessed: bool,
|
||||
pub dirty: bool,
|
||||
pub exec_user: bool,
|
||||
reserved: B1,
|
||||
_reserved: B1,
|
||||
pub phys: B52,
|
||||
}
|
||||
|
||||
|
@ -1,9 +1,6 @@
|
||||
use core::u64;
|
||||
|
||||
use alloc::vec;
|
||||
use alloc::vec::Vec;
|
||||
use x86::vmx::vmcs;
|
||||
use x86_64::structures::paging::OffsetPageTable;
|
||||
use x86_64::{PhysAddr, VirtAddr};
|
||||
|
||||
use crate::info;
|
||||
|
@ -1,5 +1,3 @@
|
||||
use core::arch::naked_asm;
|
||||
|
||||
use raw_cpuid::cpuid;
|
||||
use x86_64::{
|
||||
registers::control::Cr4Flags,
|
||||
@ -47,11 +45,6 @@ pub struct IntelVCpu {
|
||||
}
|
||||
|
||||
impl IntelVCpu {
|
||||
#[unsafe(naked)]
|
||||
unsafe extern "C" fn test_guest_code() -> ! {
|
||||
naked_asm!("2: hlt; jmp 2b");
|
||||
}
|
||||
|
||||
#[unsafe(no_mangle)]
|
||||
unsafe extern "C" fn intel_set_host_stack(rsp: u64) {
|
||||
vmwrite(x86::vmx::vmcs::host::RSP, rsp).unwrap();
|
||||
|
@ -1,3 +1,5 @@
|
||||
#![allow(non_snake_case)]
|
||||
|
||||
use modular_bitfield::{bitfield, prelude::*};
|
||||
|
||||
use crate::vmm::x86_64::intel::vmcs;
|
||||
@ -7,14 +9,14 @@ use crate::vmm::x86_64::intel::vmcs;
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
pub struct PinBasedVmExecutionControls {
|
||||
pub external_interrupt_exiting: bool,
|
||||
reserved1: B1,
|
||||
_reserved1: B1,
|
||||
pub interrupt_window_exiting: bool,
|
||||
pub nmi_exiting: bool,
|
||||
reserved2: B1,
|
||||
_reserved2: B1,
|
||||
pub virtual_nmi: bool,
|
||||
pub activate_vmx_preemption_timer: bool,
|
||||
pub process_posted_interrupts: bool,
|
||||
reserved3: B24,
|
||||
_reserved3: B24,
|
||||
}
|
||||
|
||||
impl PinBasedVmExecutionControls {
|
||||
@ -34,21 +36,21 @@ impl PinBasedVmExecutionControls {
|
||||
#[repr(u32)]
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
pub struct PrimaryProcessorBasedVmExecutionControls {
|
||||
resetved1: B2,
|
||||
_reserved1: B2,
|
||||
pub interrupt_window: bool,
|
||||
pub tsc_offsetting: bool,
|
||||
reserved2: B3,
|
||||
_reserved2: B3,
|
||||
pub hlt: bool,
|
||||
reserved3: B1,
|
||||
_reserved3: B1,
|
||||
pub invlpg: bool,
|
||||
pub mwait: bool,
|
||||
pub rdpmc: bool,
|
||||
pub rdtsc: bool,
|
||||
reserved4: B2,
|
||||
_reserved4: B2,
|
||||
pub cr3load: bool,
|
||||
pub cr3store: bool,
|
||||
pub activate_teritary_controls: bool,
|
||||
reserved5: B1,
|
||||
_reserved5: B1,
|
||||
pub cr8load: bool,
|
||||
pub cr8store: bool,
|
||||
pub use_tpr_shadow: bool,
|
||||
@ -56,7 +58,7 @@ pub struct PrimaryProcessorBasedVmExecutionControls {
|
||||
pub mov_dr: bool,
|
||||
pub unconditional_io: bool,
|
||||
pub use_io_bitmap: bool,
|
||||
reserved6: B1,
|
||||
_reserved6: B1,
|
||||
pub monitor_trap: bool,
|
||||
pub use_msr_bitmap: bool,
|
||||
pub monitor: bool,
|
||||
@ -112,7 +114,7 @@ pub struct SecondaryProcessorBasedVmExecutionControls {
|
||||
pub enable_enclv: bool,
|
||||
pub vmm_buslock_detect: bool,
|
||||
pub instruction_timeout: bool,
|
||||
reserved: B1,
|
||||
_reserved: B1,
|
||||
}
|
||||
|
||||
impl SecondaryProcessorBasedVmExecutionControls {
|
||||
@ -132,13 +134,13 @@ impl SecondaryProcessorBasedVmExecutionControls {
|
||||
#[repr(u32)]
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
pub struct EntryControls {
|
||||
reserved1: B2,
|
||||
_reserved1: B2,
|
||||
pub load_debug_controls: bool,
|
||||
reserved2: B6,
|
||||
_reserved2: B6,
|
||||
pub ia32e_mode_guest: bool,
|
||||
pub entry_smm: bool,
|
||||
pub deactivate_dualmonitor: bool,
|
||||
reserved3: B1,
|
||||
_reserved3: B1,
|
||||
pub load_perf_global_ctrl: bool,
|
||||
pub load_ia32_pat: bool,
|
||||
pub load_ia32_efer: bool,
|
||||
@ -149,7 +151,7 @@ pub struct EntryControls {
|
||||
pub load_cet_state: bool,
|
||||
pub load_guest_lbr_ctl: bool,
|
||||
pub load_pkrs: bool,
|
||||
reserved4: B9,
|
||||
_reserved4: B9,
|
||||
}
|
||||
|
||||
impl EntryControls {
|
||||
@ -169,15 +171,15 @@ impl EntryControls {
|
||||
#[repr(u32)]
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
pub struct PrimaryExitControls {
|
||||
reserved1: B2,
|
||||
_reserved1: B2,
|
||||
pub save_debug: bool,
|
||||
reserved2: B6,
|
||||
_reserved2: B6,
|
||||
pub host_addr_space_size: bool,
|
||||
reserved3: B3,
|
||||
_reserved3: B3,
|
||||
pub load_perf_global_ctrl: bool,
|
||||
reserved4: B1,
|
||||
_reserved4: B1,
|
||||
pub ack_interrupt_onexit: bool,
|
||||
reserved5: B2,
|
||||
_reserved5: B2,
|
||||
pub save_ia32_pat: bool,
|
||||
pub load_ia32_pat: bool,
|
||||
pub save_ia32_efer: bool,
|
||||
|
@ -1,4 +1,5 @@
|
||||
#![allow(non_camel_case_types)]
|
||||
#![allow(unused)]
|
||||
|
||||
pub mod controls;
|
||||
pub mod err;
|
||||
|
@ -1,3 +1,5 @@
|
||||
#![allow(non_snake_case)]
|
||||
|
||||
use modular_bitfield::{bitfield, prelude::*};
|
||||
|
||||
#[derive(Specifier, Debug, Clone, Copy)]
|
||||
@ -24,14 +26,14 @@ pub struct SegmentRights {
|
||||
pub desc_type: DescriptorType,
|
||||
pub dpl: B2,
|
||||
pub present: bool,
|
||||
reserved: B4,
|
||||
_reserved: B4,
|
||||
pub avl: bool,
|
||||
pub long: bool,
|
||||
pub db: bool,
|
||||
#[bits = 1]
|
||||
pub granularity: Granularity,
|
||||
pub unusable: bool,
|
||||
reserved2: B15,
|
||||
_reserved2: B15,
|
||||
}
|
||||
|
||||
impl Default for SegmentRights {
|
||||
|
@ -6,7 +6,7 @@ use x86_64::{
|
||||
};
|
||||
|
||||
use crate::{
|
||||
error, info,
|
||||
error,
|
||||
vmm::x86_64::{
|
||||
common::{read_msr, write_msr},
|
||||
intel::vmx_capture_status,
|
||||
|
Reference in New Issue
Block a user