[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL v2 14/44] disas: nanoMIPS: Fix types and format strin
From: |
Aleksandar Markovic |
Subject: |
[Qemu-devel] [PULL v2 14/44] disas: nanoMIPS: Fix types and format strings |
Date: |
Mon, 31 Dec 2018 15:56:10 +0100 |
From: Stefan Weil <address@hidden>
Use POSIX types and format strings.
Reviewed-by: Aleksandar Markovic <address@hidden>
Signed-off-by: Aleksandar Markovic <address@hidden>
Signed-off-by: Stefan Weil <address@hidden>
---
disas/nanomips.cpp | 20 ++++++++++++--------
disas/nanomips.h | 10 +++++-----
2 files changed, 17 insertions(+), 13 deletions(-)
diff --git a/disas/nanomips.cpp b/disas/nanomips.cpp
index 1238c2f..28d78d6 100644
--- a/disas/nanomips.cpp
+++ b/disas/nanomips.cpp
@@ -258,7 +258,7 @@ namespace img
std::string to_string(img::address a)
{
char buffer[256];
- sprintf(buffer, "0x%08llx", a);
+ sprintf(buffer, "0x%" PRIx64, a);
return buffer;
}
@@ -284,7 +284,8 @@ uint64 NMD::renumber_registers(uint64 index, uint64
*register_list,
}
throw std::runtime_error(img::format(
- "Invalid register mapping index %d, size of list = %d",
+ "Invalid register mapping index %" PRIu64
+ ", size of list = %zu",
index, register_list_size));
}
@@ -501,7 +502,8 @@ std::string NMD::GPR(uint64 reg)
return gpr_reg[reg];
}
- throw std::runtime_error(img::format("Invalid GPR register index %d",
reg));
+ throw std::runtime_error(img::format("Invalid GPR register index %" PRIu64,
+ reg));
}
@@ -518,7 +520,8 @@ std::string NMD::FPR(uint64 reg)
return fpr_reg[reg];
}
- throw std::runtime_error(img::format("Invalid FPR register index %d",
reg));
+ throw std::runtime_error(img::format("Invalid FPR register index %" PRIu64,
+ reg));
}
@@ -532,26 +535,27 @@ std::string NMD::AC(uint64 reg)
return ac_reg[reg];
}
- throw std::runtime_error(img::format("Invalid AC register index %d", reg));
+ throw std::runtime_error(img::format("Invalid AC register index %" PRIu64,
+ reg));
}
std::string NMD::IMMEDIATE(uint64 value)
{
- return img::format("0x%x", value);
+ return img::format("0x%" PRIx64, value);
}
std::string NMD::IMMEDIATE(int64 value)
{
- return img::format("%d", value);
+ return img::format("%" PRId64, value);
}
std::string NMD::CPR(uint64 reg)
{
/* needs more work */
- return img::format("CP%d", reg);
+ return img::format("CP%" PRIu64, reg);
}
diff --git a/disas/nanomips.h b/disas/nanomips.h
index 84cc9a6..71428b3 100644
--- a/disas/nanomips.h
+++ b/disas/nanomips.h
@@ -24,14 +24,14 @@
#include <string>
-typedef unsigned short uint16;
-typedef unsigned int uint32;
-typedef long long int64;
-typedef unsigned long long uint64;
+typedef int64_t int64;
+typedef uint64_t uint64;
+typedef uint32_t uint32;
+typedef uint16_t uint16;
namespace img
{
- typedef unsigned long long address;
+ typedef uint64_t address;
}
--
2.7.4
- [Qemu-devel] [PULL v2 00/44] MIPS pull request for December 2018 - v2, Aleksandar Markovic, 2018/12/31
- [Qemu-devel] [PULL v2 01/44] MAINTAINERS: target/mips: Add MIPS files under default-configs directory, Aleksandar Markovic, 2018/12/31
- [Qemu-devel] [PULL v2 07/44] target/mips: MXU: Add generic naming for optn2 constants, Aleksandar Markovic, 2018/12/31
- [Qemu-devel] [PULL v2 03/44] MAINTAINERS: target/mips: Reorder items alphabetically, Aleksandar Markovic, 2018/12/31
- [Qemu-devel] [PULL v2 14/44] disas: nanoMIPS: Fix types and format strings,
Aleksandar Markovic <=
- [Qemu-devel] [PULL v2 12/44] target/mips: Support R5900 three-operand MADD and MADDU instructions, Aleksandar Markovic, 2018/12/31
- [Qemu-devel] [PULL v2 05/44] atomics: Set ATOMIC_REG_SIZE=8 for MIPS n32, Aleksandar Markovic, 2018/12/31
- [Qemu-devel] [PULL v2 06/44] target/mips: MXU: Add missing opcodes/decoding for LX* instructions, Aleksandar Markovic, 2018/12/31
- [Qemu-devel] [PULL v2 10/44] target/mips: MXU: Add handlers for max/min instructions, Aleksandar Markovic, 2018/12/31
- [Qemu-devel] [PULL v2 13/44] target/mips: Support R5900 three-operand MADD1 and MADDU1 instructions, Aleksandar Markovic, 2018/12/31
- [Qemu-devel] [PULL v2 02/44] MAINTAINERS: target/mips: Add filter for mips in email subjects, Aleksandar Markovic, 2018/12/31
- [Qemu-devel] [PULL v2 11/44] target/mips: MXU: Add handler for an align instruction, Aleksandar Markovic, 2018/12/31
- [Qemu-devel] [PULL v2 08/44] target/mips: MXU: Improve the comment containing MXU overview, Aleksandar Markovic, 2018/12/31
- [Qemu-devel] [PULL v2 04/44] MAINTAINERS: Add Aleksandar Rikalo as a reviewer for MIPS content, Aleksandar Markovic, 2018/12/31
- [Qemu-devel] [PULL v2 15/44] disas: nanoMIPS: Fix preamble text in nanomips.* files, Aleksandar Markovic, 2018/12/31