Make SetNativePointer setup the guest pointer
This commit is contained in:
parent
4e74db8e51
commit
3e7870fb39
|
@ -188,8 +188,7 @@ uint8_t* XObject::CreateNative(uint32_t size) {
|
||||||
|
|
||||||
allocated_guest_object_ = true;
|
allocated_guest_object_ = true;
|
||||||
memory()->Zero(mem, total_size);
|
memory()->Zero(mem, total_size);
|
||||||
guest_object_ptr_ = mem + sizeof(X_OBJECT_HEADER);
|
SetNativePointer(mem + sizeof(X_OBJECT_HEADER), true);
|
||||||
SetNativePointer(guest_object_ptr_, true);
|
|
||||||
|
|
||||||
auto header = memory()->TranslateVirtual<X_OBJECT_HEADER*>(mem);
|
auto header = memory()->TranslateVirtual<X_OBJECT_HEADER*>(mem);
|
||||||
|
|
||||||
|
@ -210,6 +209,9 @@ uint8_t* XObject::CreateNative(uint32_t size) {
|
||||||
void XObject::SetNativePointer(uint32_t native_ptr, bool uninitialized) {
|
void XObject::SetNativePointer(uint32_t native_ptr, bool uninitialized) {
|
||||||
std::lock_guard<xe::recursive_mutex> lock(kernel_state_->object_mutex());
|
std::lock_guard<xe::recursive_mutex> lock(kernel_state_->object_mutex());
|
||||||
|
|
||||||
|
// If hit: We've already setup the native ptr with CreateNative!
|
||||||
|
assert_zero(guest_object_ptr_);
|
||||||
|
|
||||||
auto header =
|
auto header =
|
||||||
kernel_state_->memory()->TranslateVirtual<X_DISPATCH_HEADER*>(native_ptr);
|
kernel_state_->memory()->TranslateVirtual<X_DISPATCH_HEADER*>(native_ptr);
|
||||||
|
|
||||||
|
@ -224,6 +226,8 @@ void XObject::SetNativePointer(uint32_t native_ptr, bool uninitialized) {
|
||||||
object_ptr |= 0x1;
|
object_ptr |= 0x1;
|
||||||
header->wait_list_flink = (uint32_t)(object_ptr >> 32);
|
header->wait_list_flink = (uint32_t)(object_ptr >> 32);
|
||||||
header->wait_list_blink = (uint32_t)(object_ptr & 0xFFFFFFFF);
|
header->wait_list_blink = (uint32_t)(object_ptr & 0xFFFFFFFF);
|
||||||
|
|
||||||
|
guest_object_ptr_ = native_ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
object_ref<XObject> XObject::GetNativeObject(KernelState* kernel_state,
|
object_ref<XObject> XObject::GetNativeObject(KernelState* kernel_state,
|
||||||
|
|
Loading…
Reference in New Issue