mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-11 01:08:39 +12:00
PPU stack fixed
This commit is contained in:
parent
8bd7823b70
commit
b7fd09740b
2 changed files with 5 additions and 4 deletions
|
@ -663,7 +663,7 @@ void PPUThread::FastCall2(u32 addr, u32 rtoc)
|
||||||
{
|
{
|
||||||
auto old_status = m_status;
|
auto old_status = m_status;
|
||||||
auto old_PC = PC;
|
auto old_PC = PC;
|
||||||
auto old_stack = GPR[1]; // only saved and restored (may be wrong)
|
auto old_stack = GPR[1];
|
||||||
auto old_rtoc = GPR[2];
|
auto old_rtoc = GPR[2];
|
||||||
auto old_LR = LR;
|
auto old_LR = LR;
|
||||||
auto old_thread = GetCurrentNamedThread();
|
auto old_thread = GetCurrentNamedThread();
|
||||||
|
@ -671,6 +671,7 @@ void PPUThread::FastCall2(u32 addr, u32 rtoc)
|
||||||
|
|
||||||
m_status = Running;
|
m_status = Running;
|
||||||
PC = addr;
|
PC = addr;
|
||||||
|
GPR[1] -= 0x70; // create stack frame reserved area
|
||||||
GPR[2] = rtoc;
|
GPR[2] = rtoc;
|
||||||
LR = Emu.GetCPUThreadStop();
|
LR = Emu.GetCPUThreadStop();
|
||||||
SetCurrentNamedThread(this);
|
SetCurrentNamedThread(this);
|
||||||
|
@ -680,7 +681,7 @@ void PPUThread::FastCall2(u32 addr, u32 rtoc)
|
||||||
|
|
||||||
m_status = old_status;
|
m_status = old_status;
|
||||||
PC = old_PC;
|
PC = old_PC;
|
||||||
GPR[1] = old_stack;
|
GPR[1] = old_stack; // TODO: error check instead of blind assignment? GPR[1] shouldn't change
|
||||||
GPR[2] = old_rtoc;
|
GPR[2] = old_rtoc;
|
||||||
LR = old_LR;
|
LR = old_LR;
|
||||||
SetCurrentNamedThread(old_thread);
|
SetCurrentNamedThread(old_thread);
|
||||||
|
|
|
@ -14,7 +14,7 @@ namespace cb_detail
|
||||||
// Current implementation can handle only fixed amount of stack arguments.
|
// Current implementation can handle only fixed amount of stack arguments.
|
||||||
// This constant can be increased if necessary.
|
// This constant can be increased if necessary.
|
||||||
// It's possible to calculate suitable stack frame size in template, but too complicated.
|
// It's possible to calculate suitable stack frame size in template, but too complicated.
|
||||||
static const auto FIXED_STACK_FRAME_SIZE = 0x100;
|
static const auto FIXED_STACK_FRAME_SIZE = 0x90;
|
||||||
|
|
||||||
template<typename T, _func_arg_type type, int g_count, int f_count, int v_count>
|
template<typename T, _func_arg_type type, int g_count, int f_count, int v_count>
|
||||||
struct _func_arg;
|
struct _func_arg;
|
||||||
|
@ -61,7 +61,7 @@ namespace cb_detail
|
||||||
|
|
||||||
__forceinline static void set_value(PPUThread& CPU, const T& arg)
|
__forceinline static void set_value(PPUThread& CPU, const T& arg)
|
||||||
{
|
{
|
||||||
const int stack_pos = 0x70 + (g_count - 9) * 8 - FIXED_STACK_FRAME_SIZE;
|
const int stack_pos = (g_count - 9) * 8 - FIXED_STACK_FRAME_SIZE;
|
||||||
static_assert(stack_pos < 0, "TODO: Increase fixed stack frame size (arg count limit broken)");
|
static_assert(stack_pos < 0, "TODO: Increase fixed stack frame size (arg count limit broken)");
|
||||||
vm::write64(CPU.GPR[1] + stack_pos, cast_to_ppu_gpr<T>(arg));
|
vm::write64(CPU.GPR[1] + stack_pos, cast_to_ppu_gpr<T>(arg));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue