include/exec: Use vaddr in DisasContextBase for virtual addresses

Updates target/ QEMU_LOG macros to use VADDR_PRIx for printing updated
DisasContextBase fields.

Signed-off-by: Anton Johansson <anjo@rev.ng>
Message-Id: <20240119144024.14289-10-anjo@rev.ng>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
Anton Johansson 2024-01-19 15:39:59 +01:00 committed by Richard Henderson
parent 32f0c394bb
commit 85c19af63e
5 changed files with 14 additions and 12 deletions

View File

@ -79,8 +79,8 @@ typedef enum DisasJumpType {
*/ */
typedef struct DisasContextBase { typedef struct DisasContextBase {
TranslationBlock *tb; TranslationBlock *tb;
target_ulong pc_first; vaddr pc_first;
target_ulong pc_next; vaddr pc_next;
DisasJumpType is_jmp; DisasJumpType is_jmp;
int num_insns; int num_insns;
int max_insns; int max_insns;
@ -235,7 +235,7 @@ void translator_fake_ldb(uint8_t insn8, abi_ptr pc);
* Translators can use this to enforce the rule that only single-insn * Translators can use this to enforce the rule that only single-insn
* translation blocks are allowed to cross page boundaries. * translation blocks are allowed to cross page boundaries.
*/ */
static inline bool is_same_page(const DisasContextBase *db, target_ulong addr) static inline bool is_same_page(const DisasContextBase *db, vaddr addr)
{ {
return ((addr ^ db->pc_first) & TARGET_PAGE_MASK) == 0; return ((addr ^ db->pc_first) & TARGET_PAGE_MASK) == 0;
} }

View File

@ -234,7 +234,8 @@ static int read_packet_words(CPUHexagonState *env, DisasContext *ctx,
g_assert(ctx->base.num_insns == 1); g_assert(ctx->base.num_insns == 1);
} }
HEX_DEBUG_LOG("decode_packet: pc = 0x%x\n", ctx->base.pc_next); HEX_DEBUG_LOG("decode_packet: pc = 0x%" VADDR_PRIx "\n",
ctx->base.pc_next);
HEX_DEBUG_LOG(" words = { "); HEX_DEBUG_LOG(" words = { ");
for (int i = 0; i < nwords; i++) { for (int i = 0; i < nwords; i++) {
HEX_DEBUG_LOG("0x%x, ", words[i]); HEX_DEBUG_LOG("0x%x, ", words[i]);

View File

@ -1457,7 +1457,7 @@ DISAS_INSN(undef)
* for the 680x0 series, as well as those that are implemented * for the 680x0 series, as well as those that are implemented
* but actually illegal for CPU32 or pre-68020. * but actually illegal for CPU32 or pre-68020.
*/ */
qemu_log_mask(LOG_UNIMP, "Illegal instruction: %04x @ %08x\n", qemu_log_mask(LOG_UNIMP, "Illegal instruction: %04x @ %" VADDR_PRIx "\n",
insn, s->base.pc_next); insn, s->base.pc_next);
gen_exception(s, s->base.pc_next, EXCP_ILLEGAL); gen_exception(s, s->base.pc_next, EXCP_ILLEGAL);
} }

View File

@ -4585,8 +4585,8 @@ static void gen_compute_branch(DisasContext *ctx, uint32_t opc,
if (ctx->hflags & MIPS_HFLAG_BMASK) { if (ctx->hflags & MIPS_HFLAG_BMASK) {
#ifdef MIPS_DEBUG_DISAS #ifdef MIPS_DEBUG_DISAS
LOG_DISAS("Branch in delay / forbidden slot at PC 0x" LOG_DISAS("Branch in delay / forbidden slot at PC 0x%016"
TARGET_FMT_lx "\n", ctx->base.pc_next); VADDR_PRIx "\n", ctx->base.pc_next);
#endif #endif
gen_reserved_instruction(ctx); gen_reserved_instruction(ctx);
goto out; goto out;
@ -9061,8 +9061,8 @@ static void gen_compute_branch1_r6(DisasContext *ctx, uint32_t op,
if (ctx->hflags & MIPS_HFLAG_BMASK) { if (ctx->hflags & MIPS_HFLAG_BMASK) {
#ifdef MIPS_DEBUG_DISAS #ifdef MIPS_DEBUG_DISAS
LOG_DISAS("Branch in delay / forbidden slot at PC 0x" TARGET_FMT_lx LOG_DISAS("Branch in delay / forbidden slot at PC 0x%016"
"\n", ctx->base.pc_next); VADDR_PRIx "\n", ctx->base.pc_next);
#endif #endif
gen_reserved_instruction(ctx); gen_reserved_instruction(ctx);
return; return;
@ -11274,8 +11274,8 @@ static void gen_compute_compact_branch(DisasContext *ctx, uint32_t opc,
if (ctx->hflags & MIPS_HFLAG_BMASK) { if (ctx->hflags & MIPS_HFLAG_BMASK) {
#ifdef MIPS_DEBUG_DISAS #ifdef MIPS_DEBUG_DISAS
LOG_DISAS("Branch in delay / forbidden slot at PC 0x" TARGET_FMT_lx LOG_DISAS("Branch in delay / forbidden slot at PC 0x%016"
"\n", ctx->base.pc_next); VADDR_PRIx "\n", ctx->base.pc_next);
#endif #endif
gen_reserved_instruction(ctx); gen_reserved_instruction(ctx);
return; return;

View File

@ -202,7 +202,8 @@ extern TCGv bcond;
do { \ do { \
if (MIPS_DEBUG_DISAS) { \ if (MIPS_DEBUG_DISAS) { \
qemu_log_mask(CPU_LOG_TB_IN_ASM, \ qemu_log_mask(CPU_LOG_TB_IN_ASM, \
TARGET_FMT_lx ": %08x Invalid %s %03x %03x %03x\n", \ "%016" VADDR_PRIx \
": %08x Invalid %s %03x %03x %03x\n", \
ctx->base.pc_next, ctx->opcode, op, \ ctx->base.pc_next, ctx->opcode, op, \
ctx->opcode >> 26, ctx->opcode & 0x3F, \ ctx->opcode >> 26, ctx->opcode & 0x3F, \
((ctx->opcode >> 16) & 0x1F)); \ ((ctx->opcode >> 16) & 0x1F)); \