Skip to content

Commit

Permalink
Linux hack
Browse files Browse the repository at this point in the history
  • Loading branch information
ngoquang2708 committed Sep 30, 2024
1 parent c1229b2 commit a920efc
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/core/libraries/kernel/thread_management.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1067,7 +1067,16 @@ ScePthread PThreadPool::Create(const char* name) {
}
}

#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;
Expand Down

0 comments on commit a920efc

Please sign in to comment.