psl1ght
A free SDK for Sony's PS3 console
process.h
Go to the documentation of this file.
1 
5 #ifndef __PROCESS_H__
6 #define __PROCESS_H__
7 
8 #include <ppu-lv2.h>
9 #include <ppu-types.h>
10 #include <lv2/process.h>
11 #include <lv2/syscalls.h>
12 
13 
14 #define SYS_PROCESS_SPAWN_MAGIC 0x13bcc5f6
15 
16 #define SYS_PROCESS_SPAWN_VERSION_1 0x00000001
17 #define SYS_PROCESS_SPAWN_VERSION_084 0x00008400
18 #define SYS_PROCESS_SPAWN_VERSION_090 0x00009000
19 #define SYS_PROCESS_SPAWN_VERSION_330 0x00330000
20 #define SYS_PROCESS_SPAWN_VERSION_INVALID 0xffffffff
21 
22 #define SYS_PROCESS_SPAWN_MALLOC_PAGE_SIZE_NONE 0x00000000
23 #define SYS_PROCESS_SPAWN_MALLOC_PAGE_SIZE_64K 0x00010000
24 #define SYS_PROCESS_SPAWN_MALLOC_PAGE_SIZE_1M 0x00100000
25 
26 #define SYS_PROCESS_SPAWN_FW_VERSION_192 0x00192001
27 #define SYS_PROCESS_SPAWN_FW_VERSION_330 0x00330000
28 #define SYS_PROCESS_SPAWN_FW_VERSION_UNKNOWN 0xffffffff
29 
30 #define SYS_PROCESS_SPAWN_PPC_SEG_DEFAULT 0x00000000
31 #define SYS_PROCESS_SPAWN_PPC_SEG_OVLM 0x00000001
32 #define SYS_PROCESS_SPAWN_PPC_SEG_PRX 0x00000002
33 
35 #define SYS_PROCESS_SPAWN_STACK_SIZE_32K 0x10
36 
37 #define SYS_PROCESS_SPAWN_STACK_SIZE_64K 0x20
38 
39 #define SYS_PROCESS_SPAWN_STACK_SIZE_96K 0x30
40 
41 #define SYS_PROCESS_SPAWN_STACK_SIZE_128K 0x40
42 
43 #define SYS_PROCESS_SPAWN_STACK_SIZE_256K 0x50
44 
45 #define SYS_PROCESS_SPAWN_STACK_SIZE_512K 0x60
46 
47 #define SYS_PROCESS_SPAWN_STACK_SIZE_1M 0x70
48 
49 /* initial stack size
50  * \param size
51  * \param magic
52  * \param version
53  * \param sdk_version
54  * \param priority
55  * \param stack size
56  * \param malloc pagesize
57  * \param ppc segment
58  * \param crash dump param addr
59  */
66 #define SYS_PROCESS_PARAM(prio,stacksize) \
67  sys_process_param_t __sys_process_param __attribute__((aligned(8), section(".sys_proc_param"), unused)) = { \
68  sizeof(sys_process_param_t), \
69  SYS_PROCESS_SPAWN_MAGIC, \
70  SYS_PROCESS_SPAWN_VERSION_090, \
71  SYS_PROCESS_SPAWN_FW_VERSION_192, \
72  prio, \
73  stacksize, \
74  SYS_PROCESS_SPAWN_MALLOC_PAGE_SIZE_1M, \
75  SYS_PROCESS_SPAWN_PPC_SEG_DEFAULT\
76  };
77 
78 #define SYS_PROCESS_PARAM_OVLM(prio,stacksize) \
79  sys_process_param_t __sys_process_param __attribute__((aligned(8), section(".sys_proc_param"), unused)) = { \
80  sizeof(sys_process_param_t), \
81  SYS_PROCESS_SPAWN_MAGIC, \
82  SYS_PROCESS_SPAWN_VERSION_090, \
83  SYS_PROCESS_SPAWN_FW_VERSION_192, \
84  prio, \
85  stacksize, \
86  SYS_PROCESS_SPAWN_MALLOC_PAGE_SIZE_1M, \
87  SYS_PROCESS_SPAWN_PPC_SEG_OVLM \
88  };
89 
90 #define SYS_PROCESS_PARAM_FIXED(prio,stacksize) \
91  sys_process_param_t __sys_process_param __attribute__((aligned(8), section(".sys_proc_param"), unused)) = { \
92  sizeof(sys_process_param_t), \
93  SYS_PROCESS_SPAWN_MAGIC, \
94  SYS_PROCESS_SPAWN_VERSION_090, \
95  SYS_PROCESS_SPAWN_FW_VERSION_192, \
96  prio, \
97  stacksize, \
98  SYS_PROCESS_SPAWN_MALLOC_PAGE_SIZE_1M, \
99  SYS_PROCESS_SPAWN_PPC_SEG_PRX \
100  };
101 
102 /* process objects */
103 #define SYS_OBJECT_MEM (0x08UL)
104 #define SYS_OBJECT_MUTEX (0x85UL)
105 #define SYS_OBJECT_COND (0x86UL)
106 #define SYS_OBJECT_RWLOCK (0x88UL)
107 #define SYS_OBJECT_INTR_TAG (0x0AUL)
108 #define SYS_OBJECT_INTR_SERVICE_HANDLE (0x0BUL)
109 #define SYS_OBJECT_EVENT_QUEUE (0x8DUL)
110 #define SYS_OBJECT_EVENT_PORT (0x0EUL)
111 #define SYS_OBJECT_TRACE (0x21UL)
112 #define SYS_OBJECT_SPUIMAGE (0x22UL)
113 #define SYS_OBJECT_PRX (0x23UL)
114 #define SYS_OBJECT_SPUPORT (0x24UL)
115 #define SYS_OBJECT_LWMUTEX (0x95UL)
116 #define SYS_OBJECT_TIMER (0x11UL)
117 #define SYS_OBJECT_SEMAPHORE (0x96UL)
118 #define SYS_OBJECT_FS_FD (0x73UL)
119 #define SYS_OBJECT_LWCOND (0x97UL)
120 #define SYS_OBJECT_EVENT_FLAG (0x98UL)
121 
122 
123 #ifdef __cplusplus
124 extern "C" {
125 #endif
126 
127 
128 typedef struct _sys_process_param
129 {
130  u32 size;
131  u32 magic;
132  u32 version;
133  u32 sdk_version;
134  s32 prio;
135  u32 stacksize;
136  u32 malloc_pagesize;
137  u32 ppc_seg;
139 
140 
147 /*
148 s32 sysProcessGetId(u32 object, u32 *buf, size_t size, size_t *set_size)
149 {
150  lv2syscall4 (SYSCALL_PROCESS_GET_ID, object, (u32)(u64)buf, size, (u32)(u64)set_size);
151  return_to_user_prog(s32);
152 }
153 */
154 
157 LV2_SYSCALL sysProcessGetPid(void)
158 {
159  lv2syscall0 (SYSCALL_PROCESS_GETPID);
160  return_to_user_prog(sys_pid_t);
161 }
162 
166 LV2_SYSCALL sysProcessGetPpid(void)
167 {
168  lv2syscall0 (SYSCALL_PROCESS_GETPPID);
169  return_to_user_prog(sys_pid_t);
170 }
171 
176 LV2_SYSCALL sysProcessGetNumberOfObject(u32 object, size_t *numptr)
177 {
178  lv2syscall2 (SYSCALL_PROCESS_GET_NUMBER_OF_OBJECT, object, (u32)(u64)numptr);
179  return_to_user_prog(s32);
180 }
181 
186 LV2_SYSCALL sysProcessIsSpuLockLinkReservation(u32 addr, u64 flags)
187 {
188  lv2syscall2 (SYSCALL_PROCESS_IS_SPU_LOCK_LINE_RESERVATION_ADDRESS, (u32)addr, flags);
189  return_to_user_prog(s32);
190 }
191 
194 LV2_SYSCALL sysProcessGetPpuGuid(void)
195 {
196  lv2syscall0 (SYSCALL_PROCESS_GET_PPU_GUID);
197  return_to_user_prog(sys_addr_t);
198 }
199 
200 
201 #ifdef __cplusplus
202  }
203 #endif
204 
205 #endif
LV2_SYSCALL sysProcessGetPpid(void)
get parent process id
Definition: process.h:166
LV2_SYSCALL sysProcessGetPpuGuid(void)
get ppu guid info from ELF
Definition: process.h:194
Definition: process.h:128
Process management.
LV2_SYSCALL sysProcessIsSpuLockLinkReservation(u32 addr, u64 flags)
check if SPU can wait for lock line reservation lost event
Definition: process.h:186
LV2_SYSCALL sysProcessGetNumberOfObject(u32 object, size_t *numptr)
get number of object
Definition: process.h:176
LV2_SYSCALL sysProcessGetPid(void)
get process id
Definition: process.h:157