mirror of
https://github.com/FEX-Emu/FEX.git
synced 2026-10-06 07:00:20 +02:00
FEXCore: Support passing process pid to the backend
This commit is contained in:
7 files changed
+13
-5
No files matched your search
@@ -84,5 +84,9 @@ struct HostFeatures {
|
||||
// MIDR information
|
||||
// Also used for determining number of CPU cores for CPUID
|
||||
fextl::vector<uint32_t> CPUMIDRs;
|
||||
|
||||
// The Linux PID of this process. Useful for punching through perf-top information.
|
||||
uint32_t ProcessPID {};
|
||||
uint32_t pad2 {};
|
||||
};
|
||||
} // namespace FEXCore
|
||||
@@ -633,6 +633,7 @@ FEXCore::HostFeatures FetchHostFeatures() {
|
||||
|
||||
HostFeatures.SupportsCPUIndexInTPIDRRO = false;
|
||||
HostFeatures.HostType = FEXCore::HostFeatures::HostTypeEnum::Linux;
|
||||
HostFeatures.ProcessPID = ::getpid();
|
||||
return HostFeatures;
|
||||
}
|
||||
} // namespace FEX
|
||||
@@ -415,7 +415,7 @@ static std::optional<std::string> GenerateSingleCache(FEXCore::ExecutableFileInf
|
||||
const auto NtDll = GetModuleHandleW(L"ntdll.dll");
|
||||
const bool IsWine = !!GetProcAddress(NtDll, "wine_get_version");
|
||||
auto HostFeatures = FEX::Windows::CPUFeatures::FetchHostFeatures(
|
||||
IsWine, Is64Bit ? FEXCore::HostFeatures::HostTypeEnum::Arm64ec : FEXCore::HostFeatures::HostTypeEnum::Wow64);
|
||||
IsWine, Is64Bit ? FEXCore::HostFeatures::HostTypeEnum::Arm64ec : FEXCore::HostFeatures::HostTypeEnum::Wow64, 0);
|
||||
#endif
|
||||
|
||||
auto CTX = FEXCore::Context::Context::CreateNewContext(HostFeatures);
|
||||
|
||||
@@ -612,7 +612,8 @@ NTSTATUS ProcessInit() {
|
||||
}
|
||||
|
||||
{
|
||||
auto HostFeatures = FEX::Windows::CPUFeatures::FetchHostFeatures(IsWine, FEXCore::HostFeatures::HostTypeEnum::Arm64ec);
|
||||
auto HostFeatures =
|
||||
FEX::Windows::CPUFeatures::FetchHostFeatures(IsWine, FEXCore::HostFeatures::HostTypeEnum::Arm64ec, FEX::Windows::UnixLib::GetPID());
|
||||
CTX = FEXCore::Context::Context::CreateNewContext(HostFeatures);
|
||||
}
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
FEXCore::HostFeatures CPUFeatures::FetchHostFeatures(bool IsWine, FEXCore::HostFeatures::HostTypeEnum HostType) {
|
||||
FEXCore::HostFeatures CPUFeatures::FetchHostFeatures(bool IsWine, FEXCore::HostFeatures::HostTypeEnum HostType, uint32_t ProcessPID) {
|
||||
HKEY Key = OpenProcessorKey(0);
|
||||
if (!Key) {
|
||||
ERROR_AND_DIE_FMT("Couldn't detect CPU features");
|
||||
@@ -84,6 +84,7 @@ FEXCore::HostFeatures CPUFeatures::FetchHostFeatures(bool IsWine, FEXCore::HostF
|
||||
HostFeatures.SupportsCPUIndexInTPIDRRO = !IsWine;
|
||||
|
||||
HostFeatures.HostType = HostType;
|
||||
HostFeatures.ProcessPID = ProcessPID;
|
||||
|
||||
if (HostType == FEXCore::HostFeatures::HostTypeEnum::Wow64) {
|
||||
// AVX is unsupported for WOW64
|
||||
|
||||
@@ -16,7 +16,7 @@ class Context;
|
||||
namespace FEX::Windows {
|
||||
class CPUFeatures {
|
||||
public:
|
||||
static FEXCore::HostFeatures FetchHostFeatures(bool IsWine, FEXCore::HostFeatures::HostTypeEnum HostType);
|
||||
static FEXCore::HostFeatures FetchHostFeatures(bool IsWine, FEXCore::HostFeatures::HostTypeEnum HostType, uint32_t ProcessPID);
|
||||
|
||||
CPUFeatures(FEXCore::Context::Context& CTX);
|
||||
|
||||
|
||||
@@ -527,7 +527,8 @@ void BTCpuProcessInit() {
|
||||
}
|
||||
|
||||
{
|
||||
auto HostFeatures = FEX::Windows::CPUFeatures::FetchHostFeatures(IsWine, FEXCore::HostFeatures::HostTypeEnum::Wow64);
|
||||
auto HostFeatures =
|
||||
FEX::Windows::CPUFeatures::FetchHostFeatures(IsWine, FEXCore::HostFeatures::HostTypeEnum::Wow64, FEX::Windows::UnixLib::GetPID());
|
||||
CTX = FEXCore::Context::Context::CreateNewContext(HostFeatures);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user