MCPcopy Create free account
hub / github.com/RPCSX/rpcsx / sys_ppu_thread_create

Function sys_ppu_thread_create

ps3fw/sys_ppu_thread_.cpp:125–158  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

123}
124
125error_code sys_ppu_thread_create(ppu_thread& ppu, vm::ptr<u64> thread_id, u32 entry, u64 arg, s32 prio, u32 stacksize, u64 flags, vm::cptr<char> threadname)
126{
127 ppu.state += cpu_flag::wait;
128
129 sysPrxForUser.warning("sys_ppu_thread_create(thread_id=*0x%x, entry=0x%x, arg=0x%llx, prio=%d, stacksize=0x%x, flags=0x%llx, threadname=%s)",
130 thread_id, entry, arg, prio, stacksize, flags, threadname);
131
132 // Allocate TLS
133 const u32 tls_addr = ppu_alloc_tls();
134
135 if (!tls_addr)
136 {
137 return CELL_ENOMEM;
138 }
139
140 // Call the syscall
141 if (error_code res = _sys_ppu_thread_create(ppu, thread_id, vm::make_var(ppu_thread_param_t{vm::cast(entry), tls_addr + 0x7030}), arg, 0, prio, stacksize, flags, threadname))
142 {
143 return res;
144 }
145
146 if (flags & SYS_PPU_THREAD_CREATE_INTERRUPT)
147 {
148 return CELL_OK;
149 }
150
151 // Run the thread
152 if (error_code res = sys_ppu_thread_start(ppu, static_cast<u32>(*thread_id)))
153 {
154 return res;
155 }
156
157 return CELL_OK;
158}
159
160error_code sys_ppu_thread_get_id(ppu_thread& ppu, vm::ptr<u64> thread_id)
161{

Callers

nothing calls this directly

Calls 5

ppu_alloc_tlsFunction · 0.85
_sys_ppu_thread_createFunction · 0.85
make_varFunction · 0.85
sys_ppu_thread_startFunction · 0.85
castFunction · 0.50

Tested by

no test coverage detected