Fixing thread ID.
This commit is contained in:
parent
8bfc43bb0d
commit
b119aa50f5
|
@ -106,8 +106,8 @@ uint32_t XThread::GetCurrentThreadHandle() {
|
|||
return thread->handle();
|
||||
}
|
||||
|
||||
uint32_t XThread::GetCurrentThreadId(const uint8_t* thread_state_block) {
|
||||
return xe::load_and_swap<uint32_t>(thread_state_block + 0x14C);
|
||||
uint32_t XThread::GetCurrentThreadId(const uint8_t* pcr) {
|
||||
return xe::load_and_swap<uint32_t>(pcr + 0x2D8 + 0x14C);
|
||||
}
|
||||
|
||||
uint32_t XThread::last_error() {
|
||||
|
|
|
@ -33,7 +33,7 @@ class XThread : public XObject {
|
|||
|
||||
static XThread* GetCurrentThread();
|
||||
static uint32_t GetCurrentThreadHandle();
|
||||
static uint32_t GetCurrentThreadId(const uint8_t* thread_state_block);
|
||||
static uint32_t GetCurrentThreadId(const uint8_t* pcr);
|
||||
|
||||
uint32_t pcr_ptr() const { return pcr_address_; }
|
||||
uint32_t thread_state_ptr() const { return thread_state_address_; }
|
||||
|
|
|
@ -149,7 +149,7 @@ SHIM_CALL NtAllocateVirtualMemory_shim(PPCContext* ppc_state,
|
|||
// Zero memory, if needed.
|
||||
if (address && !(alloc_type & X_MEM_NOZERO)) {
|
||||
if (alloc_type & X_MEM_COMMIT) {
|
||||
std::memset(SHIM_MEM_ADDR(address), 0, adjusted_size);
|
||||
state->memory()->Zero(address, adjusted_size);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -522,8 +522,8 @@ SHIM_CALL RtlEnterCriticalSection_shim(PPCContext* ppc_state,
|
|||
|
||||
// XELOGD("RtlEnterCriticalSection(%.8X)", cs_ptr);
|
||||
|
||||
const uint8_t* thread_state_block = SHIM_MEM_ADDR(ppc_state->r[13]);
|
||||
uint32_t thread_id = XThread::GetCurrentThreadId(thread_state_block);
|
||||
const uint8_t* pcr = SHIM_MEM_ADDR(ppc_state->r[13]);
|
||||
uint32_t thread_id = XThread::GetCurrentThreadId(pcr);
|
||||
|
||||
auto cs = (X_RTL_CRITICAL_SECTION*)SHIM_MEM_ADDR(cs_ptr);
|
||||
|
||||
|
@ -564,8 +564,8 @@ SHIM_CALL RtlTryEnterCriticalSection_shim(PPCContext* ppc_state,
|
|||
|
||||
// XELOGD("RtlTryEnterCriticalSection(%.8X)", cs_ptr);
|
||||
|
||||
const uint8_t* thread_state_block = SHIM_MEM_ADDR(ppc_state->r[13]);
|
||||
uint32_t thread_id = XThread::GetCurrentThreadId(thread_state_block);
|
||||
const uint8_t* pcr = SHIM_MEM_ADDR(ppc_state->r[13]);
|
||||
uint32_t thread_id = XThread::GetCurrentThreadId(pcr);
|
||||
|
||||
auto cs = (X_RTL_CRITICAL_SECTION*)SHIM_MEM_ADDR(cs_ptr);
|
||||
|
||||
|
|
|
@ -731,7 +731,7 @@ bool BaseHeap::AllocRange(uint32_t low_address, uint32_t high_address,
|
|||
}
|
||||
|
||||
if (FLAGS_scribble_heap && protect & kMemoryProtectWrite) {
|
||||
memset(result, 0xCD, page_count * page_size_);
|
||||
std::memset(result, 0xCD, page_count * page_size_);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue