blob: 611b30b55b7fcc3117868ccb124a17dd375ebadf [file] [log] [blame]
bellardb9adb4a2003-04-29 20:41:16 +00001/* General "disassemble this chunk" code. Used for debugging. */
bellard5bbe9292003-06-09 19:38:38 +00002#include "config.h"
bellardb9adb4a2003-04-29 20:41:16 +00003#include "dis-asm.h"
bellardb9adb4a2003-04-29 20:41:16 +00004#include "elf.h"
bellardaa0aa4f2003-06-09 15:23:31 +00005#include <errno.h>
bellardb9adb4a2003-04-29 20:41:16 +00006
bellardc6105c02003-10-27 21:13:58 +00007#include "cpu.h"
bellard9307c4c2004-04-04 12:57:25 +00008#include "disas.h"
bellardc6105c02003-10-27 21:13:58 +00009
bellardb9adb4a2003-04-29 20:41:16 +000010/* Filled in by elfload.c. Simplistic, but will do for now. */
bellarde80cfcf2004-12-19 23:18:01 +000011struct syminfo *syminfos = NULL;
bellardb9adb4a2003-04-29 20:41:16 +000012
bellardaa0aa4f2003-06-09 15:23:31 +000013/* Get LENGTH bytes from info's buffer, at target address memaddr.
14 Transfer them to myaddr. */
15int
pbrook3a742b72008-10-22 15:55:18 +000016buffer_read_memory(bfd_vma memaddr, bfd_byte *myaddr, int length,
17 struct disassemble_info *info)
bellardaa0aa4f2003-06-09 15:23:31 +000018{
bellardc6105c02003-10-27 21:13:58 +000019 if (memaddr < info->buffer_vma
20 || memaddr + length > info->buffer_vma + info->buffer_length)
21 /* Out of bounds. Use EIO because GDB uses it. */
22 return EIO;
23 memcpy (myaddr, info->buffer + (memaddr - info->buffer_vma), length);
24 return 0;
bellardaa0aa4f2003-06-09 15:23:31 +000025}
26
bellardc6105c02003-10-27 21:13:58 +000027/* Get LENGTH bytes from info's buffer, at target address memaddr.
28 Transfer them to myaddr. */
29static int
bellardc27004e2005-01-03 23:35:10 +000030target_read_memory (bfd_vma memaddr,
31 bfd_byte *myaddr,
32 int length,
33 struct disassemble_info *info)
bellardc6105c02003-10-27 21:13:58 +000034{
Blue Swirle612a1f2009-05-07 17:14:07 +000035 cpu_memory_rw_debug(cpu_single_env, memaddr, myaddr, length, 0);
bellardc6105c02003-10-27 21:13:58 +000036 return 0;
37}
bellardc6105c02003-10-27 21:13:58 +000038
bellardaa0aa4f2003-06-09 15:23:31 +000039/* Print an error message. We can assume that this is in response to
40 an error return from buffer_read_memory. */
41void
pbrook3a742b72008-10-22 15:55:18 +000042perror_memory (int status, bfd_vma memaddr, struct disassemble_info *info)
bellardaa0aa4f2003-06-09 15:23:31 +000043{
44 if (status != EIO)
45 /* Can't happen. */
46 (*info->fprintf_func) (info->stream, "Unknown error %d\n", status);
47 else
48 /* Actually, address between memaddr and memaddr + len was
49 out of bounds. */
50 (*info->fprintf_func) (info->stream,
bellard26a76462006-06-25 18:15:32 +000051 "Address 0x%" PRIx64 " is out of bounds.\n", memaddr);
bellardaa0aa4f2003-06-09 15:23:31 +000052}
53
54/* This could be in a separate file, to save miniscule amounts of space
55 in statically linked executables. */
56
57/* Just print the address is hex. This is included for completeness even
58 though both GDB and objdump provide their own (to print symbolic
59 addresses). */
60
61void
pbrook3a742b72008-10-22 15:55:18 +000062generic_print_address (bfd_vma addr, struct disassemble_info *info)
bellardaa0aa4f2003-06-09 15:23:31 +000063{
bellard26a76462006-06-25 18:15:32 +000064 (*info->fprintf_func) (info->stream, "0x%" PRIx64, addr);
bellardaa0aa4f2003-06-09 15:23:31 +000065}
66
67/* Just return the given address. */
68
69int
pbrook3a742b72008-10-22 15:55:18 +000070generic_symbol_at_address (bfd_vma addr, struct disassemble_info *info)
bellardaa0aa4f2003-06-09 15:23:31 +000071{
72 return 1;
73}
74
Aurelien Jarno903ec552010-03-29 02:12:51 +020075bfd_vma bfd_getl64 (const bfd_byte *addr)
76{
77 unsigned long long v;
78
79 v = (unsigned long long) addr[0];
80 v |= (unsigned long long) addr[1] << 8;
81 v |= (unsigned long long) addr[2] << 16;
82 v |= (unsigned long long) addr[3] << 24;
83 v |= (unsigned long long) addr[4] << 32;
84 v |= (unsigned long long) addr[5] << 40;
85 v |= (unsigned long long) addr[6] << 48;
86 v |= (unsigned long long) addr[7] << 56;
87 return (bfd_vma) v;
88}
89
bellardaa0aa4f2003-06-09 15:23:31 +000090bfd_vma bfd_getl32 (const bfd_byte *addr)
91{
92 unsigned long v;
93
94 v = (unsigned long) addr[0];
95 v |= (unsigned long) addr[1] << 8;
96 v |= (unsigned long) addr[2] << 16;
97 v |= (unsigned long) addr[3] << 24;
98 return (bfd_vma) v;
99}
100
101bfd_vma bfd_getb32 (const bfd_byte *addr)
102{
103 unsigned long v;
104
105 v = (unsigned long) addr[0] << 24;
106 v |= (unsigned long) addr[1] << 16;
107 v |= (unsigned long) addr[2] << 8;
108 v |= (unsigned long) addr[3];
109 return (bfd_vma) v;
110}
111
bellard6af0bf92005-07-02 14:58:51 +0000112bfd_vma bfd_getl16 (const bfd_byte *addr)
113{
114 unsigned long v;
115
116 v = (unsigned long) addr[0];
117 v |= (unsigned long) addr[1] << 8;
118 return (bfd_vma) v;
119}
120
121bfd_vma bfd_getb16 (const bfd_byte *addr)
122{
123 unsigned long v;
124
125 v = (unsigned long) addr[0] << 24;
126 v |= (unsigned long) addr[1] << 16;
127 return (bfd_vma) v;
128}
129
bellardc2d551f2005-04-27 20:15:00 +0000130#ifdef TARGET_ARM
131static int
132print_insn_thumb1(bfd_vma pc, disassemble_info *info)
133{
134 return print_insn_arm(pc | 1, info);
135}
136#endif
137
thse91c8a72007-06-03 13:35:16 +0000138/* Disassemble this for me please... (debugging). 'flags' has the following
bellardc2d551f2005-04-27 20:15:00 +0000139 values:
Frediano Ziglioe99722f2011-08-25 09:14:38 +0200140 i386 - 1 means 16 bit code, 2 means 64 bit code
ths5fafdf22007-09-16 21:08:06 +0000141 arm - nonzero means thumb code
bellard6a00d602005-11-21 23:25:50 +0000142 ppc - nonzero means little endian
bellardc2d551f2005-04-27 20:15:00 +0000143 other targets - unused
144 */
bellard83b34f82005-01-23 20:26:30 +0000145void target_disas(FILE *out, target_ulong code, target_ulong size, int flags)
bellardb9adb4a2003-04-29 20:41:16 +0000146{
bellardc27004e2005-01-03 23:35:10 +0000147 target_ulong pc;
bellardb9adb4a2003-04-29 20:41:16 +0000148 int count;
149 struct disassemble_info disasm_info;
150 int (*print_insn)(bfd_vma pc, disassemble_info *info);
151
152 INIT_DISASSEMBLE_INFO(disasm_info, out, fprintf);
153
bellardc27004e2005-01-03 23:35:10 +0000154 disasm_info.read_memory_func = target_read_memory;
155 disasm_info.buffer_vma = code;
156 disasm_info.buffer_length = size;
157
158#ifdef TARGET_WORDS_BIGENDIAN
159 disasm_info.endian = BFD_ENDIAN_BIG;
160#else
161 disasm_info.endian = BFD_ENDIAN_LITTLE;
bellardc6105c02003-10-27 21:13:58 +0000162#endif
bellardc27004e2005-01-03 23:35:10 +0000163#if defined(TARGET_I386)
164 if (flags == 2)
165 disasm_info.mach = bfd_mach_x86_64;
ths5fafdf22007-09-16 21:08:06 +0000166 else if (flags == 1)
bellardc27004e2005-01-03 23:35:10 +0000167 disasm_info.mach = bfd_mach_i386_i8086;
168 else
169 disasm_info.mach = bfd_mach_i386_i386;
170 print_insn = print_insn_i386;
171#elif defined(TARGET_ARM)
bellardc2d551f2005-04-27 20:15:00 +0000172 if (flags)
173 print_insn = print_insn_thumb1;
174 else
175 print_insn = print_insn_arm;
bellardc27004e2005-01-03 23:35:10 +0000176#elif defined(TARGET_SPARC)
177 print_insn = print_insn_sparc;
bellard34751872005-07-02 14:31:34 +0000178#ifdef TARGET_SPARC64
179 disasm_info.mach = bfd_mach_sparc_v9b;
ths3b46e622007-09-17 08:09:54 +0000180#endif
bellardc27004e2005-01-03 23:35:10 +0000181#elif defined(TARGET_PPC)
j_mayer237c0af2007-09-29 12:01:46 +0000182 if (flags >> 16)
bellard111bfab2005-04-23 18:16:07 +0000183 disasm_info.endian = BFD_ENDIAN_LITTLE;
j_mayer237c0af2007-09-29 12:01:46 +0000184 if (flags & 0xFFFF) {
185 /* If we have a precise definitions of the instructions set, use it */
186 disasm_info.mach = flags & 0xFFFF;
187 } else {
bellarda2458622005-07-23 22:39:53 +0000188#ifdef TARGET_PPC64
j_mayer237c0af2007-09-29 12:01:46 +0000189 disasm_info.mach = bfd_mach_ppc64;
bellarda2458622005-07-23 22:39:53 +0000190#else
j_mayer237c0af2007-09-29 12:01:46 +0000191 disasm_info.mach = bfd_mach_ppc;
bellarda2458622005-07-23 22:39:53 +0000192#endif
j_mayer237c0af2007-09-29 12:01:46 +0000193 }
bellardc27004e2005-01-03 23:35:10 +0000194 print_insn = print_insn_ppc;
pbrooke6e59062006-10-22 00:18:54 +0000195#elif defined(TARGET_M68K)
196 print_insn = print_insn_m68k;
bellard6af0bf92005-07-02 14:58:51 +0000197#elif defined(TARGET_MIPS)
bellard76b30302005-12-17 01:10:04 +0000198#ifdef TARGET_WORDS_BIGENDIAN
bellard6af0bf92005-07-02 14:58:51 +0000199 print_insn = print_insn_big_mips;
bellard76b30302005-12-17 01:10:04 +0000200#else
201 print_insn = print_insn_little_mips;
202#endif
bellardfdf9b3e2006-04-27 21:07:38 +0000203#elif defined(TARGET_SH4)
204 disasm_info.mach = bfd_mach_sh4;
205 print_insn = print_insn_sh;
j_mayereddf68a2007-04-05 07:22:49 +0000206#elif defined(TARGET_ALPHA)
Richard Hendersonb9bec752011-04-10 10:31:20 -0700207 disasm_info.mach = bfd_mach_alpha_ev6;
j_mayereddf68a2007-04-05 07:22:49 +0000208 print_insn = print_insn_alpha;
thsa25fd132007-10-08 12:46:58 +0000209#elif defined(TARGET_CRIS)
Edgar E. Iglesiasb09cd072011-01-10 22:31:09 +0100210 if (flags != 32) {
211 disasm_info.mach = bfd_mach_cris_v0_v10;
212 print_insn = print_insn_crisv10;
213 } else {
214 disasm_info.mach = bfd_mach_cris_v32;
215 print_insn = print_insn_crisv32;
216 }
Ulrich Hechtdb500602011-03-29 15:29:32 +0200217#elif defined(TARGET_S390X)
218 disasm_info.mach = bfd_mach_s390_64;
219 print_insn = print_insn_s390;
Edgar E. Iglesiase90e3902009-05-20 20:07:38 +0200220#elif defined(TARGET_MICROBLAZE)
221 disasm_info.mach = bfd_arch_microblaze;
222 print_insn = print_insn_microblaze;
bellardc27004e2005-01-03 23:35:10 +0000223#else
bellardb8076a72005-04-07 22:20:31 +0000224 fprintf(out, "0x" TARGET_FMT_lx
225 ": Asm output not supported on this arch\n", code);
bellardc27004e2005-01-03 23:35:10 +0000226 return;
227#endif
228
blueswir17e000c22009-02-13 21:44:41 +0000229 for (pc = code; size > 0; pc += count, size -= count) {
bellardfa15e032005-01-31 23:32:31 +0000230 fprintf(out, "0x" TARGET_FMT_lx ": ", pc);
bellardc27004e2005-01-03 23:35:10 +0000231 count = print_insn(pc, &disasm_info);
232#if 0
233 {
234 int i;
235 uint8_t b;
236 fprintf(out, " {");
237 for(i = 0; i < count; i++) {
238 target_read_memory(pc + i, &b, 1, &disasm_info);
239 fprintf(out, " %02x", b);
240 }
241 fprintf(out, " }");
242 }
243#endif
244 fprintf(out, "\n");
245 if (count < 0)
246 break;
malc754d00a2009-04-21 22:26:22 +0000247 if (size < count) {
248 fprintf(out,
249 "Disassembler disagrees with translator over instruction "
250 "decoding\n"
251 "Please report this to qemu-devel@nongnu.org\n");
252 break;
253 }
bellardc27004e2005-01-03 23:35:10 +0000254 }
255}
256
257/* Disassemble this for me please... (debugging). */
258void disas(FILE *out, void *code, unsigned long size)
259{
260 unsigned long pc;
261 int count;
262 struct disassemble_info disasm_info;
263 int (*print_insn)(bfd_vma pc, disassemble_info *info);
264
265 INIT_DISASSEMBLE_INFO(disasm_info, out, fprintf);
bellardc6105c02003-10-27 21:13:58 +0000266
bellardb9adb4a2003-04-29 20:41:16 +0000267 disasm_info.buffer = code;
268 disasm_info.buffer_vma = (unsigned long)code;
269 disasm_info.buffer_length = size;
270
Juan Quintelae2542fe2009-07-27 16:13:06 +0200271#ifdef HOST_WORDS_BIGENDIAN
bellardc27004e2005-01-03 23:35:10 +0000272 disasm_info.endian = BFD_ENDIAN_BIG;
bellardb9adb4a2003-04-29 20:41:16 +0000273#else
bellardc27004e2005-01-03 23:35:10 +0000274 disasm_info.endian = BFD_ENDIAN_LITTLE;
bellardb9adb4a2003-04-29 20:41:16 +0000275#endif
bellardbc51c5c2004-03-17 23:46:04 +0000276#if defined(__i386__)
bellardc27004e2005-01-03 23:35:10 +0000277 disasm_info.mach = bfd_mach_i386_i386;
278 print_insn = print_insn_i386;
bellardbc51c5c2004-03-17 23:46:04 +0000279#elif defined(__x86_64__)
bellardc27004e2005-01-03 23:35:10 +0000280 disasm_info.mach = bfd_mach_x86_64;
281 print_insn = print_insn_i386;
malce58ffeb2009-01-14 18:39:49 +0000282#elif defined(_ARCH_PPC)
bellardc27004e2005-01-03 23:35:10 +0000283 print_insn = print_insn_ppc;
bellarda993ba82003-05-11 12:25:45 +0000284#elif defined(__alpha__)
bellardc27004e2005-01-03 23:35:10 +0000285 print_insn = print_insn_alpha;
bellardaa0aa4f2003-06-09 15:23:31 +0000286#elif defined(__sparc__)
bellardc27004e2005-01-03 23:35:10 +0000287 print_insn = print_insn_sparc;
blueswir16ecd4532007-04-08 11:22:29 +0000288#if defined(__sparc_v8plus__) || defined(__sparc_v8plusa__) || defined(__sparc_v9__)
289 disasm_info.mach = bfd_mach_sparc_v9b;
290#endif
ths5fafdf22007-09-16 21:08:06 +0000291#elif defined(__arm__)
bellardc27004e2005-01-03 23:35:10 +0000292 print_insn = print_insn_arm;
bellard6af0bf92005-07-02 14:58:51 +0000293#elif defined(__MIPSEB__)
294 print_insn = print_insn_big_mips;
295#elif defined(__MIPSEL__)
296 print_insn = print_insn_little_mips;
bellard48024e42005-11-06 16:52:11 +0000297#elif defined(__m68k__)
298 print_insn = print_insn_m68k;
ths8f860bb2007-07-31 23:44:21 +0000299#elif defined(__s390__)
300 print_insn = print_insn_s390;
aurel32f54b3f92008-04-12 20:14:54 +0000301#elif defined(__hppa__)
302 print_insn = print_insn_hppa;
Aurelien Jarno903ec552010-03-29 02:12:51 +0200303#elif defined(__ia64__)
304 print_insn = print_insn_ia64;
bellardb9adb4a2003-04-29 20:41:16 +0000305#else
bellardb8076a72005-04-07 22:20:31 +0000306 fprintf(out, "0x%lx: Asm output not supported on this arch\n",
307 (long) code);
bellardc27004e2005-01-03 23:35:10 +0000308 return;
bellardb9adb4a2003-04-29 20:41:16 +0000309#endif
blueswir17e000c22009-02-13 21:44:41 +0000310 for (pc = (unsigned long)code; size > 0; pc += count, size -= count) {
bellardc27004e2005-01-03 23:35:10 +0000311 fprintf(out, "0x%08lx: ", pc);
bellardc27004e2005-01-03 23:35:10 +0000312 count = print_insn(pc, &disasm_info);
bellardb9adb4a2003-04-29 20:41:16 +0000313 fprintf(out, "\n");
314 if (count < 0)
315 break;
316 }
317}
318
319/* Look up symbol for debugging purpose. Returns "" if unknown. */
bellardc27004e2005-01-03 23:35:10 +0000320const char *lookup_symbol(target_ulong orig_addr)
bellardb9adb4a2003-04-29 20:41:16 +0000321{
pbrook49918a72008-10-22 15:11:31 +0000322 const char *symbol = "";
bellarde80cfcf2004-12-19 23:18:01 +0000323 struct syminfo *s;
ths3b46e622007-09-17 08:09:54 +0000324
bellarde80cfcf2004-12-19 23:18:01 +0000325 for (s = syminfos; s; s = s->next) {
pbrook49918a72008-10-22 15:11:31 +0000326 symbol = s->lookup_symbol(s, orig_addr);
327 if (symbol[0] != '\0') {
328 break;
329 }
bellardb9adb4a2003-04-29 20:41:16 +0000330 }
pbrook49918a72008-10-22 15:11:31 +0000331
332 return symbol;
bellardb9adb4a2003-04-29 20:41:16 +0000333}
bellard9307c4c2004-04-04 12:57:25 +0000334
335#if !defined(CONFIG_USER_ONLY)
336
aliguori376253e2009-03-05 23:01:23 +0000337#include "monitor.h"
bellard3d2cfdf2004-08-01 21:49:07 +0000338
bellard9307c4c2004-04-04 12:57:25 +0000339static int monitor_disas_is_physical;
bellard6a00d602005-11-21 23:25:50 +0000340static CPUState *monitor_disas_env;
bellard9307c4c2004-04-04 12:57:25 +0000341
342static int
blueswir1a5f1b962008-08-17 20:21:51 +0000343monitor_read_memory (bfd_vma memaddr, bfd_byte *myaddr, int length,
344 struct disassemble_info *info)
bellard9307c4c2004-04-04 12:57:25 +0000345{
346 if (monitor_disas_is_physical) {
Stefan Weil54f7b4a2011-04-10 18:23:39 +0200347 cpu_physical_memory_read(memaddr, myaddr, length);
bellard9307c4c2004-04-04 12:57:25 +0000348 } else {
bellard6a00d602005-11-21 23:25:50 +0000349 cpu_memory_rw_debug(monitor_disas_env, memaddr,myaddr, length, 0);
bellard9307c4c2004-04-04 12:57:25 +0000350 }
351 return 0;
352}
353
Stefan Weil8b7968f2010-09-23 21:28:05 +0200354static int GCC_FMT_ATTR(2, 3)
355monitor_fprintf(FILE *stream, const char *fmt, ...)
bellard3d2cfdf2004-08-01 21:49:07 +0000356{
357 va_list ap;
358 va_start(ap, fmt);
aliguori376253e2009-03-05 23:01:23 +0000359 monitor_vprintf((Monitor *)stream, fmt, ap);
bellard3d2cfdf2004-08-01 21:49:07 +0000360 va_end(ap);
361 return 0;
362}
363
aliguori376253e2009-03-05 23:01:23 +0000364void monitor_disas(Monitor *mon, CPUState *env,
bellard6a00d602005-11-21 23:25:50 +0000365 target_ulong pc, int nb_insn, int is_physical, int flags)
bellard9307c4c2004-04-04 12:57:25 +0000366{
bellard9307c4c2004-04-04 12:57:25 +0000367 int count, i;
368 struct disassemble_info disasm_info;
369 int (*print_insn)(bfd_vma pc, disassemble_info *info);
370
aliguori376253e2009-03-05 23:01:23 +0000371 INIT_DISASSEMBLE_INFO(disasm_info, (FILE *)mon, monitor_fprintf);
bellard9307c4c2004-04-04 12:57:25 +0000372
bellard6a00d602005-11-21 23:25:50 +0000373 monitor_disas_env = env;
bellard9307c4c2004-04-04 12:57:25 +0000374 monitor_disas_is_physical = is_physical;
375 disasm_info.read_memory_func = monitor_read_memory;
376
377 disasm_info.buffer_vma = pc;
378
379#ifdef TARGET_WORDS_BIGENDIAN
380 disasm_info.endian = BFD_ENDIAN_BIG;
381#else
382 disasm_info.endian = BFD_ENDIAN_LITTLE;
383#endif
384#if defined(TARGET_I386)
bellardfa15e032005-01-31 23:32:31 +0000385 if (flags == 2)
386 disasm_info.mach = bfd_mach_x86_64;
ths5fafdf22007-09-16 21:08:06 +0000387 else if (flags == 1)
bellard9307c4c2004-04-04 12:57:25 +0000388 disasm_info.mach = bfd_mach_i386_i8086;
bellardfa15e032005-01-31 23:32:31 +0000389 else
390 disasm_info.mach = bfd_mach_i386_i386;
bellard9307c4c2004-04-04 12:57:25 +0000391 print_insn = print_insn_i386;
392#elif defined(TARGET_ARM)
393 print_insn = print_insn_arm;
thscbd669d2007-12-25 00:26:36 +0000394#elif defined(TARGET_ALPHA)
395 print_insn = print_insn_alpha;
bellard9307c4c2004-04-04 12:57:25 +0000396#elif defined(TARGET_SPARC)
397 print_insn = print_insn_sparc;
blueswir1682c4f12007-04-09 15:14:57 +0000398#ifdef TARGET_SPARC64
399 disasm_info.mach = bfd_mach_sparc_v9b;
400#endif
bellard9307c4c2004-04-04 12:57:25 +0000401#elif defined(TARGET_PPC)
bellarda2458622005-07-23 22:39:53 +0000402#ifdef TARGET_PPC64
403 disasm_info.mach = bfd_mach_ppc64;
404#else
405 disasm_info.mach = bfd_mach_ppc;
406#endif
bellard9307c4c2004-04-04 12:57:25 +0000407 print_insn = print_insn_ppc;
pbrooke6e59062006-10-22 00:18:54 +0000408#elif defined(TARGET_M68K)
409 print_insn = print_insn_m68k;
bellard6af0bf92005-07-02 14:58:51 +0000410#elif defined(TARGET_MIPS)
bellard76b30302005-12-17 01:10:04 +0000411#ifdef TARGET_WORDS_BIGENDIAN
bellard6af0bf92005-07-02 14:58:51 +0000412 print_insn = print_insn_big_mips;
bellard76b30302005-12-17 01:10:04 +0000413#else
414 print_insn = print_insn_little_mips;
415#endif
Magnus Dammb4e1f072009-11-13 18:54:22 +0900416#elif defined(TARGET_SH4)
417 disasm_info.mach = bfd_mach_sh4;
418 print_insn = print_insn_sh;
Ulrich Hechtdb500602011-03-29 15:29:32 +0200419#elif defined(TARGET_S390X)
420 disasm_info.mach = bfd_mach_s390_64;
421 print_insn = print_insn_s390;
bellard9307c4c2004-04-04 12:57:25 +0000422#else
aliguori376253e2009-03-05 23:01:23 +0000423 monitor_printf(mon, "0x" TARGET_FMT_lx
424 ": Asm output not supported on this arch\n", pc);
bellard9307c4c2004-04-04 12:57:25 +0000425 return;
426#endif
427
428 for(i = 0; i < nb_insn; i++) {
aliguori376253e2009-03-05 23:01:23 +0000429 monitor_printf(mon, "0x" TARGET_FMT_lx ": ", pc);
bellard9307c4c2004-04-04 12:57:25 +0000430 count = print_insn(pc, &disasm_info);
aliguori376253e2009-03-05 23:01:23 +0000431 monitor_printf(mon, "\n");
bellard9307c4c2004-04-04 12:57:25 +0000432 if (count < 0)
433 break;
434 pc += count;
435 }
436}
437#endif