This PR significantly enhances the memory management strategy for Extended Page Table (EPT) hooks within the hypervisor framework. By integrating the heapless crate. A system is established where all memory allocations are pre-allocated and fixed, which not only improves stability but also boosts performance during runtime. The update facilitates precise mapping of guest page physical addresses to their corresponding shadow pages and page tables, supporting efficient EPT hook management.
Key Enhancements:
Pre-allocated Memory Buffers: Implements upfront allocation of memory for shadow pages and page tables in MemoryManager::new(). This change eliminates dynamic memory allocation during VM operations, which is critical to avoid allocation failures post-VMExit when requesting memory from UEFI.
Pre-allocated Page Table Management: Improved the hypervsor's ability to manage page tables by pre-allocating Pt structures, which are later mapped to corresponding guest physical addresses. This setup simplifies tracking and ensures that if a page is already split, the existing Pt is reused. This avoids unnecessary operations and errors associated with re-splitting already managed pages.
Efficient Shadow Page Management: The hypervisor now allows multiple hooks on the same page to share a single shadow page safely. It prevents unnecessary overwrites and additional copying by returning the same shadow page if it's already mapped to a guest physical address, thereby optimizing resource usage and enhancing performance consistency.
Integration of the Heapless Crate: Utilizes heapless to create fixed-size arrays for active and free page tables and shadow pages, eliminating runtime allocation errors. This is particularly beneficial for real-time systems that require predictable execution times.
VM Exit Enhancements: Updates related to VM exits, such as EPT violations and monitor trap flags, now leverage pre-mapped page tables and shadow pages accessed via guest physical addresses, streamlining the handling processes.
Description:
This PR significantly enhances the memory management strategy for Extended Page Table (EPT) hooks within the hypervisor framework. By integrating the
heapless
crate. A system is established where all memory allocations are pre-allocated and fixed, which not only improves stability but also boosts performance during runtime. The update facilitates precise mapping of guest page physical addresses to their corresponding shadow pages and page tables, supporting efficient EPT hook management.Key Enhancements:
Pre-allocated Memory Buffers: Implements upfront allocation of memory for shadow pages and page tables in
MemoryManager::new()
. This change eliminates dynamic memory allocation during VM operations, which is critical to avoid allocation failures post-VMExit when requesting memory from UEFI.Pre-allocated Page Table Management: Improved the hypervsor's ability to manage page tables by pre-allocating
Pt
structures, which are later mapped to corresponding guest physical addresses. This setup simplifies tracking and ensures that if a page is already split, the existingPt
is reused. This avoids unnecessary operations and errors associated with re-splitting already managed pages.Efficient Shadow Page Management: The hypervisor now allows multiple hooks on the same page to share a single shadow page safely. It prevents unnecessary overwrites and additional copying by returning the same shadow page if it's already mapped to a guest physical address, thereby optimizing resource usage and enhancing performance consistency.
Integration of the Heapless Crate: Utilizes
heapless
to create fixed-size arrays for active and free page tables and shadow pages, eliminating runtime allocation errors. This is particularly beneficial for real-time systems that require predictable execution times.VM Exit Enhancements: Updates related to VM exits, such as EPT violations and monitor trap flags, now leverage pre-mapped page tables and shadow pages accessed via guest physical addresses, streamlining the handling processes.
Enhancement and fixes for #21 and #10