summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar bunnei2014-06-02 20:38:34 -0400
committerGravatar bunnei2014-06-02 20:38:34 -0400
commitb78aff85857a3a356fdf11e1dbc4e5f52490676e (patch)
tree0cb0b9855ae2eed179fb1401e3edbcbd7d59f6f3 /src
parentkernel: moved position of * for GetTypeName and GetName (diff)
downloadyuzu-b78aff85857a3a356fdf11e1dbc4e5f52490676e.tar.gz
yuzu-b78aff85857a3a356fdf11e1dbc4e5f52490676e.tar.xz
yuzu-b78aff85857a3a356fdf11e1dbc4e5f52490676e.zip
svc: added optional name field to Event and Mutex (used for debugging)
Diffstat (limited to 'src')
-rw-r--r--src/core/hle/kernel/event.cpp11
-rw-r--r--src/core/hle/kernel/event.h3
-rw-r--r--src/core/hle/kernel/mutex.cpp12
-rw-r--r--src/core/hle/kernel/mutex.h3
-rw-r--r--src/core/hle/service/apt.cpp6
-rw-r--r--src/core/hle/service/srv.cpp2
6 files changed, 25 insertions, 12 deletions
diff --git a/src/core/hle/kernel/event.cpp b/src/core/hle/kernel/event.cpp
index e84d0b49e..70e50115d 100644
--- a/src/core/hle/kernel/event.cpp
+++ b/src/core/hle/kernel/event.cpp
@@ -15,6 +15,7 @@ namespace Kernel {
15class Event : public Object { 15class Event : public Object {
16public: 16public:
17 const char* GetTypeName() { return "Event"; } 17 const char* GetTypeName() { return "Event"; }
18 const char* GetName() { return name.c_str(); }
18 19
19 static Kernel::HandleType GetStaticHandleType() { return Kernel::HandleType::Event; } 20 static Kernel::HandleType GetStaticHandleType() { return Kernel::HandleType::Event; }
20 Kernel::HandleType GetHandleType() const { return Kernel::HandleType::Event; } 21 Kernel::HandleType GetHandleType() const { return Kernel::HandleType::Event; }
@@ -24,6 +25,7 @@ public:
24 25
25 bool locked; ///< Current locked state 26 bool locked; ///< Current locked state
26 bool permanent_locked; ///< Hack - to set event permanent state (for easy passthrough) 27 bool permanent_locked; ///< Hack - to set event permanent state (for easy passthrough)
28 std::string name; ///< Name of event (optional)
27 29
28 /** 30 /**
29 * Synchronize kernel object 31 * Synchronize kernel object
@@ -98,9 +100,10 @@ Result ClearEvent(Handle handle) {
98 * Creates an event 100 * Creates an event
99 * @param handle Reference to handle for the newly created mutex 101 * @param handle Reference to handle for the newly created mutex
100 * @param reset_type ResetType describing how to create event 102 * @param reset_type ResetType describing how to create event
103 * @param name Optional name of event
101 * @return Newly created Event object 104 * @return Newly created Event object
102 */ 105 */
103Event* CreateEvent(Handle& handle, const ResetType reset_type) { 106Event* CreateEvent(Handle& handle, const ResetType reset_type, const std::string name) {
104 Event* evt = new Event; 107 Event* evt = new Event;
105 108
106 handle = Kernel::g_object_pool.Create(evt); 109 handle = Kernel::g_object_pool.Create(evt);
@@ -108,6 +111,7 @@ Event* CreateEvent(Handle& handle, const ResetType reset_type) {
108 evt->locked = true; 111 evt->locked = true;
109 evt->permanent_locked = false; 112 evt->permanent_locked = false;
110 evt->reset_type = evt->intitial_reset_type = reset_type; 113 evt->reset_type = evt->intitial_reset_type = reset_type;
114 evt->name = name;
111 115
112 return evt; 116 return evt;
113} 117}
@@ -115,11 +119,12 @@ Event* CreateEvent(Handle& handle, const ResetType reset_type) {
115/** 119/**
116 * Creates an event 120 * Creates an event
117 * @param reset_type ResetType describing how to create event 121 * @param reset_type ResetType describing how to create event
122 * @param name Optional name of event
118 * @return Handle to newly created Event object 123 * @return Handle to newly created Event object
119 */ 124 */
120Handle CreateEvent(const ResetType reset_type) { 125Handle CreateEvent(const ResetType reset_type, const std::string name) {
121 Handle handle; 126 Handle handle;
122 Event* evt = CreateEvent(handle, reset_type); 127 Event* evt = CreateEvent(handle, reset_type, name);
123 return handle; 128 return handle;
124} 129}
125 130
diff --git a/src/core/hle/kernel/event.h b/src/core/hle/kernel/event.h
index f91a72c1c..eed09f0e3 100644
--- a/src/core/hle/kernel/event.h
+++ b/src/core/hle/kernel/event.h
@@ -37,8 +37,9 @@ Result ClearEvent(Handle handle);
37/** 37/**
38 * Creates an event 38 * Creates an event
39 * @param reset_type ResetType describing how to create event 39 * @param reset_type ResetType describing how to create event
40 * @param name Optional name of event
40 * @return Handle to newly created Event object 41 * @return Handle to newly created Event object
41 */ 42 */
42Handle CreateEvent(const ResetType reset_type); 43Handle CreateEvent(const ResetType reset_type, const std::string name="Unknown");
43 44
44} // namespace 45} // namespace
diff --git a/src/core/hle/kernel/mutex.cpp b/src/core/hle/kernel/mutex.cpp
index 5ac88cd85..7e60fbfe0 100644
--- a/src/core/hle/kernel/mutex.cpp
+++ b/src/core/hle/kernel/mutex.cpp
@@ -16,6 +16,7 @@ namespace Kernel {
16class Mutex : public Object { 16class Mutex : public Object {
17public: 17public:
18 const char* GetTypeName() { return "Mutex"; } 18 const char* GetTypeName() { return "Mutex"; }
19 const char* GetName() { return name.c_str(); }
19 20
20 static Kernel::HandleType GetStaticHandleType() { return Kernel::HandleType::Mutex; } 21 static Kernel::HandleType GetStaticHandleType() { return Kernel::HandleType::Mutex; }
21 Kernel::HandleType GetHandleType() const { return Kernel::HandleType::Mutex; } 22 Kernel::HandleType GetHandleType() const { return Kernel::HandleType::Mutex; }
@@ -24,6 +25,7 @@ public:
24 bool locked; ///< Current locked state 25 bool locked; ///< Current locked state
25 Handle lock_thread; ///< Handle to thread that currently has mutex 26 Handle lock_thread; ///< Handle to thread that currently has mutex
26 std::vector<Handle> waiting_threads; ///< Threads that are waiting for the mutex 27 std::vector<Handle> waiting_threads; ///< Threads that are waiting for the mutex
28 std::string name; ///< Name of mutex (optional)
27 29
28 /** 30 /**
29 * Synchronize kernel object 31 * Synchronize kernel object
@@ -128,13 +130,15 @@ Result ReleaseMutex(Handle handle) {
128 * Creates a mutex 130 * Creates a mutex
129 * @param handle Reference to handle for the newly created mutex 131 * @param handle Reference to handle for the newly created mutex
130 * @param initial_locked Specifies if the mutex should be locked initially 132 * @param initial_locked Specifies if the mutex should be locked initially
133 * @param name Optional name of mutex
131 * @return Pointer to new Mutex object 134 * @return Pointer to new Mutex object
132 */ 135 */
133Mutex* CreateMutex(Handle& handle, bool initial_locked) { 136Mutex* CreateMutex(Handle& handle, bool initial_locked, const std::string name) {
134 Mutex* mutex = new Mutex; 137 Mutex* mutex = new Mutex;
135 handle = Kernel::g_object_pool.Create(mutex); 138 handle = Kernel::g_object_pool.Create(mutex);
136 139
137 mutex->locked = mutex->initial_locked = initial_locked; 140 mutex->locked = mutex->initial_locked = initial_locked;
141 mutex->name = name;
138 142
139 // Acquire mutex with current thread if initialized as locked... 143 // Acquire mutex with current thread if initialized as locked...
140 if (mutex->locked) { 144 if (mutex->locked) {
@@ -150,10 +154,12 @@ Mutex* CreateMutex(Handle& handle, bool initial_locked) {
150/** 154/**
151 * Creates a mutex 155 * Creates a mutex
152 * @param initial_locked Specifies if the mutex should be locked initially 156 * @param initial_locked Specifies if the mutex should be locked initially
157 * @param name Optional name of mutex
158 * @return Handle to newly created object
153 */ 159 */
154Handle CreateMutex(bool initial_locked) { 160Handle CreateMutex(bool initial_locked, std::string name) {
155 Handle handle; 161 Handle handle;
156 Mutex* mutex = CreateMutex(handle, initial_locked); 162 Mutex* mutex = CreateMutex(handle, initial_locked, name);
157 return handle; 163 return handle;
158} 164}
159 165
diff --git a/src/core/hle/kernel/mutex.h b/src/core/hle/kernel/mutex.h
index 4cd266725..fde5549fa 100644
--- a/src/core/hle/kernel/mutex.h
+++ b/src/core/hle/kernel/mutex.h
@@ -20,8 +20,9 @@ Result ReleaseMutex(Handle handle);
20/** 20/**
21 * Creates a mutex 21 * Creates a mutex
22 * @param initial_locked Specifies if the mutex should be locked initially 22 * @param initial_locked Specifies if the mutex should be locked initially
23 * @param name Optional name of mutex
23 * @return Handle to newly created object 24 * @return Handle to newly created object
24 */ 25 */
25Handle CreateMutex(bool initial_locked); 26Handle CreateMutex(bool initial_locked, const std::string name="Unknown");
26 27
27} // namespace 28} // namespace
diff --git a/src/core/hle/service/apt.cpp b/src/core/hle/service/apt.cpp
index 10d9a94bd..33ee1ec8f 100644
--- a/src/core/hle/service/apt.cpp
+++ b/src/core/hle/service/apt.cpp
@@ -19,8 +19,8 @@ void Initialize(Service::Interface* self) {
19 u32* cmd_buff = Service::GetCommandBuffer(); 19 u32* cmd_buff = Service::GetCommandBuffer();
20 DEBUG_LOG(KERNEL, "called"); 20 DEBUG_LOG(KERNEL, "called");
21 21
22 cmd_buff[3] = Kernel::CreateEvent(RESETTYPE_ONESHOT); // APT menu event handle 22 cmd_buff[3] = Kernel::CreateEvent(RESETTYPE_ONESHOT, "APT_U:Menu"); // APT menu event handle
23 cmd_buff[4] = Kernel::CreateEvent(RESETTYPE_ONESHOT); // APT pause event handle 23 cmd_buff[4] = Kernel::CreateEvent(RESETTYPE_ONESHOT, "APT_U:Pause"); // APT pause event handle
24 24
25 Kernel::SetEventLocked(cmd_buff[3], true); 25 Kernel::SetEventLocked(cmd_buff[3], true);
26 Kernel::SetEventLocked(cmd_buff[4], false); // Fire start event 26 Kernel::SetEventLocked(cmd_buff[4], false); // Fire start event
@@ -32,7 +32,7 @@ void GetLockHandle(Service::Interface* self) {
32 u32* cmd_buff = Service::GetCommandBuffer(); 32 u32* cmd_buff = Service::GetCommandBuffer();
33 u32 flags = cmd_buff[1]; // TODO(bunnei): Figure out the purpose of the flag field 33 u32 flags = cmd_buff[1]; // TODO(bunnei): Figure out the purpose of the flag field
34 cmd_buff[1] = 0; // No error 34 cmd_buff[1] = 0; // No error
35 cmd_buff[5] = Kernel::CreateMutex(false); 35 cmd_buff[5] = Kernel::CreateMutex(false, "APT_U:Lock");
36 DEBUG_LOG(KERNEL, "called handle=0x%08X", cmd_buff[5]); 36 DEBUG_LOG(KERNEL, "called handle=0x%08X", cmd_buff[5]);
37} 37}
38 38
diff --git a/src/core/hle/service/srv.cpp b/src/core/hle/service/srv.cpp
index f1940e6f5..07e2009a0 100644
--- a/src/core/hle/service/srv.cpp
+++ b/src/core/hle/service/srv.cpp
@@ -17,7 +17,7 @@ Handle g_mutex = 0;
17void Initialize(Service::Interface* self) { 17void Initialize(Service::Interface* self) {
18 DEBUG_LOG(OSHLE, "called"); 18 DEBUG_LOG(OSHLE, "called");
19 if (!g_mutex) { 19 if (!g_mutex) {
20 g_mutex = Kernel::CreateMutex(false); 20 g_mutex = Kernel::CreateMutex(true, "SRV:Lock");
21 } 21 }
22} 22}
23 23