diff --git a/src/machine/core.cpp b/src/machine/core.cpp index 9889b7f0..ff72d126 100644 --- a/src/machine/core.cpp +++ b/src/machine/core.cpp @@ -4,6 +4,8 @@ #include "execute/alu.h" #include "utils.h" +#include + LOG_CATEGORY("machine.core"); using namespace machine; @@ -626,8 +628,8 @@ bool StopExceptionHandler::handle_exception( Address mem_ref_addr) { Q_UNUSED(core) DEBUG( - "Exception cause %d instruction PC 0x%08lx next PC 0x%08lx jump branch PC 0x%08lx " - "registers PC 0x%08lx mem ref 0x%08lx", + "Exception cause %d instruction PC 0x%08" PRIx64 " next PC 0x%08" PRIx64 " jump branch PC 0x%08" PRIx64 + "registers PC 0x%08" PRIx64 " mem ref 0x%08" PRIx64, excause, inst_addr.get_raw(), next_addr.get_raw(), jump_branch_pc.get_raw(), regs->read_pc().get_raw(), mem_ref_addr.get_raw()); return true; diff --git a/src/machine/memory/backend/memory.test.cpp b/src/machine/memory/backend/memory.test.cpp index b568ff75..6430aecf 100644 --- a/src/machine/memory/backend/memory.test.cpp +++ b/src/machine/memory/backend/memory.test.cpp @@ -7,6 +7,8 @@ #include "machine/memory/memory_utils.h" #include "tests/utils/integer_decomposition.h" +#include + using namespace machine; // Default memory testing data. Some tests may use other values, where it @@ -85,7 +87,7 @@ constexpr void prepare_data( auto result_value = (endian == BIG) ? (value << (stride * 8)) : (value >> (stride * 8)); QTest::addRow( - "endian=%s, address=0x%lx, stride=%ld, value=0x%lx", to_string(endian), + "endian=%s, address=0x%lx, stride=%ld, value=0x%" PRIx64, to_string(endian), address, stride, value) << endian << address << stride << IntegerDecomposition(value, endian) << IntegerDecomposition(result_value, endian); @@ -328,4 +330,4 @@ void TestMemory::memory_read_ctl() { } } -QTEST_APPLESS_MAIN(TestMemory) \ No newline at end of file +QTEST_APPLESS_MAIN(TestMemory) diff --git a/src/machine/memory/cache/cache.test.cpp b/src/machine/memory/cache/cache.test.cpp index 4568bb13..d9ae770f 100644 --- a/src/machine/memory/cache/cache.test.cpp +++ b/src/machine/memory/cache/cache.test.cpp @@ -9,6 +9,8 @@ #include +#include + using namespace machine; using std::array; using std::pair; @@ -158,8 +160,8 @@ void TestCache::cache_correctness_data() { auto result_value = (endian == BIG) ? (value << (stride * 8)) : (value >> (stride * 8)); QTest::addRow( - "endian=%s, address=0x%lx, stride=%ld, " - "value=0x%lx, cache_config={ %d, " + "endian=%s, address=0x%" PRIx64 ", stride=%ld, " + "value=0x%" PRIx64 ", cache_config={ %d, " "r=%d, wr=%d, s=%d, b=%d, a=%d }", to_string(endian), address, stride, value, cache_config.enabled(), cache_config.replacement_policy(), cache_config.write_policy(), diff --git a/src/os_emulation/ossyscall.cpp b/src/os_emulation/ossyscall.cpp index 89ce3cc0..306e011c 100644 --- a/src/os_emulation/ossyscall.cpp +++ b/src/os_emulation/ossyscall.cpp @@ -570,12 +570,12 @@ bool OsSyscallExceptionHandler::handle_exception( #if 1 printf( - "Exception cause %d instruction PC 0x%08lx next PC 0x%08lx jump branch " - "PC 0x%08lx " - "registers PC 0x%08lx mem ref 0x%08lx\n", - excause, (unsigned long)inst_addr.get_raw(), (unsigned long)next_addr.get_raw(), - (unsigned long)jump_branch_pc.get_raw(), (unsigned long)regs->read_pc().get_raw(), - (unsigned long)mem_ref_addr.get_raw()); + "Exception cause %d instruction PC 0x%08" PRIx64 " next PC 0x%08" PRIx64 " jump branch " + "PC 0x%08" PRIx64 + "registers PC 0x%08" PRIx64 " mem ref 0x%08" PRIx64 "\n", + excause, inst_addr.get_raw(), next_addr.get_raw(), + jump_branch_pc.get_raw(), regs->read_pc().get_raw(), + mem_ref_addr.get_raw()); #else (void)excause; (void)inst_addr; @@ -607,7 +607,7 @@ bool OsSyscallExceptionHandler::handle_exception( #if 1 printf( - "Syscall %s number %ld/0x%lx a1=%" PRIu64 " a2=%" PRIu64 " a3=%" PRIu64 " a4=%" PRIu64 "\n", + "Syscall %s number %" PRId64 "/0x%" PRIx64 " a1=%" PRIu64 " a2=%" PRIu64 " a3=%" PRIu64 " a4=%" PRIu64 "\n", sdesc->name, syscall_num, syscall_num, a1.as_u64(), a2.as_u64(), a3.as_u64(), a4.as_u64()); #endif @@ -787,7 +787,8 @@ int OsSyscallExceptionHandler::syscall_default_handler( const rv_syscall_desc_t *sdesc = &rv_syscall_args[syscall_num]; #if 1 printf( - "Unimplemented syscall %s number %ld/0x%lx a1 %ld a2 %ld a3 %ld a4 %ld\n", sdesc->name, + "Unimplemented syscall %s number %" PRId64 "/0x%" PRIx64 " a1 %" PRId64 + " a2 %" PRId64 " a3 %" PRId64 " a4 %" PRId64 "\n", sdesc->name, syscall_num, syscall_num, a1, a2, a3, a4); #endif @@ -1052,7 +1053,7 @@ int OsSyscallExceptionHandler::do_sys_openat( result = 0; if (int64_t(a1) != TARGET_AT_FDCWD) { - printf("Unimplemented openat argument a1 %ld", a1); + printf("Unimplemented openat argument a1 %" PRId64, a1); if (unknown_syscall_stop) { emit core->stop_on_exception_reached(); } return TARGET_ENOSYS; }