summaryrefslogtreecommitdiff
path: root/src/core/hle/service/srv.cpp
diff options
context:
space:
mode:
authorGravatar bunnei2014-06-14 12:13:16 -0400
committerGravatar bunnei2014-06-14 12:13:16 -0400
commit004df767953a949817da89bddcd5d1379240f769 (patch)
treeb2d54928dcbf3cb4dde0cd5d3277afe7999b7bd9 /src/core/hle/service/srv.cpp
parentGPU debugger: Const correctness and build fix. (diff)
parentKernel: Removed unnecessary "#pragma once". (diff)
downloadyuzu-004df767953a949817da89bddcd5d1379240f769.tar.gz
yuzu-004df767953a949817da89bddcd5d1379240f769.tar.xz
yuzu-004df767953a949817da89bddcd5d1379240f769.zip
Merge branch 'threading' of https://github.com/bunnei/citra
Conflicts: src/core/hle/function_wrappers.h src/core/hle/service/gsp.cpp
Diffstat (limited to 'src/core/hle/service/srv.cpp')
-rw-r--r--src/core/hle/service/srv.cpp27
1 files changed, 15 insertions, 12 deletions
diff --git a/src/core/hle/service/srv.cpp b/src/core/hle/service/srv.cpp
index ff6da8f1c..f45c0efc2 100644
--- a/src/core/hle/service/srv.cpp
+++ b/src/core/hle/service/srv.cpp
@@ -5,21 +5,28 @@
5#include "core/hle/hle.h" 5#include "core/hle/hle.h"
6#include "core/hle/service/srv.h" 6#include "core/hle/service/srv.h"
7#include "core/hle/service/service.h" 7#include "core/hle/service/service.h"
8 8#include "core/hle/kernel/mutex.h"
9 9
10//////////////////////////////////////////////////////////////////////////////////////////////////// 10////////////////////////////////////////////////////////////////////////////////////////////////////
11// Namespace SRV 11// Namespace SRV
12 12
13namespace SRV { 13namespace SRV {
14 14
15Handle g_mutex = 0;
16
15void Initialize(Service::Interface* self) { 17void Initialize(Service::Interface* self) {
16 NOTICE_LOG(OSHLE, "SRV::Sync - Initialize"); 18 DEBUG_LOG(OSHLE, "called");
19 if (!g_mutex) {
20 g_mutex = Kernel::CreateMutex(true, "SRV:Lock");
21 }
17} 22}
18 23
19void GetProcSemaphore(Service::Interface* self) { 24void GetProcSemaphore(Service::Interface* self) {
25 DEBUG_LOG(OSHLE, "called");
20 // Get process semaphore? 26 // Get process semaphore?
21 u32* cmd_buff = Service::GetCommandBuffer(); 27 u32* cmd_buff = Service::GetCommandBuffer();
22 cmd_buff[3] = 0xDEADBEEF; // Return something... 0 == NULL, raises an exception 28 cmd_buff[1] = 0; // No error
29 cmd_buff[3] = g_mutex; // Return something... 0 == nullptr, raises an exception
23} 30}
24 31
25void GetServiceHandle(Service::Interface* self) { 32void GetServiceHandle(Service::Interface* self) {
@@ -29,25 +36,21 @@ void GetServiceHandle(Service::Interface* self) {
29 std::string port_name = std::string((const char*)&cmd_buff[1], 0, Service::kMaxPortSize); 36 std::string port_name = std::string((const char*)&cmd_buff[1], 0, Service::kMaxPortSize);
30 Service::Interface* service = Service::g_manager->FetchFromPortName(port_name); 37 Service::Interface* service = Service::g_manager->FetchFromPortName(port_name);
31 38
32 NOTICE_LOG(OSHLE, "SRV::Sync - GetHandle - port: %s, handle: 0x%08X", port_name.c_str(), 39 if (nullptr != service) {
33 service->GetHandle());
34
35 if (NULL != service) {
36 cmd_buff[3] = service->GetHandle(); 40 cmd_buff[3] = service->GetHandle();
41 DEBUG_LOG(OSHLE, "called port=%s, handle=0x%08X", port_name.c_str(), cmd_buff[3]);
37 } else { 42 } else {
38 ERROR_LOG(OSHLE, "Service %s does not exist", port_name.c_str()); 43 ERROR_LOG(OSHLE, "(UNIMPLEMENTED) called port=%s", port_name.c_str());
39 res = -1; 44 res = -1;
40 } 45 }
41 cmd_buff[1] = res; 46 cmd_buff[1] = res;
42
43 //return res;
44} 47}
45 48
46const Interface::FunctionInfo FunctionTable[] = { 49const Interface::FunctionInfo FunctionTable[] = {
47 {0x00010002, Initialize, "Initialize"}, 50 {0x00010002, Initialize, "Initialize"},
48 {0x00020000, GetProcSemaphore, "GetProcSemaphore"}, 51 {0x00020000, GetProcSemaphore, "GetProcSemaphore"},
49 {0x00030100, NULL, "RegisterService"}, 52 {0x00030100, nullptr, "RegisterService"},
50 {0x000400C0, NULL, "UnregisterService"}, 53 {0x000400C0, nullptr, "UnregisterService"},
51 {0x00050100, GetServiceHandle, "GetServiceHandle"}, 54 {0x00050100, GetServiceHandle, "GetServiceHandle"},
52}; 55};
53 56