summaryrefslogtreecommitdiff
path: root/src/core/hle/svc.cpp
diff options
context:
space:
mode:
authorGravatar bunnei2014-06-01 10:37:19 -0400
committerGravatar bunnei2014-06-01 10:37:19 -0400
commitf2f638492b1585739d193b400e34ede91c256462 (patch)
tree5580cd6e353637b13856b7e200d4cd08971fcd8e /src/core/hle/svc.cpp
parentthread: updated Reschedule to sit at a synchronization barrier when no other ... (diff)
downloadyuzu-f2f638492b1585739d193b400e34ede91c256462.tar.gz
yuzu-f2f638492b1585739d193b400e34ede91c256462.tar.xz
yuzu-f2f638492b1585739d193b400e34ede91c256462.zip
svc: updated waitSychronization to not overwrite handle on return, added stub for SleepThread (does nothing)
Diffstat (limited to 'src/core/hle/svc.cpp')
-rw-r--r--src/core/hle/svc.cpp23
1 files changed, 21 insertions, 2 deletions
diff --git a/src/core/hle/svc.cpp b/src/core/hle/svc.cpp
index 01fb647e7..5ba42973a 100644
--- a/src/core/hle/svc.cpp
+++ b/src/core/hle/svc.cpp
@@ -126,6 +126,14 @@ Result WaitSynchronization1(Handle handle, s64 nano_seconds) {
126 if (wait) { 126 if (wait) {
127 Kernel::WaitCurrentThread(WAITTYPE_SYNCH); // TODO(bunnei): Is this correct? 127 Kernel::WaitCurrentThread(WAITTYPE_SYNCH); // TODO(bunnei): Is this correct?
128 Kernel::Reschedule(); 128 Kernel::Reschedule();
129
130 // Context switch - Function blocked, is not actually returning (will be "called" again)
131
132 // TODO(bunnei): This saves handle to R0 so that it's correctly reloaded on context switch
133 // (otherwise R0 will be set to whatever is returned, and handle will be invalid when this
134 // thread is resumed). There is probably a better way of keeping track of state so that we
135 // don't necessarily have to do this.
136 return (Result)PARAM(0);
129 } 137 }
130 138
131 return res; 139 return res;
@@ -171,7 +179,13 @@ Result WaitSynchronizationN(void* _out, void* _handles, u32 handle_count, u32 wa
171 Kernel::WaitCurrentThread(WAITTYPE_SYNCH); // TODO(bunnei): Is this correct? 179 Kernel::WaitCurrentThread(WAITTYPE_SYNCH); // TODO(bunnei): Is this correct?
172 Kernel::Reschedule(); 180 Kernel::Reschedule();
173 181
174 return 0; 182 // Context switch - Function blocked, is not actually returning (will be "called" again)
183
184 // TODO(bunnei): This saves handle to R0 so that it's correctly reloaded on context switch
185 // (otherwise R0 will be set to whatever is returned, and handle will be invalid when this
186 // thread is resumed). There is probably a better way of keeping track of state so that we
187 // don't necessarily have to do this.
188 return (Result)PARAM(0);
175} 189}
176 190
177/// Create an address arbiter (to allocate access to shared resources) 191/// Create an address arbiter (to allocate access to shared resources)
@@ -289,6 +303,11 @@ Result ClearEvent(Handle evt) {
289 return res; 303 return res;
290} 304}
291 305
306/// Sleep the current thread
307void SleepThread(s64 nanoseconds) {
308 DEBUG_LOG(SVC, "called nanoseconds=%d", nanoseconds);
309}
310
292const HLE::FunctionDef SVC_Table[] = { 311const HLE::FunctionDef SVC_Table[] = {
293 {0x00, NULL, "Unknown"}, 312 {0x00, NULL, "Unknown"},
294 {0x01, WrapI_VUUUUU<ControlMemory>, "ControlMemory"}, 313 {0x01, WrapI_VUUUUU<ControlMemory>, "ControlMemory"},
@@ -300,7 +319,7 @@ const HLE::FunctionDef SVC_Table[] = {
300 {0x07, NULL, "SetProcessIdealProcessor"}, 319 {0x07, NULL, "SetProcessIdealProcessor"},
301 {0x08, WrapI_UUUUU<CreateThread>, "CreateThread"}, 320 {0x08, WrapI_UUUUU<CreateThread>, "CreateThread"},
302 {0x09, NULL, "ExitThread"}, 321 {0x09, NULL, "ExitThread"},
303 {0x0A, NULL, "SleepThread"}, 322 {0x0A, WrapV_S64<SleepThread>, "SleepThread"},
304 {0x0B, NULL, "GetThreadPriority"}, 323 {0x0B, NULL, "GetThreadPriority"},
305 {0x0C, NULL, "SetThreadPriority"}, 324 {0x0C, NULL, "SetThreadPriority"},
306 {0x0D, NULL, "GetThreadAffinityMask"}, 325 {0x0D, NULL, "GetThreadAffinityMask"},