summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar bunnei2018-02-14 10:07:03 -0500
committerGravatar GitHub2018-02-14 10:07:03 -0500
commitd939792b9b7b81953b7ddc7df1a86a9e9e3c9add (patch)
tree99b757106b78913075fd954d6c85d296aa3c9c57
parentMerge pull request #189 from lioncash/misc (diff)
parentmemory: Silence formatting sepecifier warnings (diff)
downloadyuzu-d939792b9b7b81953b7ddc7df1a86a9e9e3c9add.tar.gz
yuzu-d939792b9b7b81953b7ddc7df1a86a9e9e3c9add.tar.xz
yuzu-d939792b9b7b81953b7ddc7df1a86a9e9e3c9add.zip
Merge pull request #191 from lioncash/log
core: Silence formatting specifier warnings
-rw-r--r--src/core/gdbstub/gdbstub.cpp15
-rw-r--r--src/core/hle/kernel/thread.cpp5
-rw-r--r--src/core/hle/kernel/vm_manager.cpp12
-rw-r--r--src/core/hle/service/nvdrv/devices/nvhost_as_gpu.cpp12
-rw-r--r--src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp4
-rw-r--r--src/core/hle/service/nvdrv/devices/nvhost_ctrl_gpu.cpp7
-rw-r--r--src/core/hle/service/nvdrv/devices/nvhost_gpu.cpp14
-rw-r--r--src/core/hle/service/nvdrv/devices/nvmap.cpp3
-rw-r--r--src/core/hle/service/nvdrv/interface.cpp3
-rw-r--r--src/core/loader/deconstructed_rom_directory.cpp7
-rw-r--r--src/core/loader/nso.cpp6
-rw-r--r--src/core/memory.cpp51
12 files changed, 82 insertions, 57 deletions
diff --git a/src/core/gdbstub/gdbstub.cpp b/src/core/gdbstub/gdbstub.cpp
index 2405da0c6..7a142dc21 100644
--- a/src/core/gdbstub/gdbstub.cpp
+++ b/src/core/gdbstub/gdbstub.cpp
@@ -6,6 +6,7 @@
6 6
7#include <algorithm> 7#include <algorithm>
8#include <atomic> 8#include <atomic>
9#include <cinttypes>
9#include <climits> 10#include <climits>
10#include <csignal> 11#include <csignal>
11#include <cstdarg> 12#include <cstdarg>
@@ -360,8 +361,9 @@ static void RemoveBreakpoint(BreakpointType type, PAddr addr) {
360 361
361 auto bp = p.find(static_cast<u64>(addr)); 362 auto bp = p.find(static_cast<u64>(addr));
362 if (bp != p.end()) { 363 if (bp != p.end()) {
363 LOG_DEBUG(Debug_GDBStub, "gdb: removed a breakpoint: %08x bytes at %08x of type %d\n", 364 LOG_DEBUG(Debug_GDBStub,
364 bp->second.len, bp->second.addr, type); 365 "gdb: removed a breakpoint: %016" PRIx64 " bytes at %016" PRIx64 " of type %d\n",
366 bp->second.len, bp->second.addr, static_cast<int>(type));
365 p.erase(static_cast<u64>(addr)); 367 p.erase(static_cast<u64>(addr));
366 } 368 }
367} 369}
@@ -407,8 +409,9 @@ bool CheckBreakpoint(PAddr addr, BreakpointType type) {
407 409
408 if (bp->second.active && (addr >= bp->second.addr && addr < bp->second.addr + len)) { 410 if (bp->second.active && (addr >= bp->second.addr && addr < bp->second.addr + len)) {
409 LOG_DEBUG(Debug_GDBStub, 411 LOG_DEBUG(Debug_GDBStub,
410 "Found breakpoint type %d @ %08x, range: %08x - %08x (%d bytes)\n", type, 412 "Found breakpoint type %d @ %016" PRIx64 ", range: %016" PRIx64
411 addr, bp->second.addr, bp->second.addr + len, len); 413 " - %016" PRIx64 " (%" PRIx64 " bytes)\n",
414 static_cast<int>(type), addr, bp->second.addr, bp->second.addr + len, len);
412 return true; 415 return true;
413 } 416 }
414 } 417 }
@@ -778,8 +781,8 @@ static bool CommitBreakpoint(BreakpointType type, PAddr addr, u64 len) {
778 breakpoint.len = len; 781 breakpoint.len = len;
779 p.insert({addr, breakpoint}); 782 p.insert({addr, breakpoint});
780 783
781 LOG_DEBUG(Debug_GDBStub, "gdb: added %d breakpoint: %08x bytes at %08x\n", type, breakpoint.len, 784 LOG_DEBUG(Debug_GDBStub, "gdb: added %d breakpoint: %016" PRIx64 " bytes at %016" PRIx64 "\n",
782 breakpoint.addr); 785 static_cast<int>(type), breakpoint.len, breakpoint.addr);
783 786
784 return true; 787 return true;
785} 788}
diff --git a/src/core/hle/kernel/thread.cpp b/src/core/hle/kernel/thread.cpp
index 111c496b9..1a33cc6cb 100644
--- a/src/core/hle/kernel/thread.cpp
+++ b/src/core/hle/kernel/thread.cpp
@@ -3,6 +3,7 @@
3// Refer to the license.txt file included. 3// Refer to the license.txt file included.
4 4
5#include <algorithm> 5#include <algorithm>
6#include <cinttypes>
6#include <list> 7#include <list>
7#include <vector> 8#include <vector>
8#include "common/assert.h" 9#include "common/assert.h"
@@ -379,7 +380,7 @@ ResultVal<SharedPtr<Thread>> Thread::Create(std::string name, VAddr entry_point,
379 SharedPtr<Process> owner_process) { 380 SharedPtr<Process> owner_process) {
380 // Check if priority is in ranged. Lowest priority -> highest priority id. 381 // Check if priority is in ranged. Lowest priority -> highest priority id.
381 if (priority > THREADPRIO_LOWEST) { 382 if (priority > THREADPRIO_LOWEST) {
382 LOG_ERROR(Kernel_SVC, "Invalid thread priority: %d", priority); 383 LOG_ERROR(Kernel_SVC, "Invalid thread priority: %u", priority);
383 return ERR_OUT_OF_RANGE; 384 return ERR_OUT_OF_RANGE;
384 } 385 }
385 386
@@ -391,7 +392,7 @@ ResultVal<SharedPtr<Thread>> Thread::Create(std::string name, VAddr entry_point,
391 // TODO(yuriks): Other checks, returning 0xD9001BEA 392 // TODO(yuriks): Other checks, returning 0xD9001BEA
392 393
393 if (!Memory::IsValidVirtualAddress(*owner_process, entry_point)) { 394 if (!Memory::IsValidVirtualAddress(*owner_process, entry_point)) {
394 LOG_ERROR(Kernel_SVC, "(name=%s): invalid entry %08x", name.c_str(), entry_point); 395 LOG_ERROR(Kernel_SVC, "(name=%s): invalid entry %016" PRIx64, name.c_str(), entry_point);
395 // TODO (bunnei): Find the correct error code to use here 396 // TODO (bunnei): Find the correct error code to use here
396 return ResultCode(-1); 397 return ResultCode(-1);
397 } 398 }
diff --git a/src/core/hle/kernel/vm_manager.cpp b/src/core/hle/kernel/vm_manager.cpp
index 6da77eb58..d5b36d71a 100644
--- a/src/core/hle/kernel/vm_manager.cpp
+++ b/src/core/hle/kernel/vm_manager.cpp
@@ -2,6 +2,7 @@
2// Licensed under GPLv2 or any later version 2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included. 3// Refer to the license.txt file included.
4 4
5#include <cinttypes>
5#include <iterator> 6#include <iterator>
6#include "common/assert.h" 7#include "common/assert.h"
7#include "common/logging/log.h" 8#include "common/logging/log.h"
@@ -206,7 +207,8 @@ void VMManager::RefreshMemoryBlockMappings(const std::vector<u8>* block) {
206void VMManager::LogLayout(Log::Level log_level) const { 207void VMManager::LogLayout(Log::Level log_level) const {
207 for (const auto& p : vma_map) { 208 for (const auto& p : vma_map) {
208 const VirtualMemoryArea& vma = p.second; 209 const VirtualMemoryArea& vma = p.second;
209 LOG_GENERIC(Log::Class::Kernel, log_level, "%08X - %08X size: %8X %c%c%c %s", vma.base, 210 LOG_GENERIC(Log::Class::Kernel, log_level,
211 "%016" PRIx64 " - %016" PRIx64 " size: %16" PRIx64 " %c%c%c %s", vma.base,
210 vma.base + vma.size, vma.size, 212 vma.base + vma.size, vma.size,
211 (u8)vma.permissions & (u8)VMAPermission::Read ? 'R' : '-', 213 (u8)vma.permissions & (u8)VMAPermission::Read ? 'R' : '-',
212 (u8)vma.permissions & (u8)VMAPermission::Write ? 'W' : '-', 214 (u8)vma.permissions & (u8)VMAPermission::Write ? 'W' : '-',
@@ -222,8 +224,8 @@ VMManager::VMAIter VMManager::StripIterConstness(const VMAHandle& iter) {
222} 224}
223 225
224ResultVal<VMManager::VMAIter> VMManager::CarveVMA(VAddr base, u64 size) { 226ResultVal<VMManager::VMAIter> VMManager::CarveVMA(VAddr base, u64 size) {
225 ASSERT_MSG((size & Memory::PAGE_MASK) == 0, "non-page aligned size: 0x%8X", size); 227 ASSERT_MSG((size & Memory::PAGE_MASK) == 0, "non-page aligned size: 0x%16" PRIx64, size);
226 ASSERT_MSG((base & Memory::PAGE_MASK) == 0, "non-page aligned base: 0x%08X", base); 228 ASSERT_MSG((base & Memory::PAGE_MASK) == 0, "non-page aligned base: 0x%016" PRIx64, base);
227 229
228 VMAIter vma_handle = StripIterConstness(FindVMA(base)); 230 VMAIter vma_handle = StripIterConstness(FindVMA(base));
229 if (vma_handle == vma_map.end()) { 231 if (vma_handle == vma_map.end()) {
@@ -258,8 +260,8 @@ ResultVal<VMManager::VMAIter> VMManager::CarveVMA(VAddr base, u64 size) {
258} 260}
259 261
260ResultVal<VMManager::VMAIter> VMManager::CarveVMARange(VAddr target, u64 size) { 262ResultVal<VMManager::VMAIter> VMManager::CarveVMARange(VAddr target, u64 size) {
261 ASSERT_MSG((size & Memory::PAGE_MASK) == 0, "non-page aligned size: 0x%8X", size); 263 ASSERT_MSG((size & Memory::PAGE_MASK) == 0, "non-page aligned size: 0x%16" PRIx64, size);
262 ASSERT_MSG((target & Memory::PAGE_MASK) == 0, "non-page aligned base: 0x%08X", target); 264 ASSERT_MSG((target & Memory::PAGE_MASK) == 0, "non-page aligned base: 0x%016" PRIx64, target);
263 265
264 VAddr target_end = target + size; 266 VAddr target_end = target + size;
265 ASSERT(target_end >= target); 267 ASSERT(target_end >= target);
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 9832e1899..9892402fa 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 @@
2// Licensed under GPLv2 or any later version 2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included. 3// Refer to the license.txt file included.
4 4
5#include <cinttypes>
5#include "common/assert.h" 6#include "common/assert.h"
6#include "common/logging/log.h" 7#include "common/logging/log.h"
7#include "core/core.h" 8#include "core/core.h"
@@ -13,8 +14,8 @@ namespace Nvidia {
13namespace Devices { 14namespace Devices {
14 15
15u32 nvhost_as_gpu::ioctl(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) { 16u32 nvhost_as_gpu::ioctl(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) {
16 LOG_DEBUG(Service_NVDRV, "called, command=0x%08x, input_size=0x%llx, output_size=0x%llx", 17 LOG_DEBUG(Service_NVDRV, "called, command=0x%08x, input_size=0x%zx, output_size=0x%zx",
17 command, input.size(), output.size()); 18 command.raw, input.size(), output.size());
18 19
19 switch (static_cast<IoctlCommand>(command.raw)) { 20 switch (static_cast<IoctlCommand>(command.raw)) {
20 case IoctlCommand::IocInitalizeExCommand: 21 case IoctlCommand::IocInitalizeExCommand:
@@ -62,7 +63,8 @@ u32 nvhost_as_gpu::MapBufferEx(const std::vector<u8>& input, std::vector<u8>& ou
62 std::memcpy(&params, input.data(), input.size()); 63 std::memcpy(&params, input.data(), input.size());
63 64
64 LOG_DEBUG(Service_NVDRV, 65 LOG_DEBUG(Service_NVDRV,
65 "called, flags=%x, nvmap_handle=%x, buffer_offset=%lx, mapping_size=%lx, offset=%lx", 66 "called, flags=%x, nvmap_handle=%x, buffer_offset=%" PRIu64 ", mapping_size=%" PRIu64
67 ", offset=%" PRIu64,
66 params.flags, params.nvmap_handle, params.buffer_offset, params.mapping_size, 68 params.flags, params.nvmap_handle, params.buffer_offset, params.mapping_size,
67 params.offset); 69 params.offset);
68 70
@@ -97,8 +99,8 @@ u32 nvhost_as_gpu::BindChannel(const std::vector<u8>& input, std::vector<u8>& ou
97u32 nvhost_as_gpu::GetVARegions(const std::vector<u8>& input, std::vector<u8>& output) { 99u32 nvhost_as_gpu::GetVARegions(const std::vector<u8>& input, std::vector<u8>& output) {
98 IoctlGetVaRegions params{}; 100 IoctlGetVaRegions params{};
99 std::memcpy(&params, input.data(), input.size()); 101 std::memcpy(&params, input.data(), input.size());
100 LOG_WARNING(Service_NVDRV, "(STUBBED) called, buf_addr=%lx, buf_size=%x", params.buf_addr, 102 LOG_WARNING(Service_NVDRV, "(STUBBED) called, buf_addr=%" PRIu64 ", buf_size=%x",
101 params.buf_size); 103 params.buf_addr, params.buf_size);
102 104
103 params.buf_size = 0x30; 105 params.buf_size = 0x30;
104 params.regions[0].offset = 0x04000000; 106 params.regions[0].offset = 0x04000000;
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp b/src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp
index c0e35237a..ee99ab280 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 {
11namespace Devices { 11namespace Devices {
12 12
13u32 nvhost_ctrl::ioctl(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) { 13u32 nvhost_ctrl::ioctl(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) {
14 LOG_DEBUG(Service_NVDRV, "called, command=0x%08x, input_size=0x%lx, output_size=0x%lx", command, 14 LOG_DEBUG(Service_NVDRV, "called, command=0x%08x, input_size=0x%zx, output_size=0x%zx",
15 input.size(), output.size()); 15 command.raw, input.size(), output.size());
16 16
17 switch (static_cast<IoctlCommand>(command.raw)) { 17 switch (static_cast<IoctlCommand>(command.raw)) {
18 case IoctlCommand::IocGetConfigCommand: 18 case IoctlCommand::IocGetConfigCommand:
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 4776c8aa3..3b353d742 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 @@
2// Licensed under GPLv2 or any later version 2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included. 3// Refer to the license.txt file included.
4 4
5#include <cinttypes>
5#include "common/assert.h" 6#include "common/assert.h"
6#include "common/logging/log.h" 7#include "common/logging/log.h"
7#include "core/hle/service/nvdrv/devices/nvhost_ctrl_gpu.h" 8#include "core/hle/service/nvdrv/devices/nvhost_ctrl_gpu.h"
@@ -11,8 +12,8 @@ namespace Nvidia {
11namespace Devices { 12namespace Devices {
12 13
13u32 nvhost_ctrl_gpu::ioctl(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) { 14u32 nvhost_ctrl_gpu::ioctl(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) {
14 LOG_DEBUG(Service_NVDRV, "called, command=0x%08x, input_size=0x%llx, output_size=0x%llx", 15 LOG_DEBUG(Service_NVDRV, "called, command=0x%08x, input_size=0x%zx, output_size=0x%zx",
15 command, input.size(), output.size()); 16 command.raw, input.size(), output.size());
16 17
17 switch (static_cast<IoctlCommand>(command.raw)) { 18 switch (static_cast<IoctlCommand>(command.raw)) {
18 case IoctlCommand::IocGetCharacteristicsCommand: 19 case IoctlCommand::IocGetCharacteristicsCommand:
@@ -78,7 +79,7 @@ u32 nvhost_ctrl_gpu::GetCharacteristics(const std::vector<u8>& input, std::vecto
78u32 nvhost_ctrl_gpu::GetTPCMasks(const std::vector<u8>& input, std::vector<u8>& output) { 79u32 nvhost_ctrl_gpu::GetTPCMasks(const std::vector<u8>& input, std::vector<u8>& output) {
79 IoctlGpuGetTpcMasksArgs params{}; 80 IoctlGpuGetTpcMasksArgs params{};
80 std::memcpy(&params, input.data(), input.size()); 81 std::memcpy(&params, input.data(), input.size());
81 LOG_WARNING(Service_NVDRV, "(STUBBED) called, mask=0x%x, mask_buf_addr=0x%lx", 82 LOG_WARNING(Service_NVDRV, "(STUBBED) called, mask=0x%x, mask_buf_addr=0x%" PRIx64,
82 params.mask_buf_size, params.mask_buf_addr); 83 params.mask_buf_size, params.mask_buf_addr);
83 std::memcpy(output.data(), &params, sizeof(params)); 84 std::memcpy(output.data(), &params, sizeof(params));
84 return 0; 85 return 0;
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_gpu.cpp b/src/core/hle/service/nvdrv/devices/nvhost_gpu.cpp
index 0b2ebd466..da44c65f3 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 @@
2// Licensed under GPLv2 or any later version 2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included. 3// Refer to the license.txt file included.
4 4
5#include <cinttypes>
5#include <map> 6#include <map>
6#include "common/assert.h" 7#include "common/assert.h"
7#include "common/logging/log.h" 8#include "common/logging/log.h"
@@ -13,8 +14,8 @@ namespace Nvidia {
13namespace Devices { 14namespace Devices {
14 15
15u32 nvhost_gpu::ioctl(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) { 16u32 nvhost_gpu::ioctl(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) {
16 LOG_DEBUG(Service_NVDRV, "called, command=0x%08x, input_size=0x%llx, output_size=0x%llx", 17 LOG_DEBUG(Service_NVDRV, "called, command=0x%08x, input_size=0x%zx, output_size=0x%zx",
17 command, input.size(), output.size()); 18 command.raw, input.size(), output.size());
18 19
19 switch (static_cast<IoctlCommand>(command.raw)) { 20 switch (static_cast<IoctlCommand>(command.raw)) {
20 case IoctlCommand::IocSetNVMAPfdCommand: 21 case IoctlCommand::IocSetNVMAPfdCommand:
@@ -74,7 +75,8 @@ u32 nvhost_gpu::GetClientData(const std::vector<u8>& input, std::vector<u8>& out
74 75
75u32 nvhost_gpu::ZCullBind(const std::vector<u8>& input, std::vector<u8>& output) { 76u32 nvhost_gpu::ZCullBind(const std::vector<u8>& input, std::vector<u8>& output) {
76 std::memcpy(&zcull_params, input.data(), input.size()); 77 std::memcpy(&zcull_params, input.data(), input.size());
77 LOG_DEBUG(Service_NVDRV, "called, gpu_va=%lx, mode=%x", zcull_params.gpu_va, zcull_params.mode); 78 LOG_DEBUG(Service_NVDRV, "called, gpu_va=%" PRIx64 ", mode=%x", zcull_params.gpu_va,
79 zcull_params.mode);
78 std::memcpy(output.data(), &zcull_params, output.size()); 80 std::memcpy(output.data(), &zcull_params, output.size());
79 return 0; 81 return 0;
80} 82}
@@ -82,8 +84,8 @@ u32 nvhost_gpu::ZCullBind(const std::vector<u8>& input, std::vector<u8>& output)
82u32 nvhost_gpu::SetErrorNotifier(const std::vector<u8>& input, std::vector<u8>& output) { 84u32 nvhost_gpu::SetErrorNotifier(const std::vector<u8>& input, std::vector<u8>& output) {
83 IoctlSetErrorNotifier params{}; 85 IoctlSetErrorNotifier params{};
84 std::memcpy(&params, input.data(), input.size()); 86 std::memcpy(&params, input.data(), input.size());
85 LOG_WARNING(Service_NVDRV, "(STUBBED) called, offset=%lx, size=%lx, mem=%x", params.offset, 87 LOG_WARNING(Service_NVDRV, "(STUBBED) called, offset=%" PRIx64 ", size=%" PRIx64 ", mem=%x",
86 params.size, params.mem); 88 params.offset, params.size, params.mem);
87 std::memcpy(output.data(), &params, output.size()); 89 std::memcpy(output.data(), &params, output.size());
88 return 0; 90 return 0;
89} 91}
@@ -123,7 +125,7 @@ u32 nvhost_gpu::SubmitGPFIFO(const std::vector<u8>& input, std::vector<u8>& outp
123 UNIMPLEMENTED(); 125 UNIMPLEMENTED();
124 IoctlSubmitGpfifo params{}; 126 IoctlSubmitGpfifo params{};
125 std::memcpy(&params, input.data(), sizeof(IoctlSubmitGpfifo)); 127 std::memcpy(&params, input.data(), sizeof(IoctlSubmitGpfifo));
126 LOG_WARNING(Service_NVDRV, "(STUBBED) called, gpfifo=%lx, num_entries=%x, flags=%x", 128 LOG_WARNING(Service_NVDRV, "(STUBBED) called, gpfifo=%" PRIx64 ", num_entries=%x, flags=%x",
127 params.gpfifo, params.num_entries, params.flags); 129 params.gpfifo, params.num_entries, params.flags);
128 130
129 auto entries = std::vector<IoctlGpfifoEntry>(); 131 auto entries = std::vector<IoctlGpfifoEntry>();
diff --git a/src/core/hle/service/nvdrv/devices/nvmap.cpp b/src/core/hle/service/nvdrv/devices/nvmap.cpp
index 02b33374a..cd8c0c605 100644
--- a/src/core/hle/service/nvdrv/devices/nvmap.cpp
+++ b/src/core/hle/service/nvdrv/devices/nvmap.cpp
@@ -3,6 +3,7 @@
3// Refer to the license.txt file included. 3// Refer to the license.txt file included.
4 4
5#include <algorithm> 5#include <algorithm>
6#include <cinttypes>
6 7
7#include "common/assert.h" 8#include "common/assert.h"
8#include "common/logging/log.h" 9#include "common/logging/log.h"
@@ -71,7 +72,7 @@ u32 nvmap::IocAlloc(const std::vector<u8>& input, std::vector<u8>& output) {
71 object->addr = params.addr; 72 object->addr = params.addr;
72 object->status = Object::Status::Allocated; 73 object->status = Object::Status::Allocated;
73 74
74 LOG_DEBUG(Service_NVDRV, "called, addr=0x%llx", params.addr); 75 LOG_DEBUG(Service_NVDRV, "called, addr=0x%" PRIx64, params.addr);
75 76
76 std::memcpy(output.data(), &params, sizeof(params)); 77 std::memcpy(output.data(), &params, sizeof(params));
77 return 0; 78 return 0;
diff --git a/src/core/hle/service/nvdrv/interface.cpp b/src/core/hle/service/nvdrv/interface.cpp
index 367791da6..1a5efaeaf 100644
--- a/src/core/hle/service/nvdrv/interface.cpp
+++ b/src/core/hle/service/nvdrv/interface.cpp
@@ -2,6 +2,7 @@
2// Licensed under GPLv2 or any later version 2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included. 3// Refer to the license.txt file included.
4 4
5#include <cinttypes>
5#include "common/logging/log.h" 6#include "common/logging/log.h"
6#include "core/hle/ipc_helpers.h" 7#include "core/hle/ipc_helpers.h"
7#include "core/hle/kernel/event.h" 8#include "core/hle/kernel/event.h"
@@ -88,7 +89,7 @@ void NVDRV::SetClientPID(Kernel::HLERequestContext& ctx) {
88 IPC::RequestParser rp{ctx}; 89 IPC::RequestParser rp{ctx};
89 pid = rp.Pop<u64>(); 90 pid = rp.Pop<u64>();
90 91
91 LOG_WARNING(Service_NVDRV, "(STUBBED) called, pid=0x%lx", pid); 92 LOG_WARNING(Service_NVDRV, "(STUBBED) called, pid=0x%" PRIx64, pid);
92 IPC::ResponseBuilder rb{ctx, 3}; 93 IPC::ResponseBuilder rb{ctx, 3};
93 rb.Push(RESULT_SUCCESS); 94 rb.Push(RESULT_SUCCESS);
94 rb.Push<u32>(0); 95 rb.Push<u32>(0);
diff --git a/src/core/loader/deconstructed_rom_directory.cpp b/src/core/loader/deconstructed_rom_directory.cpp
index c4e003b74..661803b5f 100644
--- a/src/core/loader/deconstructed_rom_directory.cpp
+++ b/src/core/loader/deconstructed_rom_directory.cpp
@@ -2,6 +2,7 @@
2// Licensed under GPLv2 or any later version 2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included. 3// Refer to the license.txt file included.
4 4
5#include <cinttypes>
5#include "common/common_funcs.h" 6#include "common/common_funcs.h"
6#include "common/common_paths.h" 7#include "common/common_paths.h"
7#include "common/file_util.h" 8#include "common/file_util.h"
@@ -116,7 +117,7 @@ ResultStatus AppLoader_DeconstructedRomDirectory::Load(
116 const VAddr load_addr = next_load_addr; 117 const VAddr load_addr = next_load_addr;
117 next_load_addr = AppLoader_NSO::LoadModule(path, load_addr); 118 next_load_addr = AppLoader_NSO::LoadModule(path, load_addr);
118 if (next_load_addr) { 119 if (next_load_addr) {
119 LOG_DEBUG(Loader, "loaded module %s @ 0x%llx", module, load_addr); 120 LOG_DEBUG(Loader, "loaded module %s @ 0x%" PRIx64, module, load_addr);
120 } else { 121 } else {
121 next_load_addr = load_addr; 122 next_load_addr = load_addr;
122 } 123 }
@@ -158,8 +159,8 @@ ResultStatus AppLoader_DeconstructedRomDirectory::ReadRomFS(
158 offset = 0; 159 offset = 0;
159 size = romfs_file->GetSize(); 160 size = romfs_file->GetSize();
160 161
161 LOG_DEBUG(Loader, "RomFS offset: 0x%08X", offset); 162 LOG_DEBUG(Loader, "RomFS offset: 0x%016" PRIX64, offset);
162 LOG_DEBUG(Loader, "RomFS size: 0x%08X", size); 163 LOG_DEBUG(Loader, "RomFS size: 0x%016" PRIX64, size);
163 164
164 // Reset read pointer 165 // Reset read pointer
165 file.Seek(0, SEEK_SET); 166 file.Seek(0, SEEK_SET);
diff --git a/src/core/loader/nso.cpp b/src/core/loader/nso.cpp
index 3ccbbb824..407025da0 100644
--- a/src/core/loader/nso.cpp
+++ b/src/core/loader/nso.cpp
@@ -2,6 +2,7 @@
2// Licensed under GPLv2 or any later version 2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included. 3// Refer to the license.txt file included.
4 4
5#include <cinttypes>
5#include <vector> 6#include <vector>
6#include <lz4.h> 7#include <lz4.h>
7#include "common/common_funcs.h" 8#include "common/common_funcs.h"
@@ -82,7 +83,7 @@ static std::vector<u8> ReadSegment(FileUtil::IOFile& file, const NsoSegmentHeade
82 reinterpret_cast<char*>(uncompressed_data.data()), compressed_size, header.size); 83 reinterpret_cast<char*>(uncompressed_data.data()), compressed_size, header.size);
83 84
84 ASSERT_MSG(bytes_uncompressed == header.size && bytes_uncompressed == uncompressed_data.size(), 85 ASSERT_MSG(bytes_uncompressed == header.size && bytes_uncompressed == uncompressed_data.size(),
85 "%d != %d != %d", bytes_uncompressed, header.size, uncompressed_data.size()); 86 "%d != %u != %zu", bytes_uncompressed, header.size, uncompressed_data.size());
86 87
87 return uncompressed_data; 88 return uncompressed_data;
88} 89}
@@ -158,7 +159,8 @@ ResultStatus AppLoader_NSO::Load(Kernel::SharedPtr<Kernel::Process>& process) {
158 159
159 // Load module 160 // Load module
160 LoadModule(filepath, Memory::PROCESS_IMAGE_VADDR); 161 LoadModule(filepath, Memory::PROCESS_IMAGE_VADDR);
161 LOG_DEBUG(Loader, "loaded module %s @ 0x%llx", filepath.c_str(), Memory::PROCESS_IMAGE_VADDR); 162 LOG_DEBUG(Loader, "loaded module %s @ 0x%" PRIx64, filepath.c_str(),
163 Memory::PROCESS_IMAGE_VADDR);
162 164
163 process->svc_access_mask.set(); 165 process->svc_access_mask.set();
164 process->address_mappings = default_address_mappings; 166 process->address_mappings = default_address_mappings;
diff --git a/src/core/memory.cpp b/src/core/memory.cpp
index f658271a5..cc1ed16b6 100644
--- a/src/core/memory.cpp
+++ b/src/core/memory.cpp
@@ -4,6 +4,7 @@
4 4
5#include <algorithm> 5#include <algorithm>
6#include <array> 6#include <array>
7#include <cinttypes>
7#include <cstring> 8#include <cstring>
8#include <boost/optional.hpp> 9#include <boost/optional.hpp>
9#include "common/assert.h" 10#include "common/assert.h"
@@ -38,12 +39,12 @@ PageTable* GetCurrentPageTable() {
38} 39}
39 40
40static void MapPages(PageTable& page_table, VAddr base, u64 size, u8* memory, PageType type) { 41static void MapPages(PageTable& page_table, VAddr base, u64 size, u8* memory, PageType type) {
41 LOG_DEBUG(HW_Memory, "Mapping %p onto %08X-%08X", memory, base * PAGE_SIZE, 42 LOG_DEBUG(HW_Memory, "Mapping %p onto %016" PRIX64 "-%016" PRIX64, memory, base * PAGE_SIZE,
42 (base + size) * PAGE_SIZE); 43 (base + size) * PAGE_SIZE);
43 44
44 VAddr end = base + size; 45 VAddr end = base + size;
45 while (base != end) { 46 while (base != end) {
46 ASSERT_MSG(base < PAGE_TABLE_NUM_ENTRIES, "out of range mapping at %08X", base); 47 ASSERT_MSG(base < PAGE_TABLE_NUM_ENTRIES, "out of range mapping at %016" PRIX64, base);
47 48
48 page_table.attributes[base] = type; 49 page_table.attributes[base] = type;
49 page_table.pointers[base] = memory; 50 page_table.pointers[base] = memory;
@@ -55,14 +56,14 @@ static void MapPages(PageTable& page_table, VAddr base, u64 size, u8* memory, Pa
55} 56}
56 57
57void MapMemoryRegion(PageTable& page_table, VAddr base, u64 size, u8* target) { 58void MapMemoryRegion(PageTable& page_table, VAddr base, u64 size, u8* target) {
58 ASSERT_MSG((size & PAGE_MASK) == 0, "non-page aligned size: %08X", size); 59 ASSERT_MSG((size & PAGE_MASK) == 0, "non-page aligned size: %016" PRIX64, size);
59 ASSERT_MSG((base & PAGE_MASK) == 0, "non-page aligned base: %08X", base); 60 ASSERT_MSG((base & PAGE_MASK) == 0, "non-page aligned base: %016" PRIX64, base);
60 MapPages(page_table, base / PAGE_SIZE, size / PAGE_SIZE, target, PageType::Memory); 61 MapPages(page_table, base / PAGE_SIZE, size / PAGE_SIZE, target, PageType::Memory);
61} 62}
62 63
63void MapIoRegion(PageTable& page_table, VAddr base, u64 size, MemoryHookPointer mmio_handler) { 64void MapIoRegion(PageTable& page_table, VAddr base, u64 size, MemoryHookPointer mmio_handler) {
64 ASSERT_MSG((size & PAGE_MASK) == 0, "non-page aligned size: %08X", size); 65 ASSERT_MSG((size & PAGE_MASK) == 0, "non-page aligned size: %016" PRIX64, size);
65 ASSERT_MSG((base & PAGE_MASK) == 0, "non-page aligned base: %08X", base); 66 ASSERT_MSG((base & PAGE_MASK) == 0, "non-page aligned base: %016" PRIX64, base);
66 MapPages(page_table, base / PAGE_SIZE, size / PAGE_SIZE, nullptr, PageType::Special); 67 MapPages(page_table, base / PAGE_SIZE, size / PAGE_SIZE, nullptr, PageType::Special);
67 68
68 auto interval = boost::icl::discrete_interval<VAddr>::closed(base, base + size - 1); 69 auto interval = boost::icl::discrete_interval<VAddr>::closed(base, base + size - 1);
@@ -71,8 +72,8 @@ void MapIoRegion(PageTable& page_table, VAddr base, u64 size, MemoryHookPointer
71} 72}
72 73
73void UnmapRegion(PageTable& page_table, VAddr base, u64 size) { 74void UnmapRegion(PageTable& page_table, VAddr base, u64 size) {
74 ASSERT_MSG((size & PAGE_MASK) == 0, "non-page aligned size: %08X", size); 75 ASSERT_MSG((size & PAGE_MASK) == 0, "non-page aligned size: %016" PRIX64, size);
75 ASSERT_MSG((base & PAGE_MASK) == 0, "non-page aligned base: %08X", base); 76 ASSERT_MSG((base & PAGE_MASK) == 0, "non-page aligned base: %016" PRIX64, base);
76 MapPages(page_table, base / PAGE_SIZE, size / PAGE_SIZE, nullptr, PageType::Unmapped); 77 MapPages(page_table, base / PAGE_SIZE, size / PAGE_SIZE, nullptr, PageType::Unmapped);
77 78
78 auto interval = boost::icl::discrete_interval<VAddr>::closed(base, base + size - 1); 79 auto interval = boost::icl::discrete_interval<VAddr>::closed(base, base + size - 1);
@@ -120,7 +121,7 @@ T Read(const VAddr vaddr) {
120 const PageType type = current_page_table->attributes[vaddr >> PAGE_BITS]; 121 const PageType type = current_page_table->attributes[vaddr >> PAGE_BITS];
121 switch (type) { 122 switch (type) {
122 case PageType::Unmapped: 123 case PageType::Unmapped:
123 LOG_ERROR(HW_Memory, "unmapped Read%lu @ 0x%016llX", sizeof(T) * 8, vaddr); 124 LOG_ERROR(HW_Memory, "unmapped Read%zu @ 0x%016" PRIX64, sizeof(T) * 8, vaddr);
124 return 0; 125 return 0;
125 case PageType::Special: { 126 case PageType::Special: {
126 if (auto result = ReadSpecial<T>(vaddr)) 127 if (auto result = ReadSpecial<T>(vaddr))
@@ -129,7 +130,7 @@ T Read(const VAddr vaddr) {
129 } 130 }
130 case PageType::Memory: { 131 case PageType::Memory: {
131 const u8* page_pointer = current_page_table->pointers[vaddr >> PAGE_BITS]; 132 const u8* page_pointer = current_page_table->pointers[vaddr >> PAGE_BITS];
132 ASSERT_MSG(page_pointer, "Mapped memory page without a pointer @ %08X", vaddr); 133 ASSERT_MSG(page_pointer, "Mapped memory page without a pointer @ %016" PRIX64, vaddr);
133 134
134 T value; 135 T value;
135 std::memcpy(&value, &page_pointer[vaddr & PAGE_MASK], sizeof(T)); 136 std::memcpy(&value, &page_pointer[vaddr & PAGE_MASK], sizeof(T));
@@ -148,8 +149,8 @@ void Write(const VAddr vaddr, const T data) {
148 const PageType type = current_page_table->attributes[vaddr >> PAGE_BITS]; 149 const PageType type = current_page_table->attributes[vaddr >> PAGE_BITS];
149 switch (type) { 150 switch (type) {
150 case PageType::Unmapped: 151 case PageType::Unmapped:
151 LOG_ERROR(HW_Memory, "unmapped Write%lu 0x%08X @ 0x%08X", sizeof(data) * 8, (u32)data, 152 LOG_ERROR(HW_Memory, "unmapped Write%zu 0x%08X @ 0x%016" PRIX64, sizeof(data) * 8,
152 vaddr); 153 static_cast<u32>(data), vaddr);
153 return; 154 return;
154 case PageType::Special: { 155 case PageType::Special: {
155 if (WriteSpecial<T>(vaddr, data)) 156 if (WriteSpecial<T>(vaddr, data))
@@ -158,7 +159,7 @@ void Write(const VAddr vaddr, const T data) {
158 } 159 }
159 case PageType::Memory: { 160 case PageType::Memory: {
160 u8* page_pointer = current_page_table->pointers[vaddr >> PAGE_BITS]; 161 u8* page_pointer = current_page_table->pointers[vaddr >> PAGE_BITS];
161 ASSERT_MSG(page_pointer, "Mapped memory page without a pointer @ %08X", vaddr); 162 ASSERT_MSG(page_pointer, "Mapped memory page without a pointer @ %016" PRIX64, vaddr);
162 std::memcpy(&page_pointer[vaddr & PAGE_MASK], &data, sizeof(T)); 163 std::memcpy(&page_pointer[vaddr & PAGE_MASK], &data, sizeof(T));
163 return; 164 return;
164 } 165 }
@@ -203,7 +204,7 @@ u8* GetPointer(const VAddr vaddr) {
203 return page_pointer + (vaddr & PAGE_MASK); 204 return page_pointer + (vaddr & PAGE_MASK);
204 } 205 }
205 206
206 LOG_ERROR(HW_Memory, "unknown GetPointer @ 0x%08x", vaddr); 207 LOG_ERROR(HW_Memory, "unknown GetPointer @ 0x%016" PRIx64, vaddr);
207 return nullptr; 208 return nullptr;
208} 209}
209 210
@@ -241,12 +242,13 @@ u8* GetPhysicalPointer(PAddr address) {
241 }); 242 });
242 243
243 if (area == std::end(memory_areas)) { 244 if (area == std::end(memory_areas)) {
244 LOG_ERROR(HW_Memory, "unknown GetPhysicalPointer @ 0x%08X", address); 245 LOG_ERROR(HW_Memory, "unknown GetPhysicalPointer @ 0x%016" PRIX64, address);
245 return nullptr; 246 return nullptr;
246 } 247 }
247 248
248 if (area->paddr_base == IO_AREA_PADDR) { 249 if (area->paddr_base == IO_AREA_PADDR) {
249 LOG_ERROR(HW_Memory, "MMIO mappings are not supported yet. phys_addr=0x%08X", address); 250 LOG_ERROR(HW_Memory, "MMIO mappings are not supported yet. phys_addr=0x%016" PRIX64,
251 address);
250 return nullptr; 252 return nullptr;
251 } 253 }
252 254
@@ -321,7 +323,9 @@ void ReadBlock(const Kernel::Process& process, const VAddr src_addr, void* dest_
321 323
322 switch (page_table.attributes[page_index]) { 324 switch (page_table.attributes[page_index]) {
323 case PageType::Unmapped: 325 case PageType::Unmapped:
324 LOG_ERROR(HW_Memory, "unmapped ReadBlock @ 0x%08X (start address = 0xllx, size = %zu)", 326 LOG_ERROR(HW_Memory,
327 "unmapped ReadBlock @ 0x%016" PRIX64 " (start address = 0x%" PRIx64
328 ", size = %zu)",
325 current_vaddr, src_addr, size); 329 current_vaddr, src_addr, size);
326 std::memset(dest_buffer, 0, copy_amount); 330 std::memset(dest_buffer, 0, copy_amount);
327 break; 331 break;
@@ -393,7 +397,8 @@ void WriteBlock(const Kernel::Process& process, const VAddr dest_addr, const voi
393 switch (page_table.attributes[page_index]) { 397 switch (page_table.attributes[page_index]) {
394 case PageType::Unmapped: 398 case PageType::Unmapped:
395 LOG_ERROR(HW_Memory, 399 LOG_ERROR(HW_Memory,
396 "unmapped WriteBlock @ 0x%08X (start address = 0x%08X, size = %zu)", 400 "unmapped WriteBlock @ 0x%016" PRIX64 " (start address = 0x%016" PRIX64
401 ", size = %zu)",
397 current_vaddr, dest_addr, size); 402 current_vaddr, dest_addr, size);
398 break; 403 break;
399 case PageType::Special: 404 case PageType::Special:
@@ -437,7 +442,9 @@ void ZeroBlock(const VAddr dest_addr, const size_t size) {
437 442
438 switch (current_page_table->attributes[page_index]) { 443 switch (current_page_table->attributes[page_index]) {
439 case PageType::Unmapped: 444 case PageType::Unmapped:
440 LOG_ERROR(HW_Memory, "unmapped ZeroBlock @ 0x%08X (start address = 0x%08X, size = %zu)", 445 LOG_ERROR(HW_Memory,
446 "unmapped ZeroBlock @ 0x%016" PRIX64 " (start address = 0x%016" PRIX64
447 ", size = %zu)",
441 current_vaddr, dest_addr, size); 448 current_vaddr, dest_addr, size);
442 break; 449 break;
443 case PageType::Special: 450 case PageType::Special:
@@ -474,7 +481,9 @@ void CopyBlock(VAddr dest_addr, VAddr src_addr, const size_t size) {
474 481
475 switch (current_page_table->attributes[page_index]) { 482 switch (current_page_table->attributes[page_index]) {
476 case PageType::Unmapped: 483 case PageType::Unmapped:
477 LOG_ERROR(HW_Memory, "unmapped CopyBlock @ 0x%08X (start address = 0x%08X, size = %zu)", 484 LOG_ERROR(HW_Memory,
485 "unmapped CopyBlock @ 0x%016" PRIX64 " (start address = 0x%016" PRIX64
486 ", size = %zu)",
478 current_vaddr, src_addr, size); 487 current_vaddr, src_addr, size);
479 ZeroBlock(dest_addr, copy_amount); 488 ZeroBlock(dest_addr, copy_amount);
480 break; 489 break;
@@ -599,7 +608,7 @@ boost::optional<PAddr> TryVirtualToPhysicalAddress(const VAddr addr) {
599PAddr VirtualToPhysicalAddress(const VAddr addr) { 608PAddr VirtualToPhysicalAddress(const VAddr addr) {
600 auto paddr = TryVirtualToPhysicalAddress(addr); 609 auto paddr = TryVirtualToPhysicalAddress(addr);
601 if (!paddr) { 610 if (!paddr) {
602 LOG_ERROR(HW_Memory, "Unknown virtual address @ 0x%08X", addr); 611 LOG_ERROR(HW_Memory, "Unknown virtual address @ 0x%016" PRIX64, addr);
603 // To help with debugging, set bit on address so that it's obviously invalid. 612 // To help with debugging, set bit on address so that it's obviously invalid.
604 return addr | 0x80000000; 613 return addr | 0x80000000;
605 } 614 }