2019-07-30 22:46:58 +08:00
|
|
|
/*
|
2021-09-27 21:17:26 +08:00
|
|
|
* Copyright (C) 2019-2021 Intel Corporation
|
2019-07-30 22:46:58 +08:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: MIT
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2020-02-24 05:44:01 +08:00
|
|
|
#include "shared/source/os_interface/os_memory.h"
|
2019-07-30 22:46:58 +08:00
|
|
|
|
|
|
|
#include <windows.h>
|
|
|
|
|
|
|
|
namespace NEO {
|
|
|
|
|
|
|
|
class OSMemoryWindows : public OSMemory {
|
|
|
|
public:
|
|
|
|
OSMemoryWindows() = default;
|
|
|
|
|
2020-07-02 21:28:03 +08:00
|
|
|
void getMemoryMaps(MemoryMaps &memoryMaps) override {}
|
|
|
|
|
2021-09-27 21:17:26 +08:00
|
|
|
typedef BOOL(WINAPI *VirtualFreeFcn)(LPVOID ptr, SIZE_T size, DWORD flags);
|
|
|
|
typedef LPVOID(WINAPI *VirtualAllocFcn)(LPVOID inPtr, SIZE_T size, DWORD flags, DWORD type);
|
|
|
|
|
2019-07-30 22:46:58 +08:00
|
|
|
protected:
|
2021-09-27 21:17:26 +08:00
|
|
|
void *osReserveCpuAddressRange(void *baseAddress, size_t sizeToReserve, bool topDownHint) override;
|
2020-03-30 01:40:34 +08:00
|
|
|
void osReleaseCpuAddressRange(void *reservedCpuAddressRange, size_t reservedSize) override;
|
|
|
|
|
2019-07-30 22:46:58 +08:00
|
|
|
MOCKABLE_VIRTUAL LPVOID virtualAllocWrapper(LPVOID, SIZE_T, DWORD, DWORD);
|
|
|
|
MOCKABLE_VIRTUAL BOOL virtualFreeWrapper(LPVOID, SIZE_T, DWORD);
|
2021-09-27 21:17:26 +08:00
|
|
|
|
|
|
|
static VirtualFreeFcn virtualFreeFnc;
|
|
|
|
static VirtualAllocFcn virtualAllocFnc;
|
2019-07-30 22:46:58 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
}; // namespace NEO
|