summaryrefslogtreecommitdiffstats
path: root/src/core/hle
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2017-12-31 23:23:36 +0100
committerbunnei <bunneidev@gmail.com>2017-12-31 23:23:36 +0100
commit1cb978eb82253d6869d1c3729e976a98fb5a7a9c (patch)
tree8e1045990a52e489b6e7441aca8c68893959d6e7 /src/core/hle
parentsvc: Implement svcExitThread. (diff)
downloadyuzu-1cb978eb82253d6869d1c3729e976a98fb5a7a9c.tar
yuzu-1cb978eb82253d6869d1c3729e976a98fb5a7a9c.tar.gz
yuzu-1cb978eb82253d6869d1c3729e976a98fb5a7a9c.tar.bz2
yuzu-1cb978eb82253d6869d1c3729e976a98fb5a7a9c.tar.lz
yuzu-1cb978eb82253d6869d1c3729e976a98fb5a7a9c.tar.xz
yuzu-1cb978eb82253d6869d1c3729e976a98fb5a7a9c.tar.zst
yuzu-1cb978eb82253d6869d1c3729e976a98fb5a7a9c.zip
Diffstat (limited to 'src/core/hle')
-rw-r--r--src/core/hle/kernel/thread.cpp3
-rw-r--r--src/core/hle/kernel/thread.h3
-rw-r--r--src/core/hle/svc.cpp3
3 files changed, 7 insertions, 2 deletions
diff --git a/src/core/hle/kernel/thread.cpp b/src/core/hle/kernel/thread.cpp
index b20092761..1588cfc7e 100644
--- a/src/core/hle/kernel/thread.cpp
+++ b/src/core/hle/kernel/thread.cpp
@@ -502,7 +502,8 @@ SharedPtr<Thread> SetupMainThread(VAddr entry_point, u32 priority,
SharedPtr<Thread> thread = std::move(thread_res).Unwrap();
// 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 =
FPSCR_DEFAULT_NAN | FPSCR_FLUSH_TO_ZERO | FPSCR_ROUND_TOZERO | FPSCR_IXC; // 0x03C00010
diff --git a/src/core/hle/kernel/thread.h b/src/core/hle/kernel/thread.h
index 25d678ba3..ed44ee933 100644
--- a/src/core/hle/kernel/thread.h
+++ b/src/core/hle/kernel/thread.h
@@ -212,6 +212,9 @@ public:
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 callback_handle;
diff --git a/src/core/hle/svc.cpp b/src/core/hle/svc.cpp
index bffa18c39..133b868f2 100644
--- a/src/core/hle/svc.cpp
+++ b/src/core/hle/svc.cpp
@@ -268,7 +268,8 @@ static ResultCode CreateThread(Handle* out_handle, VAddr entry_point, u64 arg, V
thread->context.fpscr =
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();