diff options
| author | 2014-06-01 22:12:54 -0400 | |
|---|---|---|
| committer | 2014-06-01 22:12:54 -0400 | |
| commit | 3fb31fbc57fd1d537db79af898ef26c92b0e0867 (patch) | |
| tree | a4ce54e66ae91c66c0ce55ab32468b3b8ec4d6ab /src/core/hle/svc.cpp | |
| parent | kernel: changed main thread priority to default, updated Kernel::Reschedule t... (diff) | |
| download | yuzu-3fb31fbc57fd1d537db79af898ef26c92b0e0867.tar.gz yuzu-3fb31fbc57fd1d537db79af898ef26c92b0e0867.tar.xz yuzu-3fb31fbc57fd1d537db79af898ef26c92b0e0867.zip | |
svc: added GetThreadPriority and SetThreadPriority, added (incomplete) DuplicateHandle support
Diffstat (limited to 'src/core/hle/svc.cpp')
| -rw-r--r-- | src/core/hle/svc.cpp | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/src/core/hle/svc.cpp b/src/core/hle/svc.cpp index 0c2412a65..2384b7936 100644 --- a/src/core/hle/svc.cpp +++ b/src/core/hle/svc.cpp | |||
| @@ -258,6 +258,18 @@ Result CreateThread(u32 priority, u32 entry_point, u32 arg, u32 stack_top, u32 p | |||
| 258 | return 0; | 258 | return 0; |
| 259 | } | 259 | } |
| 260 | 260 | ||
| 261 | /// Gets the priority for the specified thread | ||
| 262 | Result GetThreadPriority(void* _priority, Handle handle) { | ||
| 263 | s32* priority = (s32*)_priority; | ||
| 264 | *priority = Kernel::GetThreadPriority(handle); | ||
| 265 | return 0; | ||
| 266 | } | ||
| 267 | |||
| 268 | /// Sets the priority for the specified thread | ||
| 269 | Result SetThreadPriority(Handle handle, s32 priority) { | ||
| 270 | return Kernel::SetThreadPriority(handle, priority); | ||
| 271 | } | ||
| 272 | |||
| 261 | /// Create a mutex | 273 | /// Create a mutex |
| 262 | Result CreateMutex(void* _mutex, u32 initial_locked) { | 274 | Result CreateMutex(void* _mutex, u32 initial_locked) { |
| 263 | Handle* mutex = (Handle*)_mutex; | 275 | Handle* mutex = (Handle*)_mutex; |
| @@ -299,7 +311,18 @@ Result CreateEvent(void* _event, u32 reset_type) { | |||
| 299 | /// Duplicates a kernel handle | 311 | /// Duplicates a kernel handle |
| 300 | Result DuplicateHandle(void* _out, Handle handle) { | 312 | Result DuplicateHandle(void* _out, Handle handle) { |
| 301 | Handle* out = (Handle*)_out; | 313 | Handle* out = (Handle*)_out; |
| 302 | ERROR_LOG(SVC, "(UNIMPLEMENTED) called handle=0x%08X", handle); | 314 | ERROR_LOG(SVC, "called handle=0x%08X", handle); |
| 315 | |||
| 316 | // Translate kernel handles -> real handles | ||
| 317 | if (handle == Kernel::CurrentThread) { | ||
| 318 | handle = Kernel::GetCurrentThreadHandle(); | ||
| 319 | } | ||
| 320 | _assert_msg_(KERNEL, (handle != Kernel::CurrentProcess), | ||
| 321 | "(UNIMPLEMENTED) process handle duplication!"); | ||
| 322 | |||
| 323 | // TODO(bunnei): FixMe - This is a hack to return the handle that we were asked to duplicate. | ||
| 324 | *out = handle; | ||
| 325 | |||
| 303 | return 0; | 326 | return 0; |
| 304 | } | 327 | } |
| 305 | 328 | ||
| @@ -327,8 +350,8 @@ const HLE::FunctionDef SVC_Table[] = { | |||
| 327 | {0x08, WrapI_UUUUU<CreateThread>, "CreateThread"}, | 350 | {0x08, WrapI_UUUUU<CreateThread>, "CreateThread"}, |
| 328 | {0x09, NULL, "ExitThread"}, | 351 | {0x09, NULL, "ExitThread"}, |
| 329 | {0x0A, WrapV_S64<SleepThread>, "SleepThread"}, | 352 | {0x0A, WrapV_S64<SleepThread>, "SleepThread"}, |
| 330 | {0x0B, NULL, "GetThreadPriority"}, | 353 | {0x0B, WrapI_VU<GetThreadPriority>, "GetThreadPriority"}, |
| 331 | {0x0C, NULL, "SetThreadPriority"}, | 354 | {0x0C, WrapI_UI<SetThreadPriority>, "SetThreadPriority"}, |
| 332 | {0x0D, NULL, "GetThreadAffinityMask"}, | 355 | {0x0D, NULL, "GetThreadAffinityMask"}, |
| 333 | {0x0E, NULL, "SetThreadAffinityMask"}, | 356 | {0x0E, NULL, "SetThreadAffinityMask"}, |
| 334 | {0x0F, NULL, "GetThreadIdealProcessor"}, | 357 | {0x0F, NULL, "GetThreadIdealProcessor"}, |