Files
compute-runtime/runtime/os_interface/windows/os_memory_win.cpp
Venevtsev, Igor 8169347aa9 Add ULT for OSMemoryLinux
- ensure OSMemoryLinux::reserveCpuAddressRange() calls mmap()
  with -1 as fd param

Related-To: NEO-2877, NEO-3530

Change-Id: I2d5903291726b086af8b913f92b64e8c38c23462
Signed-off-by: Venevtsev, Igor <igor.venevtsev@intel.com>
2019-07-31 15:04:50 +02:00

33 lines
950 B
C++

/*
* Copyright (C) 2019 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "runtime/os_interface/windows/os_memory_win.h"
namespace NEO {
std::unique_ptr<OSMemory> OSMemory::create() {
return std::make_unique<OSMemoryWindows>();
}
void *OSMemoryWindows::reserveCpuAddressRange(size_t sizeToReserve) {
return virtualAllocWrapper(0, sizeToReserve, MEM_RESERVE, PAGE_READWRITE);
}
void OSMemoryWindows::releaseCpuAddressRange(void *reservedCpuAddressRange, size_t /* reservedSize */) {
virtualFreeWrapper(reservedCpuAddressRange, 0, MEM_RELEASE);
}
LPVOID OSMemoryWindows::virtualAllocWrapper(LPVOID lpAddress, SIZE_T dwSize, DWORD flAllocationType, DWORD flProtect) {
return VirtualAlloc(lpAddress, dwSize, flAllocationType, flProtect);
}
BOOL OSMemoryWindows::virtualFreeWrapper(LPVOID lpAddress, SIZE_T dwSize, DWORD dwFreeType) {
return VirtualFree(lpAddress, dwSize, dwFreeType);
}
} // namespace NEO