| 167 | } |
| 168 | |
| 169 | void sys_ppu_thread_exit(ppu_thread& ppu, u64 val) |
| 170 | { |
| 171 | sysPrxForUser.trace("sys_ppu_thread_exit(val=0x%llx)", val); |
| 172 | |
| 173 | // Call registered atexit functions |
| 174 | ensure(!sys_lwmutex_lock(ppu, g_ppu_atexit_lwm, 0)); |
| 175 | |
| 176 | for (auto ptr : *g_ppu_atexit) |
| 177 | { |
| 178 | if (ptr) |
| 179 | { |
| 180 | ptr(ppu); |
| 181 | } |
| 182 | } |
| 183 | |
| 184 | ensure(!sys_lwmutex_unlock(ppu, g_ppu_atexit_lwm)); |
| 185 | |
| 186 | // Deallocate TLS |
| 187 | ppu_free_tls(vm::cast(ppu.gpr[13]) - 0x7030); |
| 188 | |
| 189 | // Call the syscall |
| 190 | _sys_ppu_thread_exit(ppu, val); |
| 191 | } |
| 192 | |
| 193 | error_code sys_ppu_thread_register_atexit(ppu_thread& ppu, vm::ptr<void()> func) |
| 194 | { |
no test coverage detected