4

The QEMU -d asm_in and -d asm_out options are useful for examining the dynamically generated asm created by QEMU.

Unfortunately (for me) it defaults to AT&T syntax. Is there an option to output in Intel syntax?

3

No, QEMU doesn't provide a config option for choosing the disassembly syntax. (We use the binutils disassembler sources, so the code to output Intel syntax rather than AT&T is all there, but we don't wire it up to something the user can change.)

1

Thanks to Peter Maydell's answer we know that QEMU's disassembler is based on binutils. But binutils disassembler actually does support Intel syntax, we just need to know what to change to activate it. If you're willing to recompile QEMU, here's a patch which will force Intel syntax unconditionally:

diff --git a/disas/i386.c b/disas/i386.c
index f1e376c..4493115 100644
--- a/disas/i386.c
+++ b/disas/i386.c
@@ -3682,7 +3682,7 @@ static char scale_char;
 int
 print_insn_i386 (bfd_vma pc, disassemble_info *info)
 {
-  intel_syntax = -1;
+  intel_syntax = 1;

   return print_insn (pc, info);
 }
  • For the in_asm logging you would need to make a similar change to the disas() function in disas.c, and for disassembly via the QEMU monitor change monitor_disas(). – Peter Maydell Aug 18 '17 at 12:25
  • @PeterMaydell actually I've realized that I just have to change one place to make Intel syntax apply to all the cases (at least in_asm and out_asm are now correct, not sure how to test QEMu monitor). – Ruslan Aug 18 '17 at 13:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.