psl1ght
A free SDK for Sony's PS3 console
dbg.h
Go to the documentation of this file.
1 
5 #ifndef __SYS_DBG_H__
6 #define __SYS_DBG_H__
7 
8 #include <ppu-types.h>
9 #include <sys/thread.h>
10 #include <sys/event_queue.h>
11 
13 #define SYS_DBG_PPU_NUM_GPR 32
14 
15 #define SYS_DBG_PPU_NUM_FPR 32
16 
17 #define SYS_DBG_PPU_NUM_VR 32
18 
19 #define SYS_DBG_PPU_VR_WIDTH 16
20 
22 #define SYS_DBG_SPU_NUM_GPR 128
23 
24 #define SYS_DBG_SPU_NUM_MFC_CQ_SR 96
25 
26 #define SYS_DBG_SPU_GPR_WIDTH 16
27 
28 #define SYS_DBG_SPU_NUM_MB 4
29 
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33 
35 typedef enum
36 {
37  PPU_THREAD_STATUS_IDLE,
38  PPU_THREAD_STATUS_RUNNABLE,
39  PPU_THREAD_STATUS_ONPROC,
40  PPU_THREAD_STATUS_SLEEP,
41  PPU_THREAD_STATUS_STOP,
42  PPU_THREAD_STATUS_ZOMBIE,
43  PPU_THREAD_STATUS_DELETED,
44  PPU_THREAD_STATUS_UNKNOWN
46 
48 typedef enum
49 {
50  SPU_THREAD_GROUP_STATUS_NOTINITIALIZED,
51  SPU_THREAD_GROUP_STATUS_INITIALIZED,
52  SPU_THREAD_GROUP_STATUS_READY,
53  SPU_THREAD_GROUP_STATUS_WAITING,
54  SPU_THREAD_GROUP_STATUS_SUSPENDED,
55  SPU_THREAD_GROUP_STATUS_WAITING_AND_SUSPENDED,
56  SPU_THREAD_GROUP_STATUS_RUNNING,
57  SPU_THREAD_GROUP_STATUS_STOPPED,
58  SPU_THREAD_GROUP_STATUS_UNKNOWN,
60 
62 typedef union
63 {
67  u16 halfword[SYS_DBG_PPU_VR_WIDTH/sizeof(u16)];
69  u32 word[SYS_DBG_PPU_VR_WIDTH/sizeof(u32)];
71  u64 dword[SYS_DBG_PPU_VR_WIDTH/sizeof(u64)];
72 } sys_dbg_vr_t;
73 
75 typedef union
76 {
80  u16 halfword[SYS_DBG_SPU_GPR_WIDTH/sizeof(u16)];
82  u32 word[SYS_DBG_SPU_GPR_WIDTH/sizeof(u32)];
84  u64 dword[SYS_DBG_SPU_GPR_WIDTH/sizeof(u64)];
86 
89 {
91  u32 cr;
92  u32 xer;
93  u32 lr;
94  u32 ctr;
95  u32 pc;
97  u32 fpscr;
101 
104 {
106  u32 npc;
107  u32 fpscr;
108  u32 srr0;
110  u64 spu_cfg;
111  u32 mb_stat;
112  u32 ppu_mb;
117 
119 typedef void (*dbg_exception_handler_t)(u64 cause,sys_ppu_thread_t tid,u64 dar);
120 
125 s32 sysDbgSetStacksizePPUExceptionHandler(size_t stacksize);
126 
134 s32 sysDbgGetSPUThreadGroupIds(u32 *group_ids,u64 *num_ids,u64 *num_all_ids);
135 
143 s32 sysDbgGetPPUThreadIds(sys_ppu_thread_t *ids,u64 *num_ids,u64 *num_all_ids);
144 
154 s32 sysDbgGetSPUThreadIds(u32 group_id,u32 *thread_ids,u64 *num_ids,u64 *num_all_ids);
155 
162 //s32 sysDbgGetEventQueueInformation();
163 
169 s32 sysDbgGetPPUThreadName(sys_ppu_thread_t id,char *name);
170 
176 s32 sysDbgGetSPUThreadName(u32 thread_id,char *name);
177 //s32 sysDbgGetMutexInformation();
178 //s32 sysDbgGetCondInformation();
179 
185 s32 sysDbgGetPPUThreadStatus(sys_ppu_thread_t id,sys_dbg_ppu_thread_status_t *status);
186 //s32 sysDbgGetRWLockInformation();
187 
194 //s32 sysDbgGetSemaphoreInformation();
195 
201 s32 sysDbgGetSPUThreadGroupName(u32 group_id,char *name);
202 
207 
213 s32 sysDbgReadSPUThreadContext(u32 thread_id,sys_dbg_spu_thread_context_t *context);
214 
220 
226 s32 sysDbgReadPPUThreadContext(sys_ppu_thread_t id,sys_dbg_ppu_thread_context_t *context);
227 
232 //s32 sysDbgGetLwMutexInformation();
233 
234 #ifdef __cplusplus
235  }
236 #endif
237 
238 #endif
#define SYS_DBG_PPU_VR_WIDTH
size (in bytes) of a PPU VR register
Definition: dbg.h:19
u64 fpr[SYS_DBG_PPU_NUM_FPR]
FPR registers.
Definition: dbg.h:96
u32 pc
PC register.
Definition: dbg.h:95
s32 sysDbgReadSPUThreadContext(u32 thread_id, sys_dbg_spu_thread_context_t *context)
Read a SPU thread context.
s32 sysDbgGetSPUThreadGroupName(u32 group_id, char *name)
Get SPU thread group name.
s32 sysDbgGetGetSPUThreadGroupStatus(u32 group_id, sys_dbg_spu_thread_group_status_t *status)
Get SPU thread group status.
u32 mb_stat
MB status register.
Definition: dbg.h:111
s32 sysDbgGetPPUThreadIds(sys_ppu_thread_t *ids, u64 *num_ids, u64 *num_all_ids)
Get the list of PPU thread ids.
#define SYS_DBG_PPU_NUM_GPR
number of PPU GPR registers
Definition: dbg.h:13
PPU thread context.
Definition: dbg.h:88
u32 spu_status
SPU status.
Definition: dbg.h:109
s32 sysDbgSetStacksizePPUExceptionHandler(size_t stacksize)
Set stack size of PPU thread exception handler.
u64 gpr[SYS_DBG_PPU_NUM_GPR]
GPR registers.
Definition: dbg.h:90
u32 cr
CR register.
Definition: dbg.h:91
struct _sys_dbg_ppu_thread_context sys_dbg_ppu_thread_context_t
PPU thread context.
s32 sysDbgRegisterPPUExceptionHandler(dbg_exception_handler_t handler, u64 flags)
Register a PPU exception handler.
s32 sysDbgGetSPUThreadGroupIds(u32 *group_ids, u64 *num_ids, u64 *num_all_ids)
Get the list of SPU thread group ids.
s32 sysDbgFinalizePPUExceptionHandler()
s32 sysDbgGetSPUThreadName(u32 thread_id, char *name)
Get SPU thread name.
#define SYS_DBG_SPU_NUM_MB
number of SPU inbound MB entries
Definition: dbg.h:28
u64 mfc_cq_sr[SYS_DBG_SPU_NUM_MFC_CQ_SR]
MFC CQ SR registers.
Definition: dbg.h:115
sys_dbg_spu_thread_group_status_t
Possible statuses for PPU thread groups.
Definition: dbg.h:48
PPU thread syscalls.
#define SYS_DBG_SPU_NUM_GPR
number of SPU GPR registers
Definition: dbg.h:22
Event queue management functions.
sys_dbg_ppu_thread_status_t
Possible statuses for PPU threads.
Definition: dbg.h:35
u32 ctr
CTR register.
Definition: dbg.h:94
u32 decrementer
Decrementer register.
Definition: dbg.h:114
u32 fpscr
FPSCR register.
Definition: dbg.h:97
u32 npc
NPC register.
Definition: dbg.h:106
s32 sysDbgGetSPUThreadIds(u32 group_id, u32 *thread_ids, u64 *num_ids, u64 *num_all_ids)
Get the list of SPU thread ids in a SPU thread group.
u32 srr0
SRR0 register.
Definition: dbg.h:108
void(* dbg_exception_handler_t)(u64 cause, sys_ppu_thread_t tid, u64 dar)
Function pointer to a PPU exception handler.
Definition: dbg.h:119
u64 spu_cfg
SPU config.
Definition: dbg.h:110
u32 ppu_mb
outbound MB register
Definition: dbg.h:112
SPU thread context.
Definition: dbg.h:103
struct _sys_dbg_spu_thread_context sys_dbg_spu_thread_context_t
SPU thread context.
sys_dbg_vr_t vscr
VSCR register.
Definition: dbg.h:99
u32 xer
XER register.
Definition: dbg.h:92
u32 spu_mb[SYS_DBG_SPU_NUM_MB]
inbound MB queue
Definition: dbg.h:113
s32 sysDbgUnregisterPPUExceptionHandler()
Unregister the PPU thread exception handler.
#define SYS_DBG_PPU_NUM_VR
number of PPU VR registers
Definition: dbg.h:17
#define SYS_DBG_SPU_NUM_MFC_CQ_SR
number of SPU MFC/CQ/SR registers
Definition: dbg.h:24
s32 sysDbgGetPPUThreadStatus(sys_ppu_thread_t id, sys_dbg_ppu_thread_status_t *status)
Get PPU thread status.
sys_dbg_vr_t vr[SYS_DBG_PPU_NUM_VR]
VR registers.
Definition: dbg.h:98
#define SYS_DBG_SPU_GPR_WIDTH
size (in bytes) of a SPU GPR register
Definition: dbg.h:26
sys_dbg_spu_gpr_t gpr[SYS_DBG_SPU_NUM_GPR]
GPR registers.
Definition: dbg.h:105
s32 sysDbgReadPPUThreadContext(sys_ppu_thread_t id, sys_dbg_ppu_thread_context_t *context)
Read a PPU thread context.
s32 sysDbgGetPPUThreadName(sys_ppu_thread_t id, char *name)
Get PPU thread name.
u32 lr
LR register.
Definition: dbg.h:93
s32 sysDbgInitializePPUExceptionHandler(s32 prio)
Initialization of the PPU thread exception handler.
contents of a SPU GPR register
Definition: dbg.h:75
#define SYS_DBG_PPU_NUM_FPR
number of PPU FPR registers
Definition: dbg.h:15
u32 fpscr
FPSCR register.
Definition: dbg.h:107
contents of a PPU VR register
Definition: dbg.h:62