thread: Keep track of the initially created handle.
This is kinda crufty, but we need it for now to update guest state variables.
This commit is contained in:
parent
45debfe4fd
commit
1cb978eb82
3 changed files with 7 additions and 2 deletions
|
@ -502,7 +502,8 @@ SharedPtr<Thread> SetupMainThread(VAddr entry_point, u32 priority,
|
||||||
SharedPtr<Thread> thread = std::move(thread_res).Unwrap();
|
SharedPtr<Thread> thread = std::move(thread_res).Unwrap();
|
||||||
|
|
||||||
// Register 1 must be a handle to the main thread
|
// Register 1 must be a handle to the main thread
|
||||||
thread->context.cpu_registers[1] = Kernel::g_handle_table.Create(thread).Unwrap();
|
thread->guest_handle = Kernel::g_handle_table.Create(thread).Unwrap();;
|
||||||
|
thread->context.cpu_registers[1] = thread->guest_handle;
|
||||||
thread->context.fpscr =
|
thread->context.fpscr =
|
||||||
FPSCR_DEFAULT_NAN | FPSCR_FLUSH_TO_ZERO | FPSCR_ROUND_TOZERO | FPSCR_IXC; // 0x03C00010
|
FPSCR_DEFAULT_NAN | FPSCR_FLUSH_TO_ZERO | FPSCR_ROUND_TOZERO | FPSCR_IXC; // 0x03C00010
|
||||||
|
|
||||||
|
|
|
@ -212,6 +212,9 @@ public:
|
||||||
|
|
||||||
std::string name;
|
std::string name;
|
||||||
|
|
||||||
|
/// Handle used by guest emulated application to access this thread
|
||||||
|
Handle guest_handle;
|
||||||
|
|
||||||
/// Handle used as userdata to reference this object when inserting into the CoreTiming queue.
|
/// Handle used as userdata to reference this object when inserting into the CoreTiming queue.
|
||||||
Handle callback_handle;
|
Handle callback_handle;
|
||||||
|
|
||||||
|
|
|
@ -268,7 +268,8 @@ static ResultCode CreateThread(Handle* out_handle, VAddr entry_point, u64 arg, V
|
||||||
thread->context.fpscr =
|
thread->context.fpscr =
|
||||||
FPSCR_DEFAULT_NAN | FPSCR_FLUSH_TO_ZERO | FPSCR_ROUND_TOZERO; // 0x03C00000
|
FPSCR_DEFAULT_NAN | FPSCR_FLUSH_TO_ZERO | FPSCR_ROUND_TOZERO; // 0x03C00000
|
||||||
|
|
||||||
CASCADE_RESULT(*out_handle, Kernel::g_handle_table.Create(std::move(thread)));
|
CASCADE_RESULT(thread->guest_handle, Kernel::g_handle_table.Create(thread));
|
||||||
|
*out_handle = thread->guest_handle;
|
||||||
|
|
||||||
Core::System::GetInstance().PrepareReschedule();
|
Core::System::GetInstance().PrepareReschedule();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue