Skip to content

Commit

Permalink
[Kernel/Thread] Set TLS slot to 0 while freeing
Browse files Browse the repository at this point in the history
  • Loading branch information
Gliniak authored and gibbed committed Jan 28, 2023
1 parent e55cb73 commit 4e87d1f
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/xenia/kernel/kernel_state.cc
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,17 @@ void KernelState::set_process_type(uint32_t value) {

uint32_t KernelState::AllocateTLS() { return uint32_t(tls_bitmap_.Acquire()); }

void KernelState::FreeTLS(uint32_t slot) { tls_bitmap_.Release(slot); }
void KernelState::FreeTLS(uint32_t slot) {
const std::vector<object_ref<XThread>> threads =
object_table()->GetObjectsByType<XThread>();

for (const object_ref<XThread>& thread : threads) {
if (thread->is_guest_thread()) {
thread->SetTLSValue(slot, 0);
}
}
tls_bitmap_.Release(slot);
}

void KernelState::RegisterTitleTerminateNotification(uint32_t routine,
uint32_t priority) {
Expand Down

0 comments on commit 4e87d1f

Please sign in to comment.