diff options
| -rw-r--r-- | src/core/hle/kernel/process.cpp | 5 | ||||
| -rw-r--r-- | src/core/hle/kernel/svc.cpp | 11 | ||||
| -rw-r--r-- | src/core/hle/kernel/thread.h | 7 |
3 files changed, 7 insertions, 16 deletions
diff --git a/src/core/hle/kernel/process.cpp b/src/core/hle/kernel/process.cpp index 4e94048da..8b2b3877d 100644 --- a/src/core/hle/kernel/process.cpp +++ b/src/core/hle/kernel/process.cpp | |||
| @@ -40,9 +40,8 @@ void SetupMainThread(Process& owner_process, KernelCore& kernel, VAddr entry_poi | |||
| 40 | SharedPtr<Thread> thread = std::move(thread_res).Unwrap(); | 40 | SharedPtr<Thread> thread = std::move(thread_res).Unwrap(); |
| 41 | 41 | ||
| 42 | // Register 1 must be a handle to the main thread | 42 | // Register 1 must be a handle to the main thread |
| 43 | const Handle guest_handle = owner_process.GetHandleTable().Create(thread).Unwrap(); | 43 | const Handle thread_handle = owner_process.GetHandleTable().Create(thread).Unwrap(); |
| 44 | thread->SetGuestHandle(guest_handle); | 44 | thread->GetContext().cpu_registers[1] = thread_handle; |
| 45 | thread->GetContext().cpu_registers[1] = guest_handle; | ||
| 46 | 45 | ||
| 47 | // Threads by default are dormant, wake up the main thread so it runs when the scheduler fires | 46 | // Threads by default are dormant, wake up the main thread so it runs when the scheduler fires |
| 48 | thread->ResumeFromWait(); | 47 | thread->ResumeFromWait(); |
diff --git a/src/core/hle/kernel/svc.cpp b/src/core/hle/kernel/svc.cpp index e5d4d6b55..f57677636 100644 --- a/src/core/hle/kernel/svc.cpp +++ b/src/core/hle/kernel/svc.cpp | |||
| @@ -1250,14 +1250,13 @@ static ResultCode CreateThread(Core::System& system, Handle* out_handle, VAddr e | |||
| 1250 | Thread::Create(kernel, name, entry_point, priority, arg, processor_id, stack_top, | 1250 | Thread::Create(kernel, name, entry_point, priority, arg, processor_id, stack_top, |
| 1251 | *current_process)); | 1251 | *current_process)); |
| 1252 | 1252 | ||
| 1253 | const auto new_guest_handle = current_process->GetHandleTable().Create(thread); | 1253 | const auto new_thread_handle = current_process->GetHandleTable().Create(thread); |
| 1254 | if (new_guest_handle.Failed()) { | 1254 | if (new_thread_handle.Failed()) { |
| 1255 | LOG_ERROR(Kernel_SVC, "Failed to create handle with error=0x{:X}", | 1255 | LOG_ERROR(Kernel_SVC, "Failed to create handle with error=0x{:X}", |
| 1256 | new_guest_handle.Code().raw); | 1256 | new_thread_handle.Code().raw); |
| 1257 | return new_guest_handle.Code(); | 1257 | return new_thread_handle.Code(); |
| 1258 | } | 1258 | } |
| 1259 | thread->SetGuestHandle(*new_guest_handle); | 1259 | *out_handle = *new_thread_handle; |
| 1260 | *out_handle = *new_guest_handle; | ||
| 1261 | 1260 | ||
| 1262 | system.CpuCore(thread->GetProcessorID()).PrepareReschedule(); | 1261 | system.CpuCore(thread->GetProcessorID()).PrepareReschedule(); |
| 1263 | 1262 | ||
diff --git a/src/core/hle/kernel/thread.h b/src/core/hle/kernel/thread.h index 83c83e45a..e14b84a81 100644 --- a/src/core/hle/kernel/thread.h +++ b/src/core/hle/kernel/thread.h | |||
| @@ -345,10 +345,6 @@ public: | |||
| 345 | arb_wait_address = address; | 345 | arb_wait_address = address; |
| 346 | } | 346 | } |
| 347 | 347 | ||
| 348 | void SetGuestHandle(Handle handle) { | ||
| 349 | guest_handle = handle; | ||
| 350 | } | ||
| 351 | |||
| 352 | bool HasWakeupCallback() const { | 348 | bool HasWakeupCallback() const { |
| 353 | return wakeup_callback != nullptr; | 349 | return wakeup_callback != nullptr; |
| 354 | } | 350 | } |
| @@ -442,9 +438,6 @@ private: | |||
| 442 | /// If waiting for an AddressArbiter, this is the address being waited on. | 438 | /// If waiting for an AddressArbiter, this is the address being waited on. |
| 443 | VAddr arb_wait_address{0}; | 439 | VAddr arb_wait_address{0}; |
| 444 | 440 | ||
| 445 | /// Handle used by guest emulated application to access this thread | ||
| 446 | Handle guest_handle = 0; | ||
| 447 | |||
| 448 | /// Handle used as userdata to reference this object when inserting into the CoreTiming queue. | 441 | /// Handle used as userdata to reference this object when inserting into the CoreTiming queue. |
| 449 | Handle callback_handle = 0; | 442 | Handle callback_handle = 0; |
| 450 | 443 | ||