diff options
| author | 2018-04-25 19:11:22 -0400 | |
|---|---|---|
| committer | 2018-04-25 20:32:09 -0400 | |
| commit | 40dee76c57e76438d06fc282d1f8a632933d5816 (patch) | |
| tree | b8c8571cb0bd59744f431affdab790827feb446a | |
| parent | Merge pull request #390 from mailwl/pctl-module (diff) | |
| download | yuzu-40dee76c57e76438d06fc282d1f8a632933d5816.tar.gz yuzu-40dee76c57e76438d06fc282d1f8a632933d5816.tar.xz yuzu-40dee76c57e76438d06fc282d1f8a632933d5816.zip | |
kernel: Migrate logging macros to fmt-compatible ones
| -rw-r--r-- | src/core/hle/kernel/handle_table.cpp | 4 | ||||
| -rw-r--r-- | src/core/hle/kernel/hle_ipc.cpp | 5 | ||||
| -rw-r--r-- | src/core/hle/kernel/process.cpp | 8 | ||||
| -rw-r--r-- | src/core/hle/kernel/resource_limit.cpp | 6 | ||||
| -rw-r--r-- | src/core/hle/kernel/scheduler.cpp | 6 | ||||
| -rw-r--r-- | src/core/hle/kernel/server_session.cpp | 6 | ||||
| -rw-r--r-- | src/core/hle/kernel/shared_memory.cpp | 15 | ||||
| -rw-r--r-- | src/core/hle/kernel/svc.cpp | 138 | ||||
| -rw-r--r-- | src/core/hle/kernel/thread.cpp | 15 | ||||
| -rw-r--r-- | src/core/hle/kernel/timer.cpp | 4 | ||||
| -rw-r--r-- | src/core/hle/kernel/vm_manager.cpp | 8 |
11 files changed, 109 insertions, 106 deletions
diff --git a/src/core/hle/kernel/handle_table.cpp b/src/core/hle/kernel/handle_table.cpp index 822449cd5..f7a9920d8 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 | LOG_ERROR(Kernel, "Unable to allocate Handle, too many slots in use."); | 29 | NGLOG_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) { | |||
| 48 | ResultVal<Handle> HandleTable::Duplicate(Handle handle) { | 48 | ResultVal<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 | LOG_ERROR(Kernel, "Tried to duplicate invalid handle: %08X", handle); | 51 | NGLOG_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 bef4f15f5..aa6ca1026 100644 --- a/src/core/hle/kernel/hle_ipc.cpp +++ b/src/core/hle/kernel/hle_ipc.cpp | |||
| @@ -118,7 +118,7 @@ void HLERequestContext::ParseCommandBuffer(u32_le* src_cmdbuf, bool incoming) { | |||
| 118 | std::make_shared<IPC::DomainMessageHeader>(rp.PopRaw<IPC::DomainMessageHeader>()); | 118 | std::make_shared<IPC::DomainMessageHeader>(rp.PopRaw<IPC::DomainMessageHeader>()); |
| 119 | } else { | 119 | } else { |
| 120 | if (Session()->IsDomain()) | 120 | if (Session()->IsDomain()) |
| 121 | LOG_WARNING(IPC, "Domain request has no DomainMessageHeader!"); | 121 | NGLOG_WARNING(IPC, "Domain request has no DomainMessageHeader!"); |
| 122 | } | 122 | } |
| 123 | } | 123 | } |
| 124 | 124 | ||
| @@ -270,7 +270,8 @@ size_t HLERequestContext::WriteBuffer(const void* buffer, size_t size) const { | |||
| 270 | const bool is_buffer_b{BufferDescriptorB().size() && BufferDescriptorB()[0].Size()}; | 270 | const bool is_buffer_b{BufferDescriptorB().size() && BufferDescriptorB()[0].Size()}; |
| 271 | const size_t buffer_size{GetWriteBufferSize()}; | 271 | const size_t buffer_size{GetWriteBufferSize()}; |
| 272 | if (size > buffer_size) { | 272 | if (size > buffer_size) { |
| 273 | LOG_CRITICAL(Core, "size (%016zx) is greater than buffer_size (%016zx)", size, buffer_size); | 273 | NGLOG_CRITICAL(Core, "size ({:016X}) is greater than buffer_size ({:016X})", size, |
| 274 | buffer_size); | ||
| 274 | size = buffer_size; // TODO(bunnei): This needs to be HW tested | 275 | size = buffer_size; // TODO(bunnei): This needs to be HW tested |
| 275 | } | 276 | } |
| 276 | 277 | ||
diff --git a/src/core/hle/kernel/process.cpp b/src/core/hle/kernel/process.cpp index 2cffec198..751a0524d 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 | LOG_WARNING(Loader, "ExHeader allowed interrupts list ignored"); | 57 | NGLOG_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 | LOG_WARNING(Loader, "Incomplete exheader memory range descriptor ignored."); | 77 | NGLOG_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 | LOG_INFO(Loader, "ExHeader kernel version: %d.%d", major, minor); | 112 | NGLOG_INFO(Loader, "ExHeader kernel version: {}.{}", major, minor); |
| 113 | } else { | 113 | } else { |
| 114 | LOG_ERROR(Loader, "Unhandled kernel caps descriptor: 0x%08X", descriptor); | 114 | NGLOG_ERROR(Loader, "Unhandled kernel caps descriptor: {:#010X}", 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 88ca8ad7e..0ef5fc57d 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 | LOG_CRITICAL(Kernel, "Unknown resource limit category"); | 32 | NGLOG_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 | LOG_ERROR(Kernel, "Unknown resource type=%08X", static_cast<u32>(resource)); | 58 | NGLOG_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 | LOG_ERROR(Kernel, "Unknown resource type=%08X", static_cast<u32>(resource)); | 87 | NGLOG_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 921f27efb..ff6a0941a 100644 --- a/src/core/hle/kernel/scheduler.cpp +++ b/src/core/hle/kernel/scheduler.cpp | |||
| @@ -94,11 +94,11 @@ void Scheduler::Reschedule() { | |||
| 94 | Thread* next = PopNextReadyThread(); | 94 | Thread* next = PopNextReadyThread(); |
| 95 | 95 | ||
| 96 | if (cur && next) { | 96 | if (cur && next) { |
| 97 | LOG_TRACE(Kernel, "context switch %u -> %u", cur->GetObjectId(), next->GetObjectId()); | 97 | NGLOG_TRACE(Kernel, "context switch {} -> {}", cur->GetObjectId(), next->GetObjectId()); |
| 98 | } else if (cur) { | 98 | } else if (cur) { |
| 99 | LOG_TRACE(Kernel, "context switch %u -> idle", cur->GetObjectId()); | 99 | NGLOG_TRACE(Kernel, "context switch {} -> idle", cur->GetObjectId()); |
| 100 | } else if (next) { | 100 | } else if (next) { |
| 101 | LOG_TRACE(Kernel, "context switch idle -> %u", next->GetObjectId()); | 101 | NGLOG_TRACE(Kernel, "context switch idle -> {}", next->GetObjectId()); |
| 102 | } | 102 | } |
| 103 | 103 | ||
| 104 | SwitchContext(next); | 104 | SwitchContext(next); |
diff --git a/src/core/hle/kernel/server_session.cpp b/src/core/hle/kernel/server_session.cpp index 33397d84f..b1f8e771c 100644 --- a/src/core/hle/kernel/server_session.cpp +++ b/src/core/hle/kernel/server_session.cpp | |||
| @@ -68,7 +68,7 @@ ResultCode ServerSession::HandleDomainSyncRequest(Kernel::HLERequestContext& con | |||
| 68 | return domain_request_handlers[object_id - 1]->HandleSyncRequest(context); | 68 | return domain_request_handlers[object_id - 1]->HandleSyncRequest(context); |
| 69 | 69 | ||
| 70 | case IPC::DomainMessageHeader::CommandType::CloseVirtualHandle: { | 70 | case IPC::DomainMessageHeader::CommandType::CloseVirtualHandle: { |
| 71 | LOG_DEBUG(IPC, "CloseVirtualHandle, object_id=0x%08X", object_id); | 71 | NGLOG_DEBUG(IPC, "CloseVirtualHandle, object_id={:#010X}", object_id); |
| 72 | 72 | ||
| 73 | domain_request_handlers[object_id - 1] = nullptr; | 73 | domain_request_handlers[object_id - 1] = nullptr; |
| 74 | 74 | ||
| @@ -78,8 +78,8 @@ ResultCode ServerSession::HandleDomainSyncRequest(Kernel::HLERequestContext& con | |||
| 78 | } | 78 | } |
| 79 | } | 79 | } |
| 80 | 80 | ||
| 81 | LOG_CRITICAL(IPC, "Unknown domain command=%d", | 81 | NGLOG_CRITICAL(IPC, "Unknown domain command={}", |
| 82 | static_cast<int>(domain_message_header->command.Value())); | 82 | static_cast<int>(domain_message_header->command.Value())); |
| 83 | ASSERT(false); | 83 | ASSERT(false); |
| 84 | } | 84 | } |
| 85 | 85 | ||
diff --git a/src/core/hle/kernel/shared_memory.cpp b/src/core/hle/kernel/shared_memory.cpp index bc99993c8..b18e9aea4 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 | LOG_ERROR(Kernel, "cannot map id=%u, address=0x%lx name=%s, permissions don't match", | 110 | NGLOG_ERROR(Kernel, "cannot map id={}, address={:#X} name={}, permissions don't match", |
| 111 | GetObjectId(), address, name.c_str()); | 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 | LOG_ERROR(Kernel, "cannot map id=%u, address=0x%lx name=%s, permissions don't match", | 118 | NGLOG_ERROR(Kernel, "cannot map id={}, address={:#X} name={}, permissions don't match", |
| 119 | GetObjectId(), address, name.c_str()); | 119 | GetObjectId(), address, name); |
| 120 | return ERR_WRONG_PERMISSION; | 120 | return ERR_WRONG_PERMISSION; |
| 121 | } | 121 | } |
| 122 | 122 | ||
| @@ -131,9 +131,10 @@ 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 | LOG_ERROR(Kernel, | 134 | NGLOG_ERROR( |
| 135 | "cannot map id=%u, target_address=0x%lx name=%s, error mapping to virtual memory", | 135 | Kernel, |
| 136 | GetObjectId(), target_address, name.c_str()); | 136 | "cannot map id={}, target_address={:#X} name={}, error mapping to virtual memory", |
| 137 | GetObjectId(), target_address, name); | ||
| 137 | return result.Code(); | 138 | return result.Code(); |
| 138 | } | 139 | } |
| 139 | 140 | ||
diff --git a/src/core/hle/kernel/svc.cpp b/src/core/hle/kernel/svc.cpp index c22da6e47..cb19b1a69 100644 --- a/src/core/hle/kernel/svc.cpp +++ b/src/core/hle/kernel/svc.cpp | |||
| @@ -31,7 +31,7 @@ namespace Kernel { | |||
| 31 | 31 | ||
| 32 | /// Set the process heap to a given Size. It can both extend and shrink the heap. | 32 | /// Set the process heap to a given Size. It can both extend and shrink the heap. |
| 33 | static ResultCode SetHeapSize(VAddr* heap_addr, u64 heap_size) { | 33 | static ResultCode SetHeapSize(VAddr* heap_addr, u64 heap_size) { |
| 34 | LOG_TRACE(Kernel_SVC, "called, heap_size=0x%llx", heap_size); | 34 | NGLOG_TRACE(Kernel_SVC, "called, heap_size={:#X}", heap_size); |
| 35 | auto& process = *Core::CurrentProcess(); | 35 | auto& process = *Core::CurrentProcess(); |
| 36 | CASCADE_RESULT(*heap_addr, | 36 | CASCADE_RESULT(*heap_addr, |
| 37 | process.HeapAllocate(Memory::HEAP_VADDR, heap_size, VMAPermission::ReadWrite)); | 37 | process.HeapAllocate(Memory::HEAP_VADDR, heap_size, VMAPermission::ReadWrite)); |
| @@ -39,21 +39,21 @@ static ResultCode SetHeapSize(VAddr* heap_addr, u64 heap_size) { | |||
| 39 | } | 39 | } |
| 40 | 40 | ||
| 41 | static ResultCode SetMemoryAttribute(VAddr addr, u64 size, u32 state0, u32 state1) { | 41 | static ResultCode SetMemoryAttribute(VAddr addr, u64 size, u32 state0, u32 state1) { |
| 42 | LOG_WARNING(Kernel_SVC, "(STUBBED) called, addr=0x%lx", addr); | 42 | NGLOG_WARNING(Kernel_SVC, "(STUBBED) called, addr={:#X}", addr); |
| 43 | return RESULT_SUCCESS; | 43 | return RESULT_SUCCESS; |
| 44 | } | 44 | } |
| 45 | 45 | ||
| 46 | /// Maps a memory range into a different range. | 46 | /// Maps a memory range into a different range. |
| 47 | static ResultCode MapMemory(VAddr dst_addr, VAddr src_addr, u64 size) { | 47 | static ResultCode MapMemory(VAddr dst_addr, VAddr src_addr, u64 size) { |
| 48 | LOG_TRACE(Kernel_SVC, "called, dst_addr=0x%llx, src_addr=0x%llx, size=0x%llx", dst_addr, | 48 | NGLOG_TRACE(Kernel_SVC, "called, dst_addr={:#X}, src_addr={:#X}, size={:#X}", dst_addr, |
| 49 | src_addr, size); | 49 | src_addr, size); |
| 50 | return Core::CurrentProcess()->MirrorMemory(dst_addr, src_addr, size); | 50 | return Core::CurrentProcess()->MirrorMemory(dst_addr, src_addr, size); |
| 51 | } | 51 | } |
| 52 | 52 | ||
| 53 | /// Unmaps a region that was previously mapped with svcMapMemory | 53 | /// Unmaps a region that was previously mapped with svcMapMemory |
| 54 | static ResultCode UnmapMemory(VAddr dst_addr, VAddr src_addr, u64 size) { | 54 | static ResultCode UnmapMemory(VAddr dst_addr, VAddr src_addr, u64 size) { |
| 55 | LOG_TRACE(Kernel_SVC, "called, dst_addr=0x%llx, src_addr=0x%llx, size=0x%llx", dst_addr, | 55 | NGLOG_TRACE(Kernel_SVC, "called, dst_addr={:#X}, src_addr={:#X}, size={:#X}", dst_addr, |
| 56 | src_addr, size); | 56 | src_addr, size); |
| 57 | return Core::CurrentProcess()->UnmapMemory(dst_addr, src_addr, size); | 57 | return Core::CurrentProcess()->UnmapMemory(dst_addr, src_addr, size); |
| 58 | } | 58 | } |
| 59 | 59 | ||
| @@ -68,11 +68,11 @@ static ResultCode ConnectToNamedPort(Handle* out_handle, VAddr port_name_address | |||
| 68 | if (port_name.size() > PortNameMaxLength) | 68 | if (port_name.size() > PortNameMaxLength) |
| 69 | return ERR_PORT_NAME_TOO_LONG; | 69 | return ERR_PORT_NAME_TOO_LONG; |
| 70 | 70 | ||
| 71 | LOG_TRACE(Kernel_SVC, "called port_name=%s", port_name.c_str()); | 71 | NGLOG_TRACE(Kernel_SVC, "called port_name={}", port_name); |
| 72 | 72 | ||
| 73 | auto it = Service::g_kernel_named_ports.find(port_name); | 73 | auto it = Service::g_kernel_named_ports.find(port_name); |
| 74 | if (it == Service::g_kernel_named_ports.end()) { | 74 | if (it == Service::g_kernel_named_ports.end()) { |
| 75 | LOG_WARNING(Kernel_SVC, "tried to connect to unknown port: %s", port_name.c_str()); | 75 | NGLOG_WARNING(Kernel_SVC, "tried to connect to unknown port: {}", port_name); |
| 76 | return ERR_NOT_FOUND; | 76 | return ERR_NOT_FOUND; |
| 77 | } | 77 | } |
| 78 | 78 | ||
| @@ -90,11 +90,11 @@ static ResultCode ConnectToNamedPort(Handle* out_handle, VAddr port_name_address | |||
| 90 | static ResultCode SendSyncRequest(Handle handle) { | 90 | static ResultCode SendSyncRequest(Handle handle) { |
| 91 | SharedPtr<ClientSession> session = g_handle_table.Get<ClientSession>(handle); | 91 | SharedPtr<ClientSession> session = g_handle_table.Get<ClientSession>(handle); |
| 92 | if (!session) { | 92 | if (!session) { |
| 93 | LOG_ERROR(Kernel_SVC, "called with invalid handle=0x%08X", handle); | 93 | NGLOG_ERROR(Kernel_SVC, "called with invalid handle={:#010X}", handle); |
| 94 | return ERR_INVALID_HANDLE; | 94 | return ERR_INVALID_HANDLE; |
| 95 | } | 95 | } |
| 96 | 96 | ||
| 97 | LOG_TRACE(Kernel_SVC, "called handle=0x%08X(%s)", handle, session->GetName().c_str()); | 97 | NGLOG_TRACE(Kernel_SVC, "called handle={:#010X}({})", handle, session->GetName()); |
| 98 | 98 | ||
| 99 | Core::System::GetInstance().PrepareReschedule(); | 99 | Core::System::GetInstance().PrepareReschedule(); |
| 100 | 100 | ||
| @@ -105,7 +105,7 @@ static ResultCode SendSyncRequest(Handle handle) { | |||
| 105 | 105 | ||
| 106 | /// Get the ID for the specified thread. | 106 | /// Get the ID for the specified thread. |
| 107 | static ResultCode GetThreadId(u32* thread_id, Handle thread_handle) { | 107 | static ResultCode GetThreadId(u32* thread_id, Handle thread_handle) { |
| 108 | LOG_TRACE(Kernel_SVC, "called thread=0x%08X", thread_handle); | 108 | NGLOG_TRACE(Kernel_SVC, "called thread={:#010X}", thread_handle); |
| 109 | 109 | ||
| 110 | const SharedPtr<Thread> thread = g_handle_table.Get<Thread>(thread_handle); | 110 | const SharedPtr<Thread> thread = g_handle_table.Get<Thread>(thread_handle); |
| 111 | if (!thread) { | 111 | if (!thread) { |
| @@ -118,7 +118,7 @@ static ResultCode GetThreadId(u32* thread_id, Handle thread_handle) { | |||
| 118 | 118 | ||
| 119 | /// Get the ID of the specified process | 119 | /// Get the ID of the specified process |
| 120 | static ResultCode GetProcessId(u32* process_id, Handle process_handle) { | 120 | static ResultCode GetProcessId(u32* process_id, Handle process_handle) { |
| 121 | LOG_TRACE(Kernel_SVC, "called process=0x%08X", process_handle); | 121 | NGLOG_TRACE(Kernel_SVC, "called process={:#010X}", process_handle); |
| 122 | 122 | ||
| 123 | const SharedPtr<Process> process = g_handle_table.Get<Process>(process_handle); | 123 | const SharedPtr<Process> process = g_handle_table.Get<Process>(process_handle); |
| 124 | if (!process) { | 124 | if (!process) { |
| @@ -178,8 +178,8 @@ static ResultCode WaitSynchronization1( | |||
| 178 | /// Wait for the given handles to synchronize, timeout after the specified nanoseconds | 178 | /// Wait for the given handles to synchronize, timeout after the specified nanoseconds |
| 179 | static ResultCode WaitSynchronization(Handle* index, VAddr handles_address, u64 handle_count, | 179 | static ResultCode WaitSynchronization(Handle* index, VAddr handles_address, u64 handle_count, |
| 180 | s64 nano_seconds) { | 180 | s64 nano_seconds) { |
| 181 | LOG_TRACE(Kernel_SVC, "called handles_address=0x%llx, handle_count=%d, nano_seconds=%d", | 181 | NGLOG_TRACE(Kernel_SVC, "called handles_address={:#X}, handle_count={}, nano_seconds={}", |
| 182 | handles_address, handle_count, nano_seconds); | 182 | handles_address, handle_count, nano_seconds); |
| 183 | 183 | ||
| 184 | if (!Memory::IsValidVirtualAddress(handles_address)) | 184 | if (!Memory::IsValidVirtualAddress(handles_address)) |
| 185 | return ERR_INVALID_POINTER; | 185 | return ERR_INVALID_POINTER; |
| @@ -239,7 +239,7 @@ static ResultCode WaitSynchronization(Handle* index, VAddr handles_address, u64 | |||
| 239 | 239 | ||
| 240 | /// Resumes a thread waiting on WaitSynchronization | 240 | /// Resumes a thread waiting on WaitSynchronization |
| 241 | static ResultCode CancelSynchronization(Handle thread_handle) { | 241 | static ResultCode CancelSynchronization(Handle thread_handle) { |
| 242 | LOG_TRACE(Kernel_SVC, "called thread=0x%08X", thread_handle); | 242 | NGLOG_TRACE(Kernel_SVC, "called thread={:#X}", thread_handle); |
| 243 | 243 | ||
| 244 | const SharedPtr<Thread> thread = g_handle_table.Get<Thread>(thread_handle); | 244 | const SharedPtr<Thread> thread = g_handle_table.Get<Thread>(thread_handle); |
| 245 | if (!thread) { | 245 | if (!thread) { |
| @@ -256,38 +256,38 @@ static ResultCode CancelSynchronization(Handle thread_handle) { | |||
| 256 | /// Attempts to locks a mutex, creating it if it does not already exist | 256 | /// Attempts to locks a mutex, creating it if it does not already exist |
| 257 | static ResultCode ArbitrateLock(Handle holding_thread_handle, VAddr mutex_addr, | 257 | static ResultCode ArbitrateLock(Handle holding_thread_handle, VAddr mutex_addr, |
| 258 | Handle requesting_thread_handle) { | 258 | Handle requesting_thread_handle) { |
| 259 | LOG_TRACE(Kernel_SVC, | 259 | NGLOG_TRACE(Kernel_SVC, |
| 260 | "called holding_thread_handle=0x%08X, mutex_addr=0x%llx, " | 260 | "called holding_thread_handle={:#010X}, mutex_addr={:#X}, " |
| 261 | "requesting_current_thread_handle=0x%08X", | 261 | "requesting_current_thread_handle={:#010X}", |
| 262 | holding_thread_handle, mutex_addr, requesting_thread_handle); | 262 | holding_thread_handle, mutex_addr, requesting_thread_handle); |
| 263 | 263 | ||
| 264 | return Mutex::TryAcquire(mutex_addr, holding_thread_handle, requesting_thread_handle); | 264 | return Mutex::TryAcquire(mutex_addr, holding_thread_handle, requesting_thread_handle); |
| 265 | } | 265 | } |
| 266 | 266 | ||
| 267 | /// Unlock a mutex | 267 | /// Unlock a mutex |
| 268 | static ResultCode ArbitrateUnlock(VAddr mutex_addr) { | 268 | static ResultCode ArbitrateUnlock(VAddr mutex_addr) { |
| 269 | LOG_TRACE(Kernel_SVC, "called mutex_addr=0x%llx", mutex_addr); | 269 | NGLOG_TRACE(Kernel_SVC, "called mutex_addr={:#X}", mutex_addr); |
| 270 | 270 | ||
| 271 | return Mutex::Release(mutex_addr); | 271 | return Mutex::Release(mutex_addr); |
| 272 | } | 272 | } |
| 273 | 273 | ||
| 274 | /// Break program execution | 274 | /// Break program execution |
| 275 | static void Break(u64 unk_0, u64 unk_1, u64 unk_2) { | 275 | static void Break(u64 unk_0, u64 unk_1, u64 unk_2) { |
| 276 | LOG_CRITICAL(Debug_Emulated, "Emulated program broke execution!"); | 276 | NGLOG_CRITICAL(Debug_Emulated, "Emulated program broke execution!"); |
| 277 | ASSERT(false); | 277 | ASSERT(false); |
| 278 | } | 278 | } |
| 279 | 279 | ||
| 280 | /// Used to output a message on a debug hardware unit - does nothing on a retail unit | 280 | /// Used to output a message on a debug hardware unit - does nothing on a retail unit |
| 281 | static void OutputDebugString(VAddr address, s32 len) { | 281 | static void OutputDebugString(VAddr address, s32 len) { |
| 282 | std::vector<char> string(len); | 282 | std::string str(len, '\0'); |
| 283 | Memory::ReadBlock(address, string.data(), len); | 283 | Memory::ReadBlock(address, str.data(), str.size()); |
| 284 | LOG_DEBUG(Debug_Emulated, "%.*s", len, string.data()); | 284 | NGLOG_DEBUG(Debug_Emulated, "{}", str); |
| 285 | } | 285 | } |
| 286 | 286 | ||
| 287 | /// Gets system/memory information for the current process | 287 | /// Gets system/memory information for the current process |
| 288 | static ResultCode GetInfo(u64* result, u64 info_id, u64 handle, u64 info_sub_id) { | 288 | static ResultCode GetInfo(u64* result, u64 info_id, u64 handle, u64 info_sub_id) { |
| 289 | LOG_TRACE(Kernel_SVC, "called info_id=0x%X, info_sub_id=0x%X, handle=0x%08X", info_id, | 289 | NGLOG_TRACE(Kernel_SVC, "called info_id={:#X}, info_sub_id={:#X}, handle={:#010X}", info_id, |
| 290 | info_sub_id, handle); | 290 | info_sub_id, handle); |
| 291 | 291 | ||
| 292 | auto& vm_manager = Core::CurrentProcess()->vm_manager; | 292 | auto& vm_manager = Core::CurrentProcess()->vm_manager; |
| 293 | 293 | ||
| @@ -338,12 +338,12 @@ static ResultCode GetInfo(u64* result, u64 info_id, u64 handle, u64 info_sub_id) | |||
| 338 | *result = Core::CurrentProcess()->is_virtual_address_memory_enabled; | 338 | *result = Core::CurrentProcess()->is_virtual_address_memory_enabled; |
| 339 | break; | 339 | break; |
| 340 | case GetInfoType::TitleId: | 340 | case GetInfoType::TitleId: |
| 341 | LOG_WARNING(Kernel_SVC, "(STUBBED) Attempted to query titleid, returned 0"); | 341 | NGLOG_WARNING(Kernel_SVC, "(STUBBED) Attempted to query titleid, returned 0"); |
| 342 | *result = 0; | 342 | *result = 0; |
| 343 | break; | 343 | break; |
| 344 | case GetInfoType::PrivilegedProcessId: | 344 | case GetInfoType::PrivilegedProcessId: |
| 345 | LOG_WARNING(Kernel_SVC, | 345 | NGLOG_WARNING(Kernel_SVC, |
| 346 | "(STUBBED) Attempted to query priviledged process id bounds, returned 0"); | 346 | "(STUBBED) Attempted to query privileged process id bounds, returned 0"); |
| 347 | *result = 0; | 347 | *result = 0; |
| 348 | break; | 348 | break; |
| 349 | default: | 349 | default: |
| @@ -355,13 +355,14 @@ static ResultCode GetInfo(u64* result, u64 info_id, u64 handle, u64 info_sub_id) | |||
| 355 | 355 | ||
| 356 | /// Sets the thread activity | 356 | /// Sets the thread activity |
| 357 | static ResultCode SetThreadActivity(Handle handle, u32 unknown) { | 357 | static ResultCode SetThreadActivity(Handle handle, u32 unknown) { |
| 358 | LOG_WARNING(Kernel_SVC, "(STUBBED) called, handle=0x%08X, unknown=0x%08X", handle, unknown); | 358 | NGLOG_WARNING(Kernel_SVC, "(STUBBED) called, handle={:#010X}, unknown={:#010X}", handle, |
| 359 | unknown); | ||
| 359 | return RESULT_SUCCESS; | 360 | return RESULT_SUCCESS; |
| 360 | } | 361 | } |
| 361 | 362 | ||
| 362 | /// Gets the thread context | 363 | /// Gets the thread context |
| 363 | static ResultCode GetThreadContext(Handle handle, VAddr addr) { | 364 | static ResultCode GetThreadContext(Handle handle, VAddr addr) { |
| 364 | LOG_WARNING(Kernel_SVC, "(STUBBED) called, handle=0x%08X, addr=0x%" PRIx64, handle, addr); | 365 | NGLOG_WARNING(Kernel_SVC, "(STUBBED) called, handle={:#010X}, addr={:#X}", handle, addr); |
| 365 | return RESULT_SUCCESS; | 366 | return RESULT_SUCCESS; |
| 366 | } | 367 | } |
| 367 | 368 | ||
| @@ -400,15 +401,15 @@ static ResultCode SetThreadPriority(Handle handle, u32 priority) { | |||
| 400 | 401 | ||
| 401 | /// Get which CPU core is executing the current thread | 402 | /// Get which CPU core is executing the current thread |
| 402 | static u32 GetCurrentProcessorNumber() { | 403 | static u32 GetCurrentProcessorNumber() { |
| 403 | LOG_WARNING(Kernel_SVC, "(STUBBED) called, defaulting to processor 0"); | 404 | NGLOG_WARNING(Kernel_SVC, "(STUBBED) called, defaulting to processor 0"); |
| 404 | return 0; | 405 | return 0; |
| 405 | } | 406 | } |
| 406 | 407 | ||
| 407 | static ResultCode MapSharedMemory(Handle shared_memory_handle, VAddr addr, u64 size, | 408 | static ResultCode MapSharedMemory(Handle shared_memory_handle, VAddr addr, u64 size, |
| 408 | u32 permissions) { | 409 | u32 permissions) { |
| 409 | LOG_TRACE(Kernel_SVC, | 410 | NGLOG_TRACE(Kernel_SVC, |
| 410 | "called, shared_memory_handle=0x%08X, addr=0x%llx, size=0x%llx, permissions=0x%08X", | 411 | "called, shared_memory_handle={:#X}, addr={:#X}, size={:#X}, permissions={:#010X}", |
| 411 | shared_memory_handle, addr, size, permissions); | 412 | shared_memory_handle, addr, size, permissions); |
| 412 | 413 | ||
| 413 | SharedPtr<SharedMemory> shared_memory = g_handle_table.Get<SharedMemory>(shared_memory_handle); | 414 | SharedPtr<SharedMemory> shared_memory = g_handle_table.Get<SharedMemory>(shared_memory_handle); |
| 414 | if (!shared_memory) { | 415 | if (!shared_memory) { |
| @@ -428,16 +429,15 @@ static ResultCode MapSharedMemory(Handle shared_memory_handle, VAddr addr, u64 s | |||
| 428 | return shared_memory->Map(Core::CurrentProcess().get(), addr, permissions_type, | 429 | return shared_memory->Map(Core::CurrentProcess().get(), addr, permissions_type, |
| 429 | MemoryPermission::DontCare); | 430 | MemoryPermission::DontCare); |
| 430 | default: | 431 | default: |
| 431 | LOG_ERROR(Kernel_SVC, "unknown permissions=0x%08X", permissions); | 432 | NGLOG_ERROR(Kernel_SVC, "unknown permissions={:#010X}", permissions); |
| 432 | } | 433 | } |
| 433 | 434 | ||
| 434 | return RESULT_SUCCESS; | 435 | return RESULT_SUCCESS; |
| 435 | } | 436 | } |
| 436 | 437 | ||
| 437 | static ResultCode UnmapSharedMemory(Handle shared_memory_handle, VAddr addr, u64 size) { | 438 | static ResultCode UnmapSharedMemory(Handle shared_memory_handle, VAddr addr, u64 size) { |
| 438 | LOG_WARNING(Kernel_SVC, | 439 | NGLOG_WARNING(Kernel_SVC, "called, shared_memory_handle={:#010X}, addr={:#X}, size={:#X}", |
| 439 | "called, shared_memory_handle=0x%08X, addr=0x%" PRIx64 ", size=0x%" PRIx64 "", | 440 | shared_memory_handle, addr, size); |
| 440 | shared_memory_handle, addr, size); | ||
| 441 | 441 | ||
| 442 | SharedPtr<SharedMemory> shared_memory = g_handle_table.Get<SharedMemory>(shared_memory_handle); | 442 | SharedPtr<SharedMemory> shared_memory = g_handle_table.Get<SharedMemory>(shared_memory_handle); |
| 443 | 443 | ||
| @@ -465,19 +465,19 @@ static ResultCode QueryProcessMemory(MemoryInfo* memory_info, PageInfo* /*page_i | |||
| 465 | memory_info->type = static_cast<u32>(vma->second.meminfo_state); | 465 | memory_info->type = static_cast<u32>(vma->second.meminfo_state); |
| 466 | } | 466 | } |
| 467 | 467 | ||
| 468 | LOG_TRACE(Kernel_SVC, "called process=0x%08X addr=%llx", process_handle, addr); | 468 | NGLOG_TRACE(Kernel_SVC, "called process={:#010X} addr={:X}", process_handle, addr); |
| 469 | return RESULT_SUCCESS; | 469 | return RESULT_SUCCESS; |
| 470 | } | 470 | } |
| 471 | 471 | ||
| 472 | /// Query memory | 472 | /// Query memory |
| 473 | static ResultCode QueryMemory(MemoryInfo* memory_info, PageInfo* page_info, VAddr addr) { | 473 | static ResultCode QueryMemory(MemoryInfo* memory_info, PageInfo* page_info, VAddr addr) { |
| 474 | LOG_TRACE(Kernel_SVC, "called, addr=%llx", addr); | 474 | NGLOG_TRACE(Kernel_SVC, "called, addr={:X}", addr); |
| 475 | return QueryProcessMemory(memory_info, page_info, CurrentProcess, addr); | 475 | return QueryProcessMemory(memory_info, page_info, CurrentProcess, addr); |
| 476 | } | 476 | } |
| 477 | 477 | ||
| 478 | /// Exits the current process | 478 | /// Exits the current process |
| 479 | static void ExitProcess() { | 479 | static void ExitProcess() { |
| 480 | LOG_INFO(Kernel_SVC, "Process %u exiting", Core::CurrentProcess()->process_id); | 480 | NGLOG_INFO(Kernel_SVC, "Process {} exiting", Core::CurrentProcess()->process_id); |
| 481 | 481 | ||
| 482 | ASSERT_MSG(Core::CurrentProcess()->status == ProcessStatus::Running, | 482 | ASSERT_MSG(Core::CurrentProcess()->status == ProcessStatus::Running, |
| 483 | "Process has already exited"); | 483 | "Process has already exited"); |
| @@ -534,9 +534,9 @@ static ResultCode CreateThread(Handle* out_handle, VAddr entry_point, u64 arg, V | |||
| 534 | case THREADPROCESSORID_2: | 534 | case THREADPROCESSORID_2: |
| 535 | case THREADPROCESSORID_3: | 535 | case THREADPROCESSORID_3: |
| 536 | // TODO(bunnei): Implement support for other processor IDs | 536 | // TODO(bunnei): Implement support for other processor IDs |
| 537 | LOG_ERROR(Kernel_SVC, | 537 | NGLOG_ERROR(Kernel_SVC, |
| 538 | "Newly created thread must run in another thread (%u), unimplemented.", | 538 | "Newly created thread must run in another thread ({}), unimplemented.", |
| 539 | processor_id); | 539 | processor_id); |
| 540 | break; | 540 | break; |
| 541 | default: | 541 | default: |
| 542 | ASSERT_MSG(false, "Unsupported thread processor ID: %d", processor_id); | 542 | ASSERT_MSG(false, "Unsupported thread processor ID: %d", processor_id); |
| @@ -551,17 +551,17 @@ static ResultCode CreateThread(Handle* out_handle, VAddr entry_point, u64 arg, V | |||
| 551 | 551 | ||
| 552 | Core::System::GetInstance().PrepareReschedule(); | 552 | Core::System::GetInstance().PrepareReschedule(); |
| 553 | 553 | ||
| 554 | LOG_TRACE(Kernel_SVC, | 554 | NGLOG_TRACE(Kernel_SVC, |
| 555 | "called entrypoint=0x%08X (%s), arg=0x%08X, stacktop=0x%08X, " | 555 | "called entrypoint={:#010X} ({}), arg={:#010X}, stacktop={:#010X}, " |
| 556 | "threadpriority=0x%08X, processorid=0x%08X : created handle=0x%08X", | 556 | "threadpriority={:#010X}, processorid={:#010X} : created handle={:#010X}", |
| 557 | entry_point, name.c_str(), arg, stack_top, priority, processor_id, *out_handle); | 557 | entry_point, name, arg, stack_top, priority, processor_id, *out_handle); |
| 558 | 558 | ||
| 559 | return RESULT_SUCCESS; | 559 | return RESULT_SUCCESS; |
| 560 | } | 560 | } |
| 561 | 561 | ||
| 562 | /// Starts the thread for the provided handle | 562 | /// Starts the thread for the provided handle |
| 563 | static ResultCode StartThread(Handle thread_handle) { | 563 | static ResultCode StartThread(Handle thread_handle) { |
| 564 | LOG_TRACE(Kernel_SVC, "called thread=0x%08X", thread_handle); | 564 | NGLOG_TRACE(Kernel_SVC, "called thread={:#010X}", thread_handle); |
| 565 | 565 | ||
| 566 | const SharedPtr<Thread> thread = g_handle_table.Get<Thread>(thread_handle); | 566 | const SharedPtr<Thread> thread = g_handle_table.Get<Thread>(thread_handle); |
| 567 | if (!thread) { | 567 | if (!thread) { |
| @@ -575,7 +575,7 @@ static ResultCode StartThread(Handle thread_handle) { | |||
| 575 | 575 | ||
| 576 | /// Called when a thread exits | 576 | /// Called when a thread exits |
| 577 | static void ExitThread() { | 577 | static void ExitThread() { |
| 578 | LOG_TRACE(Kernel_SVC, "called, pc=0x%08X", Core::CPU().GetPC()); | 578 | NGLOG_TRACE(Kernel_SVC, "called, pc={:#010X}", Core::CPU().GetPC()); |
| 579 | 579 | ||
| 580 | ExitCurrentThread(); | 580 | ExitCurrentThread(); |
| 581 | Core::System::GetInstance().PrepareReschedule(); | 581 | Core::System::GetInstance().PrepareReschedule(); |
| @@ -583,7 +583,7 @@ static void ExitThread() { | |||
| 583 | 583 | ||
| 584 | /// Sleep the current thread | 584 | /// Sleep the current thread |
| 585 | static void SleepThread(s64 nanoseconds) { | 585 | static void SleepThread(s64 nanoseconds) { |
| 586 | LOG_TRACE(Kernel_SVC, "called nanoseconds=%lld", nanoseconds); | 586 | NGLOG_TRACE(Kernel_SVC, "called nanoseconds={}", nanoseconds); |
| 587 | 587 | ||
| 588 | // Don't attempt to yield execution if there are no available threads to run, | 588 | // Don't attempt to yield execution if there are no available threads to run, |
| 589 | // this way we avoid a useless reschedule to the idle thread. | 589 | // this way we avoid a useless reschedule to the idle thread. |
| @@ -602,9 +602,9 @@ static void SleepThread(s64 nanoseconds) { | |||
| 602 | /// Signal process wide key atomic | 602 | /// Signal process wide key atomic |
| 603 | static ResultCode WaitProcessWideKeyAtomic(VAddr mutex_addr, VAddr condition_variable_addr, | 603 | static ResultCode WaitProcessWideKeyAtomic(VAddr mutex_addr, VAddr condition_variable_addr, |
| 604 | Handle thread_handle, s64 nano_seconds) { | 604 | Handle thread_handle, s64 nano_seconds) { |
| 605 | LOG_TRACE( | 605 | NGLOG_TRACE( |
| 606 | Kernel_SVC, | 606 | Kernel_SVC, |
| 607 | "called mutex_addr=%llx, condition_variable_addr=%llx, thread_handle=0x%08X, timeout=%d", | 607 | "called mutex_addr={:X}, condition_variable_addr={:X}, thread_handle={:#010X}, timeout={}", |
| 608 | mutex_addr, condition_variable_addr, thread_handle, nano_seconds); | 608 | mutex_addr, condition_variable_addr, thread_handle, nano_seconds); |
| 609 | 609 | ||
| 610 | SharedPtr<Thread> thread = g_handle_table.Get<Thread>(thread_handle); | 610 | SharedPtr<Thread> thread = g_handle_table.Get<Thread>(thread_handle); |
| @@ -629,8 +629,8 @@ static ResultCode WaitProcessWideKeyAtomic(VAddr mutex_addr, VAddr condition_var | |||
| 629 | 629 | ||
| 630 | /// Signal process wide key | 630 | /// Signal process wide key |
| 631 | static ResultCode SignalProcessWideKey(VAddr condition_variable_addr, s32 target) { | 631 | static ResultCode SignalProcessWideKey(VAddr condition_variable_addr, s32 target) { |
| 632 | LOG_TRACE(Kernel_SVC, "called, condition_variable_addr=0x%llx, target=0x%08x", | 632 | NGLOG_TRACE(Kernel_SVC, "called, condition_variable_addr={:#X}, target={:#010X}", |
| 633 | condition_variable_addr, target); | 633 | condition_variable_addr, target); |
| 634 | 634 | ||
| 635 | u32 processed = 0; | 635 | u32 processed = 0; |
| 636 | auto& thread_list = Core::System::GetInstance().Scheduler().GetThreadList(); | 636 | auto& thread_list = Core::System::GetInstance().Scheduler().GetThreadList(); |
| @@ -696,13 +696,13 @@ static u64 GetSystemTick() { | |||
| 696 | 696 | ||
| 697 | /// Close a handle | 697 | /// Close a handle |
| 698 | static ResultCode CloseHandle(Handle handle) { | 698 | static ResultCode CloseHandle(Handle handle) { |
| 699 | LOG_TRACE(Kernel_SVC, "Closing handle 0x%08X", handle); | 699 | NGLOG_TRACE(Kernel_SVC, "Closing handle {:#010X}", handle); |
| 700 | return g_handle_table.Close(handle); | 700 | return g_handle_table.Close(handle); |
| 701 | } | 701 | } |
| 702 | 702 | ||
| 703 | /// Reset an event | 703 | /// Reset an event |
| 704 | static ResultCode ResetSignal(Handle handle) { | 704 | static ResultCode ResetSignal(Handle handle) { |
| 705 | LOG_WARNING(Kernel_SVC, "(STUBBED) called handle 0x%08X", handle); | 705 | NGLOG_WARNING(Kernel_SVC, "(STUBBED) called handle {:#010X}", handle); |
| 706 | auto event = g_handle_table.Get<Event>(handle); | 706 | auto event = g_handle_table.Get<Event>(handle); |
| 707 | ASSERT(event != nullptr); | 707 | ASSERT(event != nullptr); |
| 708 | event->Clear(); | 708 | event->Clear(); |
| @@ -711,29 +711,29 @@ static ResultCode ResetSignal(Handle handle) { | |||
| 711 | 711 | ||
| 712 | /// Creates a TransferMemory object | 712 | /// Creates a TransferMemory object |
| 713 | static ResultCode CreateTransferMemory(Handle* handle, VAddr addr, u64 size, u32 permissions) { | 713 | static ResultCode CreateTransferMemory(Handle* handle, VAddr addr, u64 size, u32 permissions) { |
| 714 | LOG_WARNING(Kernel_SVC, "(STUBBED) called addr=0x%lx, size=0x%lx, perms=%08X", addr, size, | 714 | NGLOG_WARNING(Kernel_SVC, "(STUBBED) called addr={:#X}, size={:#X}, perms={:010X}", addr, size, |
| 715 | permissions); | 715 | permissions); |
| 716 | *handle = 0; | 716 | *handle = 0; |
| 717 | return RESULT_SUCCESS; | 717 | return RESULT_SUCCESS; |
| 718 | } | 718 | } |
| 719 | 719 | ||
| 720 | static ResultCode GetThreadCoreMask(Handle handle, u32* mask, u64* unknown) { | 720 | static ResultCode GetThreadCoreMask(Handle handle, u32* mask, u64* unknown) { |
| 721 | LOG_WARNING(Kernel_SVC, "(STUBBED) called, handle=0x%08X", handle); | 721 | NGLOG_WARNING(Kernel_SVC, "(STUBBED) called, handle={:010X}", handle); |
| 722 | *mask = 0x0; | 722 | *mask = 0x0; |
| 723 | *unknown = 0xf; | 723 | *unknown = 0xf; |
| 724 | return RESULT_SUCCESS; | 724 | return RESULT_SUCCESS; |
| 725 | } | 725 | } |
| 726 | 726 | ||
| 727 | static ResultCode SetThreadCoreMask(Handle handle, u32 mask, u64 unknown) { | 727 | static ResultCode SetThreadCoreMask(Handle handle, u32 mask, u64 unknown) { |
| 728 | LOG_WARNING(Kernel_SVC, "(STUBBED) called, handle=0x%08X, mask=0x%08X, unknown=0x%lx", handle, | 728 | NGLOG_WARNING(Kernel_SVC, "(STUBBED) called, handle={:#010X}, mask={:#010X}, unknown={:#X}", |
| 729 | mask, unknown); | 729 | handle, mask, unknown); |
| 730 | return RESULT_SUCCESS; | 730 | return RESULT_SUCCESS; |
| 731 | } | 731 | } |
| 732 | 732 | ||
| 733 | static ResultCode CreateSharedMemory(Handle* handle, u64 size, u32 local_permissions, | 733 | static ResultCode CreateSharedMemory(Handle* handle, u64 size, u32 local_permissions, |
| 734 | u32 remote_permissions) { | 734 | u32 remote_permissions) { |
| 735 | LOG_TRACE(Kernel_SVC, "called, size=0x%llx, localPerms=0x%08x, remotePerms=0x%08x", size, | 735 | NGLOG_TRACE(Kernel_SVC, "called, size={:#X}, localPerms={:#010X}, remotePerms={:#010X}", size, |
| 736 | local_permissions, remote_permissions); | 736 | local_permissions, remote_permissions); |
| 737 | auto sharedMemHandle = | 737 | auto sharedMemHandle = |
| 738 | SharedMemory::Create(g_handle_table.Get<Process>(KernelHandle::CurrentProcess), size, | 738 | SharedMemory::Create(g_handle_table.Get<Process>(KernelHandle::CurrentProcess), size, |
| 739 | static_cast<MemoryPermission>(local_permissions), | 739 | static_cast<MemoryPermission>(local_permissions), |
| @@ -744,7 +744,7 @@ static ResultCode CreateSharedMemory(Handle* handle, u64 size, u32 local_permiss | |||
| 744 | } | 744 | } |
| 745 | 745 | ||
| 746 | static ResultCode ClearEvent(Handle handle) { | 746 | static ResultCode ClearEvent(Handle handle) { |
| 747 | LOG_TRACE(Kernel_SVC, "called, event=0xX", handle); | 747 | NGLOG_TRACE(Kernel_SVC, "called, event={:010X}", handle); |
| 748 | 748 | ||
| 749 | SharedPtr<Event> evt = g_handle_table.Get<Event>(handle); | 749 | SharedPtr<Event> evt = g_handle_table.Get<Event>(handle); |
| 750 | if (evt == nullptr) | 750 | if (evt == nullptr) |
| @@ -896,7 +896,7 @@ static const FunctionDef SVC_Table[] = { | |||
| 896 | 896 | ||
| 897 | static const FunctionDef* GetSVCInfo(u32 func_num) { | 897 | static const FunctionDef* GetSVCInfo(u32 func_num) { |
| 898 | if (func_num >= std::size(SVC_Table)) { | 898 | if (func_num >= std::size(SVC_Table)) { |
| 899 | LOG_ERROR(Kernel_SVC, "unknown svc=0x%02X", func_num); | 899 | NGLOG_ERROR(Kernel_SVC, "Unknown svc={:#04X}", func_num); |
| 900 | return nullptr; | 900 | return nullptr; |
| 901 | } | 901 | } |
| 902 | return &SVC_Table[func_num]; | 902 | return &SVC_Table[func_num]; |
| @@ -915,10 +915,10 @@ void CallSVC(u32 immediate) { | |||
| 915 | if (info->func) { | 915 | if (info->func) { |
| 916 | info->func(); | 916 | info->func(); |
| 917 | } else { | 917 | } else { |
| 918 | LOG_CRITICAL(Kernel_SVC, "unimplemented SVC function %s(..)", info->name); | 918 | NGLOG_CRITICAL(Kernel_SVC, "Unimplemented SVC function {}(..)", info->name); |
| 919 | } | 919 | } |
| 920 | } else { | 920 | } else { |
| 921 | LOG_CRITICAL(Kernel_SVC, "unknown SVC function 0x%x", immediate); | 921 | NGLOG_CRITICAL(Kernel_SVC, "Unknown SVC function {:#X}", immediate); |
| 922 | } | 922 | } |
| 923 | } | 923 | } |
| 924 | 924 | ||
diff --git a/src/core/hle/kernel/thread.cpp b/src/core/hle/kernel/thread.cpp index 36222d45f..4cd57ab25 100644 --- a/src/core/hle/kernel/thread.cpp +++ b/src/core/hle/kernel/thread.cpp | |||
| @@ -101,9 +101,10 @@ void ExitCurrentThread() { | |||
| 101 | * @param cycles_late The number of CPU cycles that have passed since the desired wakeup time | 101 | * @param cycles_late The number of CPU cycles that have passed since the desired wakeup time |
| 102 | */ | 102 | */ |
| 103 | static void ThreadWakeupCallback(u64 thread_handle, int cycles_late) { | 103 | static void ThreadWakeupCallback(u64 thread_handle, int cycles_late) { |
| 104 | SharedPtr<Thread> thread = wakeup_callback_handle_table.Get<Thread>((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 | if (thread == nullptr) { | 106 | if (thread == nullptr) { |
| 106 | LOG_CRITICAL(Kernel, "Callback fired for invalid thread %08X", (Handle)thread_handle); | 107 | NGLOG_CRITICAL(Kernel, "Callback fired for invalid thread {:08X}", proper_handle); |
| 107 | return; | 108 | return; |
| 108 | } | 109 | } |
| 109 | 110 | ||
| @@ -238,19 +239,19 @@ ResultVal<SharedPtr<Thread>> Thread::Create(std::string name, VAddr entry_point, | |||
| 238 | SharedPtr<Process> owner_process) { | 239 | SharedPtr<Process> owner_process) { |
| 239 | // Check if priority is in ranged. Lowest priority -> highest priority id. | 240 | // Check if priority is in ranged. Lowest priority -> highest priority id. |
| 240 | if (priority > THREADPRIO_LOWEST) { | 241 | if (priority > THREADPRIO_LOWEST) { |
| 241 | LOG_ERROR(Kernel_SVC, "Invalid thread priority: %u", priority); | 242 | NGLOG_ERROR(Kernel_SVC, "Invalid thread priority: {}", priority); |
| 242 | return ERR_OUT_OF_RANGE; | 243 | return ERR_OUT_OF_RANGE; |
| 243 | } | 244 | } |
| 244 | 245 | ||
| 245 | if (processor_id > THREADPROCESSORID_MAX) { | 246 | if (processor_id > THREADPROCESSORID_MAX) { |
| 246 | LOG_ERROR(Kernel_SVC, "Invalid processor id: %d", processor_id); | 247 | NGLOG_ERROR(Kernel_SVC, "Invalid processor id: {}", processor_id); |
| 247 | return ERR_OUT_OF_RANGE_KERNEL; | 248 | return ERR_OUT_OF_RANGE_KERNEL; |
| 248 | } | 249 | } |
| 249 | 250 | ||
| 250 | // TODO(yuriks): Other checks, returning 0xD9001BEA | 251 | // TODO(yuriks): Other checks, returning 0xD9001BEA |
| 251 | 252 | ||
| 252 | if (!Memory::IsValidVirtualAddress(*owner_process, entry_point)) { | 253 | if (!Memory::IsValidVirtualAddress(*owner_process, entry_point)) { |
| 253 | LOG_ERROR(Kernel_SVC, "(name=%s): invalid entry %016" PRIx64, name.c_str(), entry_point); | 254 | NGLOG_ERROR(Kernel_SVC, "(name={}): invalid entry {:016X}", name, entry_point); |
| 254 | // TODO (bunnei): Find the correct error code to use here | 255 | // TODO (bunnei): Find the correct error code to use here |
| 255 | return ResultCode(-1); | 256 | return ResultCode(-1); |
| 256 | } | 257 | } |
| @@ -289,8 +290,8 @@ ResultVal<SharedPtr<Thread>> Thread::Create(std::string name, VAddr entry_point, | |||
| 289 | auto& linheap_memory = memory_region->linear_heap_memory; | 290 | auto& linheap_memory = memory_region->linear_heap_memory; |
| 290 | 291 | ||
| 291 | if (linheap_memory->size() + Memory::PAGE_SIZE > memory_region->size) { | 292 | if (linheap_memory->size() + Memory::PAGE_SIZE > memory_region->size) { |
| 292 | LOG_ERROR(Kernel_SVC, | 293 | NGLOG_ERROR(Kernel_SVC, |
| 293 | "Not enough space in region to allocate a new TLS page for thread"); | 294 | "Not enough space in region to allocate a new TLS page for thread"); |
| 294 | return ERR_OUT_OF_MEMORY; | 295 | return ERR_OUT_OF_MEMORY; |
| 295 | } | 296 | } |
| 296 | 297 | ||
diff --git a/src/core/hle/kernel/timer.cpp b/src/core/hle/kernel/timer.cpp index 8da745634..ad58bf043 100644 --- a/src/core/hle/kernel/timer.cpp +++ b/src/core/hle/kernel/timer.cpp | |||
| @@ -77,7 +77,7 @@ void Timer::WakeupAllWaitingThreads() { | |||
| 77 | } | 77 | } |
| 78 | 78 | ||
| 79 | void Timer::Signal(int cycles_late) { | 79 | void Timer::Signal(int cycles_late) { |
| 80 | LOG_TRACE(Kernel, "Timer %u fired", GetObjectId()); | 80 | NGLOG_TRACE(Kernel, "Timer {} fired", GetObjectId()); |
| 81 | 81 | ||
| 82 | signaled = true; | 82 | signaled = true; |
| 83 | 83 | ||
| @@ -97,7 +97,7 @@ static void TimerCallback(u64 timer_handle, int cycles_late) { | |||
| 97 | timer_callback_handle_table.Get<Timer>(static_cast<Handle>(timer_handle)); | 97 | timer_callback_handle_table.Get<Timer>(static_cast<Handle>(timer_handle)); |
| 98 | 98 | ||
| 99 | if (timer == nullptr) { | 99 | if (timer == nullptr) { |
| 100 | LOG_CRITICAL(Kernel, "Callback fired for invalid timer %08" PRIx64, timer_handle); | 100 | NGLOG_CRITICAL(Kernel, "Callback fired for invalid timer {:016X}", timer_handle); |
| 101 | return; | 101 | return; |
| 102 | } | 102 | } |
| 103 | 103 | ||
diff --git a/src/core/hle/kernel/vm_manager.cpp b/src/core/hle/kernel/vm_manager.cpp index acd65ee68..eb2e35eed 100644 --- a/src/core/hle/kernel/vm_manager.cpp +++ b/src/core/hle/kernel/vm_manager.cpp | |||
| @@ -379,22 +379,22 @@ void VMManager::UpdatePageTableForVMA(const VirtualMemoryArea& vma) { | |||
| 379 | } | 379 | } |
| 380 | 380 | ||
| 381 | u64 VMManager::GetTotalMemoryUsage() { | 381 | u64 VMManager::GetTotalMemoryUsage() { |
| 382 | LOG_WARNING(Kernel, "(STUBBED) called"); | 382 | NGLOG_WARNING(Kernel, "(STUBBED) called"); |
| 383 | return 0xF8000000; | 383 | return 0xF8000000; |
| 384 | } | 384 | } |
| 385 | 385 | ||
| 386 | u64 VMManager::GetTotalHeapUsage() { | 386 | u64 VMManager::GetTotalHeapUsage() { |
| 387 | LOG_WARNING(Kernel, "(STUBBED) called"); | 387 | NGLOG_WARNING(Kernel, "(STUBBED) called"); |
| 388 | return 0x0; | 388 | return 0x0; |
| 389 | } | 389 | } |
| 390 | 390 | ||
| 391 | VAddr VMManager::GetAddressSpaceBaseAddr() { | 391 | VAddr VMManager::GetAddressSpaceBaseAddr() { |
| 392 | LOG_WARNING(Kernel, "(STUBBED) called"); | 392 | NGLOG_WARNING(Kernel, "(STUBBED) called"); |
| 393 | return 0x8000000; | 393 | return 0x8000000; |
| 394 | } | 394 | } |
| 395 | 395 | ||
| 396 | u64 VMManager::GetAddressSpaceSize() { | 396 | u64 VMManager::GetAddressSpaceSize() { |
| 397 | LOG_WARNING(Kernel, "(STUBBED) called"); | 397 | NGLOG_WARNING(Kernel, "(STUBBED) called"); |
| 398 | return MAX_ADDRESS; | 398 | return MAX_ADDRESS; |
| 399 | } | 399 | } |
| 400 | 400 | ||