Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/core/libraries/kernel/threads/tcb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,16 +68,17 @@ void TcbDtor(Core::Tcb* oldtls) {
ASSERT_MSG(num_dtvs <= max_tls_index, "Out of bounds DTV access");

const u32 static_tls_size = linker->StaticTlsSize();
const u8* tls_base = (const u8*)oldtls - static_tls_size;
u8* tls_base = (u8*)oldtls - static_tls_size;

for (int i = 1; i < num_dtvs; i++) {
u8* dtv_ptr = dtv_table[i + 1].pointer;
if (dtv_ptr && (dtv_ptr < tls_base || (const u8*)oldtls < dtv_ptr)) {
linker->FreeTlsForNonPrimaryThread(dtv_ptr);
}
}

delete[] dtv_table;

linker->FreeTlsForNonPrimaryThread(tls_base);
}

struct TlsIndex {
Expand Down