mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-10 08:51:28 +12:00
Syscall analysis implemented
This commit is contained in:
parent
63e690ca11
commit
9db7de29fb
16 changed files with 234 additions and 155 deletions
|
@ -126,13 +126,11 @@ extern thread_local std::string(*g_tls_log_prefix)();
|
|||
|
||||
void ARMv7Thread::cpu_task()
|
||||
{
|
||||
if (custom_task)
|
||||
{
|
||||
if (check_status()) return;
|
||||
|
||||
return custom_task(*this);
|
||||
}
|
||||
return custom_task ? custom_task(*this) : fast_call(PC);
|
||||
}
|
||||
|
||||
void ARMv7Thread::cpu_task_main()
|
||||
{
|
||||
g_tls_log_prefix = []
|
||||
{
|
||||
const auto cpu = static_cast<ARMv7Thread*>(get_current_cpu_thread());
|
||||
|
@ -191,34 +189,49 @@ ARMv7Thread::ARMv7Thread(const std::string& name)
|
|||
|
||||
void ARMv7Thread::fast_call(u32 addr)
|
||||
{
|
||||
auto old_PC = PC;
|
||||
auto old_stack = SP;
|
||||
auto old_LR = LR;
|
||||
auto old_task = std::move(custom_task);
|
||||
const auto old_PC = PC;
|
||||
const auto old_SP = SP;
|
||||
const auto old_LR = LR;
|
||||
const auto old_task = std::move(custom_task);
|
||||
const auto old_func = last_function;
|
||||
|
||||
PC = addr;
|
||||
LR = Emu.GetCPUThreadStop();
|
||||
custom_task = nullptr;
|
||||
last_function = nullptr;
|
||||
|
||||
try
|
||||
{
|
||||
cpu_task();
|
||||
cpu_task_main();
|
||||
|
||||
if (SP != old_SP && !state.test(cpu_state::ret) && !state.test(cpu_state::exit)) // SP shouldn't change
|
||||
{
|
||||
throw fmt::exception("Stack inconsistency (addr=0x%x, SP=0x%x, old=0x%x)", addr, SP, old_SP);
|
||||
}
|
||||
}
|
||||
catch (cpu_state _s)
|
||||
{
|
||||
state += _s;
|
||||
if (_s != cpu_state::ret) throw;
|
||||
}
|
||||
catch (EmulationStopped)
|
||||
{
|
||||
if (last_function) LOG_WARNING(ARMv7, "'%s' aborted", last_function);
|
||||
last_function = old_func;
|
||||
throw;
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
if (last_function) LOG_ERROR(ARMv7, "'%s' aborted", last_function);
|
||||
last_function = old_func;
|
||||
throw;
|
||||
}
|
||||
|
||||
state -= cpu_state::ret;
|
||||
|
||||
PC = old_PC;
|
||||
|
||||
if (SP != old_stack) // SP shouldn't change
|
||||
{
|
||||
throw EXCEPTION("Stack inconsistency (addr=0x%x, SP=0x%x, old=0x%x)", addr, SP, old_stack);
|
||||
}
|
||||
|
||||
SP = old_SP;
|
||||
LR = old_LR;
|
||||
custom_task = std::move(old_task);
|
||||
last_function = old_func;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue