1
0
mirror of https://github.com/momo5502/hypervisor.git synced 2025-07-04 10:11:51 +00:00

Add ept translation hints

This commit is contained in:
momo5502
2022-04-17 10:19:00 +02:00
parent 77785486ae
commit 30daca5444
7 changed files with 174 additions and 46 deletions

View File

@ -25,6 +25,28 @@ namespace memory
void copy_physical_data(uint64_t address, void* destination, size_t length);
template <typename T, typename... Args>
T* allocate_non_paged_object(Args ... args)
{
auto* object = static_cast<T*>(allocate_non_paged_memory(sizeof(T)));
if (object)
{
new(object) T(std::forward<Args>(args)...);
}
return object;
}
template <typename T>
void free_non_paged_object(T* object)
{
if (object)
{
object->~T();
free_non_paged_memory(object);
}
}
template <typename T, typename... Args>
T* allocate_aligned_object(Args ... args)
{