mirror of
https://github.com/momo5502/hypervisor.git
synced 2025-07-05 10:41:50 +00:00
Reflect memory writes to shadow page
This commit is contained in:
@ -1,7 +1,6 @@
|
||||
#include "std_include.hpp"
|
||||
#include "memory.hpp"
|
||||
#include "string.hpp"
|
||||
#include "process.hpp"
|
||||
|
||||
namespace memory
|
||||
{
|
||||
@ -84,6 +83,23 @@ namespace memory
|
||||
_Must_inspect_result_
|
||||
_IRQL_requires_max_(DISPATCH_LEVEL)
|
||||
|
||||
void* map_physical_memory(const uint64_t address, const size_t size)
|
||||
{
|
||||
PHYSICAL_ADDRESS physical_address{};
|
||||
physical_address.QuadPart = static_cast<LONGLONG>(address);
|
||||
return MmMapIoSpace(physical_address, size, MmNonCached);
|
||||
}
|
||||
|
||||
_IRQL_requires_max_(DISPATCH_LEVEL)
|
||||
|
||||
void unmap_physical_memory(void* address, const size_t size)
|
||||
{
|
||||
MmUnmapIoSpace(address, size);
|
||||
}
|
||||
|
||||
_Must_inspect_result_
|
||||
_IRQL_requires_max_(DISPATCH_LEVEL)
|
||||
|
||||
void* allocate_non_paged_memory(const size_t size)
|
||||
{
|
||||
void* memory = ExAllocatePoolWithTag(NonPagedPool, size, 'MOMO');
|
||||
|
Reference in New Issue
Block a user