monitor: QEMU Monitor Instruction Disassembly Incorrect for PowerPC LE Mode
The monitor support for disassembling instructions does not honor the MSR[LE] bit for PowerPC processors. This change enhances the monitor_disas() routine by supporting a flag bit for Little Endian mode. Bit 16 is used since that bit was used in the analagous guest disassembly routine target_disas(). Also, to be consistent with target_disas(), the disassembler bfd_mach field can be passed in the flags argument. Reported-by: Anton Blanchard <anton@samba.org> Signed-off-by: Tom Musta <tommusta@gmail.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Alexander Graf <agraf@suse.de>
This commit is contained in:
parent
e13951f896
commit
1c38f84373
14
disas.c
14
disas.c
|
@ -445,6 +445,8 @@ monitor_fprintf(FILE *stream, const char *fmt, ...)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Disassembler for the monitor.
|
||||||
|
See target_disas for a description of flags. */
|
||||||
void monitor_disas(Monitor *mon, CPUArchState *env,
|
void monitor_disas(Monitor *mon, CPUArchState *env,
|
||||||
target_ulong pc, int nb_insn, int is_physical, int flags)
|
target_ulong pc, int nb_insn, int is_physical, int flags)
|
||||||
{
|
{
|
||||||
|
@ -485,11 +487,19 @@ void monitor_disas(Monitor *mon, CPUArchState *env,
|
||||||
s.info.mach = bfd_mach_sparc_v9b;
|
s.info.mach = bfd_mach_sparc_v9b;
|
||||||
#endif
|
#endif
|
||||||
#elif defined(TARGET_PPC)
|
#elif defined(TARGET_PPC)
|
||||||
|
if (flags & 0xFFFF) {
|
||||||
|
/* If we have a precise definition of the instruction set, use it. */
|
||||||
|
s.info.mach = flags & 0xFFFF;
|
||||||
|
} else {
|
||||||
#ifdef TARGET_PPC64
|
#ifdef TARGET_PPC64
|
||||||
s.info.mach = bfd_mach_ppc64;
|
s.info.mach = bfd_mach_ppc64;
|
||||||
#else
|
#else
|
||||||
s.info.mach = bfd_mach_ppc;
|
s.info.mach = bfd_mach_ppc;
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
if ((flags >> 16) & 1) {
|
||||||
|
s.info.endian = BFD_ENDIAN_LITTLE;
|
||||||
|
}
|
||||||
print_insn = print_insn_ppc;
|
print_insn = print_insn_ppc;
|
||||||
#elif defined(TARGET_M68K)
|
#elif defined(TARGET_M68K)
|
||||||
print_insn = print_insn_m68k;
|
print_insn = print_insn_m68k;
|
||||||
|
|
|
@ -1284,6 +1284,10 @@ static void memory_dump(Monitor *mon, int count, int format, int wsize,
|
||||||
flags = 1;
|
flags = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
#ifdef TARGET_PPC
|
||||||
|
flags = msr_le << 16;
|
||||||
|
flags |= env->bfd_mach;
|
||||||
#endif
|
#endif
|
||||||
monitor_disas(mon, env, addr, count, is_physical, flags);
|
monitor_disas(mon, env, addr, count, is_physical, flags);
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in a new issue