diff options
| author | 2014-12-14 22:03:28 -0500 | |
|---|---|---|
| committer | 2014-12-14 22:03:28 -0500 | |
| commit | 17b4d6747a0185c30a5d7c5b90872a6daa3dbe99 (patch) | |
| tree | 096e29ba94d07ce7d390580f71f1893997cd1ec2 /src/core/hle/svc.cpp | |
| parent | Merge pull request #273 from bunnei/more-skyeye-fixes (diff) | |
| parent | Kernel/Semaphores: Fixed build (diff) | |
| download | yuzu-17b4d6747a0185c30a5d7c5b90872a6daa3dbe99.tar.gz yuzu-17b4d6747a0185c30a5d7c5b90872a6daa3dbe99.tar.xz yuzu-17b4d6747a0185c30a5d7c5b90872a6daa3dbe99.zip | |
Merge pull request #246 from Subv/cbranch_1
SVC: Implemented Semaphores
Diffstat (limited to 'src/core/hle/svc.cpp')
| -rw-r--r-- | src/core/hle/svc.cpp | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/src/core/hle/svc.cpp b/src/core/hle/svc.cpp index db0c42e74..f3595096e 100644 --- a/src/core/hle/svc.cpp +++ b/src/core/hle/svc.cpp | |||
| @@ -12,6 +12,7 @@ | |||
| 12 | #include "core/hle/kernel/address_arbiter.h" | 12 | #include "core/hle/kernel/address_arbiter.h" |
| 13 | #include "core/hle/kernel/event.h" | 13 | #include "core/hle/kernel/event.h" |
| 14 | #include "core/hle/kernel/mutex.h" | 14 | #include "core/hle/kernel/mutex.h" |
| 15 | #include "core/hle/kernel/semaphore.h" | ||
| 15 | #include "core/hle/kernel/shared_memory.h" | 16 | #include "core/hle/kernel/shared_memory.h" |
| 16 | #include "core/hle/kernel/thread.h" | 17 | #include "core/hle/kernel/thread.h" |
| 17 | 18 | ||
| @@ -288,6 +289,21 @@ static Result GetThreadId(u32* thread_id, Handle handle) { | |||
| 288 | return result.raw; | 289 | return result.raw; |
| 289 | } | 290 | } |
| 290 | 291 | ||
| 292 | /// Creates a semaphore | ||
| 293 | static Result CreateSemaphore(Handle* semaphore, s32 initial_count, s32 max_count) { | ||
| 294 | ResultCode res = Kernel::CreateSemaphore(semaphore, initial_count, max_count); | ||
| 295 | LOG_TRACE(Kernel_SVC, "called initial_count=%d, max_count=%d, created handle=0x%08X", | ||
| 296 | initial_count, max_count, *semaphore); | ||
| 297 | return res.raw; | ||
| 298 | } | ||
| 299 | |||
| 300 | /// Releases a certain number of slots in a semaphore | ||
| 301 | static Result ReleaseSemaphore(s32* count, Handle semaphore, s32 release_count) { | ||
| 302 | LOG_TRACE(Kernel_SVC, "called release_count=%d, handle=0x%08X", release_count, semaphore); | ||
| 303 | ResultCode res = Kernel::ReleaseSemaphore(count, semaphore, release_count); | ||
| 304 | return res.raw; | ||
| 305 | } | ||
| 306 | |||
| 291 | /// Query memory | 307 | /// Query memory |
| 292 | static Result QueryMemory(void* info, void* out, u32 addr) { | 308 | static Result QueryMemory(void* info, void* out, u32 addr) { |
| 293 | LOG_ERROR(Kernel_SVC, "(UNIMPLEMENTED) called addr=0x%08X", addr); | 309 | LOG_ERROR(Kernel_SVC, "(UNIMPLEMENTED) called addr=0x%08X", addr); |
| @@ -366,8 +382,8 @@ const HLE::FunctionDef SVC_Table[] = { | |||
| 366 | {0x12, nullptr, "Run"}, | 382 | {0x12, nullptr, "Run"}, |
| 367 | {0x13, HLE::Wrap<CreateMutex>, "CreateMutex"}, | 383 | {0x13, HLE::Wrap<CreateMutex>, "CreateMutex"}, |
| 368 | {0x14, HLE::Wrap<ReleaseMutex>, "ReleaseMutex"}, | 384 | {0x14, HLE::Wrap<ReleaseMutex>, "ReleaseMutex"}, |
| 369 | {0x15, nullptr, "CreateSemaphore"}, | 385 | {0x15, HLE::Wrap<CreateSemaphore>, "CreateSemaphore"}, |
| 370 | {0x16, nullptr, "ReleaseSemaphore"}, | 386 | {0x16, HLE::Wrap<ReleaseSemaphore>, "ReleaseSemaphore"}, |
| 371 | {0x17, HLE::Wrap<CreateEvent>, "CreateEvent"}, | 387 | {0x17, HLE::Wrap<CreateEvent>, "CreateEvent"}, |
| 372 | {0x18, HLE::Wrap<SignalEvent>, "SignalEvent"}, | 388 | {0x18, HLE::Wrap<SignalEvent>, "SignalEvent"}, |
| 373 | {0x19, HLE::Wrap<ClearEvent>, "ClearEvent"}, | 389 | {0x19, HLE::Wrap<ClearEvent>, "ClearEvent"}, |