From a6322c7bf4387f83876724d9f33f8aabf0d92869 Mon Sep 17 00:00:00 2001 From: "Dr. Chat" Date: Sun, 6 Dec 2015 17:19:46 -0600 Subject: [PATCH] NativeList getters/setters --- src/xenia/kernel/util/native_list.h | 5 +++++ src/xenia/kernel/xthread.cc | 6 +++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/xenia/kernel/util/native_list.h b/src/xenia/kernel/util/native_list.h index 446f0e5af..f16ad5c27 100644 --- a/src/xenia/kernel/util/native_list.h +++ b/src/xenia/kernel/util/native_list.h @@ -38,6 +38,11 @@ class NativeList { uint32_t Shift(); bool HasPending(); + uint32_t head() const { return head_; } + void set_head(uint32_t head) { head_ = head; } + + void set_memory(Memory* mem) { memory_ = mem; } + private: const uint32_t kInvalidPointer = 0xE0FE0FFF; diff --git a/src/xenia/kernel/xthread.cc b/src/xenia/kernel/xthread.cc index 106ae60be..96af1258b 100644 --- a/src/xenia/kernel/xthread.cc +++ b/src/xenia/kernel/xthread.cc @@ -825,7 +825,6 @@ uint32_t XThread::StepIntoBranch(uint32_t pc) { // FIXME: This won't work on non-conditional conditional branches. XELOGE("XThread: Could not install breakpoint to step forward!"); assert_always(); - return 0; } uint32_t nia = 0; @@ -974,6 +973,7 @@ uint32_t XThread::StepToSafePoint() { struct ThreadSavedState { uint32_t thread_id; bool main_thread; + uint32_t apc_head; uint32_t tls_address; uint32_t pcr_address; uint32_t stack_base; // High address @@ -1021,6 +1021,7 @@ bool XThread::Save(ByteStream* stream) { ThreadSavedState state; state.thread_id = thread_id_; state.main_thread = main_thread_; + state.apc_head = apc_list_.head(); state.tls_address = tls_address_; state.pcr_address = pcr_address_; state.stack_base = stack_base_; @@ -1076,6 +1077,7 @@ object_ref XThread::Restore(KernelState* kernel_state, stream->Read(&state, sizeof(ThreadSavedState)); thread->thread_id_ = state.thread_id; thread->main_thread_ = state.main_thread; + thread->apc_list_.set_head(state.apc_head); thread->tls_address_ = state.tls_address; thread->pcr_address_ = state.pcr_address; thread->stack_base_ = state.stack_base; @@ -1083,6 +1085,8 @@ object_ref XThread::Restore(KernelState* kernel_state, thread->stack_alloc_base_ = state.stack_alloc_base; thread->stack_alloc_size_ = state.stack_alloc_size; + thread->apc_list_.set_memory(kernel_state->memory()); + // Register now that we know our thread ID. kernel_state->RegisterThread(thread);