SPU: Implement SYS_SPU_THREAD_OPTION_DEC_SYNC_TB_ENABLE (#8657)

This commit is contained in:
Eladash 2020-07-30 16:01:25 +03:00 committed by GitHub
parent 03ae1481fb
commit e52dd9dc6f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 7 deletions

View File

@ -981,8 +981,8 @@ void spu_thread::cpu_init()
interrupts_enabled.raw() = false; interrupts_enabled.raw() = false;
raddr = 0; raddr = 0;
ch_dec_start_timestamp = get_timebased_time(); // ??? ch_dec_start_timestamp = get_timebased_time();
ch_dec_value = 0; ch_dec_value = option & SYS_SPU_THREAD_OPTION_DEC_SYNC_TB_ENABLE ? ~static_cast<u32>(ch_dec_start_timestamp) : 0;
if (get_type() >= spu_type::raw) if (get_type() >= spu_type::raw)
{ {
@ -1188,7 +1188,7 @@ spu_thread::~spu_thread()
} }
} }
spu_thread::spu_thread(vm::addr_t _ls, lv2_spu_group* group, u32 index, std::string_view name, u32 lv2_id, bool is_isolated) spu_thread::spu_thread(vm::addr_t _ls, lv2_spu_group* group, u32 index, std::string_view name, u32 lv2_id, bool is_isolated, u32 option)
: cpu_thread(idm::last_id()) : cpu_thread(idm::last_id())
, index(index) , index(index)
, ls([&]() , ls([&]()
@ -1209,6 +1209,7 @@ spu_thread::spu_thread(vm::addr_t _ls, lv2_spu_group* group, u32 index, std::str
, thread_type(group ? spu_type::threaded : is_isolated ? spu_type::isolated : spu_type::raw) , thread_type(group ? spu_type::threaded : is_isolated ? spu_type::isolated : spu_type::raw)
, offset(_ls) , offset(_ls)
, group(group) , group(group)
, option(option)
, lv2_id(lv2_id) , lv2_id(lv2_id)
, spu_tname(stx::shared_cptr<std::string>::make(name)) , spu_tname(stx::shared_cptr<std::string>::make(name))
{ {

View File

@ -629,7 +629,7 @@ public:
static const u32 id_step = 1; static const u32 id_step = 1;
static const u32 id_count = 2048; static const u32 id_count = 2048;
spu_thread(vm::addr_t ls, lv2_spu_group* group, u32 index, std::string_view name, u32 lv2_id, bool is_isolated = false); spu_thread(vm::addr_t ls, lv2_spu_group* group, u32 index, std::string_view name, u32 lv2_id, bool is_isolated = false, u32 option = 0);
u32 pc = 0; u32 pc = 0;
@ -722,6 +722,7 @@ private:
const u32 offset; // SPU LS offset const u32 offset; // SPU LS offset
lv2_spu_group* const group; // SPU Thread Group (only safe to access in the spu thread itself) lv2_spu_group* const group; // SPU Thread Group (only safe to access in the spu thread itself)
public: public:
const u32 option; // sys_spu_thread_initialize option
const u32 lv2_id; // The actual id that is used by syscalls const u32 lv2_id; // The actual id that is used by syscalls
// Thread name // Thread name

View File

@ -322,7 +322,9 @@ error_code sys_spu_thread_initialize(ppu_thread& ppu, vm::ptr<u32> thread, u32 g
sys_spu.warning("sys_spu_thread_initialize(thread=*0x%x, group=0x%x, spu_num=%d, img=*0x%x, attr=*0x%x, arg=*0x%x)", thread, group_id, spu_num, img, attr, arg); sys_spu.warning("sys_spu_thread_initialize(thread=*0x%x, group=0x%x, spu_num=%d, img=*0x%x, attr=*0x%x, arg=*0x%x)", thread, group_id, spu_num, img, attr, arg);
if (attr->name_len > 0x80 || attr->option & ~(SYS_SPU_THREAD_OPTION_DEC_SYNC_TB_ENABLE | SYS_SPU_THREAD_OPTION_ASYNC_INTR_ENABLE)) const u32 option = attr->option;
if (attr->name_len > 0x80 || option & ~(SYS_SPU_THREAD_OPTION_DEC_SYNC_TB_ENABLE | SYS_SPU_THREAD_OPTION_ASYNC_INTR_ENABLE))
{ {
return CELL_EINVAL; return CELL_EINVAL;
} }
@ -392,7 +394,7 @@ error_code sys_spu_thread_initialize(ppu_thread& ppu, vm::ptr<u32> thread, u32 g
return CELL_EBUSY; return CELL_EBUSY;
} }
if (u32 option = attr->option) if (option & SYS_SPU_THREAD_OPTION_ASYNC_INTR_ENABLE)
{ {
sys_spu.warning("Unimplemented SPU Thread options (0x%x)", option); sys_spu.warning("Unimplemented SPU Thread options (0x%x)", option);
} }
@ -412,7 +414,7 @@ error_code sys_spu_thread_initialize(ppu_thread& ppu, vm::ptr<u32> thread, u32 g
fmt::append(full_name, "%s ", thread_name); fmt::append(full_name, "%s ", thread_name);
} }
const auto spu = std::make_shared<named_thread<spu_thread>>(full_name, ls_addr, group.get(), spu_num, thread_name, tid); const auto spu = std::make_shared<named_thread<spu_thread>>(full_name, ls_addr, group.get(), spu_num, thread_name, tid, false, option);
group->threads[inited] = spu; group->threads[inited] = spu;
group->threads_map[spu_num] = static_cast<s8>(inited); group->threads_map[spu_num] = static_cast<s8>(inited);
return spu; return spu;