[PR #1836] [MERGED] core/libraries: HLE fiber reimplementation #2336

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

📋 Pull Request Information

Original PR: https://github.com/shadps4-emu/shadPS4/pull/1836
Author: @polybiusproxy
Created: 12/21/2024
Status: Merged
Merged: 12/24/2024
Merged by: @polybiusproxy

Base: mainHead: core/you-need-fibers


📝 Commits (1)

  • de8aba9 core/libraries: HLE fiber reimplementation

📊 Changes

6 files changed (+539 additions, -168 deletions)

View changed files

📝 CMakeLists.txt (+3 -2)
📝 src/core/libraries/fiber/fiber.cpp (+332 -129)
📝 src/core/libraries/fiber/fiber.h (+77 -37)
src/core/libraries/fiber/fiber_context.s (+121 -0)
📝 src/core/libraries/kernel/threads/tcb.cpp (+1 -0)
📝 src/core/tls.h (+5 -0)

📄 Description

This PR reimplements the fiber library according to the original library. The goal is for the reimplementation to be overall more accurate, multiplatform (the previous implementation was only for Windows), while fixing bugs the previous implementation had.

A big problem is our implementation won't work on fibers with small stack areas due to HLE consuming most of the stack and overflowing it. The previous implementation did not have this issue as the game-provided stack was completely ignored. A possible solution to avoid this (suggested by red_prig) would be to make a wrapper for all HLE functions that switches the stack, but not many games (only found on The Playroom) have this issue so that's out of scope for this PR.


🔄 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/1836 **Author:** [@polybiusproxy](https://github.com/polybiusproxy) **Created:** 12/21/2024 **Status:** ✅ Merged **Merged:** 12/24/2024 **Merged by:** [@polybiusproxy](https://github.com/polybiusproxy) **Base:** `main` ← **Head:** `core/you-need-fibers` --- ### 📝 Commits (1) - [`de8aba9`](https://github.com/shadps4-emu/shadPS4/commit/de8aba93fbb3137057bad91c24f388c3c9519795) core/libraries: HLE fiber reimplementation ### 📊 Changes **6 files changed** (+539 additions, -168 deletions) <details> <summary>View changed files</summary> 📝 `CMakeLists.txt` (+3 -2) 📝 `src/core/libraries/fiber/fiber.cpp` (+332 -129) 📝 `src/core/libraries/fiber/fiber.h` (+77 -37) ➕ `src/core/libraries/fiber/fiber_context.s` (+121 -0) 📝 `src/core/libraries/kernel/threads/tcb.cpp` (+1 -0) 📝 `src/core/tls.h` (+5 -0) </details> ### 📄 Description This PR reimplements the fiber library according to the original library. The goal is for the reimplementation to be overall more accurate, multiplatform (the previous implementation was only for Windows), while fixing bugs the previous implementation had. A big problem is our implementation won't work on fibers with small stack areas due to HLE consuming most of the stack and overflowing it. The previous implementation did not have this issue as the game-provided stack was completely ignored. A possible solution to avoid this (suggested by red_prig) would be to make a wrapper for all HLE functions that switches the stack, but not many games (only found on The Playroom) have this issue so that's out of scope for this PR. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-27 21:16:06 +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#2336
No description provided.