commit
c69ee78c27
|
@ -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();
|
||||
|
||||
|
|
|
@ -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<std::mutex> lock(kernel_state_->object_mutex());
|
||||
|
||||
auto header =
|
||||
kernel_state_->memory()->TranslateVirtual<DISPATCH_HEADER*>(native_ptr);
|
||||
|
||||
// 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<uint64_t>(this);
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -596,6 +596,10 @@ bool BaseHeap::AllocFixed(uint32_t base_address, uint32_t size,
|
|||
XELOGE("BaseHeap::Alloc failed to alloc range from host");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (FLAGS_scribble_heap && protect & kMemoryProtectWrite) {
|
||||
memset(result, 0xCD, page_count * page_size_);
|
||||
}
|
||||
}
|
||||
|
||||
// Set page state.
|
||||
|
@ -725,6 +729,10 @@ bool BaseHeap::AllocRange(uint32_t low_address, uint32_t high_address,
|
|||
XELOGE("BaseHeap::Alloc failed to alloc range from host");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (FLAGS_scribble_heap && protect & kMemoryProtectWrite) {
|
||||
memset(result, 0xCD, page_count * page_size_);
|
||||
}
|
||||
}
|
||||
|
||||
// Set page state.
|
||||
|
|
Loading…
Reference in New Issue