mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-13 18:28:35 +12:00
Allow cpu_thread& arg passed to the syscalls
Minor cleanup. cpu_mem(), cpu_unmem() removed.
This commit is contained in:
parent
f03d4cf8fd
commit
150e18539c
9 changed files with 22 additions and 42 deletions
|
@ -92,7 +92,7 @@ public:
|
||||||
std::string get_name() const;
|
std::string get_name() const;
|
||||||
|
|
||||||
// Get CPU state dump (everything)
|
// Get CPU state dump (everything)
|
||||||
virtual std::string dump_all() const = 0;
|
virtual std::string dump_all() const;
|
||||||
|
|
||||||
// Get CPU register dump
|
// Get CPU register dump
|
||||||
virtual std::string dump_regs() const;
|
virtual std::string dump_regs() const;
|
||||||
|
@ -112,12 +112,6 @@ public:
|
||||||
// Callback for cpu_flag::suspend
|
// Callback for cpu_flag::suspend
|
||||||
virtual void cpu_sleep() {}
|
virtual void cpu_sleep() {}
|
||||||
|
|
||||||
// Callback for cpu_flag::memory
|
|
||||||
virtual void cpu_mem() {}
|
|
||||||
|
|
||||||
// Callback for vm::temporary_unlock
|
|
||||||
virtual void cpu_unmem() {}
|
|
||||||
|
|
||||||
// Callback for cpu_flag::ret
|
// Callback for cpu_flag::ret
|
||||||
virtual void cpu_return() {}
|
virtual void cpu_return() {}
|
||||||
|
|
||||||
|
|
|
@ -86,9 +86,9 @@ namespace ppu_func_detail
|
||||||
template<typename T, u32 g_count, u32 f_count, u32 v_count>
|
template<typename T, u32 g_count, u32 f_count, u32 v_count>
|
||||||
struct bind_arg<T, ARG_CONTEXT, g_count, f_count, v_count>
|
struct bind_arg<T, ARG_CONTEXT, g_count, f_count, v_count>
|
||||||
{
|
{
|
||||||
static_assert(std::is_same<std::decay_t<T>, ppu_thread>::value, "Invalid function argument type for ARG_CONTEXT");
|
static_assert(std::is_base_of<std::decay_t<T>, ppu_thread>::value, "Invalid function argument type for ARG_CONTEXT");
|
||||||
|
|
||||||
static FORCE_INLINE ppu_thread& get_arg(ppu_thread& ppu)
|
static FORCE_INLINE T& get_arg(ppu_thread& ppu)
|
||||||
{
|
{
|
||||||
return ppu;
|
return ppu;
|
||||||
}
|
}
|
||||||
|
@ -184,7 +184,7 @@ namespace ppu_func_detail
|
||||||
// TODO: check calculations
|
// TODO: check calculations
|
||||||
const bool is_float = std::is_floating_point<T>::value;
|
const bool is_float = std::is_floating_point<T>::value;
|
||||||
const bool is_vector = std::is_same<std::decay_t<T>, v128>::value;
|
const bool is_vector = std::is_same<std::decay_t<T>, v128>::value;
|
||||||
const bool is_context = std::is_same<std::decay_t<T>, ppu_thread>::value;
|
const bool is_context = std::is_base_of<std::decay_t<T>, ppu_thread>::value;
|
||||||
const bool is_variadic = std::is_same<std::decay_t<T>, ppu_va_args_t>::value;
|
const bool is_variadic = std::is_same<std::decay_t<T>, ppu_va_args_t>::value;
|
||||||
const bool is_general = !is_float && !is_vector && !is_context && !is_variadic;
|
const bool is_general = !is_float && !is_vector && !is_context && !is_variadic;
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
#include "Crypto/sha1.h"
|
#include "Crypto/sha1.h"
|
||||||
#include "Emu/perf_meter.hpp"
|
#include "Emu/perf_meter.hpp"
|
||||||
#include "Emu/Memory/vm_reservation.h"
|
#include "Emu/Memory/vm_reservation.h"
|
||||||
|
#include "Emu/Memory/vm_locking.h"
|
||||||
#include "Emu/RSX/RSXThread.h"
|
#include "Emu/RSX/RSXThread.h"
|
||||||
#include "Emu/VFS.h"
|
#include "Emu/VFS.h"
|
||||||
#include "PPUThread.h"
|
#include "PPUThread.h"
|
||||||
|
@ -748,21 +749,20 @@ void ppu_thread::cpu_task()
|
||||||
|
|
||||||
void ppu_thread::cpu_sleep()
|
void ppu_thread::cpu_sleep()
|
||||||
{
|
{
|
||||||
raddr = 0; // Clear reservation
|
// Clear reservation
|
||||||
vm::temporary_unlock(*this);
|
raddr = 0;
|
||||||
|
|
||||||
|
// Setup wait flag and memory flags to relock itself
|
||||||
|
state += cpu_flag::wait + cpu_flag::memory;
|
||||||
|
|
||||||
|
if (auto ptr = vm::g_tls_locked)
|
||||||
|
{
|
||||||
|
ptr->compare_and_swap(this, nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
lv2_obj::awake(this);
|
lv2_obj::awake(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ppu_thread::cpu_mem()
|
|
||||||
{
|
|
||||||
vm::passive_lock(*this);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ppu_thread::cpu_unmem()
|
|
||||||
{
|
|
||||||
state.test_and_set(cpu_flag::memory);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ppu_thread::exec_task()
|
void ppu_thread::exec_task()
|
||||||
{
|
{
|
||||||
if (g_cfg.core.ppu_decoder == ppu_decoder_type::llvm)
|
if (g_cfg.core.ppu_decoder == ppu_decoder_type::llvm)
|
||||||
|
|
|
@ -74,8 +74,6 @@ public:
|
||||||
virtual std::string dump_misc() const override;
|
virtual std::string dump_misc() const override;
|
||||||
virtual void cpu_task() override final;
|
virtual void cpu_task() override final;
|
||||||
virtual void cpu_sleep() override;
|
virtual void cpu_sleep() override;
|
||||||
virtual void cpu_mem() override;
|
|
||||||
virtual void cpu_unmem() override;
|
|
||||||
virtual ~ppu_thread() override;
|
virtual ~ppu_thread() override;
|
||||||
|
|
||||||
ppu_thread(const ppu_thread_params&, std::string_view name, u32 prio, int detached = 0);
|
ppu_thread(const ppu_thread_params&, std::string_view name, u32 prio, int detached = 0);
|
||||||
|
|
|
@ -1453,16 +1453,6 @@ void spu_thread::cpu_task()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void spu_thread::cpu_mem()
|
|
||||||
{
|
|
||||||
//vm::passive_lock(*this);
|
|
||||||
}
|
|
||||||
|
|
||||||
void spu_thread::cpu_unmem()
|
|
||||||
{
|
|
||||||
//state.test_and_set(cpu_flag::memory);
|
|
||||||
}
|
|
||||||
|
|
||||||
spu_thread::~spu_thread()
|
spu_thread::~spu_thread()
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
|
@ -3537,7 +3527,7 @@ bool spu_thread::set_ch_value(u32 ch, u32 value)
|
||||||
std::lock_guard lock(group->mutex);
|
std::lock_guard lock(group->mutex);
|
||||||
|
|
||||||
// Use the syscall to set flag
|
// Use the syscall to set flag
|
||||||
const auto res = ch_in_mbox.get_count() ? CELL_EBUSY : 0u + sys_event_flag_set(data, 1ull << flag);
|
const auto res = ch_in_mbox.get_count() ? CELL_EBUSY : 0u + sys_event_flag_set(*this, data, 1ull << flag);
|
||||||
|
|
||||||
if (res == CELL_EBUSY)
|
if (res == CELL_EBUSY)
|
||||||
{
|
{
|
||||||
|
@ -3562,7 +3552,7 @@ bool spu_thread::set_ch_value(u32 ch, u32 value)
|
||||||
spu_log.trace("sys_event_flag_set_bit_impatient(id=%d, value=0x%x (flag=%d))", data, value, flag);
|
spu_log.trace("sys_event_flag_set_bit_impatient(id=%d, value=0x%x (flag=%d))", data, value, flag);
|
||||||
|
|
||||||
// Use the syscall to set flag
|
// Use the syscall to set flag
|
||||||
sys_event_flag_set(data, 1ull << flag);
|
sys_event_flag_set(*this, data, 1ull << flag);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -624,8 +624,6 @@ public:
|
||||||
virtual std::vector<std::pair<u32, u32>> dump_callstack_list() const override;
|
virtual std::vector<std::pair<u32, u32>> dump_callstack_list() const override;
|
||||||
virtual std::string dump_misc() const override;
|
virtual std::string dump_misc() const override;
|
||||||
virtual void cpu_task() override final;
|
virtual void cpu_task() override final;
|
||||||
virtual void cpu_mem() override;
|
|
||||||
virtual void cpu_unmem() override;
|
|
||||||
virtual void cpu_return() override;
|
virtual void cpu_return() override;
|
||||||
virtual ~spu_thread() override;
|
virtual ~spu_thread() override;
|
||||||
void cpu_init();
|
void cpu_init();
|
||||||
|
|
|
@ -244,9 +244,9 @@ error_code sys_event_flag_trywait(ppu_thread& ppu, u32 id, u64 bitptn, u32 mode,
|
||||||
return CELL_OK;
|
return CELL_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
error_code sys_event_flag_set(u32 id, u64 bitptn)
|
error_code sys_event_flag_set(cpu_thread& cpu, u32 id, u64 bitptn)
|
||||||
{
|
{
|
||||||
vm::temporary_unlock();
|
cpu.state += cpu_flag::wait;
|
||||||
|
|
||||||
// Warning: may be called from SPU thread.
|
// Warning: may be called from SPU thread.
|
||||||
sys_event_flag.trace("sys_event_flag_set(id=0x%x, bitptn=0x%llx)", id, bitptn);
|
sys_event_flag.trace("sys_event_flag_set(id=0x%x, bitptn=0x%llx)", id, bitptn);
|
||||||
|
|
|
@ -118,7 +118,7 @@ error_code sys_event_flag_create(ppu_thread& ppu, vm::ptr<u32> id, vm::ptr<sys_e
|
||||||
error_code sys_event_flag_destroy(ppu_thread& ppu, u32 id);
|
error_code sys_event_flag_destroy(ppu_thread& ppu, u32 id);
|
||||||
error_code sys_event_flag_wait(ppu_thread& ppu, u32 id, u64 bitptn, u32 mode, vm::ptr<u64> result, u64 timeout);
|
error_code sys_event_flag_wait(ppu_thread& ppu, u32 id, u64 bitptn, u32 mode, vm::ptr<u64> result, u64 timeout);
|
||||||
error_code sys_event_flag_trywait(ppu_thread& ppu, u32 id, u64 bitptn, u32 mode, vm::ptr<u64> result);
|
error_code sys_event_flag_trywait(ppu_thread& ppu, u32 id, u64 bitptn, u32 mode, vm::ptr<u64> result);
|
||||||
error_code sys_event_flag_set(u32 id, u64 bitptn);
|
error_code sys_event_flag_set(cpu_thread& cpu, u32 id, u64 bitptn);
|
||||||
error_code sys_event_flag_clear(ppu_thread& ppu, u32 id, u64 bitptn);
|
error_code sys_event_flag_clear(ppu_thread& ppu, u32 id, u64 bitptn);
|
||||||
error_code sys_event_flag_cancel(ppu_thread& ppu, u32 id, vm::ptr<u32> num);
|
error_code sys_event_flag_cancel(ppu_thread& ppu, u32 id, vm::ptr<u32> num);
|
||||||
error_code sys_event_flag_get(ppu_thread& ppu, u32 id, vm::ptr<u64> flags);
|
error_code sys_event_flag_get(ppu_thread& ppu, u32 id, vm::ptr<u64> flags);
|
||||||
|
|
|
@ -332,7 +332,7 @@ namespace vm
|
||||||
|
|
||||||
if (g_tls_locked && g_tls_locked->compare_and_swap_test(&cpu, nullptr))
|
if (g_tls_locked && g_tls_locked->compare_and_swap_test(&cpu, nullptr))
|
||||||
{
|
{
|
||||||
cpu.cpu_unmem();
|
cpu.state += cpu_flag::memory;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue