mirror of
https://github.com/mii443/nel_os.git
synced 2025-08-22 16:15:38 +00:00
fix vmentry success
This commit is contained in:
30
src/vmm/ept.rs
Normal file
30
src/vmm/ept.rs
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
use bitfield::bitfield;
|
||||||
|
use x86_64::PhysAddr;
|
||||||
|
|
||||||
|
bitfield! {
|
||||||
|
pub struct EntryBase(u64);
|
||||||
|
impl Debug;
|
||||||
|
|
||||||
|
pub read, set_read: 0;
|
||||||
|
pub write, set_write: 1;
|
||||||
|
pub exec_super, set_exec_super: 2;
|
||||||
|
pub typ, set_typ: 5, 3;
|
||||||
|
pub ignore_pat, set_ignore_pat: 6;
|
||||||
|
pub map_memory, set_map_memory: 7;
|
||||||
|
pub accessed, set_accessed: 8;
|
||||||
|
pub dirty, set_dirty: 9;
|
||||||
|
pub exec_user, set_exec_user: 10;
|
||||||
|
pub phys, set_phys: 63, 12;
|
||||||
|
}
|
||||||
|
|
||||||
|
impl EntryBase {
|
||||||
|
pub fn present(&self) -> bool {
|
||||||
|
self.read() || self.write() || self.exec_super()
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn address(&self) -> PhysAddr {
|
||||||
|
PhysAddr::new(self.phys() << 12)
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn new_map_table() {}
|
||||||
|
}
|
@ -1,3 +1,4 @@
|
|||||||
|
pub mod ept;
|
||||||
pub mod error;
|
pub mod error;
|
||||||
pub mod register;
|
pub mod register;
|
||||||
pub mod support;
|
pub mod support;
|
||||||
|
@ -351,9 +351,11 @@ impl VCpu {
|
|||||||
result == 0
|
result == 0
|
||||||
};
|
};
|
||||||
|
|
||||||
self.launch_done = true;
|
if !self.launch_done && success {
|
||||||
|
self.launch_done = true;
|
||||||
|
}
|
||||||
|
|
||||||
if success {
|
if !success {
|
||||||
let error = InstructionError::read();
|
let error = InstructionError::read();
|
||||||
if error.0 != 0 {
|
if error.0 != 0 {
|
||||||
return Err(error);
|
return Err(error);
|
||||||
@ -530,7 +532,7 @@ impl VCpu {
|
|||||||
"pop r14",
|
"pop r14",
|
||||||
"pop r15",
|
"pop r15",
|
||||||
"pop rbp",
|
"pop rbp",
|
||||||
"mov rax, 1",
|
"mov rax, 0",
|
||||||
"ret",
|
"ret",
|
||||||
const RAX_OFFSET,
|
const RAX_OFFSET,
|
||||||
const RCX_OFFSET,
|
const RCX_OFFSET,
|
||||||
|
Reference in New Issue
Block a user