nixpkgs/pkgs/by-name/sh/shadps4/bloodborne.patch
2024-10-14 13:39:18 -06:00

20 lines
714 B
Diff

--- a/src/core/libraries/kernel/thread_management.cpp
+++ b/src/core/libraries/kernel/thread_management.cpp
@@ -1065,7 +1065,16 @@ ScePthread PThreadPool::Create() {
}
}
+#ifdef _WIN64
auto* ret = new PthreadInternal{};
+#else
+ // TODO: Linux specific hack
+ static u8* hint_address = reinterpret_cast<u8*>(0x7FFFFC000ULL);
+ auto* ret = reinterpret_cast<PthreadInternal*>(
+ mmap(hint_address, sizeof(PthreadInternal), PROT_READ | PROT_WRITE,
+ MAP_PRIVATE | MAP_ANONYMOUS | MAP_FIXED, -1, 0));
+ hint_address += Common::AlignUp(sizeof(PthreadInternal), 4_KB);
+#endif
ret->is_free = false;
ret->is_detached = false;
ret->is_almost_done = false;