mirror of
https://github.com/FEX-Emu/FEX.git
synced 2026-10-06 21:00:17 +02:00
Centralizes all the nasty behaviour that will end up breaking when WINE eventually turns on userspace syscall dispatch. Pushes all of the logic in to the UnixLib. Support both paths until everyone is migrated to supporting the UnixLib, then we can delete the bit of code duplication between the PE side and UnixLib side. Helpful that everything that gets punched through the UnixLib is optional, so worst case some optional bits can break for a while.
49 lines
1.3 KiB
C++
49 lines
1.3 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);
|
|
|
|
/**
|
|
* @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();
|
|
} // namespace FEX::Windows::UnixLib
|