SVC: Implemented ReleaseSemaphore.

This behavior was tested on hardware, however i'm still not sure what use the "initial_count" parameter has
This commit is contained in:
Subv 2014-12-04 11:40:36 -05:00
parent 82c84883a5
commit 49b31badba
4 changed files with 82 additions and 20 deletions

View file

@ -291,10 +291,17 @@ static Result GetThreadId(u32* thread_id, Handle handle) {
/// Creates a semaphore
static Result CreateSemaphore(Handle* semaphore, s32 initial_count, s32 max_count) {
*semaphore = Kernel::CreateSemaphore(initial_count, max_count);
ResultCode res = Kernel::CreateSemaphore(semaphore, initial_count, max_count);
DEBUG_LOG(SVC, "called initial_count=%d, max_count=%d, created handle=0x%08X",
initial_count, max_count, *semaphore);
return 0;
return res.raw;
}
/// Releases a certain number of slots in a semaphore
static Result ReleaseSemaphore(s32* count, Handle semaphore, s32 release_count) {
DEBUG_LOG(SVC, "called release_count=%d, handle=0x%08X", release_count, semaphore);
ResultCode res = Kernel::ReleaseSemaphore(count, semaphore, release_count);
return res.raw;
}
/// Query memory
@ -376,7 +383,7 @@ const HLE::FunctionDef SVC_Table[] = {
{0x13, HLE::Wrap<CreateMutex>, "CreateMutex"},
{0x14, HLE::Wrap<ReleaseMutex>, "ReleaseMutex"},
{0x15, HLE::Wrap<CreateSemaphore>, "CreateSemaphore"},
{0x16, nullptr, "ReleaseSemaphore"},
{0x16, HLE::Wrap<ReleaseSemaphore>, "ReleaseSemaphore"},
{0x17, HLE::Wrap<CreateEvent>, "CreateEvent"},
{0x18, HLE::Wrap<SignalEvent>, "SignalEvent"},
{0x19, HLE::Wrap<ClearEvent>, "ClearEvent"},