mirror of
				https://git.suyu.dev/suyu/suyu
				synced 2025-10-30 15:39:02 -05:00 
			
		
		
		
	Rename logging macro back to LOG_*
This commit is contained in:
		| @@ -26,7 +26,7 @@ ResultVal<Handle> HandleTable::Create(SharedPtr<Object> obj) { | ||||
|  | ||||
|     u16 slot = next_free_slot; | ||||
|     if (slot >= generations.size()) { | ||||
|         NGLOG_ERROR(Kernel, "Unable to allocate Handle, too many slots in use."); | ||||
|         LOG_ERROR(Kernel, "Unable to allocate Handle, too many slots in use."); | ||||
|         return ERR_OUT_OF_HANDLES; | ||||
|     } | ||||
|     next_free_slot = generations[slot]; | ||||
| @@ -48,7 +48,7 @@ ResultVal<Handle> HandleTable::Create(SharedPtr<Object> obj) { | ||||
| ResultVal<Handle> HandleTable::Duplicate(Handle handle) { | ||||
|     SharedPtr<Object> object = GetGeneric(handle); | ||||
|     if (object == nullptr) { | ||||
|         NGLOG_ERROR(Kernel, "Tried to duplicate invalid handle: {:08X}", handle); | ||||
|         LOG_ERROR(Kernel, "Tried to duplicate invalid handle: {:08X}", handle); | ||||
|         return ERR_INVALID_HANDLE; | ||||
|     } | ||||
|     return Create(std::move(object)); | ||||
|   | ||||
| @@ -120,7 +120,7 @@ void HLERequestContext::ParseCommandBuffer(u32_le* src_cmdbuf, bool incoming) { | ||||
|                 std::make_shared<IPC::DomainMessageHeader>(rp.PopRaw<IPC::DomainMessageHeader>()); | ||||
|         } else { | ||||
|             if (Session()->IsDomain()) | ||||
|                 NGLOG_WARNING(IPC, "Domain request has no DomainMessageHeader!"); | ||||
|                 LOG_WARNING(IPC, "Domain request has no DomainMessageHeader!"); | ||||
|         } | ||||
|     } | ||||
|  | ||||
| @@ -272,14 +272,14 @@ std::vector<u8> HLERequestContext::ReadBuffer(int buffer_index) const { | ||||
|  | ||||
| size_t HLERequestContext::WriteBuffer(const void* buffer, size_t size, int buffer_index) const { | ||||
|     if (size == 0) { | ||||
|         NGLOG_WARNING(Core, "skip empty buffer write"); | ||||
|         LOG_WARNING(Core, "skip empty buffer write"); | ||||
|         return 0; | ||||
|     } | ||||
|  | ||||
|     const bool is_buffer_b{BufferDescriptorB().size() && BufferDescriptorB()[buffer_index].Size()}; | ||||
|     const size_t buffer_size{GetWriteBufferSize(buffer_index)}; | ||||
|     if (size > buffer_size) { | ||||
|         NGLOG_CRITICAL(Core, "size ({:016X}) is greater than buffer_size ({:016X})", size, | ||||
|         LOG_CRITICAL(Core, "size ({:016X}) is greater than buffer_size ({:016X})", size, | ||||
|                        buffer_size); | ||||
|         size = buffer_size; // TODO(bunnei): This needs to be HW tested | ||||
|     } | ||||
|   | ||||
| @@ -54,7 +54,7 @@ void Process::ParseKernelCaps(const u32* kernel_caps, size_t len) { | ||||
|             continue; | ||||
|         } else if ((type & 0xF00) == 0xE00) { // 0x0FFF | ||||
|             // Allowed interrupts list | ||||
|             NGLOG_WARNING(Loader, "ExHeader allowed interrupts list ignored"); | ||||
|             LOG_WARNING(Loader, "ExHeader allowed interrupts list ignored"); | ||||
|         } else if ((type & 0xF80) == 0xF00) { // 0x07FF | ||||
|             // Allowed syscalls mask | ||||
|             unsigned int index = ((descriptor >> 24) & 7) * 24; | ||||
| @@ -74,7 +74,7 @@ void Process::ParseKernelCaps(const u32* kernel_caps, size_t len) { | ||||
|         } else if ((type & 0xFFE) == 0xFF8) { // 0x001F | ||||
|             // Mapped memory range | ||||
|             if (i + 1 >= len || ((kernel_caps[i + 1] >> 20) & 0xFFE) != 0xFF8) { | ||||
|                 NGLOG_WARNING(Loader, "Incomplete exheader memory range descriptor ignored."); | ||||
|                 LOG_WARNING(Loader, "Incomplete exheader memory range descriptor ignored."); | ||||
|                 continue; | ||||
|             } | ||||
|             u32 end_desc = kernel_caps[i + 1]; | ||||
| @@ -109,9 +109,9 @@ void Process::ParseKernelCaps(const u32* kernel_caps, size_t len) { | ||||
|  | ||||
|             int minor = kernel_version & 0xFF; | ||||
|             int major = (kernel_version >> 8) & 0xFF; | ||||
|             NGLOG_INFO(Loader, "ExHeader kernel version: {}.{}", major, minor); | ||||
|             LOG_INFO(Loader, "ExHeader kernel version: {}.{}", major, minor); | ||||
|         } else { | ||||
|             NGLOG_ERROR(Loader, "Unhandled kernel caps descriptor: 0x{:08X}", descriptor); | ||||
|             LOG_ERROR(Loader, "Unhandled kernel caps descriptor: 0x{:08X}", descriptor); | ||||
|         } | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -29,7 +29,7 @@ SharedPtr<ResourceLimit> ResourceLimit::GetForCategory(ResourceLimitCategory cat | ||||
|     case ResourceLimitCategory::OTHER: | ||||
|         return resource_limits[static_cast<u8>(category)]; | ||||
|     default: | ||||
|         NGLOG_CRITICAL(Kernel, "Unknown resource limit category"); | ||||
|         LOG_CRITICAL(Kernel, "Unknown resource limit category"); | ||||
|         UNREACHABLE(); | ||||
|     } | ||||
| } | ||||
| @@ -55,7 +55,7 @@ s32 ResourceLimit::GetCurrentResourceValue(ResourceType resource) const { | ||||
|     case ResourceType::CPUTime: | ||||
|         return current_cpu_time; | ||||
|     default: | ||||
|         NGLOG_ERROR(Kernel, "Unknown resource type={:08X}", static_cast<u32>(resource)); | ||||
|         LOG_ERROR(Kernel, "Unknown resource type={:08X}", static_cast<u32>(resource)); | ||||
|         UNIMPLEMENTED(); | ||||
|         return 0; | ||||
|     } | ||||
| @@ -84,7 +84,7 @@ u32 ResourceLimit::GetMaxResourceValue(ResourceType resource) const { | ||||
|     case ResourceType::CPUTime: | ||||
|         return max_cpu_time; | ||||
|     default: | ||||
|         NGLOG_ERROR(Kernel, "Unknown resource type={:08X}", static_cast<u32>(resource)); | ||||
|         LOG_ERROR(Kernel, "Unknown resource type={:08X}", static_cast<u32>(resource)); | ||||
|         UNIMPLEMENTED(); | ||||
|         return 0; | ||||
|     } | ||||
|   | ||||
| @@ -99,11 +99,11 @@ void Scheduler::Reschedule() { | ||||
|     Thread* next = PopNextReadyThread(); | ||||
|  | ||||
|     if (cur && next) { | ||||
|         NGLOG_TRACE(Kernel, "context switch {} -> {}", cur->GetObjectId(), next->GetObjectId()); | ||||
|         LOG_TRACE(Kernel, "context switch {} -> {}", cur->GetObjectId(), next->GetObjectId()); | ||||
|     } else if (cur) { | ||||
|         NGLOG_TRACE(Kernel, "context switch {} -> idle", cur->GetObjectId()); | ||||
|         LOG_TRACE(Kernel, "context switch {} -> idle", cur->GetObjectId()); | ||||
|     } else if (next) { | ||||
|         NGLOG_TRACE(Kernel, "context switch idle -> {}", next->GetObjectId()); | ||||
|         LOG_TRACE(Kernel, "context switch idle -> {}", next->GetObjectId()); | ||||
|     } | ||||
|  | ||||
|     SwitchContext(next); | ||||
|   | ||||
| @@ -71,7 +71,7 @@ ResultCode ServerSession::HandleDomainSyncRequest(Kernel::HLERequestContext& con | ||||
|             return domain_request_handlers[object_id - 1]->HandleSyncRequest(context); | ||||
|  | ||||
|         case IPC::DomainMessageHeader::CommandType::CloseVirtualHandle: { | ||||
|             NGLOG_DEBUG(IPC, "CloseVirtualHandle, object_id=0x{:08X}", object_id); | ||||
|             LOG_DEBUG(IPC, "CloseVirtualHandle, object_id=0x{:08X}", object_id); | ||||
|  | ||||
|             domain_request_handlers[object_id - 1] = nullptr; | ||||
|  | ||||
| @@ -81,7 +81,7 @@ ResultCode ServerSession::HandleDomainSyncRequest(Kernel::HLERequestContext& con | ||||
|         } | ||||
|         } | ||||
|  | ||||
|         NGLOG_CRITICAL(IPC, "Unknown domain command={}", | ||||
|         LOG_CRITICAL(IPC, "Unknown domain command={}", | ||||
|                        static_cast<int>(domain_message_header->command.Value())); | ||||
|         ASSERT(false); | ||||
|     } | ||||
|   | ||||
| @@ -107,7 +107,7 @@ ResultCode SharedMemory::Map(Process* target_process, VAddr address, MemoryPermi | ||||
|  | ||||
|     // Error out if the requested permissions don't match what the creator process allows. | ||||
|     if (static_cast<u32>(permissions) & ~static_cast<u32>(own_other_permissions)) { | ||||
|         NGLOG_ERROR(Kernel, "cannot map id={}, address=0x{:X} name={}, permissions don't match", | ||||
|         LOG_ERROR(Kernel, "cannot map id={}, address=0x{:X} name={}, permissions don't match", | ||||
|                     GetObjectId(), address, name); | ||||
|         return ERR_INVALID_COMBINATION; | ||||
|     } | ||||
| @@ -115,7 +115,7 @@ ResultCode SharedMemory::Map(Process* target_process, VAddr address, MemoryPermi | ||||
|     // Error out if the provided permissions are not compatible with what the creator process needs. | ||||
|     if (other_permissions != MemoryPermission::DontCare && | ||||
|         static_cast<u32>(this->permissions) & ~static_cast<u32>(other_permissions)) { | ||||
|         NGLOG_ERROR(Kernel, "cannot map id={}, address=0x{:X} name={}, permissions don't match", | ||||
|         LOG_ERROR(Kernel, "cannot map id={}, address=0x{:X} name={}, permissions don't match", | ||||
|                     GetObjectId(), address, name); | ||||
|         return ERR_WRONG_PERMISSION; | ||||
|     } | ||||
| @@ -131,7 +131,7 @@ ResultCode SharedMemory::Map(Process* target_process, VAddr address, MemoryPermi | ||||
|     auto result = target_process->vm_manager.MapMemoryBlock( | ||||
|         target_address, backing_block, backing_block_offset, size, MemoryState::Shared); | ||||
|     if (result.Failed()) { | ||||
|         NGLOG_ERROR( | ||||
|         LOG_ERROR( | ||||
|             Kernel, | ||||
|             "cannot map id={}, target_address=0x{:X} name={}, error mapping to virtual memory", | ||||
|             GetObjectId(), target_address, name); | ||||
|   | ||||
| @@ -32,7 +32,7 @@ namespace Kernel { | ||||
|  | ||||
| /// Set the process heap to a given Size. It can both extend and shrink the heap. | ||||
| static ResultCode SetHeapSize(VAddr* heap_addr, u64 heap_size) { | ||||
|     NGLOG_TRACE(Kernel_SVC, "called, heap_size=0x{:X}", heap_size); | ||||
|     LOG_TRACE(Kernel_SVC, "called, heap_size=0x{:X}", heap_size); | ||||
|     auto& process = *Core::CurrentProcess(); | ||||
|     CASCADE_RESULT(*heap_addr, | ||||
|                    process.HeapAllocate(Memory::HEAP_VADDR, heap_size, VMAPermission::ReadWrite)); | ||||
| @@ -40,20 +40,20 @@ static ResultCode SetHeapSize(VAddr* heap_addr, u64 heap_size) { | ||||
| } | ||||
|  | ||||
| static ResultCode SetMemoryAttribute(VAddr addr, u64 size, u32 state0, u32 state1) { | ||||
|     NGLOG_WARNING(Kernel_SVC, "(STUBBED) called, addr=0x{:X}", addr); | ||||
|     LOG_WARNING(Kernel_SVC, "(STUBBED) called, addr=0x{:X}", addr); | ||||
|     return RESULT_SUCCESS; | ||||
| } | ||||
|  | ||||
| /// Maps a memory range into a different range. | ||||
| static ResultCode MapMemory(VAddr dst_addr, VAddr src_addr, u64 size) { | ||||
|     NGLOG_TRACE(Kernel_SVC, "called, dst_addr=0x{:X}, src_addr=0x{:X}, size=0x{:X}", dst_addr, | ||||
|     LOG_TRACE(Kernel_SVC, "called, dst_addr=0x{:X}, src_addr=0x{:X}, size=0x{:X}", dst_addr, | ||||
|                 src_addr, size); | ||||
|     return Core::CurrentProcess()->MirrorMemory(dst_addr, src_addr, size); | ||||
| } | ||||
|  | ||||
| /// Unmaps a region that was previously mapped with svcMapMemory | ||||
| static ResultCode UnmapMemory(VAddr dst_addr, VAddr src_addr, u64 size) { | ||||
|     NGLOG_TRACE(Kernel_SVC, "called, dst_addr=0x{:X}, src_addr=0x{:X}, size=0x{:X}", dst_addr, | ||||
|     LOG_TRACE(Kernel_SVC, "called, dst_addr=0x{:X}, src_addr=0x{:X}, size=0x{:X}", dst_addr, | ||||
|                 src_addr, size); | ||||
|     return Core::CurrentProcess()->UnmapMemory(dst_addr, src_addr, size); | ||||
| } | ||||
| @@ -69,11 +69,11 @@ static ResultCode ConnectToNamedPort(Handle* out_handle, VAddr port_name_address | ||||
|     if (port_name.size() > PortNameMaxLength) | ||||
|         return ERR_PORT_NAME_TOO_LONG; | ||||
|  | ||||
|     NGLOG_TRACE(Kernel_SVC, "called port_name={}", port_name); | ||||
|     LOG_TRACE(Kernel_SVC, "called port_name={}", port_name); | ||||
|  | ||||
|     auto it = Service::g_kernel_named_ports.find(port_name); | ||||
|     if (it == Service::g_kernel_named_ports.end()) { | ||||
|         NGLOG_WARNING(Kernel_SVC, "tried to connect to unknown port: {}", port_name); | ||||
|         LOG_WARNING(Kernel_SVC, "tried to connect to unknown port: {}", port_name); | ||||
|         return ERR_NOT_FOUND; | ||||
|     } | ||||
|  | ||||
| @@ -91,11 +91,11 @@ static ResultCode ConnectToNamedPort(Handle* out_handle, VAddr port_name_address | ||||
| static ResultCode SendSyncRequest(Handle handle) { | ||||
|     SharedPtr<ClientSession> session = g_handle_table.Get<ClientSession>(handle); | ||||
|     if (!session) { | ||||
|         NGLOG_ERROR(Kernel_SVC, "called with invalid handle=0x{:08X}", handle); | ||||
|         LOG_ERROR(Kernel_SVC, "called with invalid handle=0x{:08X}", handle); | ||||
|         return ERR_INVALID_HANDLE; | ||||
|     } | ||||
|  | ||||
|     NGLOG_TRACE(Kernel_SVC, "called handle=0x{:08X}({})", handle, session->GetName()); | ||||
|     LOG_TRACE(Kernel_SVC, "called handle=0x{:08X}({})", handle, session->GetName()); | ||||
|  | ||||
|     Core::System::GetInstance().PrepareReschedule(); | ||||
|  | ||||
| @@ -106,7 +106,7 @@ static ResultCode SendSyncRequest(Handle handle) { | ||||
|  | ||||
| /// Get the ID for the specified thread. | ||||
| static ResultCode GetThreadId(u32* thread_id, Handle thread_handle) { | ||||
|     NGLOG_TRACE(Kernel_SVC, "called thread=0x{:08X}", thread_handle); | ||||
|     LOG_TRACE(Kernel_SVC, "called thread=0x{:08X}", thread_handle); | ||||
|  | ||||
|     const SharedPtr<Thread> thread = g_handle_table.Get<Thread>(thread_handle); | ||||
|     if (!thread) { | ||||
| @@ -119,7 +119,7 @@ static ResultCode GetThreadId(u32* thread_id, Handle thread_handle) { | ||||
|  | ||||
| /// Get the ID of the specified process | ||||
| static ResultCode GetProcessId(u32* process_id, Handle process_handle) { | ||||
|     NGLOG_TRACE(Kernel_SVC, "called process=0x{:08X}", process_handle); | ||||
|     LOG_TRACE(Kernel_SVC, "called process=0x{:08X}", process_handle); | ||||
|  | ||||
|     const SharedPtr<Process> process = g_handle_table.Get<Process>(process_handle); | ||||
|     if (!process) { | ||||
| @@ -149,7 +149,7 @@ static bool DefaultThreadWakeupCallback(ThreadWakeupReason reason, SharedPtr<Thr | ||||
| /// Wait for the given handles to synchronize, timeout after the specified nanoseconds | ||||
| static ResultCode WaitSynchronization(Handle* index, VAddr handles_address, u64 handle_count, | ||||
|                                       s64 nano_seconds) { | ||||
|     NGLOG_TRACE(Kernel_SVC, "called handles_address=0x{:X}, handle_count={}, nano_seconds={}", | ||||
|     LOG_TRACE(Kernel_SVC, "called handles_address=0x{:X}, handle_count={}, nano_seconds={}", | ||||
|                 handles_address, handle_count, nano_seconds); | ||||
|  | ||||
|     if (!Memory::IsValidVirtualAddress(handles_address)) | ||||
| @@ -210,7 +210,7 @@ static ResultCode WaitSynchronization(Handle* index, VAddr handles_address, u64 | ||||
|  | ||||
| /// Resumes a thread waiting on WaitSynchronization | ||||
| static ResultCode CancelSynchronization(Handle thread_handle) { | ||||
|     NGLOG_TRACE(Kernel_SVC, "called thread=0x{:X}", thread_handle); | ||||
|     LOG_TRACE(Kernel_SVC, "called thread=0x{:X}", thread_handle); | ||||
|  | ||||
|     const SharedPtr<Thread> thread = g_handle_table.Get<Thread>(thread_handle); | ||||
|     if (!thread) { | ||||
| @@ -227,7 +227,7 @@ static ResultCode CancelSynchronization(Handle thread_handle) { | ||||
| /// Attempts to locks a mutex, creating it if it does not already exist | ||||
| static ResultCode ArbitrateLock(Handle holding_thread_handle, VAddr mutex_addr, | ||||
|                                 Handle requesting_thread_handle) { | ||||
|     NGLOG_TRACE(Kernel_SVC, | ||||
|     LOG_TRACE(Kernel_SVC, | ||||
|                 "called holding_thread_handle=0x{:08X}, mutex_addr=0x{:X}, " | ||||
|                 "requesting_current_thread_handle=0x{:08X}", | ||||
|                 holding_thread_handle, mutex_addr, requesting_thread_handle); | ||||
| @@ -237,14 +237,14 @@ static ResultCode ArbitrateLock(Handle holding_thread_handle, VAddr mutex_addr, | ||||
|  | ||||
| /// Unlock a mutex | ||||
| static ResultCode ArbitrateUnlock(VAddr mutex_addr) { | ||||
|     NGLOG_TRACE(Kernel_SVC, "called mutex_addr=0x{:X}", mutex_addr); | ||||
|     LOG_TRACE(Kernel_SVC, "called mutex_addr=0x{:X}", mutex_addr); | ||||
|  | ||||
|     return Mutex::Release(mutex_addr); | ||||
| } | ||||
|  | ||||
| /// Break program execution | ||||
| static void Break(u64 unk_0, u64 unk_1, u64 unk_2) { | ||||
|     NGLOG_CRITICAL(Debug_Emulated, "Emulated program broke execution!"); | ||||
|     LOG_CRITICAL(Debug_Emulated, "Emulated program broke execution!"); | ||||
|     ASSERT(false); | ||||
| } | ||||
|  | ||||
| @@ -252,12 +252,12 @@ static void Break(u64 unk_0, u64 unk_1, u64 unk_2) { | ||||
| static void OutputDebugString(VAddr address, s32 len) { | ||||
|     std::string str(len, '\0'); | ||||
|     Memory::ReadBlock(address, str.data(), str.size()); | ||||
|     NGLOG_DEBUG(Debug_Emulated, "{}", str); | ||||
|     LOG_DEBUG(Debug_Emulated, "{}", str); | ||||
| } | ||||
|  | ||||
| /// Gets system/memory information for the current process | ||||
| static ResultCode GetInfo(u64* result, u64 info_id, u64 handle, u64 info_sub_id) { | ||||
|     NGLOG_TRACE(Kernel_SVC, "called info_id=0x{:X}, info_sub_id=0x{:X}, handle=0x{:08X}", info_id, | ||||
|     LOG_TRACE(Kernel_SVC, "called info_id=0x{:X}, info_sub_id=0x{:X}, handle=0x{:08X}", info_id, | ||||
|                 info_sub_id, handle); | ||||
|  | ||||
|     auto& vm_manager = Core::CurrentProcess()->vm_manager; | ||||
| @@ -309,16 +309,16 @@ static ResultCode GetInfo(u64* result, u64 info_id, u64 handle, u64 info_sub_id) | ||||
|         *result = Core::CurrentProcess()->is_virtual_address_memory_enabled; | ||||
|         break; | ||||
|     case GetInfoType::TitleId: | ||||
|         NGLOG_WARNING(Kernel_SVC, "(STUBBED) Attempted to query titleid, returned 0"); | ||||
|         LOG_WARNING(Kernel_SVC, "(STUBBED) Attempted to query titleid, returned 0"); | ||||
|         *result = 0; | ||||
|         break; | ||||
|     case GetInfoType::PrivilegedProcessId: | ||||
|         NGLOG_WARNING(Kernel_SVC, | ||||
|         LOG_WARNING(Kernel_SVC, | ||||
|                       "(STUBBED) Attempted to query privileged process id bounds, returned 0"); | ||||
|         *result = 0; | ||||
|         break; | ||||
|     case GetInfoType::UserExceptionContextAddr: | ||||
|         NGLOG_WARNING(Kernel_SVC, | ||||
|         LOG_WARNING(Kernel_SVC, | ||||
|                       "(STUBBED) Attempted to query user exception context address, returned 0"); | ||||
|         *result = 0; | ||||
|         break; | ||||
| @@ -331,14 +331,14 @@ static ResultCode GetInfo(u64* result, u64 info_id, u64 handle, u64 info_sub_id) | ||||
|  | ||||
| /// Sets the thread activity | ||||
| static ResultCode SetThreadActivity(Handle handle, u32 unknown) { | ||||
|     NGLOG_WARNING(Kernel_SVC, "(STUBBED) called, handle=0x{:08X}, unknown=0x{:08X}", handle, | ||||
|     LOG_WARNING(Kernel_SVC, "(STUBBED) called, handle=0x{:08X}, unknown=0x{:08X}", handle, | ||||
|                   unknown); | ||||
|     return RESULT_SUCCESS; | ||||
| } | ||||
|  | ||||
| /// Gets the thread context | ||||
| static ResultCode GetThreadContext(Handle handle, VAddr addr) { | ||||
|     NGLOG_WARNING(Kernel_SVC, "(STUBBED) called, handle=0x{:08X}, addr=0x{:X}", handle, addr); | ||||
|     LOG_WARNING(Kernel_SVC, "(STUBBED) called, handle=0x{:08X}, addr=0x{:X}", handle, addr); | ||||
|     return RESULT_SUCCESS; | ||||
| } | ||||
|  | ||||
| @@ -377,13 +377,13 @@ static ResultCode SetThreadPriority(Handle handle, u32 priority) { | ||||
|  | ||||
| /// Get which CPU core is executing the current thread | ||||
| static u32 GetCurrentProcessorNumber() { | ||||
|     NGLOG_TRACE(Kernel_SVC, "called"); | ||||
|     LOG_TRACE(Kernel_SVC, "called"); | ||||
|     return GetCurrentThread()->processor_id; | ||||
| } | ||||
|  | ||||
| static ResultCode MapSharedMemory(Handle shared_memory_handle, VAddr addr, u64 size, | ||||
|                                   u32 permissions) { | ||||
|     NGLOG_TRACE( | ||||
|     LOG_TRACE( | ||||
|         Kernel_SVC, | ||||
|         "called, shared_memory_handle=0x{:X}, addr=0x{:X}, size=0x{:X}, permissions=0x{:08X}", | ||||
|         shared_memory_handle, addr, size, permissions); | ||||
| @@ -406,14 +406,14 @@ static ResultCode MapSharedMemory(Handle shared_memory_handle, VAddr addr, u64 s | ||||
|         return shared_memory->Map(Core::CurrentProcess().get(), addr, permissions_type, | ||||
|                                   MemoryPermission::DontCare); | ||||
|     default: | ||||
|         NGLOG_ERROR(Kernel_SVC, "unknown permissions=0x{:08X}", permissions); | ||||
|         LOG_ERROR(Kernel_SVC, "unknown permissions=0x{:08X}", permissions); | ||||
|     } | ||||
|  | ||||
|     return RESULT_SUCCESS; | ||||
| } | ||||
|  | ||||
| static ResultCode UnmapSharedMemory(Handle shared_memory_handle, VAddr addr, u64 size) { | ||||
|     NGLOG_WARNING(Kernel_SVC, "called, shared_memory_handle=0x{:08X}, addr=0x{:X}, size=0x{:X}", | ||||
|     LOG_WARNING(Kernel_SVC, "called, shared_memory_handle=0x{:08X}, addr=0x{:X}, size=0x{:X}", | ||||
|                   shared_memory_handle, addr, size); | ||||
|  | ||||
|     SharedPtr<SharedMemory> shared_memory = g_handle_table.Get<SharedMemory>(shared_memory_handle); | ||||
| @@ -442,19 +442,19 @@ static ResultCode QueryProcessMemory(MemoryInfo* memory_info, PageInfo* /*page_i | ||||
|         memory_info->type = static_cast<u32>(vma->second.meminfo_state); | ||||
|     } | ||||
|  | ||||
|     NGLOG_TRACE(Kernel_SVC, "called process=0x{:08X} addr={:X}", process_handle, addr); | ||||
|     LOG_TRACE(Kernel_SVC, "called process=0x{:08X} addr={:X}", process_handle, addr); | ||||
|     return RESULT_SUCCESS; | ||||
| } | ||||
|  | ||||
| /// Query memory | ||||
| static ResultCode QueryMemory(MemoryInfo* memory_info, PageInfo* page_info, VAddr addr) { | ||||
|     NGLOG_TRACE(Kernel_SVC, "called, addr={:X}", addr); | ||||
|     LOG_TRACE(Kernel_SVC, "called, addr={:X}", addr); | ||||
|     return QueryProcessMemory(memory_info, page_info, CurrentProcess, addr); | ||||
| } | ||||
|  | ||||
| /// Exits the current process | ||||
| static void ExitProcess() { | ||||
|     NGLOG_INFO(Kernel_SVC, "Process {} exiting", Core::CurrentProcess()->process_id); | ||||
|     LOG_INFO(Kernel_SVC, "Process {} exiting", Core::CurrentProcess()->process_id); | ||||
|  | ||||
|     ASSERT_MSG(Core::CurrentProcess()->status == ProcessStatus::Running, | ||||
|                "Process has already exited"); | ||||
| @@ -530,7 +530,7 @@ static ResultCode CreateThread(Handle* out_handle, VAddr entry_point, u64 arg, V | ||||
|     Core::System::GetInstance().PrepareReschedule(); | ||||
|     Core::System::GetInstance().CpuCore(thread->processor_id).PrepareReschedule(); | ||||
|  | ||||
|     NGLOG_TRACE(Kernel_SVC, | ||||
|     LOG_TRACE(Kernel_SVC, | ||||
|                 "called entrypoint=0x{:08X} ({}), arg=0x{:08X}, stacktop=0x{:08X}, " | ||||
|                 "threadpriority=0x{:08X}, processorid=0x{:08X} : created handle=0x{:08X}", | ||||
|                 entry_point, name, arg, stack_top, priority, processor_id, *out_handle); | ||||
| @@ -540,7 +540,7 @@ static ResultCode CreateThread(Handle* out_handle, VAddr entry_point, u64 arg, V | ||||
|  | ||||
| /// Starts the thread for the provided handle | ||||
| static ResultCode StartThread(Handle thread_handle) { | ||||
|     NGLOG_TRACE(Kernel_SVC, "called thread=0x{:08X}", thread_handle); | ||||
|     LOG_TRACE(Kernel_SVC, "called thread=0x{:08X}", thread_handle); | ||||
|  | ||||
|     const SharedPtr<Thread> thread = g_handle_table.Get<Thread>(thread_handle); | ||||
|     if (!thread) { | ||||
| @@ -557,7 +557,7 @@ static ResultCode StartThread(Handle thread_handle) { | ||||
|  | ||||
| /// Called when a thread exits | ||||
| static void ExitThread() { | ||||
|     NGLOG_TRACE(Kernel_SVC, "called, pc=0x{:08X}", Core::CurrentArmInterface().GetPC()); | ||||
|     LOG_TRACE(Kernel_SVC, "called, pc=0x{:08X}", Core::CurrentArmInterface().GetPC()); | ||||
|  | ||||
|     ExitCurrentThread(); | ||||
|     Core::System::GetInstance().PrepareReschedule(); | ||||
| @@ -565,7 +565,7 @@ static void ExitThread() { | ||||
|  | ||||
| /// Sleep the current thread | ||||
| static void SleepThread(s64 nanoseconds) { | ||||
|     NGLOG_TRACE(Kernel_SVC, "called nanoseconds={}", nanoseconds); | ||||
|     LOG_TRACE(Kernel_SVC, "called nanoseconds={}", nanoseconds); | ||||
|  | ||||
|     // Don't attempt to yield execution if there are no available threads to run, | ||||
|     // this way we avoid a useless reschedule to the idle thread. | ||||
| @@ -584,7 +584,7 @@ static void SleepThread(s64 nanoseconds) { | ||||
| /// Wait process wide key atomic | ||||
| static ResultCode WaitProcessWideKeyAtomic(VAddr mutex_addr, VAddr condition_variable_addr, | ||||
|                                            Handle thread_handle, s64 nano_seconds) { | ||||
|     NGLOG_TRACE( | ||||
|     LOG_TRACE( | ||||
|         Kernel_SVC, | ||||
|         "called mutex_addr={:X}, condition_variable_addr={:X}, thread_handle=0x{:08X}, timeout={}", | ||||
|         mutex_addr, condition_variable_addr, thread_handle, nano_seconds); | ||||
| @@ -611,7 +611,7 @@ static ResultCode WaitProcessWideKeyAtomic(VAddr mutex_addr, VAddr condition_var | ||||
|  | ||||
| /// Signal process wide key | ||||
| static ResultCode SignalProcessWideKey(VAddr condition_variable_addr, s32 target) { | ||||
|     NGLOG_TRACE(Kernel_SVC, "called, condition_variable_addr=0x{:X}, target=0x{:08X}", | ||||
|     LOG_TRACE(Kernel_SVC, "called, condition_variable_addr=0x{:X}, target=0x{:08X}", | ||||
|                 condition_variable_addr, target); | ||||
|  | ||||
|     auto RetrieveWaitingThreads = | ||||
| @@ -692,7 +692,7 @@ static ResultCode SignalProcessWideKey(VAddr condition_variable_addr, s32 target | ||||
|  | ||||
| // Wait for an address (via Address Arbiter) | ||||
| static ResultCode WaitForAddress(VAddr address, u32 type, s32 value, s64 timeout) { | ||||
|     NGLOG_WARNING(Kernel_SVC, "called, address=0x{:X}, type=0x{:X}, value=0x{:X}, timeout={}", | ||||
|     LOG_WARNING(Kernel_SVC, "called, address=0x{:X}, type=0x{:X}, value=0x{:X}, timeout={}", | ||||
|                   address, type, value, timeout); | ||||
|     // If the passed address is a kernel virtual address, return invalid memory state. | ||||
|     if (Memory::IsKernelVirtualAddress(address)) { | ||||
| @@ -717,7 +717,7 @@ static ResultCode WaitForAddress(VAddr address, u32 type, s32 value, s64 timeout | ||||
|  | ||||
| // Signals to an address (via Address Arbiter) | ||||
| static ResultCode SignalToAddress(VAddr address, u32 type, s32 value, s32 num_to_wake) { | ||||
|     NGLOG_WARNING(Kernel_SVC, | ||||
|     LOG_WARNING(Kernel_SVC, | ||||
|                   "called, address=0x{:X}, type=0x{:X}, value=0x{:X}, num_to_wake=0x{:X}", address, | ||||
|                   type, value, num_to_wake); | ||||
|     // If the passed address is a kernel virtual address, return invalid memory state. | ||||
| @@ -754,13 +754,13 @@ static u64 GetSystemTick() { | ||||
|  | ||||
| /// Close a handle | ||||
| static ResultCode CloseHandle(Handle handle) { | ||||
|     NGLOG_TRACE(Kernel_SVC, "Closing handle 0x{:08X}", handle); | ||||
|     LOG_TRACE(Kernel_SVC, "Closing handle 0x{:08X}", handle); | ||||
|     return g_handle_table.Close(handle); | ||||
| } | ||||
|  | ||||
| /// Reset an event | ||||
| static ResultCode ResetSignal(Handle handle) { | ||||
|     NGLOG_WARNING(Kernel_SVC, "(STUBBED) called handle 0x{:08X}", handle); | ||||
|     LOG_WARNING(Kernel_SVC, "(STUBBED) called handle 0x{:08X}", handle); | ||||
|     auto event = g_handle_table.Get<Event>(handle); | ||||
|     ASSERT(event != nullptr); | ||||
|     event->Clear(); | ||||
| @@ -769,14 +769,14 @@ static ResultCode ResetSignal(Handle handle) { | ||||
|  | ||||
| /// Creates a TransferMemory object | ||||
| static ResultCode CreateTransferMemory(Handle* handle, VAddr addr, u64 size, u32 permissions) { | ||||
|     NGLOG_WARNING(Kernel_SVC, "(STUBBED) called addr=0x{:X}, size=0x{:X}, perms=0x{:08X}", addr, | ||||
|     LOG_WARNING(Kernel_SVC, "(STUBBED) called addr=0x{:X}, size=0x{:X}, perms=0x{:08X}", addr, | ||||
|                   size, permissions); | ||||
|     *handle = 0; | ||||
|     return RESULT_SUCCESS; | ||||
| } | ||||
|  | ||||
| static ResultCode GetThreadCoreMask(Handle thread_handle, u32* core, u64* mask) { | ||||
|     NGLOG_TRACE(Kernel_SVC, "called, handle=0x{:08X}", thread_handle); | ||||
|     LOG_TRACE(Kernel_SVC, "called, handle=0x{:08X}", thread_handle); | ||||
|  | ||||
|     const SharedPtr<Thread> thread = g_handle_table.Get<Thread>(thread_handle); | ||||
|     if (!thread) { | ||||
| @@ -790,7 +790,7 @@ static ResultCode GetThreadCoreMask(Handle thread_handle, u32* core, u64* mask) | ||||
| } | ||||
|  | ||||
| static ResultCode SetThreadCoreMask(Handle thread_handle, u32 core, u64 mask) { | ||||
|     NGLOG_DEBUG(Kernel_SVC, "called, handle=0x{:08X}, mask=0x{:16X}, core=0x{:X}", thread_handle, | ||||
|     LOG_DEBUG(Kernel_SVC, "called, handle=0x{:08X}, mask=0x{:16X}, core=0x{:X}", thread_handle, | ||||
|                 mask, core); | ||||
|  | ||||
|     const SharedPtr<Thread> thread = g_handle_table.Get<Thread>(thread_handle); | ||||
| @@ -830,7 +830,7 @@ static ResultCode SetThreadCoreMask(Handle thread_handle, u32 core, u64 mask) { | ||||
|  | ||||
| static ResultCode CreateSharedMemory(Handle* handle, u64 size, u32 local_permissions, | ||||
|                                      u32 remote_permissions) { | ||||
|     NGLOG_TRACE(Kernel_SVC, "called, size=0x{:X}, localPerms=0x{:08X}, remotePerms=0x{:08X}", size, | ||||
|     LOG_TRACE(Kernel_SVC, "called, size=0x{:X}, localPerms=0x{:08X}, remotePerms=0x{:08X}", size, | ||||
|                 local_permissions, remote_permissions); | ||||
|     auto sharedMemHandle = | ||||
|         SharedMemory::Create(g_handle_table.Get<Process>(KernelHandle::CurrentProcess), size, | ||||
| @@ -842,7 +842,7 @@ static ResultCode CreateSharedMemory(Handle* handle, u64 size, u32 local_permiss | ||||
| } | ||||
|  | ||||
| static ResultCode ClearEvent(Handle handle) { | ||||
|     NGLOG_TRACE(Kernel_SVC, "called, event=0x{:08X}", handle); | ||||
|     LOG_TRACE(Kernel_SVC, "called, event=0x{:08X}", handle); | ||||
|  | ||||
|     SharedPtr<Event> evt = g_handle_table.Get<Event>(handle); | ||||
|     if (evt == nullptr) | ||||
| @@ -994,7 +994,7 @@ static const FunctionDef SVC_Table[] = { | ||||
|  | ||||
| static const FunctionDef* GetSVCInfo(u32 func_num) { | ||||
|     if (func_num >= std::size(SVC_Table)) { | ||||
|         NGLOG_ERROR(Kernel_SVC, "Unknown svc=0x{:02X}", func_num); | ||||
|         LOG_ERROR(Kernel_SVC, "Unknown svc=0x{:02X}", func_num); | ||||
|         return nullptr; | ||||
|     } | ||||
|     return &SVC_Table[func_num]; | ||||
| @@ -1013,10 +1013,10 @@ void CallSVC(u32 immediate) { | ||||
|         if (info->func) { | ||||
|             info->func(); | ||||
|         } else { | ||||
|             NGLOG_CRITICAL(Kernel_SVC, "Unimplemented SVC function {}(..)", info->name); | ||||
|             LOG_CRITICAL(Kernel_SVC, "Unimplemented SVC function {}(..)", info->name); | ||||
|         } | ||||
|     } else { | ||||
|         NGLOG_CRITICAL(Kernel_SVC, "Unknown SVC function 0x{:X}", immediate); | ||||
|         LOG_CRITICAL(Kernel_SVC, "Unknown SVC function 0x{:X}", immediate); | ||||
|     } | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -104,7 +104,7 @@ static void ThreadWakeupCallback(u64 thread_handle, int cycles_late) { | ||||
|     const auto proper_handle = static_cast<Handle>(thread_handle); | ||||
|     SharedPtr<Thread> thread = wakeup_callback_handle_table.Get<Thread>(proper_handle); | ||||
|     if (thread == nullptr) { | ||||
|         NGLOG_CRITICAL(Kernel, "Callback fired for invalid thread {:08X}", proper_handle); | ||||
|         LOG_CRITICAL(Kernel, "Callback fired for invalid thread {:08X}", proper_handle); | ||||
|         return; | ||||
|     } | ||||
|  | ||||
| @@ -290,19 +290,19 @@ ResultVal<SharedPtr<Thread>> Thread::Create(std::string name, VAddr entry_point, | ||||
|                                             SharedPtr<Process> owner_process) { | ||||
|     // Check if priority is in ranged. Lowest priority -> highest priority id. | ||||
|     if (priority > THREADPRIO_LOWEST) { | ||||
|         NGLOG_ERROR(Kernel_SVC, "Invalid thread priority: {}", priority); | ||||
|         LOG_ERROR(Kernel_SVC, "Invalid thread priority: {}", priority); | ||||
|         return ERR_OUT_OF_RANGE; | ||||
|     } | ||||
|  | ||||
|     if (processor_id > THREADPROCESSORID_MAX) { | ||||
|         NGLOG_ERROR(Kernel_SVC, "Invalid processor id: {}", processor_id); | ||||
|         LOG_ERROR(Kernel_SVC, "Invalid processor id: {}", processor_id); | ||||
|         return ERR_OUT_OF_RANGE_KERNEL; | ||||
|     } | ||||
|  | ||||
|     // TODO(yuriks): Other checks, returning 0xD9001BEA | ||||
|  | ||||
|     if (!Memory::IsValidVirtualAddress(*owner_process, entry_point)) { | ||||
|         NGLOG_ERROR(Kernel_SVC, "(name={}): invalid entry {:016X}", name, entry_point); | ||||
|         LOG_ERROR(Kernel_SVC, "(name={}): invalid entry {:016X}", name, entry_point); | ||||
|         // TODO (bunnei): Find the correct error code to use here | ||||
|         return ResultCode(-1); | ||||
|     } | ||||
| @@ -343,7 +343,7 @@ ResultVal<SharedPtr<Thread>> Thread::Create(std::string name, VAddr entry_point, | ||||
|         auto& linheap_memory = memory_region->linear_heap_memory; | ||||
|  | ||||
|         if (linheap_memory->size() + Memory::PAGE_SIZE > memory_region->size) { | ||||
|             NGLOG_ERROR(Kernel_SVC, | ||||
|             LOG_ERROR(Kernel_SVC, | ||||
|                         "Not enough space in region to allocate a new TLS page for thread"); | ||||
|             return ERR_OUT_OF_MEMORY; | ||||
|         } | ||||
|   | ||||
| @@ -78,7 +78,7 @@ void Timer::WakeupAllWaitingThreads() { | ||||
| } | ||||
|  | ||||
| void Timer::Signal(int cycles_late) { | ||||
|     NGLOG_TRACE(Kernel, "Timer {} fired", GetObjectId()); | ||||
|     LOG_TRACE(Kernel, "Timer {} fired", GetObjectId()); | ||||
|  | ||||
|     signaled = true; | ||||
|  | ||||
| @@ -98,7 +98,7 @@ static void TimerCallback(u64 timer_handle, int cycles_late) { | ||||
|         timer_callback_handle_table.Get<Timer>(static_cast<Handle>(timer_handle)); | ||||
|  | ||||
|     if (timer == nullptr) { | ||||
|         NGLOG_CRITICAL(Kernel, "Callback fired for invalid timer {:016X}", timer_handle); | ||||
|         LOG_CRITICAL(Kernel, "Callback fired for invalid timer {:016X}", timer_handle); | ||||
|         return; | ||||
|     } | ||||
|  | ||||
|   | ||||
| @@ -242,7 +242,7 @@ void VMManager::RefreshMemoryBlockMappings(const std::vector<u8>* block) { | ||||
| void VMManager::LogLayout() const { | ||||
|     for (const auto& p : vma_map) { | ||||
|         const VirtualMemoryArea& vma = p.second; | ||||
|         NGLOG_DEBUG(Kernel, "{:016X} - {:016X} size: {:016X} {}{}{} {}", vma.base, | ||||
|         LOG_DEBUG(Kernel, "{:016X} - {:016X} size: {:016X} {}{}{} {}", vma.base, | ||||
|                     vma.base + vma.size, vma.size, | ||||
|                     (u8)vma.permissions & (u8)VMAPermission::Read ? 'R' : '-', | ||||
|                     (u8)vma.permissions & (u8)VMAPermission::Write ? 'W' : '-', | ||||
| @@ -392,22 +392,22 @@ void VMManager::UpdatePageTableForVMA(const VirtualMemoryArea& vma) { | ||||
| } | ||||
|  | ||||
| u64 VMManager::GetTotalMemoryUsage() { | ||||
|     NGLOG_WARNING(Kernel, "(STUBBED) called"); | ||||
|     LOG_WARNING(Kernel, "(STUBBED) called"); | ||||
|     return 0xF8000000; | ||||
| } | ||||
|  | ||||
| u64 VMManager::GetTotalHeapUsage() { | ||||
|     NGLOG_WARNING(Kernel, "(STUBBED) called"); | ||||
|     LOG_WARNING(Kernel, "(STUBBED) called"); | ||||
|     return 0x0; | ||||
| } | ||||
|  | ||||
| VAddr VMManager::GetAddressSpaceBaseAddr() { | ||||
|     NGLOG_WARNING(Kernel, "(STUBBED) called"); | ||||
|     LOG_WARNING(Kernel, "(STUBBED) called"); | ||||
|     return 0x8000000; | ||||
| } | ||||
|  | ||||
| u64 VMManager::GetAddressSpaceSize() { | ||||
|     NGLOG_WARNING(Kernel, "(STUBBED) called"); | ||||
|     LOG_WARNING(Kernel, "(STUBBED) called"); | ||||
|     return MAX_ADDRESS; | ||||
| } | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 James Rowe
					James Rowe