From 3e7870fb39c3a064ce4c0869a4dae87c888952f4 Mon Sep 17 00:00:00 2001 From: "Dr. Chat" Date: Fri, 12 Jun 2015 22:46:19 -0500 Subject: [PATCH] Make SetNativePointer setup the guest pointer --- src/xenia/kernel/xobject.cc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/xenia/kernel/xobject.cc b/src/xenia/kernel/xobject.cc index 077a3e112..29639316f 100644 --- a/src/xenia/kernel/xobject.cc +++ b/src/xenia/kernel/xobject.cc @@ -188,8 +188,7 @@ uint8_t* XObject::CreateNative(uint32_t size) { allocated_guest_object_ = true; memory()->Zero(mem, total_size); - guest_object_ptr_ = mem + sizeof(X_OBJECT_HEADER); - SetNativePointer(guest_object_ptr_, true); + SetNativePointer(mem + sizeof(X_OBJECT_HEADER), true); auto header = memory()->TranslateVirtual(mem); @@ -210,6 +209,9 @@ uint8_t* XObject::CreateNative(uint32_t size) { void XObject::SetNativePointer(uint32_t native_ptr, bool uninitialized) { std::lock_guard lock(kernel_state_->object_mutex()); + // If hit: We've already setup the native ptr with CreateNative! + assert_zero(guest_object_ptr_); + auto header = kernel_state_->memory()->TranslateVirtual(native_ptr); @@ -224,6 +226,8 @@ void XObject::SetNativePointer(uint32_t native_ptr, bool uninitialized) { object_ptr |= 0x1; header->wait_list_flink = (uint32_t)(object_ptr >> 32); header->wait_list_blink = (uint32_t)(object_ptr & 0xFFFFFFFF); + + guest_object_ptr_ = native_ptr; } object_ref XObject::GetNativeObject(KernelState* kernel_state,