Files
FEX-Emu--FEX/Source/Windows/Common/FEXUnixLib.h
T
Pierre-Loup A. Griffais 2a82f58195 DiskCache: use memory-mapped IO for reads when possible
On Wine, use a unixlib call to get a quality mapping that can track a growing
file.
2026-08-27 21:15:22 -07:00

52 lines
1.4 KiB
C++

// SPDX-License-Identifier: MIT
#pragma once
#include <cstdint>
#include <FEXCore/Utils/AllocatorHooks.h>
#include <FEXCore/Utils/EnumUtils.h>
#include "../UnixLib/FEXUnixLib.h"
#include "wine/unixlib.h"
namespace FEX::Windows::UnixLib {
extern decltype(__wine_unix_call_dispatcher) UnixCallDispatcher;
extern unixlib_handle_t UnixLibHandle;
inline NTSTATUS Call(FEXUnixLibFunctions code, void* args) {
if (!UnixCallDispatcher) {
return STATUS_NOT_SUPPORTED;
}
return UnixCallDispatcher(UnixLibHandle, FEXCore::ToUnderlying(code), args);
}
bool Init(HMODULE NtDll);
bool Available();
/**
* @brief Tries to enable hardware TSO if supported.
*
* @return true if hardware TSO is supported and enabled.
*/
bool TryEnableHardwareTSO();
/**
* @brief Tries to enable kernel unaligned atomic handling if supported.
*
* @param Flags Which unaligned types to enable
*
* @return true if the flags were enabled
*/
bool SetKernelUnalignedAtomicControl(uint64_t Flags);
void VirtualTHPControl(const void* Ptr, size_t Size, FEXCore::Allocator::THPControl Control);
void VirtualName(const char* Name, const void* Ptr, size_t Size);
struct SHMSlotResult {
void* SHMBase;
uint32_t MappedSize;
};
SHMSlotResult AllocateSHMSlots(void* SHMBase, uint32_t MapSize, uint32_t MaxSize);
void DeleteSHMStatsFile();
void* MapFile(HANDLE FileHandle, uint64_t MapSize);
} // namespace FEX::Windows::UnixLib