[PR #394] [MERGED] thread_management.cpp: Various Mandatory Threading Fixes | Resolve #398 #1537

Closed
opened 2026-02-27 21:12:59 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/shadps4-emu/shadPS4/pull/394
Author: @lzardy
Created: 8/9/2024
Status: Merged
Merged: 8/13/2024
Merged by: @raphaelthegreat

Base: mainHead: main


📝 Commits (10+)

📊 Changes

5 files changed (+48 additions, -12 deletions)

View changed files

📝 src/core/libraries/kernel/memory_management.cpp (+2 -2)
📝 src/core/libraries/kernel/memory_management.h (+1 -1)
📝 src/core/libraries/kernel/thread_management.cpp (+10 -2)
📝 src/core/linker.cpp (+17 -3)
📝 src/core/linker.h (+18 -4)

📄 Description

  • scePthreadMutexInit did not return default when the mutex attributes were empty, resulting in invalid accesses.
    Now, we return default as expected.
  • Current HeapAPI was incomplete.
    Now it has a full struct with all 10 preset function replacement fields.
    Additionally, we now account for the full size 10 array parameter passed to _sceKernelRtldSetApplicationHeapAPI.
  • HeapAPI malloc replacement unaccounted for
    Now, we at least have a fallback to std::malloc, such that allocation completes without early crash within user thread.

Resolves #398


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/shadps4-emu/shadPS4/pull/394 **Author:** [@lzardy](https://github.com/lzardy) **Created:** 8/9/2024 **Status:** ✅ Merged **Merged:** 8/13/2024 **Merged by:** [@raphaelthegreat](https://github.com/raphaelthegreat) **Base:** `main` ← **Head:** `main` --- ### 📝 Commits (10+) - [`4e54f05`](https://github.com/shadps4-emu/shadPS4/commit/4e54f054d6539b14ec65bd57c192c0da5253b2cf) Handle empty mutex attribute - [`4a2cc38`](https://github.com/shadps4-emu/shadPS4/commit/4a2cc38511e12c45b6d296f7aa071991cf6d59da) fix conditional unsafety - [`42a805e`](https://github.com/shadps4-emu/shadPS4/commit/42a805eb48ea88a36da9a8f7338cbfa02f1c6d2d) Update thread_management.cpp - [`8c5db7c`](https://github.com/shadps4-emu/shadPS4/commit/8c5db7c800288827a3bdb59932d58d3c3027fe98) accurate heap api - [`d7b219a`](https://github.com/shadps4-emu/shadPS4/commit/d7b219a53d828a22a5826cca837454b2199277e1) Merge branch 'main' of https://github.com/lzardy/shadPS4 - [`7c062dc`](https://github.com/shadps4-emu/shadPS4/commit/7c062dcae3eeac8975e13defbf21fbc60ad37dee) Merge branch 'shadps4-emu:main' into main - [`bfd9611`](https://github.com/shadps4-emu/shadPS4/commit/bfd9611f806eaea99f531517711062414ff24a84) Merge branch 'shadps4-emu:main' into main - [`b8856be`](https://github.com/shadps4-emu/shadPS4/commit/b8856be903da81a645a29442235309b50c0b82c4) fallback to std malloc - [`19877ac`](https://github.com/shadps4-emu/shadPS4/commit/19877ac0263658ed0b3513a493834ce5ba7b4add) clang format - [`7411939`](https://github.com/shadps4-emu/shadPS4/commit/7411939bb81b0a9afd1c8a6c770e796882885794) Declare all HeapAPI replacement functions ### 📊 Changes **5 files changed** (+48 additions, -12 deletions) <details> <summary>View changed files</summary> 📝 `src/core/libraries/kernel/memory_management.cpp` (+2 -2) 📝 `src/core/libraries/kernel/memory_management.h` (+1 -1) 📝 `src/core/libraries/kernel/thread_management.cpp` (+10 -2) 📝 `src/core/linker.cpp` (+17 -3) 📝 `src/core/linker.h` (+18 -4) </details> ### 📄 Description - scePthreadMutexInit did not return default when the mutex attributes were empty, resulting in invalid accesses. Now, we return default as expected. - Current HeapAPI was incomplete. Now it has a full struct with all 10 preset function replacement fields. Additionally, we now account for the full size 10 array parameter passed to _sceKernelRtldSetApplicationHeapAPI. - HeapAPI malloc replacement unaccounted for Now, we at least have a fallback to `std::malloc`, such that allocation completes without early crash within user thread. Resolves #398 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-27 21:12:59 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/shadPS4#1537
No description provided.