From 662fa97444039f07140c4d86aa4be4cf2f4b2d01 Mon Sep 17 00:00:00 2001 From: "Dr. Chat" Date: Sat, 16 May 2015 18:47:33 -0500 Subject: [PATCH] XObject SetNativePointer: Added flag to disable asserts on uninitialized memory --- src/xenia/kernel/objects/xthread.cc | 2 +- src/xenia/kernel/xobject.cc | 7 +++++-- src/xenia/kernel/xobject.h | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/xenia/kernel/objects/xthread.cc b/src/xenia/kernel/objects/xthread.cc index 11e6e7032..f39518956 100644 --- a/src/xenia/kernel/objects/xthread.cc +++ b/src/xenia/kernel/objects/xthread.cc @@ -146,7 +146,7 @@ X_STATUS XThread::Create() { } // Set native info. - SetNativePointer(thread_state_address_); + SetNativePointer(thread_state_address_, true); XUserModule* module = kernel_state()->GetExecutableModule(); diff --git a/src/xenia/kernel/xobject.cc b/src/xenia/kernel/xobject.cc index 689026d8e..79c155a84 100644 --- a/src/xenia/kernel/xobject.cc +++ b/src/xenia/kernel/xobject.cc @@ -152,13 +152,16 @@ X_STATUS XObject::WaitMultiple(uint32_t count, XObject** objects, return result; } -void XObject::SetNativePointer(uint32_t native_ptr) { +void XObject::SetNativePointer(uint32_t native_ptr, bool uninitialized) { std::lock_guard lock(kernel_state_->object_mutex()); auto header = kernel_state_->memory()->TranslateVirtual(native_ptr); - assert_true(!(header->wait_list_blink & 0x1)); + // Memory uninitialized, so don't bother with the check. + if (!uninitialized) { + assert_true(!(header->wait_list_blink & 0x1)); + } // Stash pointer in struct. uint64_t object_ptr = reinterpret_cast(this); diff --git a/src/xenia/kernel/xobject.h b/src/xenia/kernel/xobject.h index 762acc398..dcfb1f43a 100644 --- a/src/xenia/kernel/xobject.h +++ b/src/xenia/kernel/xobject.h @@ -78,7 +78,7 @@ class XObject { virtual void* GetWaitHandle() { return 0; } protected: - void SetNativePointer(uint32_t native_ptr); + void SetNativePointer(uint32_t native_ptr, bool uninitialized = false); static uint32_t TimeoutTicksToMs(int64_t timeout_ticks);