mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2026-06-07 10:14:59 -06:00
Improve stack clearing logic in ExecuteGuest
Added a check for fiber stacks before clearing the stack in ExecuteGuest. That fixes Gravity Rush 2 crash on Windows.
This commit is contained in:
parent
e0850d5cfc
commit
2f885b6c21
@ -59,9 +59,11 @@ void ClearStack() {
|
|||||||
|
|
||||||
template <class ReturnType, class... FuncArgs, class... CallArgs>
|
template <class ReturnType, class... FuncArgs, class... CallArgs>
|
||||||
ReturnType ExecuteGuest(PS4_SYSV_ABI ReturnType (*func)(FuncArgs...), CallArgs&&... args) {
|
ReturnType ExecuteGuest(PS4_SYSV_ABI ReturnType (*func)(FuncArgs...), CallArgs&&... args) {
|
||||||
EnsureThreadInitialized();
|
// clear stack to avoid trash from EnsureThreadInitialized (skip on fiber stacks)
|
||||||
// clear stack to avoid trash from EnsureThreadInitialized
|
auto* tcb = GetTcbBase();
|
||||||
ClearStack<12_KB>();
|
if (tcb == nullptr || tcb->tcb_fiber == nullptr) {
|
||||||
|
ClearStack<12_KB>();
|
||||||
|
}
|
||||||
return func(std::forward<CallArgs>(args)...);
|
return func(std::forward<CallArgs>(args)...);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user