mirror of
https://github.com/RPCS3/rpcs3.git
synced 2024-11-17 08:11:51 +00:00
PPU stack fixed
This commit is contained in:
parent
8bd7823b70
commit
b7fd09740b
@ -663,7 +663,7 @@ void PPUThread::FastCall2(u32 addr, u32 rtoc)
|
||||
{
|
||||
auto old_status = m_status;
|
||||
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_LR = LR;
|
||||
auto old_thread = GetCurrentNamedThread();
|
||||
@ -671,6 +671,7 @@ void PPUThread::FastCall2(u32 addr, u32 rtoc)
|
||||
|
||||
m_status = Running;
|
||||
PC = addr;
|
||||
GPR[1] -= 0x70; // create stack frame reserved area
|
||||
GPR[2] = rtoc;
|
||||
LR = Emu.GetCPUThreadStop();
|
||||
SetCurrentNamedThread(this);
|
||||
@ -680,7 +681,7 @@ void PPUThread::FastCall2(u32 addr, u32 rtoc)
|
||||
|
||||
m_status = old_status;
|
||||
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;
|
||||
LR = old_LR;
|
||||
SetCurrentNamedThread(old_thread);
|
||||
|
@ -14,7 +14,7 @@ namespace cb_detail
|
||||
// Current implementation can handle only fixed amount of stack arguments.
|
||||
// This constant can be increased if necessary.
|
||||
// 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>
|
||||
struct _func_arg;
|
||||
@ -61,7 +61,7 @@ namespace cb_detail
|
||||
|
||||
__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)");
|
||||
vm::write64(CPU.GPR[1] + stack_pos, cast_to_ppu_gpr<T>(arg));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user