[PR #2905] [CLOSED] core: Implement Linux TCB access using guest<->host swapping. #3067

Closed
opened 2026-02-27 22:02:19 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/shadps4-emu/shadPS4/pull/2905
Author: @squidbus
Created: 5/11/2025
Status: Closed

Base: mainHead: tcb-swap


📝 Commits (2)

  • fe3051f core: Implement Linux TCB access using guest<->host swapping.
  • cac372e Merge branch 'main' into tcb-swap

📊 Changes

5 files changed (+46 additions, -38 deletions)

View changed files

📝 src/core/cpu_patches.cpp (+5 -28)
📝 src/core/cpu_patches.h (+0 -3)
📝 src/core/module.cpp (+0 -5)
📝 src/core/tls.cpp (+17 -0)
📝 src/core/tls.h (+24 -2)

📄 Description

Reviving an old experiment I had to implement TCB access without code patches on Linux. Essentially, whenever a call to guest code happens, we swap GS and FS so the guest TCB is in FS, and when a call to host code happens we do the reverse.

I've done some basic testing with asserts to check that the TCB should be in the correct state when swaps happen during execution of a few games. Needs actual testing from Linux users though to make sure it's working correctly.


🔄 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/2905 **Author:** [@squidbus](https://github.com/squidbus) **Created:** 5/11/2025 **Status:** ❌ Closed **Base:** `main` ← **Head:** `tcb-swap` --- ### 📝 Commits (2) - [`fe3051f`](https://github.com/shadps4-emu/shadPS4/commit/fe3051f6b35d458acba5f2beda30c318d8e2786a) core: Implement Linux TCB access using guest<->host swapping. - [`cac372e`](https://github.com/shadps4-emu/shadPS4/commit/cac372eb018f659d6112b6a2f2e24f37efff3256) Merge branch 'main' into tcb-swap ### 📊 Changes **5 files changed** (+46 additions, -38 deletions) <details> <summary>View changed files</summary> 📝 `src/core/cpu_patches.cpp` (+5 -28) 📝 `src/core/cpu_patches.h` (+0 -3) 📝 `src/core/module.cpp` (+0 -5) 📝 `src/core/tls.cpp` (+17 -0) 📝 `src/core/tls.h` (+24 -2) </details> ### 📄 Description Reviving an old experiment I had to implement TCB access without code patches on Linux. Essentially, whenever a call to guest code happens, we swap GS and FS so the guest TCB is in FS, and when a call to host code happens we do the reverse. I've done some basic testing with asserts to check that the TCB should be in the correct state when swaps happen during execution of a few games. Needs actual testing from Linux users though to make sure it's working correctly. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-27 22:02:19 +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#3067
No description provided.