Don't allocate memory for TLS slots, and copy the default TLS data at the start, rather than offset by the TLS slot size, which seems to be more correct.
This commit is contained in:
parent
edaebbf00f
commit
95afbe2d93
|
@ -191,7 +191,10 @@ X_STATUS XThread::Create() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Allocate both the slots and the extended data.
|
// Allocate both the slots and the extended data.
|
||||||
uint32_t tls_slot_size = tls_slots * 4;
|
// HACK: we're currently not using the extra memory allocated for TLS slots
|
||||||
|
// and instead relying on native TLS slots, so don't allocate anything for
|
||||||
|
// the slots.
|
||||||
|
uint32_t tls_slot_size = 0; // tls_slots * 4;
|
||||||
uint32_t tls_total_size = tls_slot_size + tls_extended_size;
|
uint32_t tls_total_size = tls_slot_size + tls_extended_size;
|
||||||
tls_address_ = memory()->SystemHeapAlloc(tls_total_size);
|
tls_address_ = memory()->SystemHeapAlloc(tls_total_size);
|
||||||
if (!tls_address_) {
|
if (!tls_address_) {
|
||||||
|
@ -205,8 +208,7 @@ X_STATUS XThread::Create() {
|
||||||
// If game has extended data, copy in the default values.
|
// If game has extended data, copy in the default values.
|
||||||
const xe_xex2_header_t* header = module->xex_header();
|
const xe_xex2_header_t* header = module->xex_header();
|
||||||
assert_not_zero(header->tls_info.raw_data_address);
|
assert_not_zero(header->tls_info.raw_data_address);
|
||||||
// TODO(benvanik): verify location relative to slots.
|
memory()->Copy(tls_address_,
|
||||||
memory()->Copy(tls_address_ + tls_slot_size,
|
|
||||||
header->tls_info.raw_data_address,
|
header->tls_info.raw_data_address,
|
||||||
header->tls_info.raw_data_size);
|
header->tls_info.raw_data_size);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue