| 123 | } |
| 124 | |
| 125 | error_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 | |
| 160 | error_code sys_ppu_thread_get_id(ppu_thread& ppu, vm::ptr<u64> thread_id) |
| 161 | { |
nothing calls this directly
no test coverage detected