From 51ce224a969e0996f8797396dd38a639545f1b7b Mon Sep 17 00:00:00 2001 From: Lioncash Date: Wed, 14 Feb 2018 00:20:04 -0500 Subject: [PATCH 01/12] gdbstub: Silence formatting specifier warnings --- src/core/gdbstub/gdbstub.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/core/gdbstub/gdbstub.cpp b/src/core/gdbstub/gdbstub.cpp index 2405da0c6a..7a142dc218 100644 --- a/src/core/gdbstub/gdbstub.cpp +++ b/src/core/gdbstub/gdbstub.cpp @@ -6,6 +6,7 @@ #include #include +#include #include #include #include @@ -360,8 +361,9 @@ static void RemoveBreakpoint(BreakpointType type, PAddr addr) { auto bp = p.find(static_cast(addr)); if (bp != p.end()) { - LOG_DEBUG(Debug_GDBStub, "gdb: removed a breakpoint: %08x bytes at %08x of type %d\n", - bp->second.len, bp->second.addr, type); + LOG_DEBUG(Debug_GDBStub, + "gdb: removed a breakpoint: %016" PRIx64 " bytes at %016" PRIx64 " of type %d\n", + bp->second.len, bp->second.addr, static_cast(type)); p.erase(static_cast(addr)); } } @@ -407,8 +409,9 @@ bool CheckBreakpoint(PAddr addr, BreakpointType type) { if (bp->second.active && (addr >= bp->second.addr && addr < bp->second.addr + len)) { LOG_DEBUG(Debug_GDBStub, - "Found breakpoint type %d @ %08x, range: %08x - %08x (%d bytes)\n", type, - addr, bp->second.addr, bp->second.addr + len, len); + "Found breakpoint type %d @ %016" PRIx64 ", range: %016" PRIx64 + " - %016" PRIx64 " (%" PRIx64 " bytes)\n", + static_cast(type), addr, bp->second.addr, bp->second.addr + len, len); return true; } } @@ -778,8 +781,8 @@ static bool CommitBreakpoint(BreakpointType type, PAddr addr, u64 len) { breakpoint.len = len; p.insert({addr, breakpoint}); - LOG_DEBUG(Debug_GDBStub, "gdb: added %d breakpoint: %08x bytes at %08x\n", type, breakpoint.len, - breakpoint.addr); + LOG_DEBUG(Debug_GDBStub, "gdb: added %d breakpoint: %016" PRIx64 " bytes at %016" PRIx64 "\n", + static_cast(type), breakpoint.len, breakpoint.addr); return true; } From 1e33db85734eb658b0168743905d4b1a50030237 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Wed, 14 Feb 2018 00:27:46 -0500 Subject: [PATCH 02/12] vm_manager: Silence formatting specifier warnings --- src/core/hle/kernel/vm_manager.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/core/hle/kernel/vm_manager.cpp b/src/core/hle/kernel/vm_manager.cpp index 6da77eb581..d5b36d71a3 100644 --- a/src/core/hle/kernel/vm_manager.cpp +++ b/src/core/hle/kernel/vm_manager.cpp @@ -2,6 +2,7 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include #include #include "common/assert.h" #include "common/logging/log.h" @@ -206,7 +207,8 @@ void VMManager::RefreshMemoryBlockMappings(const std::vector* block) { void VMManager::LogLayout(Log::Level log_level) const { for (const auto& p : vma_map) { const VirtualMemoryArea& vma = p.second; - LOG_GENERIC(Log::Class::Kernel, log_level, "%08X - %08X size: %8X %c%c%c %s", vma.base, + LOG_GENERIC(Log::Class::Kernel, log_level, + "%016" PRIx64 " - %016" PRIx64 " size: %16" PRIx64 " %c%c%c %s", vma.base, vma.base + vma.size, vma.size, (u8)vma.permissions & (u8)VMAPermission::Read ? 'R' : '-', (u8)vma.permissions & (u8)VMAPermission::Write ? 'W' : '-', @@ -222,8 +224,8 @@ VMManager::VMAIter VMManager::StripIterConstness(const VMAHandle& iter) { } ResultVal VMManager::CarveVMA(VAddr base, u64 size) { - ASSERT_MSG((size & Memory::PAGE_MASK) == 0, "non-page aligned size: 0x%8X", size); - ASSERT_MSG((base & Memory::PAGE_MASK) == 0, "non-page aligned base: 0x%08X", base); + ASSERT_MSG((size & Memory::PAGE_MASK) == 0, "non-page aligned size: 0x%16" PRIx64, size); + ASSERT_MSG((base & Memory::PAGE_MASK) == 0, "non-page aligned base: 0x%016" PRIx64, base); VMAIter vma_handle = StripIterConstness(FindVMA(base)); if (vma_handle == vma_map.end()) { @@ -258,8 +260,8 @@ ResultVal VMManager::CarveVMA(VAddr base, u64 size) { } ResultVal VMManager::CarveVMARange(VAddr target, u64 size) { - ASSERT_MSG((size & Memory::PAGE_MASK) == 0, "non-page aligned size: 0x%8X", size); - ASSERT_MSG((target & Memory::PAGE_MASK) == 0, "non-page aligned base: 0x%08X", target); + ASSERT_MSG((size & Memory::PAGE_MASK) == 0, "non-page aligned size: 0x%16" PRIx64, size); + ASSERT_MSG((target & Memory::PAGE_MASK) == 0, "non-page aligned base: 0x%016" PRIx64, target); VAddr target_end = target + size; ASSERT(target_end >= target); From c1146d2a5f9922a139f17336ba75be0100e5a485 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Wed, 14 Feb 2018 00:33:15 -0500 Subject: [PATCH 03/12] thread: Silence formatting specifier warnings --- src/core/hle/kernel/thread.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/core/hle/kernel/thread.cpp b/src/core/hle/kernel/thread.cpp index 111c496b92..1a33cc6cbb 100644 --- a/src/core/hle/kernel/thread.cpp +++ b/src/core/hle/kernel/thread.cpp @@ -3,6 +3,7 @@ // Refer to the license.txt file included. #include +#include #include #include #include "common/assert.h" @@ -379,7 +380,7 @@ ResultVal> Thread::Create(std::string name, VAddr entry_point, SharedPtr owner_process) { // Check if priority is in ranged. Lowest priority -> highest priority id. if (priority > THREADPRIO_LOWEST) { - LOG_ERROR(Kernel_SVC, "Invalid thread priority: %d", priority); + LOG_ERROR(Kernel_SVC, "Invalid thread priority: %u", priority); return ERR_OUT_OF_RANGE; } @@ -391,7 +392,7 @@ ResultVal> Thread::Create(std::string name, VAddr entry_point, // TODO(yuriks): Other checks, returning 0xD9001BEA if (!Memory::IsValidVirtualAddress(*owner_process, entry_point)) { - LOG_ERROR(Kernel_SVC, "(name=%s): invalid entry %08x", name.c_str(), entry_point); + LOG_ERROR(Kernel_SVC, "(name=%s): invalid entry %016" PRIx64, name.c_str(), entry_point); // TODO (bunnei): Find the correct error code to use here return ResultCode(-1); } From dc97117a0b2d5119ca6b623b363590228237f13f Mon Sep 17 00:00:00 2001 From: Lioncash Date: Wed, 14 Feb 2018 00:41:26 -0500 Subject: [PATCH 04/12] nvhost_as_gpu: Silence formatting specifier warnings --- src/core/hle/service/nvdrv/devices/nvhost_as_gpu.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.cpp b/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.cpp index 9832e1899c..9892402fac 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.cpp +++ b/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.cpp @@ -2,6 +2,7 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include #include "common/assert.h" #include "common/logging/log.h" #include "core/core.h" @@ -13,8 +14,8 @@ namespace Nvidia { namespace Devices { u32 nvhost_as_gpu::ioctl(Ioctl command, const std::vector& input, std::vector& output) { - LOG_DEBUG(Service_NVDRV, "called, command=0x%08x, input_size=0x%llx, output_size=0x%llx", - command, input.size(), output.size()); + LOG_DEBUG(Service_NVDRV, "called, command=0x%08x, input_size=0x%zx, output_size=0x%zx", + command.raw, input.size(), output.size()); switch (static_cast(command.raw)) { case IoctlCommand::IocInitalizeExCommand: @@ -62,7 +63,8 @@ u32 nvhost_as_gpu::MapBufferEx(const std::vector& input, std::vector& ou std::memcpy(¶ms, input.data(), input.size()); LOG_DEBUG(Service_NVDRV, - "called, flags=%x, nvmap_handle=%x, buffer_offset=%lx, mapping_size=%lx, offset=%lx", + "called, flags=%x, nvmap_handle=%x, buffer_offset=%" PRIu64 ", mapping_size=%" PRIu64 + ", offset=%" PRIu64, params.flags, params.nvmap_handle, params.buffer_offset, params.mapping_size, params.offset); @@ -97,8 +99,8 @@ u32 nvhost_as_gpu::BindChannel(const std::vector& input, std::vector& ou u32 nvhost_as_gpu::GetVARegions(const std::vector& input, std::vector& output) { IoctlGetVaRegions params{}; std::memcpy(¶ms, input.data(), input.size()); - LOG_WARNING(Service_NVDRV, "(STUBBED) called, buf_addr=%lx, buf_size=%x", params.buf_addr, - params.buf_size); + LOG_WARNING(Service_NVDRV, "(STUBBED) called, buf_addr=%" PRIu64 ", buf_size=%x", + params.buf_addr, params.buf_size); params.buf_size = 0x30; params.regions[0].offset = 0x04000000; From ce1fe0387f5629778e23233d9b2e0d98dfb043cd Mon Sep 17 00:00:00 2001 From: Lioncash Date: Wed, 14 Feb 2018 00:43:26 -0500 Subject: [PATCH 05/12] nvhost_ctrl_gpu: Silence formatting specifier warnings --- src/core/hle/service/nvdrv/devices/nvhost_ctrl_gpu.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/core/hle/service/nvdrv/devices/nvhost_ctrl_gpu.cpp b/src/core/hle/service/nvdrv/devices/nvhost_ctrl_gpu.cpp index 4776c8aa31..3b353d7428 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_ctrl_gpu.cpp +++ b/src/core/hle/service/nvdrv/devices/nvhost_ctrl_gpu.cpp @@ -2,6 +2,7 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include #include "common/assert.h" #include "common/logging/log.h" #include "core/hle/service/nvdrv/devices/nvhost_ctrl_gpu.h" @@ -11,8 +12,8 @@ namespace Nvidia { namespace Devices { u32 nvhost_ctrl_gpu::ioctl(Ioctl command, const std::vector& input, std::vector& output) { - LOG_DEBUG(Service_NVDRV, "called, command=0x%08x, input_size=0x%llx, output_size=0x%llx", - command, input.size(), output.size()); + LOG_DEBUG(Service_NVDRV, "called, command=0x%08x, input_size=0x%zx, output_size=0x%zx", + command.raw, input.size(), output.size()); switch (static_cast(command.raw)) { case IoctlCommand::IocGetCharacteristicsCommand: @@ -78,7 +79,7 @@ u32 nvhost_ctrl_gpu::GetCharacteristics(const std::vector& input, std::vecto u32 nvhost_ctrl_gpu::GetTPCMasks(const std::vector& input, std::vector& output) { IoctlGpuGetTpcMasksArgs params{}; std::memcpy(¶ms, input.data(), input.size()); - LOG_WARNING(Service_NVDRV, "(STUBBED) called, mask=0x%x, mask_buf_addr=0x%lx", + LOG_WARNING(Service_NVDRV, "(STUBBED) called, mask=0x%x, mask_buf_addr=0x%" PRIx64, params.mask_buf_size, params.mask_buf_addr); std::memcpy(output.data(), ¶ms, sizeof(params)); return 0; From 2d388a75f0f057821d8747cabcb3fc8ae74f28d7 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Wed, 14 Feb 2018 00:44:26 -0500 Subject: [PATCH 06/12] nvhost_ctrl: Silence formatting specifier warnings --- src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp b/src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp index c0e35237ac..ee99ab2807 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp +++ b/src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp @@ -11,8 +11,8 @@ namespace Nvidia { namespace Devices { u32 nvhost_ctrl::ioctl(Ioctl command, const std::vector& input, std::vector& output) { - LOG_DEBUG(Service_NVDRV, "called, command=0x%08x, input_size=0x%lx, output_size=0x%lx", command, - input.size(), output.size()); + LOG_DEBUG(Service_NVDRV, "called, command=0x%08x, input_size=0x%zx, output_size=0x%zx", + command.raw, input.size(), output.size()); switch (static_cast(command.raw)) { case IoctlCommand::IocGetConfigCommand: From 983777a3179b6e65d37c6432a601185b5827706b Mon Sep 17 00:00:00 2001 From: Lioncash Date: Wed, 14 Feb 2018 00:47:51 -0500 Subject: [PATCH 07/12] nvhost_gpu: Silence formatting specifier warnings --- src/core/hle/service/nvdrv/devices/nvhost_gpu.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/core/hle/service/nvdrv/devices/nvhost_gpu.cpp b/src/core/hle/service/nvdrv/devices/nvhost_gpu.cpp index 0b2ebd466a..da44c65f3e 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_gpu.cpp +++ b/src/core/hle/service/nvdrv/devices/nvhost_gpu.cpp @@ -2,6 +2,7 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include #include #include "common/assert.h" #include "common/logging/log.h" @@ -13,8 +14,8 @@ namespace Nvidia { namespace Devices { u32 nvhost_gpu::ioctl(Ioctl command, const std::vector& input, std::vector& output) { - LOG_DEBUG(Service_NVDRV, "called, command=0x%08x, input_size=0x%llx, output_size=0x%llx", - command, input.size(), output.size()); + LOG_DEBUG(Service_NVDRV, "called, command=0x%08x, input_size=0x%zx, output_size=0x%zx", + command.raw, input.size(), output.size()); switch (static_cast(command.raw)) { case IoctlCommand::IocSetNVMAPfdCommand: @@ -74,7 +75,8 @@ u32 nvhost_gpu::GetClientData(const std::vector& input, std::vector& out u32 nvhost_gpu::ZCullBind(const std::vector& input, std::vector& output) { std::memcpy(&zcull_params, input.data(), input.size()); - LOG_DEBUG(Service_NVDRV, "called, gpu_va=%lx, mode=%x", zcull_params.gpu_va, zcull_params.mode); + LOG_DEBUG(Service_NVDRV, "called, gpu_va=%" PRIx64 ", mode=%x", zcull_params.gpu_va, + zcull_params.mode); std::memcpy(output.data(), &zcull_params, output.size()); return 0; } @@ -82,8 +84,8 @@ u32 nvhost_gpu::ZCullBind(const std::vector& input, std::vector& output) u32 nvhost_gpu::SetErrorNotifier(const std::vector& input, std::vector& output) { IoctlSetErrorNotifier params{}; std::memcpy(¶ms, input.data(), input.size()); - LOG_WARNING(Service_NVDRV, "(STUBBED) called, offset=%lx, size=%lx, mem=%x", params.offset, - params.size, params.mem); + LOG_WARNING(Service_NVDRV, "(STUBBED) called, offset=%" PRIx64 ", size=%" PRIx64 ", mem=%x", + params.offset, params.size, params.mem); std::memcpy(output.data(), ¶ms, output.size()); return 0; } @@ -123,7 +125,7 @@ u32 nvhost_gpu::SubmitGPFIFO(const std::vector& input, std::vector& outp UNIMPLEMENTED(); IoctlSubmitGpfifo params{}; std::memcpy(¶ms, input.data(), sizeof(IoctlSubmitGpfifo)); - LOG_WARNING(Service_NVDRV, "(STUBBED) called, gpfifo=%lx, num_entries=%x, flags=%x", + LOG_WARNING(Service_NVDRV, "(STUBBED) called, gpfifo=%" PRIx64 ", num_entries=%x, flags=%x", params.gpfifo, params.num_entries, params.flags); auto entries = std::vector(); From ee170cbcead1aa19ca88a4884f2df13324874adf Mon Sep 17 00:00:00 2001 From: Lioncash Date: Wed, 14 Feb 2018 00:49:35 -0500 Subject: [PATCH 08/12] nvmap: Silence formatting specifier warnings --- src/core/hle/service/nvdrv/devices/nvmap.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/core/hle/service/nvdrv/devices/nvmap.cpp b/src/core/hle/service/nvdrv/devices/nvmap.cpp index 02b33374a8..cd8c0c6055 100644 --- a/src/core/hle/service/nvdrv/devices/nvmap.cpp +++ b/src/core/hle/service/nvdrv/devices/nvmap.cpp @@ -3,6 +3,7 @@ // Refer to the license.txt file included. #include +#include #include "common/assert.h" #include "common/logging/log.h" @@ -71,7 +72,7 @@ u32 nvmap::IocAlloc(const std::vector& input, std::vector& output) { object->addr = params.addr; object->status = Object::Status::Allocated; - LOG_DEBUG(Service_NVDRV, "called, addr=0x%llx", params.addr); + LOG_DEBUG(Service_NVDRV, "called, addr=0x%" PRIx64, params.addr); std::memcpy(output.data(), ¶ms, sizeof(params)); return 0; From eba57fce88ea3c1253d2480bc4a3b8942ec58a5d Mon Sep 17 00:00:00 2001 From: Lioncash Date: Wed, 14 Feb 2018 00:51:42 -0500 Subject: [PATCH 09/12] nvdrv/interface: Silence formatting specifier warnings --- src/core/hle/service/nvdrv/interface.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/core/hle/service/nvdrv/interface.cpp b/src/core/hle/service/nvdrv/interface.cpp index 367791da66..1a5efaeafa 100644 --- a/src/core/hle/service/nvdrv/interface.cpp +++ b/src/core/hle/service/nvdrv/interface.cpp @@ -2,6 +2,7 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include #include "common/logging/log.h" #include "core/hle/ipc_helpers.h" #include "core/hle/kernel/event.h" @@ -88,7 +89,7 @@ void NVDRV::SetClientPID(Kernel::HLERequestContext& ctx) { IPC::RequestParser rp{ctx}; pid = rp.Pop(); - LOG_WARNING(Service_NVDRV, "(STUBBED) called, pid=0x%lx", pid); + LOG_WARNING(Service_NVDRV, "(STUBBED) called, pid=0x%" PRIx64, pid); IPC::ResponseBuilder rb{ctx, 3}; rb.Push(RESULT_SUCCESS); rb.Push(0); From 2ade136ff48e0385836736d9fe3d39fa0c30e5b3 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Wed, 14 Feb 2018 00:53:51 -0500 Subject: [PATCH 10/12] deconstructed_rom_directory: Silence formatting specifier warnings --- src/core/loader/deconstructed_rom_directory.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/core/loader/deconstructed_rom_directory.cpp b/src/core/loader/deconstructed_rom_directory.cpp index c4e003b74d..661803b5f1 100644 --- a/src/core/loader/deconstructed_rom_directory.cpp +++ b/src/core/loader/deconstructed_rom_directory.cpp @@ -2,6 +2,7 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include #include "common/common_funcs.h" #include "common/common_paths.h" #include "common/file_util.h" @@ -116,7 +117,7 @@ ResultStatus AppLoader_DeconstructedRomDirectory::Load( const VAddr load_addr = next_load_addr; next_load_addr = AppLoader_NSO::LoadModule(path, load_addr); if (next_load_addr) { - LOG_DEBUG(Loader, "loaded module %s @ 0x%llx", module, load_addr); + LOG_DEBUG(Loader, "loaded module %s @ 0x%" PRIx64, module, load_addr); } else { next_load_addr = load_addr; } @@ -158,8 +159,8 @@ ResultStatus AppLoader_DeconstructedRomDirectory::ReadRomFS( offset = 0; size = romfs_file->GetSize(); - LOG_DEBUG(Loader, "RomFS offset: 0x%08X", offset); - LOG_DEBUG(Loader, "RomFS size: 0x%08X", size); + LOG_DEBUG(Loader, "RomFS offset: 0x%016" PRIX64, offset); + LOG_DEBUG(Loader, "RomFS size: 0x%016" PRIX64, size); // Reset read pointer file.Seek(0, SEEK_SET); From e6bf72877fb2906b484716ff22e39db0a2db34e7 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Wed, 14 Feb 2018 00:57:06 -0500 Subject: [PATCH 11/12] nso: Silence formatting specifier warnings --- src/core/loader/nso.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/core/loader/nso.cpp b/src/core/loader/nso.cpp index 3ccbbb824c..407025da01 100644 --- a/src/core/loader/nso.cpp +++ b/src/core/loader/nso.cpp @@ -2,6 +2,7 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include #include #include #include "common/common_funcs.h" @@ -82,7 +83,7 @@ static std::vector ReadSegment(FileUtil::IOFile& file, const NsoSegmentHeade reinterpret_cast(uncompressed_data.data()), compressed_size, header.size); ASSERT_MSG(bytes_uncompressed == header.size && bytes_uncompressed == uncompressed_data.size(), - "%d != %d != %d", bytes_uncompressed, header.size, uncompressed_data.size()); + "%d != %u != %zu", bytes_uncompressed, header.size, uncompressed_data.size()); return uncompressed_data; } @@ -158,7 +159,8 @@ ResultStatus AppLoader_NSO::Load(Kernel::SharedPtr& process) { // Load module LoadModule(filepath, Memory::PROCESS_IMAGE_VADDR); - LOG_DEBUG(Loader, "loaded module %s @ 0x%llx", filepath.c_str(), Memory::PROCESS_IMAGE_VADDR); + LOG_DEBUG(Loader, "loaded module %s @ 0x%" PRIx64, filepath.c_str(), + Memory::PROCESS_IMAGE_VADDR); process->svc_access_mask.set(); process->address_mappings = default_address_mappings; From fe0775d2f4c337b1a3b6c3385306fbd11fe22bc3 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Wed, 14 Feb 2018 01:07:01 -0500 Subject: [PATCH 12/12] memory: Silence formatting sepecifier warnings --- src/core/memory.cpp | 51 ++++++++++++++++++++++++++------------------- 1 file changed, 30 insertions(+), 21 deletions(-) diff --git a/src/core/memory.cpp b/src/core/memory.cpp index f658271a5a..cc1ed16b68 100644 --- a/src/core/memory.cpp +++ b/src/core/memory.cpp @@ -4,6 +4,7 @@ #include #include +#include #include #include #include "common/assert.h" @@ -38,12 +39,12 @@ PageTable* GetCurrentPageTable() { } static void MapPages(PageTable& page_table, VAddr base, u64 size, u8* memory, PageType type) { - LOG_DEBUG(HW_Memory, "Mapping %p onto %08X-%08X", memory, base * PAGE_SIZE, + LOG_DEBUG(HW_Memory, "Mapping %p onto %016" PRIX64 "-%016" PRIX64, memory, base * PAGE_SIZE, (base + size) * PAGE_SIZE); VAddr end = base + size; while (base != end) { - ASSERT_MSG(base < PAGE_TABLE_NUM_ENTRIES, "out of range mapping at %08X", base); + ASSERT_MSG(base < PAGE_TABLE_NUM_ENTRIES, "out of range mapping at %016" PRIX64, base); page_table.attributes[base] = type; page_table.pointers[base] = memory; @@ -55,14 +56,14 @@ static void MapPages(PageTable& page_table, VAddr base, u64 size, u8* memory, Pa } void MapMemoryRegion(PageTable& page_table, VAddr base, u64 size, u8* target) { - ASSERT_MSG((size & PAGE_MASK) == 0, "non-page aligned size: %08X", size); - ASSERT_MSG((base & PAGE_MASK) == 0, "non-page aligned base: %08X", base); + ASSERT_MSG((size & PAGE_MASK) == 0, "non-page aligned size: %016" PRIX64, size); + ASSERT_MSG((base & PAGE_MASK) == 0, "non-page aligned base: %016" PRIX64, base); MapPages(page_table, base / PAGE_SIZE, size / PAGE_SIZE, target, PageType::Memory); } void MapIoRegion(PageTable& page_table, VAddr base, u64 size, MemoryHookPointer mmio_handler) { - ASSERT_MSG((size & PAGE_MASK) == 0, "non-page aligned size: %08X", size); - ASSERT_MSG((base & PAGE_MASK) == 0, "non-page aligned base: %08X", base); + ASSERT_MSG((size & PAGE_MASK) == 0, "non-page aligned size: %016" PRIX64, size); + ASSERT_MSG((base & PAGE_MASK) == 0, "non-page aligned base: %016" PRIX64, base); MapPages(page_table, base / PAGE_SIZE, size / PAGE_SIZE, nullptr, PageType::Special); auto interval = boost::icl::discrete_interval::closed(base, base + size - 1); @@ -71,8 +72,8 @@ void MapIoRegion(PageTable& page_table, VAddr base, u64 size, MemoryHookPointer } void UnmapRegion(PageTable& page_table, VAddr base, u64 size) { - ASSERT_MSG((size & PAGE_MASK) == 0, "non-page aligned size: %08X", size); - ASSERT_MSG((base & PAGE_MASK) == 0, "non-page aligned base: %08X", base); + ASSERT_MSG((size & PAGE_MASK) == 0, "non-page aligned size: %016" PRIX64, size); + ASSERT_MSG((base & PAGE_MASK) == 0, "non-page aligned base: %016" PRIX64, base); MapPages(page_table, base / PAGE_SIZE, size / PAGE_SIZE, nullptr, PageType::Unmapped); auto interval = boost::icl::discrete_interval::closed(base, base + size - 1); @@ -120,7 +121,7 @@ T Read(const VAddr vaddr) { const PageType type = current_page_table->attributes[vaddr >> PAGE_BITS]; switch (type) { case PageType::Unmapped: - LOG_ERROR(HW_Memory, "unmapped Read%lu @ 0x%016llX", sizeof(T) * 8, vaddr); + LOG_ERROR(HW_Memory, "unmapped Read%zu @ 0x%016" PRIX64, sizeof(T) * 8, vaddr); return 0; case PageType::Special: { if (auto result = ReadSpecial(vaddr)) @@ -129,7 +130,7 @@ T Read(const VAddr vaddr) { } case PageType::Memory: { const u8* page_pointer = current_page_table->pointers[vaddr >> PAGE_BITS]; - ASSERT_MSG(page_pointer, "Mapped memory page without a pointer @ %08X", vaddr); + ASSERT_MSG(page_pointer, "Mapped memory page without a pointer @ %016" PRIX64, vaddr); T value; std::memcpy(&value, &page_pointer[vaddr & PAGE_MASK], sizeof(T)); @@ -148,8 +149,8 @@ void Write(const VAddr vaddr, const T data) { const PageType type = current_page_table->attributes[vaddr >> PAGE_BITS]; switch (type) { case PageType::Unmapped: - LOG_ERROR(HW_Memory, "unmapped Write%lu 0x%08X @ 0x%08X", sizeof(data) * 8, (u32)data, - vaddr); + LOG_ERROR(HW_Memory, "unmapped Write%zu 0x%08X @ 0x%016" PRIX64, sizeof(data) * 8, + static_cast(data), vaddr); return; case PageType::Special: { if (WriteSpecial(vaddr, data)) @@ -158,7 +159,7 @@ void Write(const VAddr vaddr, const T data) { } case PageType::Memory: { u8* page_pointer = current_page_table->pointers[vaddr >> PAGE_BITS]; - ASSERT_MSG(page_pointer, "Mapped memory page without a pointer @ %08X", vaddr); + ASSERT_MSG(page_pointer, "Mapped memory page without a pointer @ %016" PRIX64, vaddr); std::memcpy(&page_pointer[vaddr & PAGE_MASK], &data, sizeof(T)); return; } @@ -203,7 +204,7 @@ u8* GetPointer(const VAddr vaddr) { return page_pointer + (vaddr & PAGE_MASK); } - LOG_ERROR(HW_Memory, "unknown GetPointer @ 0x%08x", vaddr); + LOG_ERROR(HW_Memory, "unknown GetPointer @ 0x%016" PRIx64, vaddr); return nullptr; } @@ -241,12 +242,13 @@ u8* GetPhysicalPointer(PAddr address) { }); if (area == std::end(memory_areas)) { - LOG_ERROR(HW_Memory, "unknown GetPhysicalPointer @ 0x%08X", address); + LOG_ERROR(HW_Memory, "unknown GetPhysicalPointer @ 0x%016" PRIX64, address); return nullptr; } if (area->paddr_base == IO_AREA_PADDR) { - LOG_ERROR(HW_Memory, "MMIO mappings are not supported yet. phys_addr=0x%08X", address); + LOG_ERROR(HW_Memory, "MMIO mappings are not supported yet. phys_addr=0x%016" PRIX64, + address); return nullptr; } @@ -321,7 +323,9 @@ void ReadBlock(const Kernel::Process& process, const VAddr src_addr, void* dest_ switch (page_table.attributes[page_index]) { case PageType::Unmapped: - LOG_ERROR(HW_Memory, "unmapped ReadBlock @ 0x%08X (start address = 0xllx, size = %zu)", + LOG_ERROR(HW_Memory, + "unmapped ReadBlock @ 0x%016" PRIX64 " (start address = 0x%" PRIx64 + ", size = %zu)", current_vaddr, src_addr, size); std::memset(dest_buffer, 0, copy_amount); break; @@ -393,7 +397,8 @@ void WriteBlock(const Kernel::Process& process, const VAddr dest_addr, const voi switch (page_table.attributes[page_index]) { case PageType::Unmapped: LOG_ERROR(HW_Memory, - "unmapped WriteBlock @ 0x%08X (start address = 0x%08X, size = %zu)", + "unmapped WriteBlock @ 0x%016" PRIX64 " (start address = 0x%016" PRIX64 + ", size = %zu)", current_vaddr, dest_addr, size); break; case PageType::Special: @@ -437,7 +442,9 @@ void ZeroBlock(const VAddr dest_addr, const size_t size) { switch (current_page_table->attributes[page_index]) { case PageType::Unmapped: - LOG_ERROR(HW_Memory, "unmapped ZeroBlock @ 0x%08X (start address = 0x%08X, size = %zu)", + LOG_ERROR(HW_Memory, + "unmapped ZeroBlock @ 0x%016" PRIX64 " (start address = 0x%016" PRIX64 + ", size = %zu)", current_vaddr, dest_addr, size); break; case PageType::Special: @@ -474,7 +481,9 @@ void CopyBlock(VAddr dest_addr, VAddr src_addr, const size_t size) { switch (current_page_table->attributes[page_index]) { case PageType::Unmapped: - LOG_ERROR(HW_Memory, "unmapped CopyBlock @ 0x%08X (start address = 0x%08X, size = %zu)", + LOG_ERROR(HW_Memory, + "unmapped CopyBlock @ 0x%016" PRIX64 " (start address = 0x%016" PRIX64 + ", size = %zu)", current_vaddr, src_addr, size); ZeroBlock(dest_addr, copy_amount); break; @@ -599,7 +608,7 @@ boost::optional TryVirtualToPhysicalAddress(const VAddr addr) { PAddr VirtualToPhysicalAddress(const VAddr addr) { auto paddr = TryVirtualToPhysicalAddress(addr); if (!paddr) { - LOG_ERROR(HW_Memory, "Unknown virtual address @ 0x%08X", addr); + LOG_ERROR(HW_Memory, "Unknown virtual address @ 0x%016" PRIX64, addr); // To help with debugging, set bit on address so that it's obviously invalid. return addr | 0x80000000; }