summaryrefslogtreecommitdiffstats
path: root/src/core/hle
diff options
context:
space:
mode:
authorbunnei <ericbunnie@gmail.com>2014-05-21 05:23:58 +0200
committerbunnei <ericbunnie@gmail.com>2014-05-21 05:23:58 +0200
commiteb537c560a33db9955413a96afd3b98203a729fe (patch)
tree6bb55926f3b811a578a2680b0cd454476a144244 /src/core/hle
parentmutex: initial commit of HLE module (diff)
downloadyuzu-eb537c560a33db9955413a96afd3b98203a729fe.tar
yuzu-eb537c560a33db9955413a96afd3b98203a729fe.tar.gz
yuzu-eb537c560a33db9955413a96afd3b98203a729fe.tar.bz2
yuzu-eb537c560a33db9955413a96afd3b98203a729fe.tar.lz
yuzu-eb537c560a33db9955413a96afd3b98203a729fe.tar.xz
yuzu-eb537c560a33db9955413a96afd3b98203a729fe.tar.zst
yuzu-eb537c560a33db9955413a96afd3b98203a729fe.zip
Diffstat (limited to 'src/core/hle')
-rw-r--r--src/core/hle/kernel/mutex.cpp14
-rw-r--r--src/core/hle/kernel/mutex.h2
-rw-r--r--src/core/hle/service/apt.cpp3
-rw-r--r--src/core/hle/svc.cpp2
4 files changed, 16 insertions, 5 deletions
diff --git a/src/core/hle/kernel/mutex.cpp b/src/core/hle/kernel/mutex.cpp
index 2b2cff4ea..7cf3439e9 100644
--- a/src/core/hle/kernel/mutex.cpp
+++ b/src/core/hle/kernel/mutex.cpp
@@ -102,7 +102,7 @@ Result ReleaseMutex(Handle handle) {
* @param handle Reference to handle for the newly created mutex
* @param initial_locked Specifies if the mutex should be locked initially
*/
-Result CreateMutex(Handle& handle, bool initial_locked) {
+Mutex* CreateMutex(Handle& handle, bool initial_locked) {
Mutex* mutex = new Mutex;
handle = Kernel::g_object_pool.Create(mutex);
@@ -116,7 +116,17 @@ Result CreateMutex(Handle& handle, bool initial_locked) {
} else {
mutex->lock_thread = -1;
}
- return 0;
+ return mutex;
+}
+
+/**
+ * Creates a mutex
+ * @param initial_locked Specifies if the mutex should be locked initially
+ */
+Handle CreateMutex(bool initial_locked) {
+ Handle handle;
+ Mutex* mutex = CreateMutex(handle, initial_locked);
+ return handle;
}
} // namespace
diff --git a/src/core/hle/kernel/mutex.h b/src/core/hle/kernel/mutex.h
index 1f843e979..871e2e562 100644
--- a/src/core/hle/kernel/mutex.h
+++ b/src/core/hle/kernel/mutex.h
@@ -21,6 +21,6 @@ Result ReleaseMutex(Handle handle);
* @param handle Reference to handle for the newly created mutex
* @param initial_locked Specifies if the mutex should be locked initially
*/
-Result CreateMutex(Handle& handle, bool initial_locked);
+Handle CreateMutex(bool initial_locked);
} // namespace
diff --git a/src/core/hle/service/apt.cpp b/src/core/hle/service/apt.cpp
index ecec4da00..b01f35ac5 100644
--- a/src/core/hle/service/apt.cpp
+++ b/src/core/hle/service/apt.cpp
@@ -21,7 +21,8 @@ void Initialize(Service::Interface* self) {
void GetLockHandle(Service::Interface* self) {
u32* cmd_buff = Service::GetCommandBuffer();
u32 flags = cmd_buff[1]; // TODO(bunnei): Figure out the purpose of the flag field
- cmd_buff[1] = Kernel::CreateMutex(cmd_buff[5], false);
+ cmd_buff[1] = 0; // No error
+ cmd_buff[5] = Kernel::CreateMutex(false);
}
const Interface::FunctionInfo FunctionTable[] = {
diff --git a/src/core/hle/svc.cpp b/src/core/hle/svc.cpp
index 73ab073f5..ffacdfb86 100644
--- a/src/core/hle/svc.cpp
+++ b/src/core/hle/svc.cpp
@@ -188,7 +188,7 @@ Result CreateThread(void* thread, u32 priority, u32 entry_point, u32 arg, u32 st
Result CreateMutex(void* _mutex, u32 initial_locked) {
Handle* mutex = (Handle*)_mutex;
DEBUG_LOG(SVC, "CreateMutex called initial_locked=%s", initial_locked ? "true" : "false");
- Kernel::CreateMutex(*mutex, (bool)initial_locked);
+ *mutex = Kernel::CreateMutex((initial_locked != 0));
Core::g_app_core->SetReg(1, *mutex);
return 0;
}