fix EPT allocation

This commit is contained in:
Masato Imai
2025-08-09 14:44:40 +00:00
parent 6e34ecdc89
commit e897aa8da8
2 changed files with 3 additions and 3 deletions

View File

@ -105,7 +105,7 @@ impl EPT {
&mut self, &mut self,
gpa: u64, gpa: u64,
hpa: u64, hpa: u64,
allocator: &mut impl FrameAllocator<Size4KiB>, allocator: &mut dyn FrameAllocator<Size4KiB>,
) -> Result<(), &'static str> { ) -> Result<(), &'static str> {
let lv4_index = (gpa >> 39) & 0x1FF; let lv4_index = (gpa >> 39) & 0x1FF;
let lv3_index = (gpa >> 30) & 0x1FF; let lv3_index = (gpa >> 30) & 0x1FF;

View File

@ -144,8 +144,8 @@ impl IntelVCpu {
let frame = frame_allocator.allocate_frame().ok_or("No free frames")?; let frame = frame_allocator.allocate_frame().ok_or("No free frames")?;
let hpa = frame.start_address().as_u64(); let hpa = frame.start_address().as_u64();
self.ept.map_2m(gpa, hpa, frame_allocator)?; self.ept.map_4k(gpa, hpa, frame_allocator)?;
gpa += (4 * 1024) << 9; gpa += 0x1000;
pages -= 1; pages -= 1;
} }