MemArena: Use placeholders on Windows.

This commit is contained in:
Admiral H. Curtiss
2021-06-21 06:15:56 +02:00
parent 09a0ba06c0
commit 79405de103
2 changed files with 368 additions and 19 deletions

View File

@ -4,15 +4,16 @@
#pragma once
#include <cstddef>
#ifdef _WIN32
#include <windows.h>
#endif
#include <vector>
#include "Common/CommonTypes.h"
namespace Common
{
#ifdef _WIN32
struct WindowsMemoryRegion;
#endif
// This class lets you create a block of anonymous RAM, and then arbitrarily map views into it.
// Multiple views can mirror the same section of the block, which makes it very convenient for
// emulating memory mirrors.
@ -99,7 +100,15 @@ public:
private:
#ifdef _WIN32
HANDLE hMemoryMapping;
WindowsMemoryRegion* EnsureSplitRegionForMapping(void* address, size_t size);
bool JoinRegionsAfterUnmap(void* address, size_t size);
std::vector<WindowsMemoryRegion> m_regions;
void* m_reserved_region = nullptr;
void* m_memory_handle = nullptr;
void* m_api_ms_win_core_memory_l1_1_6_handle = nullptr;
void* m_address_VirtualAlloc2 = nullptr;
void* m_address_MapViewOfFile3 = nullptr;
#else
int fd;
#endif