Fix heap space issues

This commit is contained in:
momo5502 2022-05-07 18:31:47 +02:00
parent a9ee35965b
commit 75e6abe9d5
3 changed files with 11 additions and 5 deletions

View File

@ -1,5 +1,4 @@
#pragma once #pragma once
#include "std_include.hpp"
extern "C" extern "C"
{ {

View File

@ -76,7 +76,14 @@ namespace vmx
} }
} }
ept::ept() = default; ept::ept()
{
// Directly initializing these fields kills the compiler ._.
// https://developercommunity.visualstudio.com/t/clexe-using-20gb-of-memory-compiling-small-file-in/407999
memset(this->epml4, 0, sizeof(this->epml4));
memset(this->epdpt, 0, sizeof(this->epdpt));
memset(this->epde, 0, sizeof(this->epde));
}
ept::~ept() ept::~ept()
{ {

View File

@ -77,9 +77,9 @@ namespace vmx
static void free_translation_hints(ept_translation_hint* hints); static void free_translation_hints(ept_translation_hint* hints);
private: private:
DECLSPEC_PAGE_ALIGN pml4 epml4[EPT_PML4E_ENTRY_COUNT]{}; DECLSPEC_PAGE_ALIGN pml4 epml4[EPT_PML4E_ENTRY_COUNT];
DECLSPEC_PAGE_ALIGN pml3 epdpt[EPT_PDPTE_ENTRY_COUNT]{}; DECLSPEC_PAGE_ALIGN pml3 epdpt[EPT_PDPTE_ENTRY_COUNT];
DECLSPEC_PAGE_ALIGN pml2 epde[EPT_PDPTE_ENTRY_COUNT][EPT_PDE_ENTRY_COUNT]{}; DECLSPEC_PAGE_ALIGN pml2 epde[EPT_PDPTE_ENTRY_COUNT][EPT_PDE_ENTRY_COUNT];
ept_split* ept_splits{nullptr}; ept_split* ept_splits{nullptr};
ept_hook* ept_hooks{nullptr}; ept_hook* ept_hooks{nullptr};