Fix TLS copying (size may still be wrong though)
This commit is contained in:
parent
7abed0a033
commit
4f807a669c
|
@ -176,7 +176,9 @@ X_STATUS XThread::Create() {
|
||||||
uint32_t tls_size = 32; // Default 32 (is this OK?)
|
uint32_t tls_size = 32; // Default 32 (is this OK?)
|
||||||
if (module && module->xex_header()) {
|
if (module && module->xex_header()) {
|
||||||
const xe_xex2_header_t* header = module->xex_header();
|
const xe_xex2_header_t* header = module->xex_header();
|
||||||
tls_size = header->tls_info.slot_count * header->tls_info.data_size;
|
|
||||||
|
// FIXME: Is this correct?
|
||||||
|
tls_size = header->tls_info.data_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
tls_address_ = memory()->SystemHeapAlloc(tls_size);
|
tls_address_ = memory()->SystemHeapAlloc(tls_size);
|
||||||
|
@ -190,8 +192,7 @@ X_STATUS XThread::Create() {
|
||||||
const xe_xex2_header_t* header = module->xex_header();
|
const xe_xex2_header_t* header = module->xex_header();
|
||||||
|
|
||||||
// Copy in default TLS info.
|
// Copy in default TLS info.
|
||||||
// TODO(benvanik): is this correct?
|
memory()->Copy(tls_address_, header->tls_info.raw_data_address, header->tls_info.data_size);
|
||||||
memory()->Copy(tls_address_, header->tls_info.raw_data_address, tls_size);
|
|
||||||
} else {
|
} else {
|
||||||
memory()->Fill(tls_address_, tls_size, 0);
|
memory()->Fill(tls_address_, tls_size, 0);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue