Zero memory on alloc.

This commit is contained in:
Ben Vanik
2013-10-22 21:50:10 -07:00
parent d065ee43e8
commit d9a55a5557
6 changed files with 33 additions and 19 deletions

View File

@@ -133,7 +133,8 @@ X_STATUS XThread::Create() {
// 0x160: last error
// So, at offset 0x100 we have a 4b pointer to offset 200, then have the
// structure.
thread_state_address_ = xe_memory_heap_alloc(memory(), 0, 2048, 0);
thread_state_address_ = xe_memory_heap_alloc(
memory(), 0, 2048, XE_MEMORY_FLAG_ZERO);
if (!thread_state_address_) {
XELOGW("Unable to allocate thread state block");
return X_STATUS_NO_MEMORY;
@@ -147,7 +148,8 @@ X_STATUS XThread::Create() {
// Allocate TLS block.
const xe_xex2_header_t* header = module->xex_header();
uint32_t tls_size = header->tls_info.slot_count * header->tls_info.data_size;
tls_address_ = xe_memory_heap_alloc(memory(), 0, tls_size, 0);
tls_address_ = xe_memory_heap_alloc(
memory(), 0, tls_size, XE_MEMORY_FLAG_ZERO);
if (!tls_address_) {
XELOGW("Unable to allocate thread local storage block");
module->Release();