summaryrefslogtreecommitdiff
path: root/src/core/hle/svc.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/hle/svc.cpp')
-rw-r--r--src/core/hle/svc.cpp54
1 files changed, 27 insertions, 27 deletions
diff --git a/src/core/hle/svc.cpp b/src/core/hle/svc.cpp
index b99c301d4..db0c42e74 100644
--- a/src/core/hle/svc.cpp
+++ b/src/core/hle/svc.cpp
@@ -31,7 +31,7 @@ enum ControlMemoryOperation {
31 31
32/// Map application or GSP heap memory 32/// Map application or GSP heap memory
33static Result ControlMemory(u32* out_addr, u32 operation, u32 addr0, u32 addr1, u32 size, u32 permissions) { 33static Result ControlMemory(u32* out_addr, u32 operation, u32 addr0, u32 addr1, u32 size, u32 permissions) {
34 DEBUG_LOG(SVC,"called operation=0x%08X, addr0=0x%08X, addr1=0x%08X, size=%08X, permissions=0x%08X", 34 LOG_TRACE(Kernel_SVC,"called operation=0x%08X, addr0=0x%08X, addr1=0x%08X, size=%08X, permissions=0x%08X",
35 operation, addr0, addr1, size, permissions); 35 operation, addr0, addr1, size, permissions);
36 36
37 switch (operation) { 37 switch (operation) {
@@ -48,14 +48,14 @@ static Result ControlMemory(u32* out_addr, u32 operation, u32 addr0, u32 addr1,
48 48
49 // Unknown ControlMemory operation 49 // Unknown ControlMemory operation
50 default: 50 default:
51 ERROR_LOG(SVC, "unknown operation=0x%08X", operation); 51 LOG_ERROR(Kernel_SVC, "unknown operation=0x%08X", operation);
52 } 52 }
53 return 0; 53 return 0;
54} 54}
55 55
56/// Maps a memory block to specified address 56/// Maps a memory block to specified address
57static Result MapMemoryBlock(Handle handle, u32 addr, u32 permissions, u32 other_permissions) { 57static Result MapMemoryBlock(Handle handle, u32 addr, u32 permissions, u32 other_permissions) {
58 DEBUG_LOG(SVC, "called memblock=0x%08X, addr=0x%08X, mypermissions=0x%08X, otherpermission=%d", 58 LOG_TRACE(Kernel_SVC, "called memblock=0x%08X, addr=0x%08X, mypermissions=0x%08X, otherpermission=%d",
59 handle, addr, permissions, other_permissions); 59 handle, addr, permissions, other_permissions);
60 60
61 Kernel::MemoryPermission permissions_type = static_cast<Kernel::MemoryPermission>(permissions); 61 Kernel::MemoryPermission permissions_type = static_cast<Kernel::MemoryPermission>(permissions);
@@ -68,7 +68,7 @@ static Result MapMemoryBlock(Handle handle, u32 addr, u32 permissions, u32 other
68 static_cast<Kernel::MemoryPermission>(other_permissions)); 68 static_cast<Kernel::MemoryPermission>(other_permissions));
69 break; 69 break;
70 default: 70 default:
71 ERROR_LOG(OSHLE, "unknown permissions=0x%08X", permissions); 71 LOG_ERROR(Kernel_SVC, "unknown permissions=0x%08X", permissions);
72 } 72 }
73 return 0; 73 return 0;
74} 74}
@@ -77,7 +77,7 @@ static Result MapMemoryBlock(Handle handle, u32 addr, u32 permissions, u32 other
77static Result ConnectToPort(Handle* out, const char* port_name) { 77static Result ConnectToPort(Handle* out, const char* port_name) {
78 Service::Interface* service = Service::g_manager->FetchFromPortName(port_name); 78 Service::Interface* service = Service::g_manager->FetchFromPortName(port_name);
79 79
80 DEBUG_LOG(SVC, "called port_name=%s", port_name); 80 LOG_TRACE(Kernel_SVC, "called port_name=%s", port_name);
81 _assert_msg_(KERNEL, (service != nullptr), "called, but service is not implemented!"); 81 _assert_msg_(KERNEL, (service != nullptr), "called, but service is not implemented!");
82 82
83 *out = service->GetHandle(); 83 *out = service->GetHandle();
@@ -95,7 +95,7 @@ static Result SendSyncRequest(Handle handle) {
95 Kernel::Object* object = Kernel::g_object_pool.GetFast<Kernel::Object>(handle); 95 Kernel::Object* object = Kernel::g_object_pool.GetFast<Kernel::Object>(handle);
96 96
97 _assert_msg_(KERNEL, (object != nullptr), "called, but kernel object is nullptr!"); 97 _assert_msg_(KERNEL, (object != nullptr), "called, but kernel object is nullptr!");
98 DEBUG_LOG(SVC, "called handle=0x%08X(%s)", handle, object->GetTypeName().c_str()); 98 LOG_TRACE(Kernel_SVC, "called handle=0x%08X(%s)", handle, object->GetTypeName().c_str());
99 99
100 ResultVal<bool> wait = object->SyncRequest(); 100 ResultVal<bool> wait = object->SyncRequest();
101 if (wait.Succeeded() && *wait) { 101 if (wait.Succeeded() && *wait) {
@@ -108,7 +108,7 @@ static Result SendSyncRequest(Handle handle) {
108/// Close a handle 108/// Close a handle
109static Result CloseHandle(Handle handle) { 109static Result CloseHandle(Handle handle) {
110 // ImplementMe 110 // ImplementMe
111 ERROR_LOG(SVC, "(UNIMPLEMENTED) called handle=0x%08X", handle); 111 LOG_ERROR(Kernel_SVC, "(UNIMPLEMENTED) called handle=0x%08X", handle);
112 return 0; 112 return 0;
113} 113}
114 114
@@ -121,9 +121,9 @@ static Result WaitSynchronization1(Handle handle, s64 nano_seconds) {
121 return InvalidHandle(ErrorModule::Kernel).raw; 121 return InvalidHandle(ErrorModule::Kernel).raw;
122 } 122 }
123 Kernel::Object* object = Kernel::g_object_pool.GetFast<Kernel::Object>(handle); 123 Kernel::Object* object = Kernel::g_object_pool.GetFast<Kernel::Object>(handle);
124 _dbg_assert_(KERNEL, object != nullptr); 124 _dbg_assert_(Kernel, object != nullptr);
125 125
126 DEBUG_LOG(SVC, "called handle=0x%08X(%s:%s), nanoseconds=%lld", handle, object->GetTypeName().c_str(), 126 LOG_TRACE(Kernel_SVC, "called handle=0x%08X(%s:%s), nanoseconds=%lld", handle, object->GetTypeName().c_str(),
127 object->GetName().c_str(), nano_seconds); 127 object->GetName().c_str(), nano_seconds);
128 128
129 ResultVal<bool> wait = object->WaitSynchronization(); 129 ResultVal<bool> wait = object->WaitSynchronization();
@@ -143,7 +143,7 @@ static Result WaitSynchronizationN(s32* out, Handle* handles, s32 handle_count,
143 bool unlock_all = true; 143 bool unlock_all = true;
144 bool wait_infinite = (nano_seconds == -1); // Used to wait until a thread has terminated 144 bool wait_infinite = (nano_seconds == -1); // Used to wait until a thread has terminated
145 145
146 DEBUG_LOG(SVC, "called handle_count=%d, wait_all=%s, nanoseconds=%lld", 146 LOG_TRACE(Kernel_SVC, "called handle_count=%d, wait_all=%s, nanoseconds=%lld",
147 handle_count, (wait_all ? "true" : "false"), nano_seconds); 147 handle_count, (wait_all ? "true" : "false"), nano_seconds);
148 148
149 // Iterate through each handle, synchronize kernel object 149 // Iterate through each handle, synchronize kernel object
@@ -153,7 +153,7 @@ static Result WaitSynchronizationN(s32* out, Handle* handles, s32 handle_count,
153 } 153 }
154 Kernel::Object* object = Kernel::g_object_pool.GetFast<Kernel::Object>(handles[i]); 154 Kernel::Object* object = Kernel::g_object_pool.GetFast<Kernel::Object>(handles[i]);
155 155
156 DEBUG_LOG(SVC, "\thandle[%d] = 0x%08X(%s:%s)", i, handles[i], object->GetTypeName().c_str(), 156 LOG_TRACE(Kernel_SVC, "\thandle[%d] = 0x%08X(%s:%s)", i, handles[i], object->GetTypeName().c_str(),
157 object->GetName().c_str()); 157 object->GetName().c_str());
158 158
159 // TODO(yuriks): Verify how the real function behaves when an error happens here 159 // TODO(yuriks): Verify how the real function behaves when an error happens here
@@ -181,7 +181,7 @@ static Result WaitSynchronizationN(s32* out, Handle* handles, s32 handle_count,
181 181
182/// Create an address arbiter (to allocate access to shared resources) 182/// Create an address arbiter (to allocate access to shared resources)
183static Result CreateAddressArbiter(u32* arbiter) { 183static Result CreateAddressArbiter(u32* arbiter) {
184 DEBUG_LOG(SVC, "called"); 184 LOG_TRACE(Kernel_SVC, "called");
185 Handle handle = Kernel::CreateAddressArbiter(); 185 Handle handle = Kernel::CreateAddressArbiter();
186 *arbiter = handle; 186 *arbiter = handle;
187 return 0; 187 return 0;
@@ -189,7 +189,7 @@ static Result CreateAddressArbiter(u32* arbiter) {
189 189
190/// Arbitrate address 190/// Arbitrate address
191static Result ArbitrateAddress(Handle arbiter, u32 address, u32 type, u32 value, s64 nanoseconds) { 191static Result ArbitrateAddress(Handle arbiter, u32 address, u32 type, u32 value, s64 nanoseconds) {
192 DEBUG_LOG(SVC, "called handle=0x%08X, address=0x%08X, type=0x%08X, value=0x%08X", arbiter, 192 LOG_TRACE(Kernel_SVC, "called handle=0x%08X, address=0x%08X, type=0x%08X, value=0x%08X", arbiter,
193 address, type, value); 193 address, type, value);
194 return Kernel::ArbitrateAddress(arbiter, static_cast<Kernel::ArbitrationType>(type), 194 return Kernel::ArbitrateAddress(arbiter, static_cast<Kernel::ArbitrationType>(type),
195 address, value).raw; 195 address, value).raw;
@@ -197,7 +197,7 @@ static Result ArbitrateAddress(Handle arbiter, u32 address, u32 type, u32 value,
197 197
198/// Used to output a message on a debug hardware unit - does nothing on a retail unit 198/// Used to output a message on a debug hardware unit - does nothing on a retail unit
199static void OutputDebugString(const char* string) { 199static void OutputDebugString(const char* string) {
200 OS_LOG(SVC, "%s", string); 200 LOG_DEBUG(Debug_Emulated, "%s", string);
201} 201}
202 202
203/// Get resource limit 203/// Get resource limit
@@ -206,14 +206,14 @@ static Result GetResourceLimit(Handle* resource_limit, Handle process) {
206 // 0xFFFF8001 is a handle alias for the current KProcess, and 0xFFFF8000 is a handle alias for 206 // 0xFFFF8001 is a handle alias for the current KProcess, and 0xFFFF8000 is a handle alias for
207 // the current KThread. 207 // the current KThread.
208 *resource_limit = 0xDEADBEEF; 208 *resource_limit = 0xDEADBEEF;
209 ERROR_LOG(SVC, "(UNIMPLEMENTED) called process=0x%08X", process); 209 LOG_ERROR(Kernel_SVC, "(UNIMPLEMENTED) called process=0x%08X", process);
210 return 0; 210 return 0;
211} 211}
212 212
213/// Get resource limit current values 213/// Get resource limit current values
214static Result GetResourceLimitCurrentValues(s64* values, Handle resource_limit, void* names, 214static Result GetResourceLimitCurrentValues(s64* values, Handle resource_limit, void* names,
215 s32 name_count) { 215 s32 name_count) {
216 ERROR_LOG(SVC, "(UNIMPLEMENTED) called resource_limit=%08X, names=%s, name_count=%d", 216 LOG_ERROR(Kernel_SVC, "(UNIMPLEMENTED) called resource_limit=%08X, names=%s, name_count=%d",
217 resource_limit, names, name_count); 217 resource_limit, names, name_count);
218 Memory::Write32(Core::g_app_core->GetReg(0), 0); // Normmatt: Set used memory to 0 for now 218 Memory::Write32(Core::g_app_core->GetReg(0), 0); // Normmatt: Set used memory to 0 for now
219 return 0; 219 return 0;
@@ -234,7 +234,7 @@ static Result CreateThread(u32 priority, u32 entry_point, u32 arg, u32 stack_top
234 234
235 Core::g_app_core->SetReg(1, thread); 235 Core::g_app_core->SetReg(1, thread);
236 236
237 DEBUG_LOG(SVC, "called entrypoint=0x%08X (%s), arg=0x%08X, stacktop=0x%08X, " 237 LOG_TRACE(Kernel_SVC, "called entrypoint=0x%08X (%s), arg=0x%08X, stacktop=0x%08X, "
238 "threadpriority=0x%08X, processorid=0x%08X : created handle=0x%08X", entry_point, 238 "threadpriority=0x%08X, processorid=0x%08X : created handle=0x%08X", entry_point,
239 name.c_str(), arg, stack_top, priority, processor_id, thread); 239 name.c_str(), arg, stack_top, priority, processor_id, thread);
240 240
@@ -245,7 +245,7 @@ static Result CreateThread(u32 priority, u32 entry_point, u32 arg, u32 stack_top
245static u32 ExitThread() { 245static u32 ExitThread() {
246 Handle thread = Kernel::GetCurrentThreadHandle(); 246 Handle thread = Kernel::GetCurrentThreadHandle();
247 247
248 DEBUG_LOG(SVC, "called, pc=0x%08X", Core::g_app_core->GetPC()); // PC = 0x0010545C 248 LOG_TRACE(Kernel_SVC, "called, pc=0x%08X", Core::g_app_core->GetPC()); // PC = 0x0010545C
249 249
250 Kernel::StopThread(thread, __func__); 250 Kernel::StopThread(thread, __func__);
251 HLE::Reschedule(__func__); 251 HLE::Reschedule(__func__);
@@ -269,42 +269,42 @@ static Result SetThreadPriority(Handle handle, s32 priority) {
269/// Create a mutex 269/// Create a mutex
270static Result CreateMutex(Handle* mutex, u32 initial_locked) { 270static Result CreateMutex(Handle* mutex, u32 initial_locked) {
271 *mutex = Kernel::CreateMutex((initial_locked != 0)); 271 *mutex = Kernel::CreateMutex((initial_locked != 0));
272 DEBUG_LOG(SVC, "called initial_locked=%s : created handle=0x%08X", 272 LOG_TRACE(Kernel_SVC, "called initial_locked=%s : created handle=0x%08X",
273 initial_locked ? "true" : "false", *mutex); 273 initial_locked ? "true" : "false", *mutex);
274 return 0; 274 return 0;
275} 275}
276 276
277/// Release a mutex 277/// Release a mutex
278static Result ReleaseMutex(Handle handle) { 278static Result ReleaseMutex(Handle handle) {
279 DEBUG_LOG(SVC, "called handle=0x%08X", handle); 279 LOG_TRACE(Kernel_SVC, "called handle=0x%08X", handle);
280 ResultCode res = Kernel::ReleaseMutex(handle); 280 ResultCode res = Kernel::ReleaseMutex(handle);
281 return res.raw; 281 return res.raw;
282} 282}
283 283
284/// Get the ID for the specified thread. 284/// Get the ID for the specified thread.
285static Result GetThreadId(u32* thread_id, Handle handle) { 285static Result GetThreadId(u32* thread_id, Handle handle) {
286 DEBUG_LOG(SVC, "called thread=0x%08X", handle); 286 LOG_TRACE(Kernel_SVC, "called thread=0x%08X", handle);
287 ResultCode result = Kernel::GetThreadId(thread_id, handle); 287 ResultCode result = Kernel::GetThreadId(thread_id, handle);
288 return result.raw; 288 return result.raw;
289} 289}
290 290
291/// Query memory 291/// Query memory
292static Result QueryMemory(void* info, void* out, u32 addr) { 292static Result QueryMemory(void* info, void* out, u32 addr) {
293 ERROR_LOG(SVC, "(UNIMPLEMENTED) called addr=0x%08X", addr); 293 LOG_ERROR(Kernel_SVC, "(UNIMPLEMENTED) called addr=0x%08X", addr);
294 return 0; 294 return 0;
295} 295}
296 296
297/// Create an event 297/// Create an event
298static Result CreateEvent(Handle* evt, u32 reset_type) { 298static Result CreateEvent(Handle* evt, u32 reset_type) {
299 *evt = Kernel::CreateEvent((ResetType)reset_type); 299 *evt = Kernel::CreateEvent((ResetType)reset_type);
300 DEBUG_LOG(SVC, "called reset_type=0x%08X : created handle=0x%08X", 300 LOG_TRACE(Kernel_SVC, "called reset_type=0x%08X : created handle=0x%08X",
301 reset_type, *evt); 301 reset_type, *evt);
302 return 0; 302 return 0;
303} 303}
304 304
305/// Duplicates a kernel handle 305/// Duplicates a kernel handle
306static Result DuplicateHandle(Handle* out, Handle handle) { 306static Result DuplicateHandle(Handle* out, Handle handle) {
307 DEBUG_LOG(SVC, "called handle=0x%08X", handle); 307 LOG_WARNING(Kernel_SVC, "(STUBBED) called handle=0x%08X", handle);
308 308
309 // Translate kernel handles -> real handles 309 // Translate kernel handles -> real handles
310 if (handle == Kernel::CurrentThread) { 310 if (handle == Kernel::CurrentThread) {
@@ -321,19 +321,19 @@ static Result DuplicateHandle(Handle* out, Handle handle) {
321 321
322/// Signals an event 322/// Signals an event
323static Result SignalEvent(Handle evt) { 323static Result SignalEvent(Handle evt) {
324 DEBUG_LOG(SVC, "called event=0x%08X", evt); 324 LOG_TRACE(Kernel_SVC, "called event=0x%08X", evt);
325 return Kernel::SignalEvent(evt).raw; 325 return Kernel::SignalEvent(evt).raw;
326} 326}
327 327
328/// Clears an event 328/// Clears an event
329static Result ClearEvent(Handle evt) { 329static Result ClearEvent(Handle evt) {
330 DEBUG_LOG(SVC, "called event=0x%08X", evt); 330 LOG_TRACE(Kernel_SVC, "called event=0x%08X", evt);
331 return Kernel::ClearEvent(evt).raw; 331 return Kernel::ClearEvent(evt).raw;
332} 332}
333 333
334/// Sleep the current thread 334/// Sleep the current thread
335static void SleepThread(s64 nanoseconds) { 335static void SleepThread(s64 nanoseconds) {
336 DEBUG_LOG(SVC, "called nanoseconds=%lld", nanoseconds); 336 LOG_TRACE(Kernel_SVC, "called nanoseconds=%lld", nanoseconds);
337 337
338 // Check for next thread to schedule 338 // Check for next thread to schedule
339 HLE::Reschedule(__func__); 339 HLE::Reschedule(__func__);