ARMv7: argc, argv setting, LDRSB_IMM, bugfixes

This commit is contained in:
Nekotekina 2015-02-01 16:52:34 +03:00
parent 8a945a1a52
commit e5dd03dbcb
14 changed files with 184 additions and 98 deletions

View file

@ -25,18 +25,3 @@ PPCThread::~PPCThread()
void PPCThread::DoReset()
{
}
void PPCThread::InitStack()
{
if(m_stack_addr) return;
if(m_stack_size == 0) m_stack_size = 0x10000;
m_stack_addr = (u32)Memory.StackMem.AllocAlign(m_stack_size, 0x100);
/*
m_stack_point += m_stack_size - 0x10;
m_stack_point &= -0x10;
vm::write64(m_stack_point, 0);
m_stack_point -= 0x60;
vm::write64(m_stack_point, m_stack_point + 0x60);
*/
}

View file

@ -4,9 +4,6 @@
class PPCThread : public CPUThread
{
public:
virtual void InitRegs()=0;
virtual void InitStack();
virtual std::string GetThreadName() const
{
return fmt::format("%s[0x%08x]", GetFName(), PC);

View file

@ -80,6 +80,24 @@ void PPUThread::InitRegs()
TB = 0;
}
void PPUThread::InitStack()
{
if (!m_stack_addr)
{
assert(m_stack_size);
m_stack_addr = vm::cast(Memory.StackMem.AllocAlign(m_stack_size, 4096));
}
}
void PPUThread::CloseStack()
{
if (m_stack_addr)
{
Memory.StackMem.Free(m_stack_addr);
m_stack_addr = 0;
}
}
void PPUThread::DoRun()
{
switch(Ini.CPUDecoderMode.GetValue())

View file

@ -799,8 +799,10 @@ public:
}
public:
virtual void InitRegs();
virtual void Task();
virtual void InitRegs() override;
virtual void InitStack() override;
virtual void CloseStack() override;
virtual void Task() override;
u64 GetStackArg(s32 i);
u64 FastCall2(u32 addr, u32 rtoc);
void FastStop();

View file

@ -103,6 +103,17 @@ void SPUThread::InitRegs()
R_ADDR = 0;
}
void SPUThread::InitStack()
{
m_stack_size = 0x1000; // this value is wrong
m_stack_addr = m_offset + 0x40000 - m_stack_size; // stack is the part of SPU Local Storage
}
void SPUThread::CloseStack()
{
// nothing to do here
}
void SPUThread::DoRun()
{
switch(Ini.SPUDecoderMode.GetValue())

View file

@ -568,6 +568,8 @@ public:
public:
virtual void InitRegs();
virtual void InitStack();
virtual void CloseStack();
virtual void Task();
void FastCall(u32 ls_addr);
void FastStop();