SPU: Make spu_thread::offset private

This commit is contained in:
Eladash 2020-07-17 11:18:04 +03:00 committed by Ivan
parent 6cc0fe4221
commit c37bc3c55c
14 changed files with 151 additions and 132 deletions

View file

@ -533,6 +533,13 @@ public:
}
};
enum class spu_type : u32
{
threaded,
raw,
isolated,
};
class spu_thread : public cpu_thread
{
public:
@ -630,7 +637,6 @@ public:
u32 npc; // SPU Next Program Counter register
};
const bool is_isolated;
atomic_t<status_npc_sync_var> status_npc;
std::array<spu_int_ctrl_t, 3> int_ctrl; // SPU Class 0, 1, 2 Interrupt Management
@ -640,9 +646,10 @@ public:
atomic_t<u32> last_exit_status; // Value to be written in exit_status after checking group termination
const u32 index; // SPU index
const u32 offset; // SPU LS offset
const std::add_pointer_t<u8> ls; // SPU LS pointer
const spu_type thread_type;
private:
const u32 offset; // SPU LS offset
lv2_spu_group* const group; // SPU Thread Group (only safe to access in the spu thread itself)
public:
const u32 lv2_id; // The actual id that is used by syscalls
@ -686,18 +693,23 @@ public:
// Convert specified SPU LS address to a pointer of specified (possibly converted to BE) type
template<typename T>
inline to_be_t<T>* _ptr(u32 lsa)
to_be_t<T>* _ptr(u32 lsa) const
{
return reinterpret_cast<to_be_t<T>*>(ls + lsa);
}
// Convert specified SPU LS address to a reference of specified (possibly converted to BE) type
template<typename T>
inline to_be_t<T>& _ref(u32 lsa)
to_be_t<T>& _ref(u32 lsa) const
{
return *_ptr<T>(lsa);
}
spu_type get_type() const
{
return thread_type;
}
bool read_reg(const u32 addr, u32& value);
bool write_reg(const u32 addr, const u32 value);