rpcsx/rpcs3/Emu/Cell/lv2/sys_ppu_thread.h

73 lines
2.2 KiB
C
Raw Normal View History

2020-12-05 13:08:24 +01:00
#pragma once
#include "Emu/Memory/vm_ptr.h"
2020-12-12 12:24:01 +01:00
#include "Emu/Cell/ErrorCodes.h"
class ppu_thread;
2014-09-19 13:27:51 +02:00
enum : s32
{
2014-09-19 21:11:43 +02:00
SYS_PPU_THREAD_ONCE_INIT = 0,
SYS_PPU_THREAD_DONE_INIT = 1,
};
2015-03-09 20:56:55 +01:00
// PPU Thread Flags
enum : u64
{
SYS_PPU_THREAD_CREATE_JOINABLE = 0x1,
SYS_PPU_THREAD_CREATE_INTERRUPT = 0x2,
};
2015-04-12 03:36:25 +02:00
struct sys_ppu_thread_stack_t
{
2015-04-12 22:16:30 +02:00
be_t<u32> pst_addr;
be_t<u32> pst_size;
2015-04-12 03:36:25 +02:00
};
struct ppu_thread_param_t
{
vm::bptr<void(u64)> entry;
2018-02-09 15:49:37 +01:00
be_t<u32> tls; // vm::bptr<void>
2015-04-12 03:36:25 +02:00
};
struct sys_ppu_thread_icontext_t
{
be_t<u64> gpr[32];
be_t<u32> cr;
be_t<u32> rsv1;
be_t<u64> xer;
be_t<u64> lr;
be_t<u64> ctr;
be_t<u64> pc;
};
2015-07-09 17:30:37 +02:00
enum : u32
{
PPU_THREAD_STATUS_IDLE,
PPU_THREAD_STATUS_RUNNABLE,
PPU_THREAD_STATUS_ONPROC,
PPU_THREAD_STATUS_SLEEP,
PPU_THREAD_STATUS_STOP,
PPU_THREAD_STATUS_ZOMBIE,
PPU_THREAD_STATUS_DELETED,
PPU_THREAD_STATUS_UNKNOWN,
};
// Syscalls
void _sys_ppu_thread_exit(ppu_thread& ppu, u64 errorcode);
s32 sys_ppu_thread_yield(ppu_thread& ppu); // Return value is ignored by the library
2018-02-09 15:49:37 +01:00
error_code sys_ppu_thread_join(ppu_thread& ppu, u32 thread_id, vm::ptr<u64> vptr);
2020-10-30 16:24:11 +01:00
error_code sys_ppu_thread_detach(ppu_thread& ppu, u32 thread_id);
error_code sys_ppu_thread_get_join_state(ppu_thread& ppu, vm::ptr<s32> isjoinable); // Error code is ignored by the library
2017-02-06 19:36:46 +01:00
error_code sys_ppu_thread_set_priority(ppu_thread& ppu, u32 thread_id, s32 prio);
2020-10-30 16:24:11 +01:00
error_code sys_ppu_thread_get_priority(ppu_thread& ppu, u32 thread_id, vm::ptr<s32> priop);
2018-02-09 15:49:37 +01:00
error_code sys_ppu_thread_get_stack_information(ppu_thread& ppu, vm::ptr<sys_ppu_thread_stack_t> sp);
2020-10-30 16:24:11 +01:00
error_code sys_ppu_thread_stop(ppu_thread& ppu, u32 thread_id);
error_code sys_ppu_thread_restart(ppu_thread& ppu);
error_code _sys_ppu_thread_create(ppu_thread& ppu, vm::ptr<u64> thread_id, vm::ptr<ppu_thread_param_t> param, u64 arg, u64 arg4, s32 prio, u32 stacksize, u64 flags, vm::cptr<char> threadname);
2017-02-06 19:36:46 +01:00
error_code sys_ppu_thread_start(ppu_thread& ppu, u32 thread_id);
2020-10-30 16:24:11 +01:00
error_code sys_ppu_thread_rename(ppu_thread& ppu, u32 thread_id, vm::cptr<char> name);
error_code sys_ppu_thread_recover_page_fault(ppu_thread& ppu, u32 thread_id);
error_code sys_ppu_thread_get_page_fault_context(ppu_thread& ppu, u32 thread_id, vm::ptr<sys_ppu_thread_icontext_t> ctxt);