summaryrefslogtreecommitdiff
path: root/src/core/hle/kernel
diff options
context:
space:
mode:
authorGravatar bunnei2018-07-03 00:26:45 -0400
committerGravatar GitHub2018-07-03 00:26:45 -0400
commit15e68cdbaac38bbf13cd4eb0d70d1e34b2fd4256 (patch)
tree9d072a572c0037a44e1e35aeffc242d3772a383c /src/core/hle/kernel
parentMerge pull request #612 from bunnei/fix-cull (diff)
parentFix build and address review feedback (diff)
downloadyuzu-15e68cdbaac38bbf13cd4eb0d70d1e34b2fd4256.tar.gz
yuzu-15e68cdbaac38bbf13cd4eb0d70d1e34b2fd4256.tar.xz
yuzu-15e68cdbaac38bbf13cd4eb0d70d1e34b2fd4256.zip
Merge pull request #607 from jroweboy/logging
Logging - Customizable backends
Diffstat (limited to 'src/core/hle/kernel')
-rw-r--r--src/core/hle/kernel/handle_table.cpp4
-rw-r--r--src/core/hle/kernel/hle_ipc.cpp8
-rw-r--r--src/core/hle/kernel/process.cpp8
-rw-r--r--src/core/hle/kernel/resource_limit.cpp6
-rw-r--r--src/core/hle/kernel/scheduler.cpp6
-rw-r--r--src/core/hle/kernel/server_session.cpp6
-rw-r--r--src/core/hle/kernel/shared_memory.cpp10
-rw-r--r--src/core/hle/kernel/svc.cpp139
-rw-r--r--src/core/hle/kernel/thread.cpp12
-rw-r--r--src/core/hle/kernel/timer.cpp4
-rw-r--r--src/core/hle/kernel/vm_manager.cpp20
11 files changed, 110 insertions, 113 deletions
diff --git a/src/core/hle/kernel/handle_table.cpp b/src/core/hle/kernel/handle_table.cpp
index f7a9920d8..7dd67f80f 100644
--- a/src/core/hle/kernel/handle_table.cpp
+++ b/src/core/hle/kernel/handle_table.cpp
@@ -26,7 +26,7 @@ ResultVal<Handle> HandleTable::Create(SharedPtr<Object> obj) {
26 26
27 u16 slot = next_free_slot; 27 u16 slot = next_free_slot;
28 if (slot >= generations.size()) { 28 if (slot >= generations.size()) {
29 NGLOG_ERROR(Kernel, "Unable to allocate Handle, too many slots in use."); 29 LOG_ERROR(Kernel, "Unable to allocate Handle, too many slots in use.");
30 return ERR_OUT_OF_HANDLES; 30 return ERR_OUT_OF_HANDLES;
31 } 31 }
32 next_free_slot = generations[slot]; 32 next_free_slot = generations[slot];
@@ -48,7 +48,7 @@ ResultVal<Handle> HandleTable::Create(SharedPtr<Object> obj) {
48ResultVal<Handle> HandleTable::Duplicate(Handle handle) { 48ResultVal<Handle> HandleTable::Duplicate(Handle handle) {
49 SharedPtr<Object> object = GetGeneric(handle); 49 SharedPtr<Object> object = GetGeneric(handle);
50 if (object == nullptr) { 50 if (object == nullptr) {
51 NGLOG_ERROR(Kernel, "Tried to duplicate invalid handle: {:08X}", handle); 51 LOG_ERROR(Kernel, "Tried to duplicate invalid handle: {:08X}", handle);
52 return ERR_INVALID_HANDLE; 52 return ERR_INVALID_HANDLE;
53 } 53 }
54 return Create(std::move(object)); 54 return Create(std::move(object));
diff --git a/src/core/hle/kernel/hle_ipc.cpp b/src/core/hle/kernel/hle_ipc.cpp
index b0d83f401..609cdbff2 100644
--- a/src/core/hle/kernel/hle_ipc.cpp
+++ b/src/core/hle/kernel/hle_ipc.cpp
@@ -120,7 +120,7 @@ void HLERequestContext::ParseCommandBuffer(u32_le* src_cmdbuf, bool incoming) {
120 std::make_shared<IPC::DomainMessageHeader>(rp.PopRaw<IPC::DomainMessageHeader>()); 120 std::make_shared<IPC::DomainMessageHeader>(rp.PopRaw<IPC::DomainMessageHeader>());
121 } else { 121 } else {
122 if (Session()->IsDomain()) 122 if (Session()->IsDomain())
123 NGLOG_WARNING(IPC, "Domain request has no DomainMessageHeader!"); 123 LOG_WARNING(IPC, "Domain request has no DomainMessageHeader!");
124 } 124 }
125 } 125 }
126 126
@@ -272,15 +272,15 @@ std::vector<u8> HLERequestContext::ReadBuffer(int buffer_index) const {
272 272
273size_t HLERequestContext::WriteBuffer(const void* buffer, size_t size, int buffer_index) const { 273size_t HLERequestContext::WriteBuffer(const void* buffer, size_t size, int buffer_index) const {
274 if (size == 0) { 274 if (size == 0) {
275 NGLOG_WARNING(Core, "skip empty buffer write"); 275 LOG_WARNING(Core, "skip empty buffer write");
276 return 0; 276 return 0;
277 } 277 }
278 278
279 const bool is_buffer_b{BufferDescriptorB().size() && BufferDescriptorB()[buffer_index].Size()}; 279 const bool is_buffer_b{BufferDescriptorB().size() && BufferDescriptorB()[buffer_index].Size()};
280 const size_t buffer_size{GetWriteBufferSize(buffer_index)}; 280 const size_t buffer_size{GetWriteBufferSize(buffer_index)};
281 if (size > buffer_size) { 281 if (size > buffer_size) {
282 NGLOG_CRITICAL(Core, "size ({:016X}) is greater than buffer_size ({:016X})", size, 282 LOG_CRITICAL(Core, "size ({:016X}) is greater than buffer_size ({:016X})", size,
283 buffer_size); 283 buffer_size);
284 size = buffer_size; // TODO(bunnei): This needs to be HW tested 284 size = buffer_size; // TODO(bunnei): This needs to be HW tested
285 } 285 }
286 286
diff --git a/src/core/hle/kernel/process.cpp b/src/core/hle/kernel/process.cpp
index 651d932d3..0c0506085 100644
--- a/src/core/hle/kernel/process.cpp
+++ b/src/core/hle/kernel/process.cpp
@@ -54,7 +54,7 @@ void Process::ParseKernelCaps(const u32* kernel_caps, size_t len) {
54 continue; 54 continue;
55 } else if ((type & 0xF00) == 0xE00) { // 0x0FFF 55 } else if ((type & 0xF00) == 0xE00) { // 0x0FFF
56 // Allowed interrupts list 56 // Allowed interrupts list
57 NGLOG_WARNING(Loader, "ExHeader allowed interrupts list ignored"); 57 LOG_WARNING(Loader, "ExHeader allowed interrupts list ignored");
58 } else if ((type & 0xF80) == 0xF00) { // 0x07FF 58 } else if ((type & 0xF80) == 0xF00) { // 0x07FF
59 // Allowed syscalls mask 59 // Allowed syscalls mask
60 unsigned int index = ((descriptor >> 24) & 7) * 24; 60 unsigned int index = ((descriptor >> 24) & 7) * 24;
@@ -74,7 +74,7 @@ void Process::ParseKernelCaps(const u32* kernel_caps, size_t len) {
74 } else if ((type & 0xFFE) == 0xFF8) { // 0x001F 74 } else if ((type & 0xFFE) == 0xFF8) { // 0x001F
75 // Mapped memory range 75 // Mapped memory range
76 if (i + 1 >= len || ((kernel_caps[i + 1] >> 20) & 0xFFE) != 0xFF8) { 76 if (i + 1 >= len || ((kernel_caps[i + 1] >> 20) & 0xFFE) != 0xFF8) {
77 NGLOG_WARNING(Loader, "Incomplete exheader memory range descriptor ignored."); 77 LOG_WARNING(Loader, "Incomplete exheader memory range descriptor ignored.");
78 continue; 78 continue;
79 } 79 }
80 u32 end_desc = kernel_caps[i + 1]; 80 u32 end_desc = kernel_caps[i + 1];
@@ -109,9 +109,9 @@ void Process::ParseKernelCaps(const u32* kernel_caps, size_t len) {
109 109
110 int minor = kernel_version & 0xFF; 110 int minor = kernel_version & 0xFF;
111 int major = (kernel_version >> 8) & 0xFF; 111 int major = (kernel_version >> 8) & 0xFF;
112 NGLOG_INFO(Loader, "ExHeader kernel version: {}.{}", major, minor); 112 LOG_INFO(Loader, "ExHeader kernel version: {}.{}", major, minor);
113 } else { 113 } else {
114 NGLOG_ERROR(Loader, "Unhandled kernel caps descriptor: 0x{:08X}", descriptor); 114 LOG_ERROR(Loader, "Unhandled kernel caps descriptor: 0x{:08X}", descriptor);
115 } 115 }
116 } 116 }
117} 117}
diff --git a/src/core/hle/kernel/resource_limit.cpp b/src/core/hle/kernel/resource_limit.cpp
index 0ef5fc57d..17a3e8a74 100644
--- a/src/core/hle/kernel/resource_limit.cpp
+++ b/src/core/hle/kernel/resource_limit.cpp
@@ -29,7 +29,7 @@ SharedPtr<ResourceLimit> ResourceLimit::GetForCategory(ResourceLimitCategory cat
29 case ResourceLimitCategory::OTHER: 29 case ResourceLimitCategory::OTHER:
30 return resource_limits[static_cast<u8>(category)]; 30 return resource_limits[static_cast<u8>(category)];
31 default: 31 default:
32 NGLOG_CRITICAL(Kernel, "Unknown resource limit category"); 32 LOG_CRITICAL(Kernel, "Unknown resource limit category");
33 UNREACHABLE(); 33 UNREACHABLE();
34 } 34 }
35} 35}
@@ -55,7 +55,7 @@ s32 ResourceLimit::GetCurrentResourceValue(ResourceType resource) const {
55 case ResourceType::CPUTime: 55 case ResourceType::CPUTime:
56 return current_cpu_time; 56 return current_cpu_time;
57 default: 57 default:
58 NGLOG_ERROR(Kernel, "Unknown resource type={:08X}", static_cast<u32>(resource)); 58 LOG_ERROR(Kernel, "Unknown resource type={:08X}", static_cast<u32>(resource));
59 UNIMPLEMENTED(); 59 UNIMPLEMENTED();
60 return 0; 60 return 0;
61 } 61 }
@@ -84,7 +84,7 @@ u32 ResourceLimit::GetMaxResourceValue(ResourceType resource) const {
84 case ResourceType::CPUTime: 84 case ResourceType::CPUTime:
85 return max_cpu_time; 85 return max_cpu_time;
86 default: 86 default:
87 NGLOG_ERROR(Kernel, "Unknown resource type={:08X}", static_cast<u32>(resource)); 87 LOG_ERROR(Kernel, "Unknown resource type={:08X}", static_cast<u32>(resource));
88 UNIMPLEMENTED(); 88 UNIMPLEMENTED();
89 return 0; 89 return 0;
90 } 90 }
diff --git a/src/core/hle/kernel/scheduler.cpp b/src/core/hle/kernel/scheduler.cpp
index 9cb9e0e5c..11c2cb69e 100644
--- a/src/core/hle/kernel/scheduler.cpp
+++ b/src/core/hle/kernel/scheduler.cpp
@@ -99,11 +99,11 @@ void Scheduler::Reschedule() {
99 Thread* next = PopNextReadyThread(); 99 Thread* next = PopNextReadyThread();
100 100
101 if (cur && next) { 101 if (cur && next) {
102 NGLOG_TRACE(Kernel, "context switch {} -> {}", cur->GetObjectId(), next->GetObjectId()); 102 LOG_TRACE(Kernel, "context switch {} -> {}", cur->GetObjectId(), next->GetObjectId());
103 } else if (cur) { 103 } else if (cur) {
104 NGLOG_TRACE(Kernel, "context switch {} -> idle", cur->GetObjectId()); 104 LOG_TRACE(Kernel, "context switch {} -> idle", cur->GetObjectId());
105 } else if (next) { 105 } else if (next) {
106 NGLOG_TRACE(Kernel, "context switch idle -> {}", next->GetObjectId()); 106 LOG_TRACE(Kernel, "context switch idle -> {}", next->GetObjectId());
107 } 107 }
108 108
109 SwitchContext(next); 109 SwitchContext(next);
diff --git a/src/core/hle/kernel/server_session.cpp b/src/core/hle/kernel/server_session.cpp
index bf812c543..0d5cba1d9 100644
--- a/src/core/hle/kernel/server_session.cpp
+++ b/src/core/hle/kernel/server_session.cpp
@@ -71,7 +71,7 @@ ResultCode ServerSession::HandleDomainSyncRequest(Kernel::HLERequestContext& con
71 return domain_request_handlers[object_id - 1]->HandleSyncRequest(context); 71 return domain_request_handlers[object_id - 1]->HandleSyncRequest(context);
72 72
73 case IPC::DomainMessageHeader::CommandType::CloseVirtualHandle: { 73 case IPC::DomainMessageHeader::CommandType::CloseVirtualHandle: {
74 NGLOG_DEBUG(IPC, "CloseVirtualHandle, object_id=0x{:08X}", object_id); 74 LOG_DEBUG(IPC, "CloseVirtualHandle, object_id=0x{:08X}", object_id);
75 75
76 domain_request_handlers[object_id - 1] = nullptr; 76 domain_request_handlers[object_id - 1] = nullptr;
77 77
@@ -81,8 +81,8 @@ ResultCode ServerSession::HandleDomainSyncRequest(Kernel::HLERequestContext& con
81 } 81 }
82 } 82 }
83 83
84 NGLOG_CRITICAL(IPC, "Unknown domain command={}", 84 LOG_CRITICAL(IPC, "Unknown domain command={}",
85 static_cast<int>(domain_message_header->command.Value())); 85 static_cast<int>(domain_message_header->command.Value()));
86 ASSERT(false); 86 ASSERT(false);
87 } 87 }
88 88
diff --git a/src/core/hle/kernel/shared_memory.cpp b/src/core/hle/kernel/shared_memory.cpp
index ac4921298..93f7f2772 100644
--- a/src/core/hle/kernel/shared_memory.cpp
+++ b/src/core/hle/kernel/shared_memory.cpp
@@ -107,16 +107,16 @@ ResultCode SharedMemory::Map(Process* target_process, VAddr address, MemoryPermi
107 107
108 // Error out if the requested permissions don't match what the creator process allows. 108 // Error out if the requested permissions don't match what the creator process allows.
109 if (static_cast<u32>(permissions) & ~static_cast<u32>(own_other_permissions)) { 109 if (static_cast<u32>(permissions) & ~static_cast<u32>(own_other_permissions)) {
110 NGLOG_ERROR(Kernel, "cannot map id={}, address=0x{:X} name={}, permissions don't match", 110 LOG_ERROR(Kernel, "cannot map id={}, address=0x{:X} name={}, permissions don't match",
111 GetObjectId(), address, name); 111 GetObjectId(), address, name);
112 return ERR_INVALID_COMBINATION; 112 return ERR_INVALID_COMBINATION;
113 } 113 }
114 114
115 // Error out if the provided permissions are not compatible with what the creator process needs. 115 // Error out if the provided permissions are not compatible with what the creator process needs.
116 if (other_permissions != MemoryPermission::DontCare && 116 if (other_permissions != MemoryPermission::DontCare &&
117 static_cast<u32>(this->permissions) & ~static_cast<u32>(other_permissions)) { 117 static_cast<u32>(this->permissions) & ~static_cast<u32>(other_permissions)) {
118 NGLOG_ERROR(Kernel, "cannot map id={}, address=0x{:X} name={}, permissions don't match", 118 LOG_ERROR(Kernel, "cannot map id={}, address=0x{:X} name={}, permissions don't match",
119 GetObjectId(), address, name); 119 GetObjectId(), address, name);
120 return ERR_WRONG_PERMISSION; 120 return ERR_WRONG_PERMISSION;
121 } 121 }
122 122
@@ -131,7 +131,7 @@ ResultCode SharedMemory::Map(Process* target_process, VAddr address, MemoryPermi
131 auto result = target_process->vm_manager.MapMemoryBlock( 131 auto result = target_process->vm_manager.MapMemoryBlock(
132 target_address, backing_block, backing_block_offset, size, MemoryState::Shared); 132 target_address, backing_block, backing_block_offset, size, MemoryState::Shared);
133 if (result.Failed()) { 133 if (result.Failed()) {
134 NGLOG_ERROR( 134 LOG_ERROR(
135 Kernel, 135 Kernel,
136 "cannot map id={}, target_address=0x{:X} name={}, error mapping to virtual memory", 136 "cannot map id={}, target_address=0x{:X} name={}, error mapping to virtual memory",
137 GetObjectId(), target_address, name); 137 GetObjectId(), target_address, name);
diff --git a/src/core/hle/kernel/svc.cpp b/src/core/hle/kernel/svc.cpp
index 1a36e0d02..5ad923fe7 100644
--- a/src/core/hle/kernel/svc.cpp
+++ b/src/core/hle/kernel/svc.cpp
@@ -32,7 +32,7 @@ namespace Kernel {
32 32
33/// Set the process heap to a given Size. It can both extend and shrink the heap. 33/// Set the process heap to a given Size. It can both extend and shrink the heap.
34static ResultCode SetHeapSize(VAddr* heap_addr, u64 heap_size) { 34static ResultCode SetHeapSize(VAddr* heap_addr, u64 heap_size) {
35 NGLOG_TRACE(Kernel_SVC, "called, heap_size=0x{:X}", heap_size); 35 LOG_TRACE(Kernel_SVC, "called, heap_size=0x{:X}", heap_size);
36 auto& process = *Core::CurrentProcess(); 36 auto& process = *Core::CurrentProcess();
37 CASCADE_RESULT(*heap_addr, 37 CASCADE_RESULT(*heap_addr,
38 process.HeapAllocate(Memory::HEAP_VADDR, heap_size, VMAPermission::ReadWrite)); 38 process.HeapAllocate(Memory::HEAP_VADDR, heap_size, VMAPermission::ReadWrite));
@@ -40,21 +40,21 @@ static ResultCode SetHeapSize(VAddr* heap_addr, u64 heap_size) {
40} 40}
41 41
42static ResultCode SetMemoryAttribute(VAddr addr, u64 size, u32 state0, u32 state1) { 42static ResultCode SetMemoryAttribute(VAddr addr, u64 size, u32 state0, u32 state1) {
43 NGLOG_WARNING(Kernel_SVC, "(STUBBED) called, addr=0x{:X}", addr); 43 LOG_WARNING(Kernel_SVC, "(STUBBED) called, addr=0x{:X}", addr);
44 return RESULT_SUCCESS; 44 return RESULT_SUCCESS;
45} 45}
46 46
47/// Maps a memory range into a different range. 47/// Maps a memory range into a different range.
48static ResultCode MapMemory(VAddr dst_addr, VAddr src_addr, u64 size) { 48static ResultCode MapMemory(VAddr dst_addr, VAddr src_addr, u64 size) {
49 NGLOG_TRACE(Kernel_SVC, "called, dst_addr=0x{:X}, src_addr=0x{:X}, size=0x{:X}", dst_addr, 49 LOG_TRACE(Kernel_SVC, "called, dst_addr=0x{:X}, src_addr=0x{:X}, size=0x{:X}", dst_addr,
50 src_addr, size); 50 src_addr, size);
51 return Core::CurrentProcess()->MirrorMemory(dst_addr, src_addr, size); 51 return Core::CurrentProcess()->MirrorMemory(dst_addr, src_addr, size);
52} 52}
53 53
54/// Unmaps a region that was previously mapped with svcMapMemory 54/// Unmaps a region that was previously mapped with svcMapMemory
55static ResultCode UnmapMemory(VAddr dst_addr, VAddr src_addr, u64 size) { 55static ResultCode UnmapMemory(VAddr dst_addr, VAddr src_addr, u64 size) {
56 NGLOG_TRACE(Kernel_SVC, "called, dst_addr=0x{:X}, src_addr=0x{:X}, size=0x{:X}", dst_addr, 56 LOG_TRACE(Kernel_SVC, "called, dst_addr=0x{:X}, src_addr=0x{:X}, size=0x{:X}", dst_addr,
57 src_addr, size); 57 src_addr, size);
58 return Core::CurrentProcess()->UnmapMemory(dst_addr, src_addr, size); 58 return Core::CurrentProcess()->UnmapMemory(dst_addr, src_addr, size);
59} 59}
60 60
@@ -69,11 +69,11 @@ static ResultCode ConnectToNamedPort(Handle* out_handle, VAddr port_name_address
69 if (port_name.size() > PortNameMaxLength) 69 if (port_name.size() > PortNameMaxLength)
70 return ERR_PORT_NAME_TOO_LONG; 70 return ERR_PORT_NAME_TOO_LONG;
71 71
72 NGLOG_TRACE(Kernel_SVC, "called port_name={}", port_name); 72 LOG_TRACE(Kernel_SVC, "called port_name={}", port_name);
73 73
74 auto it = Service::g_kernel_named_ports.find(port_name); 74 auto it = Service::g_kernel_named_ports.find(port_name);
75 if (it == Service::g_kernel_named_ports.end()) { 75 if (it == Service::g_kernel_named_ports.end()) {
76 NGLOG_WARNING(Kernel_SVC, "tried to connect to unknown port: {}", port_name); 76 LOG_WARNING(Kernel_SVC, "tried to connect to unknown port: {}", port_name);
77 return ERR_NOT_FOUND; 77 return ERR_NOT_FOUND;
78 } 78 }
79 79
@@ -91,11 +91,11 @@ static ResultCode ConnectToNamedPort(Handle* out_handle, VAddr port_name_address
91static ResultCode SendSyncRequest(Handle handle) { 91static ResultCode SendSyncRequest(Handle handle) {
92 SharedPtr<ClientSession> session = g_handle_table.Get<ClientSession>(handle); 92 SharedPtr<ClientSession> session = g_handle_table.Get<ClientSession>(handle);
93 if (!session) { 93 if (!session) {
94 NGLOG_ERROR(Kernel_SVC, "called with invalid handle=0x{:08X}", handle); 94 LOG_ERROR(Kernel_SVC, "called with invalid handle=0x{:08X}", handle);
95 return ERR_INVALID_HANDLE; 95 return ERR_INVALID_HANDLE;
96 } 96 }
97 97
98 NGLOG_TRACE(Kernel_SVC, "called handle=0x{:08X}({})", handle, session->GetName()); 98 LOG_TRACE(Kernel_SVC, "called handle=0x{:08X}({})", handle, session->GetName());
99 99
100 Core::System::GetInstance().PrepareReschedule(); 100 Core::System::GetInstance().PrepareReschedule();
101 101
@@ -106,7 +106,7 @@ static ResultCode SendSyncRequest(Handle handle) {
106 106
107/// Get the ID for the specified thread. 107/// Get the ID for the specified thread.
108static ResultCode GetThreadId(u32* thread_id, Handle thread_handle) { 108static ResultCode GetThreadId(u32* thread_id, Handle thread_handle) {
109 NGLOG_TRACE(Kernel_SVC, "called thread=0x{:08X}", thread_handle); 109 LOG_TRACE(Kernel_SVC, "called thread=0x{:08X}", thread_handle);
110 110
111 const SharedPtr<Thread> thread = g_handle_table.Get<Thread>(thread_handle); 111 const SharedPtr<Thread> thread = g_handle_table.Get<Thread>(thread_handle);
112 if (!thread) { 112 if (!thread) {
@@ -119,7 +119,7 @@ static ResultCode GetThreadId(u32* thread_id, Handle thread_handle) {
119 119
120/// Get the ID of the specified process 120/// Get the ID of the specified process
121static ResultCode GetProcessId(u32* process_id, Handle process_handle) { 121static ResultCode GetProcessId(u32* process_id, Handle process_handle) {
122 NGLOG_TRACE(Kernel_SVC, "called process=0x{:08X}", process_handle); 122 LOG_TRACE(Kernel_SVC, "called process=0x{:08X}", process_handle);
123 123
124 const SharedPtr<Process> process = g_handle_table.Get<Process>(process_handle); 124 const SharedPtr<Process> process = g_handle_table.Get<Process>(process_handle);
125 if (!process) { 125 if (!process) {
@@ -149,8 +149,8 @@ static bool DefaultThreadWakeupCallback(ThreadWakeupReason reason, SharedPtr<Thr
149/// Wait for the given handles to synchronize, timeout after the specified nanoseconds 149/// Wait for the given handles to synchronize, timeout after the specified nanoseconds
150static ResultCode WaitSynchronization(Handle* index, VAddr handles_address, u64 handle_count, 150static ResultCode WaitSynchronization(Handle* index, VAddr handles_address, u64 handle_count,
151 s64 nano_seconds) { 151 s64 nano_seconds) {
152 NGLOG_TRACE(Kernel_SVC, "called handles_address=0x{:X}, handle_count={}, nano_seconds={}", 152 LOG_TRACE(Kernel_SVC, "called handles_address=0x{:X}, handle_count={}, nano_seconds={}",
153 handles_address, handle_count, nano_seconds); 153 handles_address, handle_count, nano_seconds);
154 154
155 if (!Memory::IsValidVirtualAddress(handles_address)) 155 if (!Memory::IsValidVirtualAddress(handles_address))
156 return ERR_INVALID_POINTER; 156 return ERR_INVALID_POINTER;
@@ -210,7 +210,7 @@ static ResultCode WaitSynchronization(Handle* index, VAddr handles_address, u64
210 210
211/// Resumes a thread waiting on WaitSynchronization 211/// Resumes a thread waiting on WaitSynchronization
212static ResultCode CancelSynchronization(Handle thread_handle) { 212static ResultCode CancelSynchronization(Handle thread_handle) {
213 NGLOG_TRACE(Kernel_SVC, "called thread=0x{:X}", thread_handle); 213 LOG_TRACE(Kernel_SVC, "called thread=0x{:X}", thread_handle);
214 214
215 const SharedPtr<Thread> thread = g_handle_table.Get<Thread>(thread_handle); 215 const SharedPtr<Thread> thread = g_handle_table.Get<Thread>(thread_handle);
216 if (!thread) { 216 if (!thread) {
@@ -227,24 +227,24 @@ static ResultCode CancelSynchronization(Handle thread_handle) {
227/// Attempts to locks a mutex, creating it if it does not already exist 227/// Attempts to locks a mutex, creating it if it does not already exist
228static ResultCode ArbitrateLock(Handle holding_thread_handle, VAddr mutex_addr, 228static ResultCode ArbitrateLock(Handle holding_thread_handle, VAddr mutex_addr,
229 Handle requesting_thread_handle) { 229 Handle requesting_thread_handle) {
230 NGLOG_TRACE(Kernel_SVC, 230 LOG_TRACE(Kernel_SVC,
231 "called holding_thread_handle=0x{:08X}, mutex_addr=0x{:X}, " 231 "called holding_thread_handle=0x{:08X}, mutex_addr=0x{:X}, "
232 "requesting_current_thread_handle=0x{:08X}", 232 "requesting_current_thread_handle=0x{:08X}",
233 holding_thread_handle, mutex_addr, requesting_thread_handle); 233 holding_thread_handle, mutex_addr, requesting_thread_handle);
234 234
235 return Mutex::TryAcquire(mutex_addr, holding_thread_handle, requesting_thread_handle); 235 return Mutex::TryAcquire(mutex_addr, holding_thread_handle, requesting_thread_handle);
236} 236}
237 237
238/// Unlock a mutex 238/// Unlock a mutex
239static ResultCode ArbitrateUnlock(VAddr mutex_addr) { 239static ResultCode ArbitrateUnlock(VAddr mutex_addr) {
240 NGLOG_TRACE(Kernel_SVC, "called mutex_addr=0x{:X}", mutex_addr); 240 LOG_TRACE(Kernel_SVC, "called mutex_addr=0x{:X}", mutex_addr);
241 241
242 return Mutex::Release(mutex_addr); 242 return Mutex::Release(mutex_addr);
243} 243}
244 244
245/// Break program execution 245/// Break program execution
246static void Break(u64 unk_0, u64 unk_1, u64 unk_2) { 246static void Break(u64 unk_0, u64 unk_1, u64 unk_2) {
247 NGLOG_CRITICAL(Debug_Emulated, "Emulated program broke execution!"); 247 LOG_CRITICAL(Debug_Emulated, "Emulated program broke execution!");
248 ASSERT(false); 248 ASSERT(false);
249} 249}
250 250
@@ -252,13 +252,13 @@ static void Break(u64 unk_0, u64 unk_1, u64 unk_2) {
252static void OutputDebugString(VAddr address, s32 len) { 252static void OutputDebugString(VAddr address, s32 len) {
253 std::string str(len, '\0'); 253 std::string str(len, '\0');
254 Memory::ReadBlock(address, str.data(), str.size()); 254 Memory::ReadBlock(address, str.data(), str.size());
255 NGLOG_DEBUG(Debug_Emulated, "{}", str); 255 LOG_DEBUG(Debug_Emulated, "{}", str);
256} 256}
257 257
258/// Gets system/memory information for the current process 258/// Gets system/memory information for the current process
259static ResultCode GetInfo(u64* result, u64 info_id, u64 handle, u64 info_sub_id) { 259static ResultCode GetInfo(u64* result, u64 info_id, u64 handle, u64 info_sub_id) {
260 NGLOG_TRACE(Kernel_SVC, "called info_id=0x{:X}, info_sub_id=0x{:X}, handle=0x{:08X}", info_id, 260 LOG_TRACE(Kernel_SVC, "called info_id=0x{:X}, info_sub_id=0x{:X}, handle=0x{:08X}", info_id,
261 info_sub_id, handle); 261 info_sub_id, handle);
262 262
263 auto& vm_manager = Core::CurrentProcess()->vm_manager; 263 auto& vm_manager = Core::CurrentProcess()->vm_manager;
264 264
@@ -309,17 +309,17 @@ static ResultCode GetInfo(u64* result, u64 info_id, u64 handle, u64 info_sub_id)
309 *result = Core::CurrentProcess()->is_virtual_address_memory_enabled; 309 *result = Core::CurrentProcess()->is_virtual_address_memory_enabled;
310 break; 310 break;
311 case GetInfoType::TitleId: 311 case GetInfoType::TitleId:
312 NGLOG_WARNING(Kernel_SVC, "(STUBBED) Attempted to query titleid, returned 0"); 312 LOG_WARNING(Kernel_SVC, "(STUBBED) Attempted to query titleid, returned 0");
313 *result = 0; 313 *result = 0;
314 break; 314 break;
315 case GetInfoType::PrivilegedProcessId: 315 case GetInfoType::PrivilegedProcessId:
316 NGLOG_WARNING(Kernel_SVC, 316 LOG_WARNING(Kernel_SVC,
317 "(STUBBED) Attempted to query privileged process id bounds, returned 0"); 317 "(STUBBED) Attempted to query privileged process id bounds, returned 0");
318 *result = 0; 318 *result = 0;
319 break; 319 break;
320 case GetInfoType::UserExceptionContextAddr: 320 case GetInfoType::UserExceptionContextAddr:
321 NGLOG_WARNING(Kernel_SVC, 321 LOG_WARNING(Kernel_SVC,
322 "(STUBBED) Attempted to query user exception context address, returned 0"); 322 "(STUBBED) Attempted to query user exception context address, returned 0");
323 *result = 0; 323 *result = 0;
324 break; 324 break;
325 default: 325 default:
@@ -331,14 +331,13 @@ static ResultCode GetInfo(u64* result, u64 info_id, u64 handle, u64 info_sub_id)
331 331
332/// Sets the thread activity 332/// Sets the thread activity
333static ResultCode SetThreadActivity(Handle handle, u32 unknown) { 333static ResultCode SetThreadActivity(Handle handle, u32 unknown) {
334 NGLOG_WARNING(Kernel_SVC, "(STUBBED) called, handle=0x{:08X}, unknown=0x{:08X}", handle, 334 LOG_WARNING(Kernel_SVC, "(STUBBED) called, handle=0x{:08X}, unknown=0x{:08X}", handle, unknown);
335 unknown);
336 return RESULT_SUCCESS; 335 return RESULT_SUCCESS;
337} 336}
338 337
339/// Gets the thread context 338/// Gets the thread context
340static ResultCode GetThreadContext(Handle handle, VAddr addr) { 339static ResultCode GetThreadContext(Handle handle, VAddr addr) {
341 NGLOG_WARNING(Kernel_SVC, "(STUBBED) called, handle=0x{:08X}, addr=0x{:X}", handle, addr); 340 LOG_WARNING(Kernel_SVC, "(STUBBED) called, handle=0x{:08X}, addr=0x{:X}", handle, addr);
342 return RESULT_SUCCESS; 341 return RESULT_SUCCESS;
343} 342}
344 343
@@ -377,16 +376,15 @@ static ResultCode SetThreadPriority(Handle handle, u32 priority) {
377 376
378/// Get which CPU core is executing the current thread 377/// Get which CPU core is executing the current thread
379static u32 GetCurrentProcessorNumber() { 378static u32 GetCurrentProcessorNumber() {
380 NGLOG_TRACE(Kernel_SVC, "called"); 379 LOG_TRACE(Kernel_SVC, "called");
381 return GetCurrentThread()->processor_id; 380 return GetCurrentThread()->processor_id;
382} 381}
383 382
384static ResultCode MapSharedMemory(Handle shared_memory_handle, VAddr addr, u64 size, 383static ResultCode MapSharedMemory(Handle shared_memory_handle, VAddr addr, u64 size,
385 u32 permissions) { 384 u32 permissions) {
386 NGLOG_TRACE( 385 LOG_TRACE(Kernel_SVC,
387 Kernel_SVC, 386 "called, shared_memory_handle=0x{:X}, addr=0x{:X}, size=0x{:X}, permissions=0x{:08X}",
388 "called, shared_memory_handle=0x{:X}, addr=0x{:X}, size=0x{:X}, permissions=0x{:08X}", 387 shared_memory_handle, addr, size, permissions);
389 shared_memory_handle, addr, size, permissions);
390 388
391 SharedPtr<SharedMemory> shared_memory = g_handle_table.Get<SharedMemory>(shared_memory_handle); 389 SharedPtr<SharedMemory> shared_memory = g_handle_table.Get<SharedMemory>(shared_memory_handle);
392 if (!shared_memory) { 390 if (!shared_memory) {
@@ -406,15 +404,15 @@ static ResultCode MapSharedMemory(Handle shared_memory_handle, VAddr addr, u64 s
406 return shared_memory->Map(Core::CurrentProcess().get(), addr, permissions_type, 404 return shared_memory->Map(Core::CurrentProcess().get(), addr, permissions_type,
407 MemoryPermission::DontCare); 405 MemoryPermission::DontCare);
408 default: 406 default:
409 NGLOG_ERROR(Kernel_SVC, "unknown permissions=0x{:08X}", permissions); 407 LOG_ERROR(Kernel_SVC, "unknown permissions=0x{:08X}", permissions);
410 } 408 }
411 409
412 return RESULT_SUCCESS; 410 return RESULT_SUCCESS;
413} 411}
414 412
415static ResultCode UnmapSharedMemory(Handle shared_memory_handle, VAddr addr, u64 size) { 413static ResultCode UnmapSharedMemory(Handle shared_memory_handle, VAddr addr, u64 size) {
416 NGLOG_WARNING(Kernel_SVC, "called, shared_memory_handle=0x{:08X}, addr=0x{:X}, size=0x{:X}", 414 LOG_WARNING(Kernel_SVC, "called, shared_memory_handle=0x{:08X}, addr=0x{:X}, size=0x{:X}",
417 shared_memory_handle, addr, size); 415 shared_memory_handle, addr, size);
418 416
419 SharedPtr<SharedMemory> shared_memory = g_handle_table.Get<SharedMemory>(shared_memory_handle); 417 SharedPtr<SharedMemory> shared_memory = g_handle_table.Get<SharedMemory>(shared_memory_handle);
420 418
@@ -442,19 +440,19 @@ static ResultCode QueryProcessMemory(MemoryInfo* memory_info, PageInfo* /*page_i
442 memory_info->type = static_cast<u32>(vma->second.meminfo_state); 440 memory_info->type = static_cast<u32>(vma->second.meminfo_state);
443 } 441 }
444 442
445 NGLOG_TRACE(Kernel_SVC, "called process=0x{:08X} addr={:X}", process_handle, addr); 443 LOG_TRACE(Kernel_SVC, "called process=0x{:08X} addr={:X}", process_handle, addr);
446 return RESULT_SUCCESS; 444 return RESULT_SUCCESS;
447} 445}
448 446
449/// Query memory 447/// Query memory
450static ResultCode QueryMemory(MemoryInfo* memory_info, PageInfo* page_info, VAddr addr) { 448static ResultCode QueryMemory(MemoryInfo* memory_info, PageInfo* page_info, VAddr addr) {
451 NGLOG_TRACE(Kernel_SVC, "called, addr={:X}", addr); 449 LOG_TRACE(Kernel_SVC, "called, addr={:X}", addr);
452 return QueryProcessMemory(memory_info, page_info, CurrentProcess, addr); 450 return QueryProcessMemory(memory_info, page_info, CurrentProcess, addr);
453} 451}
454 452
455/// Exits the current process 453/// Exits the current process
456static void ExitProcess() { 454static void ExitProcess() {
457 NGLOG_INFO(Kernel_SVC, "Process {} exiting", Core::CurrentProcess()->process_id); 455 LOG_INFO(Kernel_SVC, "Process {} exiting", Core::CurrentProcess()->process_id);
458 456
459 ASSERT_MSG(Core::CurrentProcess()->status == ProcessStatus::Running, 457 ASSERT_MSG(Core::CurrentProcess()->status == ProcessStatus::Running,
460 "Process has already exited"); 458 "Process has already exited");
@@ -530,17 +528,17 @@ static ResultCode CreateThread(Handle* out_handle, VAddr entry_point, u64 arg, V
530 Core::System::GetInstance().PrepareReschedule(); 528 Core::System::GetInstance().PrepareReschedule();
531 Core::System::GetInstance().CpuCore(thread->processor_id).PrepareReschedule(); 529 Core::System::GetInstance().CpuCore(thread->processor_id).PrepareReschedule();
532 530
533 NGLOG_TRACE(Kernel_SVC, 531 LOG_TRACE(Kernel_SVC,
534 "called entrypoint=0x{:08X} ({}), arg=0x{:08X}, stacktop=0x{:08X}, " 532 "called entrypoint=0x{:08X} ({}), arg=0x{:08X}, stacktop=0x{:08X}, "
535 "threadpriority=0x{:08X}, processorid=0x{:08X} : created handle=0x{:08X}", 533 "threadpriority=0x{:08X}, processorid=0x{:08X} : created handle=0x{:08X}",
536 entry_point, name, arg, stack_top, priority, processor_id, *out_handle); 534 entry_point, name, arg, stack_top, priority, processor_id, *out_handle);
537 535
538 return RESULT_SUCCESS; 536 return RESULT_SUCCESS;
539} 537}
540 538
541/// Starts the thread for the provided handle 539/// Starts the thread for the provided handle
542static ResultCode StartThread(Handle thread_handle) { 540static ResultCode StartThread(Handle thread_handle) {
543 NGLOG_TRACE(Kernel_SVC, "called thread=0x{:08X}", thread_handle); 541 LOG_TRACE(Kernel_SVC, "called thread=0x{:08X}", thread_handle);
544 542
545 const SharedPtr<Thread> thread = g_handle_table.Get<Thread>(thread_handle); 543 const SharedPtr<Thread> thread = g_handle_table.Get<Thread>(thread_handle);
546 if (!thread) { 544 if (!thread) {
@@ -557,7 +555,7 @@ static ResultCode StartThread(Handle thread_handle) {
557 555
558/// Called when a thread exits 556/// Called when a thread exits
559static void ExitThread() { 557static void ExitThread() {
560 NGLOG_TRACE(Kernel_SVC, "called, pc=0x{:08X}", Core::CurrentArmInterface().GetPC()); 558 LOG_TRACE(Kernel_SVC, "called, pc=0x{:08X}", Core::CurrentArmInterface().GetPC());
561 559
562 ExitCurrentThread(); 560 ExitCurrentThread();
563 Core::System::GetInstance().PrepareReschedule(); 561 Core::System::GetInstance().PrepareReschedule();
@@ -565,7 +563,7 @@ static void ExitThread() {
565 563
566/// Sleep the current thread 564/// Sleep the current thread
567static void SleepThread(s64 nanoseconds) { 565static void SleepThread(s64 nanoseconds) {
568 NGLOG_TRACE(Kernel_SVC, "called nanoseconds={}", nanoseconds); 566 LOG_TRACE(Kernel_SVC, "called nanoseconds={}", nanoseconds);
569 567
570 // Don't attempt to yield execution if there are no available threads to run, 568 // Don't attempt to yield execution if there are no available threads to run,
571 // this way we avoid a useless reschedule to the idle thread. 569 // this way we avoid a useless reschedule to the idle thread.
@@ -584,7 +582,7 @@ static void SleepThread(s64 nanoseconds) {
584/// Wait process wide key atomic 582/// Wait process wide key atomic
585static ResultCode WaitProcessWideKeyAtomic(VAddr mutex_addr, VAddr condition_variable_addr, 583static ResultCode WaitProcessWideKeyAtomic(VAddr mutex_addr, VAddr condition_variable_addr,
586 Handle thread_handle, s64 nano_seconds) { 584 Handle thread_handle, s64 nano_seconds) {
587 NGLOG_TRACE( 585 LOG_TRACE(
588 Kernel_SVC, 586 Kernel_SVC,
589 "called mutex_addr={:X}, condition_variable_addr={:X}, thread_handle=0x{:08X}, timeout={}", 587 "called mutex_addr={:X}, condition_variable_addr={:X}, thread_handle=0x{:08X}, timeout={}",
590 mutex_addr, condition_variable_addr, thread_handle, nano_seconds); 588 mutex_addr, condition_variable_addr, thread_handle, nano_seconds);
@@ -611,8 +609,8 @@ static ResultCode WaitProcessWideKeyAtomic(VAddr mutex_addr, VAddr condition_var
611 609
612/// Signal process wide key 610/// Signal process wide key
613static ResultCode SignalProcessWideKey(VAddr condition_variable_addr, s32 target) { 611static ResultCode SignalProcessWideKey(VAddr condition_variable_addr, s32 target) {
614 NGLOG_TRACE(Kernel_SVC, "called, condition_variable_addr=0x{:X}, target=0x{:08X}", 612 LOG_TRACE(Kernel_SVC, "called, condition_variable_addr=0x{:X}, target=0x{:08X}",
615 condition_variable_addr, target); 613 condition_variable_addr, target);
616 614
617 auto RetrieveWaitingThreads = 615 auto RetrieveWaitingThreads =
618 [](size_t core_index, std::vector<SharedPtr<Thread>>& waiting_threads, VAddr condvar_addr) { 616 [](size_t core_index, std::vector<SharedPtr<Thread>>& waiting_threads, VAddr condvar_addr) {
@@ -692,8 +690,8 @@ static ResultCode SignalProcessWideKey(VAddr condition_variable_addr, s32 target
692 690
693// Wait for an address (via Address Arbiter) 691// Wait for an address (via Address Arbiter)
694static ResultCode WaitForAddress(VAddr address, u32 type, s32 value, s64 timeout) { 692static ResultCode WaitForAddress(VAddr address, u32 type, s32 value, s64 timeout) {
695 NGLOG_WARNING(Kernel_SVC, "called, address=0x{:X}, type=0x{:X}, value=0x{:X}, timeout={}", 693 LOG_WARNING(Kernel_SVC, "called, address=0x{:X}, type=0x{:X}, value=0x{:X}, timeout={}",
696 address, type, value, timeout); 694 address, type, value, timeout);
697 // If the passed address is a kernel virtual address, return invalid memory state. 695 // If the passed address is a kernel virtual address, return invalid memory state.
698 if (Memory::IsKernelVirtualAddress(address)) { 696 if (Memory::IsKernelVirtualAddress(address)) {
699 return ERR_INVALID_ADDRESS_STATE; 697 return ERR_INVALID_ADDRESS_STATE;
@@ -717,9 +715,8 @@ static ResultCode WaitForAddress(VAddr address, u32 type, s32 value, s64 timeout
717 715
718// Signals to an address (via Address Arbiter) 716// Signals to an address (via Address Arbiter)
719static ResultCode SignalToAddress(VAddr address, u32 type, s32 value, s32 num_to_wake) { 717static ResultCode SignalToAddress(VAddr address, u32 type, s32 value, s32 num_to_wake) {
720 NGLOG_WARNING(Kernel_SVC, 718 LOG_WARNING(Kernel_SVC, "called, address=0x{:X}, type=0x{:X}, value=0x{:X}, num_to_wake=0x{:X}",
721 "called, address=0x{:X}, type=0x{:X}, value=0x{:X}, num_to_wake=0x{:X}", address, 719 address, type, value, num_to_wake);
722 type, value, num_to_wake);
723 // If the passed address is a kernel virtual address, return invalid memory state. 720 // If the passed address is a kernel virtual address, return invalid memory state.
724 if (Memory::IsKernelVirtualAddress(address)) { 721 if (Memory::IsKernelVirtualAddress(address)) {
725 return ERR_INVALID_ADDRESS_STATE; 722 return ERR_INVALID_ADDRESS_STATE;
@@ -754,13 +751,13 @@ static u64 GetSystemTick() {
754 751
755/// Close a handle 752/// Close a handle
756static ResultCode CloseHandle(Handle handle) { 753static ResultCode CloseHandle(Handle handle) {
757 NGLOG_TRACE(Kernel_SVC, "Closing handle 0x{:08X}", handle); 754 LOG_TRACE(Kernel_SVC, "Closing handle 0x{:08X}", handle);
758 return g_handle_table.Close(handle); 755 return g_handle_table.Close(handle);
759} 756}
760 757
761/// Reset an event 758/// Reset an event
762static ResultCode ResetSignal(Handle handle) { 759static ResultCode ResetSignal(Handle handle) {
763 NGLOG_WARNING(Kernel_SVC, "(STUBBED) called handle 0x{:08X}", handle); 760 LOG_WARNING(Kernel_SVC, "(STUBBED) called handle 0x{:08X}", handle);
764 auto event = g_handle_table.Get<Event>(handle); 761 auto event = g_handle_table.Get<Event>(handle);
765 ASSERT(event != nullptr); 762 ASSERT(event != nullptr);
766 event->Clear(); 763 event->Clear();
@@ -769,14 +766,14 @@ static ResultCode ResetSignal(Handle handle) {
769 766
770/// Creates a TransferMemory object 767/// Creates a TransferMemory object
771static ResultCode CreateTransferMemory(Handle* handle, VAddr addr, u64 size, u32 permissions) { 768static ResultCode CreateTransferMemory(Handle* handle, VAddr addr, u64 size, u32 permissions) {
772 NGLOG_WARNING(Kernel_SVC, "(STUBBED) called addr=0x{:X}, size=0x{:X}, perms=0x{:08X}", addr, 769 LOG_WARNING(Kernel_SVC, "(STUBBED) called addr=0x{:X}, size=0x{:X}, perms=0x{:08X}", addr, size,
773 size, permissions); 770 permissions);
774 *handle = 0; 771 *handle = 0;
775 return RESULT_SUCCESS; 772 return RESULT_SUCCESS;
776} 773}
777 774
778static ResultCode GetThreadCoreMask(Handle thread_handle, u32* core, u64* mask) { 775static ResultCode GetThreadCoreMask(Handle thread_handle, u32* core, u64* mask) {
779 NGLOG_TRACE(Kernel_SVC, "called, handle=0x{:08X}", thread_handle); 776 LOG_TRACE(Kernel_SVC, "called, handle=0x{:08X}", thread_handle);
780 777
781 const SharedPtr<Thread> thread = g_handle_table.Get<Thread>(thread_handle); 778 const SharedPtr<Thread> thread = g_handle_table.Get<Thread>(thread_handle);
782 if (!thread) { 779 if (!thread) {
@@ -790,8 +787,8 @@ static ResultCode GetThreadCoreMask(Handle thread_handle, u32* core, u64* mask)
790} 787}
791 788
792static ResultCode SetThreadCoreMask(Handle thread_handle, u32 core, u64 mask) { 789static ResultCode SetThreadCoreMask(Handle thread_handle, u32 core, u64 mask) {
793 NGLOG_DEBUG(Kernel_SVC, "called, handle=0x{:08X}, mask=0x{:16X}, core=0x{:X}", thread_handle, 790 LOG_DEBUG(Kernel_SVC, "called, handle=0x{:08X}, mask=0x{:16X}, core=0x{:X}", thread_handle,
794 mask, core); 791 mask, core);
795 792
796 const SharedPtr<Thread> thread = g_handle_table.Get<Thread>(thread_handle); 793 const SharedPtr<Thread> thread = g_handle_table.Get<Thread>(thread_handle);
797 if (!thread) { 794 if (!thread) {
@@ -830,8 +827,8 @@ static ResultCode SetThreadCoreMask(Handle thread_handle, u32 core, u64 mask) {
830 827
831static ResultCode CreateSharedMemory(Handle* handle, u64 size, u32 local_permissions, 828static ResultCode CreateSharedMemory(Handle* handle, u64 size, u32 local_permissions,
832 u32 remote_permissions) { 829 u32 remote_permissions) {
833 NGLOG_TRACE(Kernel_SVC, "called, size=0x{:X}, localPerms=0x{:08X}, remotePerms=0x{:08X}", size, 830 LOG_TRACE(Kernel_SVC, "called, size=0x{:X}, localPerms=0x{:08X}, remotePerms=0x{:08X}", size,
834 local_permissions, remote_permissions); 831 local_permissions, remote_permissions);
835 auto sharedMemHandle = 832 auto sharedMemHandle =
836 SharedMemory::Create(g_handle_table.Get<Process>(KernelHandle::CurrentProcess), size, 833 SharedMemory::Create(g_handle_table.Get<Process>(KernelHandle::CurrentProcess), size,
837 static_cast<MemoryPermission>(local_permissions), 834 static_cast<MemoryPermission>(local_permissions),
@@ -842,7 +839,7 @@ static ResultCode CreateSharedMemory(Handle* handle, u64 size, u32 local_permiss
842} 839}
843 840
844static ResultCode ClearEvent(Handle handle) { 841static ResultCode ClearEvent(Handle handle) {
845 NGLOG_TRACE(Kernel_SVC, "called, event=0x{:08X}", handle); 842 LOG_TRACE(Kernel_SVC, "called, event=0x{:08X}", handle);
846 843
847 SharedPtr<Event> evt = g_handle_table.Get<Event>(handle); 844 SharedPtr<Event> evt = g_handle_table.Get<Event>(handle);
848 if (evt == nullptr) 845 if (evt == nullptr)
@@ -994,7 +991,7 @@ static const FunctionDef SVC_Table[] = {
994 991
995static const FunctionDef* GetSVCInfo(u32 func_num) { 992static const FunctionDef* GetSVCInfo(u32 func_num) {
996 if (func_num >= std::size(SVC_Table)) { 993 if (func_num >= std::size(SVC_Table)) {
997 NGLOG_ERROR(Kernel_SVC, "Unknown svc=0x{:02X}", func_num); 994 LOG_ERROR(Kernel_SVC, "Unknown svc=0x{:02X}", func_num);
998 return nullptr; 995 return nullptr;
999 } 996 }
1000 return &SVC_Table[func_num]; 997 return &SVC_Table[func_num];
@@ -1013,10 +1010,10 @@ void CallSVC(u32 immediate) {
1013 if (info->func) { 1010 if (info->func) {
1014 info->func(); 1011 info->func();
1015 } else { 1012 } else {
1016 NGLOG_CRITICAL(Kernel_SVC, "Unimplemented SVC function {}(..)", info->name); 1013 LOG_CRITICAL(Kernel_SVC, "Unimplemented SVC function {}(..)", info->name);
1017 } 1014 }
1018 } else { 1015 } else {
1019 NGLOG_CRITICAL(Kernel_SVC, "Unknown SVC function 0x{:X}", immediate); 1016 LOG_CRITICAL(Kernel_SVC, "Unknown SVC function 0x{:X}", immediate);
1020 } 1017 }
1021} 1018}
1022 1019
diff --git a/src/core/hle/kernel/thread.cpp b/src/core/hle/kernel/thread.cpp
index 2f333ec34..9a9746585 100644
--- a/src/core/hle/kernel/thread.cpp
+++ b/src/core/hle/kernel/thread.cpp
@@ -104,7 +104,7 @@ static void ThreadWakeupCallback(u64 thread_handle, int cycles_late) {
104 const auto proper_handle = static_cast<Handle>(thread_handle); 104 const auto proper_handle = static_cast<Handle>(thread_handle);
105 SharedPtr<Thread> thread = wakeup_callback_handle_table.Get<Thread>(proper_handle); 105 SharedPtr<Thread> thread = wakeup_callback_handle_table.Get<Thread>(proper_handle);
106 if (thread == nullptr) { 106 if (thread == nullptr) {
107 NGLOG_CRITICAL(Kernel, "Callback fired for invalid thread {:08X}", proper_handle); 107 LOG_CRITICAL(Kernel, "Callback fired for invalid thread {:08X}", proper_handle);
108 return; 108 return;
109 } 109 }
110 110
@@ -290,19 +290,19 @@ ResultVal<SharedPtr<Thread>> Thread::Create(std::string name, VAddr entry_point,
290 SharedPtr<Process> owner_process) { 290 SharedPtr<Process> owner_process) {
291 // Check if priority is in ranged. Lowest priority -> highest priority id. 291 // Check if priority is in ranged. Lowest priority -> highest priority id.
292 if (priority > THREADPRIO_LOWEST) { 292 if (priority > THREADPRIO_LOWEST) {
293 NGLOG_ERROR(Kernel_SVC, "Invalid thread priority: {}", priority); 293 LOG_ERROR(Kernel_SVC, "Invalid thread priority: {}", priority);
294 return ERR_OUT_OF_RANGE; 294 return ERR_OUT_OF_RANGE;
295 } 295 }
296 296
297 if (processor_id > THREADPROCESSORID_MAX) { 297 if (processor_id > THREADPROCESSORID_MAX) {
298 NGLOG_ERROR(Kernel_SVC, "Invalid processor id: {}", processor_id); 298 LOG_ERROR(Kernel_SVC, "Invalid processor id: {}", processor_id);
299 return ERR_OUT_OF_RANGE_KERNEL; 299 return ERR_OUT_OF_RANGE_KERNEL;
300 } 300 }
301 301
302 // TODO(yuriks): Other checks, returning 0xD9001BEA 302 // TODO(yuriks): Other checks, returning 0xD9001BEA
303 303
304 if (!Memory::IsValidVirtualAddress(*owner_process, entry_point)) { 304 if (!Memory::IsValidVirtualAddress(*owner_process, entry_point)) {
305 NGLOG_ERROR(Kernel_SVC, "(name={}): invalid entry {:016X}", name, entry_point); 305 LOG_ERROR(Kernel_SVC, "(name={}): invalid entry {:016X}", name, entry_point);
306 // TODO (bunnei): Find the correct error code to use here 306 // TODO (bunnei): Find the correct error code to use here
307 return ResultCode(-1); 307 return ResultCode(-1);
308 } 308 }
@@ -343,8 +343,8 @@ ResultVal<SharedPtr<Thread>> Thread::Create(std::string name, VAddr entry_point,
343 auto& linheap_memory = memory_region->linear_heap_memory; 343 auto& linheap_memory = memory_region->linear_heap_memory;
344 344
345 if (linheap_memory->size() + Memory::PAGE_SIZE > memory_region->size) { 345 if (linheap_memory->size() + Memory::PAGE_SIZE > memory_region->size) {
346 NGLOG_ERROR(Kernel_SVC, 346 LOG_ERROR(Kernel_SVC,
347 "Not enough space in region to allocate a new TLS page for thread"); 347 "Not enough space in region to allocate a new TLS page for thread");
348 return ERR_OUT_OF_MEMORY; 348 return ERR_OUT_OF_MEMORY;
349 } 349 }
350 350
diff --git a/src/core/hle/kernel/timer.cpp b/src/core/hle/kernel/timer.cpp
index 661356a97..0141125e4 100644
--- a/src/core/hle/kernel/timer.cpp
+++ b/src/core/hle/kernel/timer.cpp
@@ -78,7 +78,7 @@ void Timer::WakeupAllWaitingThreads() {
78} 78}
79 79
80void Timer::Signal(int cycles_late) { 80void Timer::Signal(int cycles_late) {
81 NGLOG_TRACE(Kernel, "Timer {} fired", GetObjectId()); 81 LOG_TRACE(Kernel, "Timer {} fired", GetObjectId());
82 82
83 signaled = true; 83 signaled = true;
84 84
@@ -98,7 +98,7 @@ static void TimerCallback(u64 timer_handle, int cycles_late) {
98 timer_callback_handle_table.Get<Timer>(static_cast<Handle>(timer_handle)); 98 timer_callback_handle_table.Get<Timer>(static_cast<Handle>(timer_handle));
99 99
100 if (timer == nullptr) { 100 if (timer == nullptr) {
101 NGLOG_CRITICAL(Kernel, "Callback fired for invalid timer {:016X}", timer_handle); 101 LOG_CRITICAL(Kernel, "Callback fired for invalid timer {:016X}", timer_handle);
102 return; 102 return;
103 } 103 }
104 104
diff --git a/src/core/hle/kernel/vm_manager.cpp b/src/core/hle/kernel/vm_manager.cpp
index 676e5b282..034dd490e 100644
--- a/src/core/hle/kernel/vm_manager.cpp
+++ b/src/core/hle/kernel/vm_manager.cpp
@@ -242,12 +242,12 @@ void VMManager::RefreshMemoryBlockMappings(const std::vector<u8>* block) {
242void VMManager::LogLayout() const { 242void VMManager::LogLayout() const {
243 for (const auto& p : vma_map) { 243 for (const auto& p : vma_map) {
244 const VirtualMemoryArea& vma = p.second; 244 const VirtualMemoryArea& vma = p.second;
245 NGLOG_DEBUG(Kernel, "{:016X} - {:016X} size: {:016X} {}{}{} {}", vma.base, 245 LOG_DEBUG(Kernel, "{:016X} - {:016X} size: {:016X} {}{}{} {}", vma.base,
246 vma.base + vma.size, vma.size, 246 vma.base + vma.size, vma.size,
247 (u8)vma.permissions & (u8)VMAPermission::Read ? 'R' : '-', 247 (u8)vma.permissions & (u8)VMAPermission::Read ? 'R' : '-',
248 (u8)vma.permissions & (u8)VMAPermission::Write ? 'W' : '-', 248 (u8)vma.permissions & (u8)VMAPermission::Write ? 'W' : '-',
249 (u8)vma.permissions & (u8)VMAPermission::Execute ? 'X' : '-', 249 (u8)vma.permissions & (u8)VMAPermission::Execute ? 'X' : '-',
250 GetMemoryStateName(vma.meminfo_state)); 250 GetMemoryStateName(vma.meminfo_state));
251 } 251 }
252} 252}
253 253
@@ -392,22 +392,22 @@ void VMManager::UpdatePageTableForVMA(const VirtualMemoryArea& vma) {
392} 392}
393 393
394u64 VMManager::GetTotalMemoryUsage() { 394u64 VMManager::GetTotalMemoryUsage() {
395 NGLOG_WARNING(Kernel, "(STUBBED) called"); 395 LOG_WARNING(Kernel, "(STUBBED) called");
396 return 0xF8000000; 396 return 0xF8000000;
397} 397}
398 398
399u64 VMManager::GetTotalHeapUsage() { 399u64 VMManager::GetTotalHeapUsage() {
400 NGLOG_WARNING(Kernel, "(STUBBED) called"); 400 LOG_WARNING(Kernel, "(STUBBED) called");
401 return 0x0; 401 return 0x0;
402} 402}
403 403
404VAddr VMManager::GetAddressSpaceBaseAddr() { 404VAddr VMManager::GetAddressSpaceBaseAddr() {
405 NGLOG_WARNING(Kernel, "(STUBBED) called"); 405 LOG_WARNING(Kernel, "(STUBBED) called");
406 return 0x8000000; 406 return 0x8000000;
407} 407}
408 408
409u64 VMManager::GetAddressSpaceSize() { 409u64 VMManager::GetAddressSpaceSize() {
410 NGLOG_WARNING(Kernel, "(STUBBED) called"); 410 LOG_WARNING(Kernel, "(STUBBED) called");
411 return MAX_ADDRESS; 411 return MAX_ADDRESS;
412} 412}
413 413