summaryrefslogtreecommitdiff
path: root/src/core/memory.cpp
diff options
context:
space:
mode:
authorGravatar Lioncash2018-05-02 09:14:28 -0400
committerGravatar Lioncash2018-05-02 09:49:36 -0400
commit7c9644646f595605036b9fe9e51c44716ee60fa3 (patch)
tree20f8f60d78ed7db5c76629d452ed196d43dc3e78 /src/core/memory.cpp
parentMerge pull request #429 from Subv/ioctl_corruption (diff)
downloadyuzu-7c9644646f595605036b9fe9e51c44716ee60fa3.tar.gz
yuzu-7c9644646f595605036b9fe9e51c44716ee60fa3.tar.xz
yuzu-7c9644646f595605036b9fe9e51c44716ee60fa3.zip
general: Make formatting of logged hex values more straightforward
This makes the formatting expectations more obvious (e.g. any zero padding specified is padding that's entirely dedicated to the value being printed, not any pretty-printing that also gets tacked on).
Diffstat (limited to 'src/core/memory.cpp')
-rw-r--r--src/core/memory.cpp22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/core/memory.cpp b/src/core/memory.cpp
index 5a27fa902..db8211463 100644
--- a/src/core/memory.cpp
+++ b/src/core/memory.cpp
@@ -168,7 +168,7 @@ T Read(const VAddr vaddr) {
168 PageType type = current_page_table->attributes[vaddr >> PAGE_BITS]; 168 PageType type = current_page_table->attributes[vaddr >> PAGE_BITS];
169 switch (type) { 169 switch (type) {
170 case PageType::Unmapped: 170 case PageType::Unmapped:
171 NGLOG_ERROR(HW_Memory, "Unmapped Read{} @ {:#010X}", sizeof(T) * 8, vaddr); 171 NGLOG_ERROR(HW_Memory, "Unmapped Read{} @ 0x{:08X}", sizeof(T) * 8, vaddr);
172 return 0; 172 return 0;
173 case PageType::Memory: 173 case PageType::Memory:
174 ASSERT_MSG(false, "Mapped memory page without a pointer @ {:016X}", vaddr); 174 ASSERT_MSG(false, "Mapped memory page without a pointer @ {:016X}", vaddr);
@@ -200,8 +200,8 @@ void Write(const VAddr vaddr, const T data) {
200 PageType type = current_page_table->attributes[vaddr >> PAGE_BITS]; 200 PageType type = current_page_table->attributes[vaddr >> PAGE_BITS];
201 switch (type) { 201 switch (type) {
202 case PageType::Unmapped: 202 case PageType::Unmapped:
203 NGLOG_ERROR(HW_Memory, "Unmapped Write{} {:#010X} @ {:#018X}", sizeof(data) * 8, (u32)data, 203 NGLOG_ERROR(HW_Memory, "Unmapped Write{} 0x{:08X} @ 0x{:016X}", sizeof(data) * 8,
204 vaddr); 204 static_cast<u32>(data), vaddr);
205 return; 205 return;
206 case PageType::Memory: 206 case PageType::Memory:
207 ASSERT_MSG(false, "Mapped memory page without a pointer @ {:016X}", vaddr); 207 ASSERT_MSG(false, "Mapped memory page without a pointer @ {:016X}", vaddr);
@@ -250,7 +250,7 @@ u8* GetPointer(const VAddr vaddr) {
250 return GetPointerFromVMA(vaddr); 250 return GetPointerFromVMA(vaddr);
251 } 251 }
252 252
253 NGLOG_ERROR(HW_Memory, "Unknown GetPointer @ {:#018X}", vaddr); 253 NGLOG_ERROR(HW_Memory, "Unknown GetPointer @ 0x{:016X}", vaddr);
254 return nullptr; 254 return nullptr;
255} 255}
256 256
@@ -287,12 +287,12 @@ u8* GetPhysicalPointer(PAddr address) {
287 }); 287 });
288 288
289 if (area == std::end(memory_areas)) { 289 if (area == std::end(memory_areas)) {
290 NGLOG_ERROR(HW_Memory, "Unknown GetPhysicalPointer @ {:#018X}", address); 290 NGLOG_ERROR(HW_Memory, "Unknown GetPhysicalPointer @ 0x{:016X}", address);
291 return nullptr; 291 return nullptr;
292 } 292 }
293 293
294 if (area->paddr_base == IO_AREA_PADDR) { 294 if (area->paddr_base == IO_AREA_PADDR) {
295 NGLOG_ERROR(HW_Memory, "MMIO mappings are not supported yet. phys_addr={:018X}", address); 295 NGLOG_ERROR(HW_Memory, "MMIO mappings are not supported yet. phys_addr={:016X}", address);
296 return nullptr; 296 return nullptr;
297 } 297 }
298 298
@@ -476,7 +476,7 @@ void ReadBlock(const Kernel::Process& process, const VAddr src_addr, void* dest_
476 switch (page_table.attributes[page_index]) { 476 switch (page_table.attributes[page_index]) {
477 case PageType::Unmapped: { 477 case PageType::Unmapped: {
478 NGLOG_ERROR(HW_Memory, 478 NGLOG_ERROR(HW_Memory,
479 "Unmapped ReadBlock @ {:#018X} (start address = {:#018X}, size = {})", 479 "Unmapped ReadBlock @ 0x{:016X} (start address = 0x{:016X}, size = {})",
480 current_vaddr, src_addr, size); 480 current_vaddr, src_addr, size);
481 std::memset(dest_buffer, 0, copy_amount); 481 std::memset(dest_buffer, 0, copy_amount);
482 break; 482 break;
@@ -540,7 +540,7 @@ void WriteBlock(const Kernel::Process& process, const VAddr dest_addr, const voi
540 switch (page_table.attributes[page_index]) { 540 switch (page_table.attributes[page_index]) {
541 case PageType::Unmapped: { 541 case PageType::Unmapped: {
542 NGLOG_ERROR(HW_Memory, 542 NGLOG_ERROR(HW_Memory,
543 "Unmapped WriteBlock @ {:#018X} (start address = {:#018X}, size = {})", 543 "Unmapped WriteBlock @ 0x{:016X} (start address = 0x{:016X}, size = {})",
544 current_vaddr, dest_addr, size); 544 current_vaddr, dest_addr, size);
545 break; 545 break;
546 } 546 }
@@ -588,7 +588,7 @@ void ZeroBlock(const Kernel::Process& process, const VAddr dest_addr, const size
588 switch (page_table.attributes[page_index]) { 588 switch (page_table.attributes[page_index]) {
589 case PageType::Unmapped: { 589 case PageType::Unmapped: {
590 NGLOG_ERROR(HW_Memory, 590 NGLOG_ERROR(HW_Memory,
591 "Unmapped ZeroBlock @ {:#018X} (start address = {#:018X}, size = {})", 591 "Unmapped ZeroBlock @ 0x{:016X} (start address = 0x{:016X}, size = {})",
592 current_vaddr, dest_addr, size); 592 current_vaddr, dest_addr, size);
593 break; 593 break;
594 } 594 }
@@ -629,7 +629,7 @@ void CopyBlock(const Kernel::Process& process, VAddr dest_addr, VAddr src_addr,
629 switch (page_table.attributes[page_index]) { 629 switch (page_table.attributes[page_index]) {
630 case PageType::Unmapped: { 630 case PageType::Unmapped: {
631 NGLOG_ERROR(HW_Memory, 631 NGLOG_ERROR(HW_Memory,
632 "Unmapped CopyBlock @ {:#018X} (start address = {:#018X}, size = {})", 632 "Unmapped CopyBlock @ 0x{:016X} (start address = 0x{:016X}, size = {})",
633 current_vaddr, src_addr, size); 633 current_vaddr, src_addr, size);
634 ZeroBlock(process, dest_addr, copy_amount); 634 ZeroBlock(process, dest_addr, copy_amount);
635 break; 635 break;
@@ -683,7 +683,7 @@ boost::optional<PAddr> TryVirtualToPhysicalAddress(const VAddr addr) {
683PAddr VirtualToPhysicalAddress(const VAddr addr) { 683PAddr VirtualToPhysicalAddress(const VAddr addr) {
684 auto paddr = TryVirtualToPhysicalAddress(addr); 684 auto paddr = TryVirtualToPhysicalAddress(addr);
685 if (!paddr) { 685 if (!paddr) {
686 NGLOG_ERROR(HW_Memory, "Unknown virtual address @ {:#018X}", addr); 686 NGLOG_ERROR(HW_Memory, "Unknown virtual address @ 0x{:016X}", addr);
687 // To help with debugging, set bit on address so that it's obviously invalid. 687 // To help with debugging, set bit on address so that it's obviously invalid.
688 return addr | 0x80000000; 688 return addr | 0x80000000;
689 } 689 }