blob: b087c12c4727e1654001511363774d1316bd6a7e [file] [log] [blame]
bellardb9adb4a2003-04-29 20:41:16 +00001/* General "disassemble this chunk" code. Used for debugging. */
Peter Maydelld38ea872016-01-29 17:50:05 +00002#include "qemu/osdep.h"
Markus Armbruster3979fca2019-04-17 21:18:04 +02003#include "disas/dis-asm.h"
bellardb9adb4a2003-04-29 20:41:16 +00004#include "elf.h"
Markus Armbruster30cc9832019-04-17 21:18:03 +02005#include "qemu/qemu-print.h"
bellardb9adb4a2003-04-29 20:41:16 +00006
Paolo Bonzini76cad712012-10-24 11:12:21 +02007#include "disas/disas.h"
Richard Henderson8ca80762017-09-14 09:41:12 -07008#include "disas/capstone.h"
bellardc6105c02003-10-27 21:13:58 +00009
Blue Swirlf4359b92012-09-08 12:40:00 +000010typedef struct CPUDebug {
11 struct disassemble_info info;
Peter Crosthwaited49190c2015-05-24 14:20:41 -070012 CPUState *cpu;
Blue Swirlf4359b92012-09-08 12:40:00 +000013} CPUDebug;
14
bellardb9adb4a2003-04-29 20:41:16 +000015/* Filled in by elfload.c. Simplistic, but will do for now. */
bellarde80cfcf2004-12-19 23:18:01 +000016struct syminfo *syminfos = NULL;
bellardb9adb4a2003-04-29 20:41:16 +000017
Richard Henderson12b6e9b2020-09-10 14:40:54 -070018/*
19 * Get LENGTH bytes from info's buffer, at host address memaddr.
20 * Transfer them to myaddr.
21 */
22static int host_read_memory(bfd_vma memaddr, bfd_byte *myaddr, int length,
23 struct disassemble_info *info)
bellardaa0aa4f2003-06-09 15:23:31 +000024{
bellardc6105c02003-10-27 21:13:58 +000025 if (memaddr < info->buffer_vma
Richard Henderson12b6e9b2020-09-10 14:40:54 -070026 || memaddr + length > info->buffer_vma + info->buffer_length) {
bellardc6105c02003-10-27 21:13:58 +000027 /* Out of bounds. Use EIO because GDB uses it. */
28 return EIO;
Richard Henderson12b6e9b2020-09-10 14:40:54 -070029 }
bellardc6105c02003-10-27 21:13:58 +000030 memcpy (myaddr, info->buffer + (memaddr - info->buffer_vma), length);
31 return 0;
bellardaa0aa4f2003-06-09 15:23:31 +000032}
33
Richard Henderson12b6e9b2020-09-10 14:40:54 -070034/*
35 * Get LENGTH bytes from info's buffer, at target address memaddr.
36 * Transfer them to myaddr.
37 */
38static int target_read_memory(bfd_vma memaddr, bfd_byte *myaddr, int length,
39 struct disassemble_info *info)
bellardc6105c02003-10-27 21:13:58 +000040{
Blue Swirlf4359b92012-09-08 12:40:00 +000041 CPUDebug *s = container_of(info, CPUDebug, info);
Richard Henderson12b6e9b2020-09-10 14:40:54 -070042 int r = cpu_memory_rw_debug(s->cpu, memaddr, myaddr, length, 0);
Philippe Mathieu-Daudé6766ba52020-05-18 17:53:04 +020043 return r ? EIO : 0;
bellardc6105c02003-10-27 21:13:58 +000044}
bellardc6105c02003-10-27 21:13:58 +000045
Richard Henderson12b6e9b2020-09-10 14:40:54 -070046/*
47 * Print an error message. We can assume that this is in response to
48 * an error return from {host,target}_read_memory.
49 */
50static void perror_memory(int status, bfd_vma memaddr,
51 struct disassemble_info *info)
bellardaa0aa4f2003-06-09 15:23:31 +000052{
Richard Henderson12b6e9b2020-09-10 14:40:54 -070053 if (status != EIO) {
54 /* Can't happen. */
55 info->fprintf_func(info->stream, "Unknown error %d\n", status);
56 } else {
57 /* Address between memaddr and memaddr + len was out of bounds. */
58 info->fprintf_func(info->stream,
59 "Address 0x%" PRIx64 " is out of bounds.\n",
60 memaddr);
61 }
bellardaa0aa4f2003-06-09 15:23:31 +000062}
63
Richard Henderson12b6e9b2020-09-10 14:40:54 -070064/* Print address in hex. */
65static void print_address(bfd_vma addr, struct disassemble_info *info)
bellardaa0aa4f2003-06-09 15:23:31 +000066{
Richard Henderson12b6e9b2020-09-10 14:40:54 -070067 info->fprintf_func(info->stream, "0x%" PRIx64, addr);
bellardaa0aa4f2003-06-09 15:23:31 +000068}
69
Peter Maydell636bd282012-06-25 04:55:55 +000070/* Print address in hex, truncated to the width of a host virtual address. */
Richard Henderson12b6e9b2020-09-10 14:40:54 -070071static void host_print_address(bfd_vma addr, struct disassemble_info *info)
Peter Maydell636bd282012-06-25 04:55:55 +000072{
Richard Henderson12b6e9b2020-09-10 14:40:54 -070073 print_address((uintptr_t)addr, info);
Peter Maydell636bd282012-06-25 04:55:55 +000074}
75
Richard Henderson12b6e9b2020-09-10 14:40:54 -070076/* Stub prevents some fruitless earching in optabs disassemblers. */
77static int symbol_at_address(bfd_vma addr, struct disassemble_info *info)
bellardaa0aa4f2003-06-09 15:23:31 +000078{
Richard Henderson12b6e9b2020-09-10 14:40:54 -070079 return 1;
bellardaa0aa4f2003-06-09 15:23:31 +000080}
81
Richard Hendersonc46ffd52013-08-16 23:29:45 -070082static int print_insn_objdump(bfd_vma pc, disassemble_info *info,
83 const char *prefix)
84{
85 int i, n = info->buffer_length;
Alex Bennée90bbf9d2022-09-29 12:42:14 +010086 g_autofree uint8_t *buf = g_malloc(n);
Richard Hendersonc46ffd52013-08-16 23:29:45 -070087
Alex Bennée90bbf9d2022-09-29 12:42:14 +010088 if (info->read_memory_func(pc, buf, n, info) == 0) {
89 for (i = 0; i < n; ++i) {
90 if (i % 32 == 0) {
91 info->fprintf_func(info->stream, "\n%s: ", prefix);
92 }
93 info->fprintf_func(info->stream, "%02x", buf[i]);
Richard Hendersonc46ffd52013-08-16 23:29:45 -070094 }
Alex Bennée90bbf9d2022-09-29 12:42:14 +010095 } else {
96 info->fprintf_func(info->stream, "unable to read memory");
Richard Hendersonc46ffd52013-08-16 23:29:45 -070097 }
Richard Hendersonc46ffd52013-08-16 23:29:45 -070098 return n;
99}
100
101static int print_insn_od_host(bfd_vma pc, disassemble_info *info)
102{
103 return print_insn_objdump(pc, info, "OBJD-H");
104}
105
106static int print_insn_od_target(bfd_vma pc, disassemble_info *info)
107{
108 return print_insn_objdump(pc, info, "OBJD-T");
109}
110
Richard Henderson12b6e9b2020-09-10 14:40:54 -0700111static void initialize_debug(CPUDebug *s)
112{
113 memset(s, 0, sizeof(*s));
114 s->info.arch = bfd_arch_unknown;
115 s->info.cap_arch = -1;
116 s->info.cap_insn_unit = 4;
117 s->info.cap_insn_split = 4;
118 s->info.memory_error_func = perror_memory;
119 s->info.symbol_at_address_func = symbol_at_address;
120}
121
122static void initialize_debug_target(CPUDebug *s, CPUState *cpu)
123{
124 initialize_debug(s);
125
126 s->cpu = cpu;
127 s->info.read_memory_func = target_read_memory;
128 s->info.print_address_func = print_address;
Marc-André Lureauee3eb3a2022-03-23 19:57:18 +0400129#if TARGET_BIG_ENDIAN
Richard Henderson12b6e9b2020-09-10 14:40:54 -0700130 s->info.endian = BFD_ENDIAN_BIG;
131#else
132 s->info.endian = BFD_ENDIAN_LITTLE;
133#endif
134
135 CPUClass *cc = CPU_GET_CLASS(cpu);
136 if (cc->disas_set_info) {
137 cc->disas_set_info(cpu, &s->info);
138 }
139}
140
141static void initialize_debug_host(CPUDebug *s)
142{
143 initialize_debug(s);
144
145 s->info.read_memory_func = host_read_memory;
146 s->info.print_address_func = host_print_address;
Marc-André Lureaue03b5682022-03-23 19:57:17 +0400147#if HOST_BIG_ENDIAN
Richard Henderson12b6e9b2020-09-10 14:40:54 -0700148 s->info.endian = BFD_ENDIAN_BIG;
149#else
150 s->info.endian = BFD_ENDIAN_LITTLE;
151#endif
152#if defined(CONFIG_TCG_INTERPRETER)
153 s->info.print_insn = print_insn_tci;
154#elif defined(__i386__)
155 s->info.mach = bfd_mach_i386_i386;
Richard Henderson12b6e9b2020-09-10 14:40:54 -0700156 s->info.cap_arch = CS_ARCH_X86;
157 s->info.cap_mode = CS_MODE_32;
158 s->info.cap_insn_unit = 1;
159 s->info.cap_insn_split = 8;
160#elif defined(__x86_64__)
161 s->info.mach = bfd_mach_x86_64;
Richard Henderson12b6e9b2020-09-10 14:40:54 -0700162 s->info.cap_arch = CS_ARCH_X86;
163 s->info.cap_mode = CS_MODE_64;
164 s->info.cap_insn_unit = 1;
165 s->info.cap_insn_split = 8;
166#elif defined(_ARCH_PPC)
Richard Henderson12b6e9b2020-09-10 14:40:54 -0700167 s->info.cap_arch = CS_ARCH_PPC;
168# ifdef _ARCH_PPC64
169 s->info.cap_mode = CS_MODE_64;
170# endif
171#elif defined(__riscv) && defined(CONFIG_RISCV_DIS)
172#if defined(_ILP32) || (__riscv_xlen == 32)
173 s->info.print_insn = print_insn_riscv32;
174#elif defined(_LP64)
175 s->info.print_insn = print_insn_riscv64;
176#else
177#error unsupported RISC-V ABI
178#endif
Richard Hendersona4038a02020-09-11 17:59:01 -0700179#elif defined(__aarch64__)
Richard Henderson12b6e9b2020-09-10 14:40:54 -0700180 s->info.cap_arch = CS_ARCH_ARM64;
181#elif defined(__alpha__)
182 s->info.print_insn = print_insn_alpha;
183#elif defined(__sparc__)
184 s->info.print_insn = print_insn_sparc;
185 s->info.mach = bfd_mach_sparc_v9b;
186#elif defined(__arm__)
187 /* TCG only generates code for arm mode. */
Richard Henderson12b6e9b2020-09-10 14:40:54 -0700188 s->info.cap_arch = CS_ARCH_ARM;
189#elif defined(__MIPSEB__)
190 s->info.print_insn = print_insn_big_mips;
191#elif defined(__MIPSEL__)
192 s->info.print_insn = print_insn_little_mips;
193#elif defined(__m68k__)
194 s->info.print_insn = print_insn_m68k;
195#elif defined(__s390__)
Richard Henderson3d562842020-01-04 07:24:59 +1000196 s->info.cap_arch = CS_ARCH_SYSZ;
197 s->info.cap_insn_unit = 2;
198 s->info.cap_insn_split = 6;
Richard Henderson12b6e9b2020-09-10 14:40:54 -0700199#elif defined(__hppa__)
200 s->info.print_insn = print_insn_hppa;
Richard Henderson2e0d9152022-11-30 16:22:09 -0800201#elif defined(__loongarch__)
202 s->info.print_insn = print_insn_loongarch;
Richard Henderson12b6e9b2020-09-10 14:40:54 -0700203#endif
204}
205
Richard Henderson1d484742017-09-14 08:38:35 -0700206/* Disassemble this for me please... (debugging). */
Peter Crosthwaited49190c2015-05-24 14:20:41 -0700207void target_disas(FILE *out, CPUState *cpu, target_ulong code,
Richard Henderson1d484742017-09-14 08:38:35 -0700208 target_ulong size)
bellardb9adb4a2003-04-29 20:41:16 +0000209{
bellardc27004e2005-01-03 23:35:10 +0000210 target_ulong pc;
bellardb9adb4a2003-04-29 20:41:16 +0000211 int count;
Blue Swirlf4359b92012-09-08 12:40:00 +0000212 CPUDebug s;
bellardb9adb4a2003-04-29 20:41:16 +0000213
Richard Henderson12b6e9b2020-09-10 14:40:54 -0700214 initialize_debug_target(&s, cpu);
215 s.info.fprintf_func = fprintf;
216 s.info.stream = out;
Blue Swirlf4359b92012-09-08 12:40:00 +0000217 s.info.buffer_vma = code;
218 s.info.buffer_length = size;
Peter Crosthwaite37b9de42015-06-23 20:57:33 -0700219
Richard Henderson8ca80762017-09-14 09:41:12 -0700220 if (s.info.cap_arch >= 0 && cap_disas_target(&s.info, code, size)) {
221 return;
222 }
223
Peter Crosthwaite2de295c2015-06-23 20:57:32 -0700224 if (s.info.print_insn == NULL) {
225 s.info.print_insn = print_insn_od_target;
Richard Hendersonc46ffd52013-08-16 23:29:45 -0700226 }
bellardc27004e2005-01-03 23:35:10 +0000227
blueswir17e000c22009-02-13 21:44:41 +0000228 for (pc = code; size > 0; pc += count, size -= count) {
bellardfa15e032005-01-31 23:32:31 +0000229 fprintf(out, "0x" TARGET_FMT_lx ": ", pc);
Peter Crosthwaite2de295c2015-06-23 20:57:32 -0700230 count = s.info.print_insn(pc, &s.info);
bellardc27004e2005-01-03 23:35:10 +0000231 fprintf(out, "\n");
232 if (count < 0)
233 break;
malc754d00a2009-04-21 22:26:22 +0000234 if (size < count) {
235 fprintf(out,
236 "Disassembler disagrees with translator over instruction "
237 "decoding\n"
238 "Please report this to qemu-devel@nongnu.org\n");
239 break;
240 }
bellardc27004e2005-01-03 23:35:10 +0000241 }
242}
243
Daniel P. Berrangéd94e96e2022-12-19 08:02:00 -0500244static int G_GNUC_PRINTF(2, 3)
245gstring_printf(FILE *stream, const char *fmt, ...)
Alex Bennéecbafa232019-05-22 10:27:14 +0100246{
Richard Hendersonb71f3a62020-09-10 15:13:38 -0700247 /* We abuse the FILE parameter to pass a GString. */
248 GString *s = (GString *)stream;
Alex Bennéecbafa232019-05-22 10:27:14 +0100249 int initial_len = s->len;
Richard Hendersonb71f3a62020-09-10 15:13:38 -0700250 va_list va;
Alex Bennéecbafa232019-05-22 10:27:14 +0100251
252 va_start(va, fmt);
253 g_string_append_vprintf(s, fmt, va);
254 va_end(va);
255
256 return s->len - initial_len;
257}
258
259static void plugin_print_address(bfd_vma addr, struct disassemble_info *info)
260{
261 /* does nothing */
262}
263
264
Alex Bennéecbafa232019-05-22 10:27:14 +0100265/*
266 * We should only be dissembling one instruction at a time here. If
267 * there is left over it usually indicates the front end has read more
268 * bytes than it needed.
269 */
270char *plugin_disas(CPUState *cpu, uint64_t addr, size_t size)
271{
Alex Bennéecbafa232019-05-22 10:27:14 +0100272 CPUDebug s;
Richard Hendersonb71f3a62020-09-10 15:13:38 -0700273 GString *ds = g_string_new(NULL);
Alex Bennéecbafa232019-05-22 10:27:14 +0100274
Richard Henderson12b6e9b2020-09-10 14:40:54 -0700275 initialize_debug_target(&s, cpu);
Alex Bennée43320992022-09-29 12:42:13 +0100276 s.info.fprintf_func = gstring_printf;
Richard Hendersonb71f3a62020-09-10 15:13:38 -0700277 s.info.stream = (FILE *)ds; /* abuse this slot */
Alex Bennéecbafa232019-05-22 10:27:14 +0100278 s.info.buffer_vma = addr;
279 s.info.buffer_length = size;
280 s.info.print_address_func = plugin_print_address;
Alex Bennéecbafa232019-05-22 10:27:14 +0100281
282 if (s.info.cap_arch >= 0 && cap_disas_plugin(&s.info, addr, size)) {
Richard Hendersonb71f3a62020-09-10 15:13:38 -0700283 ; /* done */
284 } else if (s.info.print_insn) {
285 s.info.print_insn(addr, &s.info);
286 } else {
287 ; /* cannot disassemble -- return empty string */
Alex Bennéecbafa232019-05-22 10:27:14 +0100288 }
289
Richard Hendersonb71f3a62020-09-10 15:13:38 -0700290 /* Return the buffer, freeing the GString container. */
291 return g_string_free(ds, false);
Alex Bennéecbafa232019-05-22 10:27:14 +0100292}
293
bellardc27004e2005-01-03 23:35:10 +0000294/* Disassemble this for me please... (debugging). */
Richard Hendersonf06176b2020-10-30 20:59:01 -0700295void disas(FILE *out, const void *code, unsigned long size)
bellardc27004e2005-01-03 23:35:10 +0000296{
Stefan Weilb0b0f1c2012-04-12 15:44:35 +0200297 uintptr_t pc;
bellardc27004e2005-01-03 23:35:10 +0000298 int count;
Blue Swirlf4359b92012-09-08 12:40:00 +0000299 CPUDebug s;
bellardc27004e2005-01-03 23:35:10 +0000300
Richard Henderson12b6e9b2020-09-10 14:40:54 -0700301 initialize_debug_host(&s);
302 s.info.fprintf_func = fprintf;
303 s.info.stream = out;
Blue Swirlf4359b92012-09-08 12:40:00 +0000304 s.info.buffer = code;
305 s.info.buffer_vma = (uintptr_t)code;
306 s.info.buffer_length = size;
Richard Henderson8ca80762017-09-14 09:41:12 -0700307
Richard Henderson4c389f62020-09-10 12:15:04 -0700308 if (s.info.cap_arch >= 0 && cap_disas_host(&s.info, code, size)) {
Richard Henderson8ca80762017-09-14 09:41:12 -0700309 return;
310 }
311
Richard Henderson12b6e9b2020-09-10 14:40:54 -0700312 if (s.info.print_insn == NULL) {
313 s.info.print_insn = print_insn_od_host;
Richard Hendersonc46ffd52013-08-16 23:29:45 -0700314 }
Stefan Weilb0b0f1c2012-04-12 15:44:35 +0200315 for (pc = (uintptr_t)code; size > 0; pc += count, size -= count) {
316 fprintf(out, "0x%08" PRIxPTR ": ", pc);
Richard Henderson12b6e9b2020-09-10 14:40:54 -0700317 count = s.info.print_insn(pc, &s.info);
Alex Bennéee5ef4ec2020-05-13 18:51:32 +0100318 fprintf(out, "\n");
319 if (count < 0) {
320 break;
321 }
bellardb9adb4a2003-04-29 20:41:16 +0000322 }
Alex Bennéee5ef4ec2020-05-13 18:51:32 +0100323
bellardb9adb4a2003-04-29 20:41:16 +0000324}
325
326/* Look up symbol for debugging purpose. Returns "" if unknown. */
bellardc27004e2005-01-03 23:35:10 +0000327const char *lookup_symbol(target_ulong orig_addr)
bellardb9adb4a2003-04-29 20:41:16 +0000328{
pbrook49918a72008-10-22 15:11:31 +0000329 const char *symbol = "";
bellarde80cfcf2004-12-19 23:18:01 +0000330 struct syminfo *s;
ths3b46e622007-09-17 08:09:54 +0000331
bellarde80cfcf2004-12-19 23:18:01 +0000332 for (s = syminfos; s; s = s->next) {
pbrook49918a72008-10-22 15:11:31 +0000333 symbol = s->lookup_symbol(s, orig_addr);
334 if (symbol[0] != '\0') {
335 break;
336 }
bellardb9adb4a2003-04-29 20:41:16 +0000337 }
pbrook49918a72008-10-22 15:11:31 +0000338
339 return symbol;
bellardb9adb4a2003-04-29 20:41:16 +0000340}
bellard9307c4c2004-04-04 12:57:25 +0000341
342#if !defined(CONFIG_USER_ONLY)
343
Paolo Bonzini83c90892012-12-17 18:19:49 +0100344#include "monitor/monitor.h"
bellard3d2cfdf2004-08-01 21:49:07 +0000345
bellard9307c4c2004-04-04 12:57:25 +0000346static int
Richard Hendersonb8d87202017-09-19 09:40:40 -0500347physical_read_memory(bfd_vma memaddr, bfd_byte *myaddr, int length,
blueswir1a5f1b962008-08-17 20:21:51 +0000348 struct disassemble_info *info)
bellard9307c4c2004-04-04 12:57:25 +0000349{
Peter Maydellf2c6abc2018-12-14 13:30:49 +0000350 CPUDebug *s = container_of(info, CPUDebug, info);
Philippe Mathieu-Daudé6766ba52020-05-18 17:53:04 +0200351 MemTxResult res;
Peter Maydellf2c6abc2018-12-14 13:30:49 +0000352
Philippe Mathieu-Daudé6766ba52020-05-18 17:53:04 +0200353 res = address_space_read(s->cpu->as, memaddr, MEMTXATTRS_UNSPECIFIED,
354 myaddr, length);
355 return res == MEMTX_OK ? 0 : EIO;
bellard9307c4c2004-04-04 12:57:25 +0000356}
357
Richard Henderson1d484742017-09-14 08:38:35 -0700358/* Disassembler for the monitor. */
Peter Crosthwaited49190c2015-05-24 14:20:41 -0700359void monitor_disas(Monitor *mon, CPUState *cpu,
Richard Henderson1d484742017-09-14 08:38:35 -0700360 target_ulong pc, int nb_insn, int is_physical)
bellard9307c4c2004-04-04 12:57:25 +0000361{
bellard9307c4c2004-04-04 12:57:25 +0000362 int count, i;
Blue Swirlf4359b92012-09-08 12:40:00 +0000363 CPUDebug s;
Alex Bennée43320992022-09-29 12:42:13 +0100364 g_autoptr(GString) ds = g_string_new("");
bellard9307c4c2004-04-04 12:57:25 +0000365
Richard Henderson12b6e9b2020-09-10 14:40:54 -0700366 initialize_debug_target(&s, cpu);
Alex Bennée43320992022-09-29 12:42:13 +0100367 s.info.fprintf_func = gstring_printf;
368 s.info.stream = (FILE *)ds; /* abuse this slot */
369
Richard Henderson12b6e9b2020-09-10 14:40:54 -0700370 if (is_physical) {
371 s.info.read_memory_func = physical_read_memory;
Peter Crosthwaite37b9de42015-06-23 20:57:33 -0700372 }
Richard Henderson12b6e9b2020-09-10 14:40:54 -0700373 s.info.buffer_vma = pc;
Peter Crosthwaite37b9de42015-06-23 20:57:33 -0700374
Richard Henderson8ca80762017-09-14 09:41:12 -0700375 if (s.info.cap_arch >= 0 && cap_disas_monitor(&s.info, pc, nb_insn)) {
Alex Bennée43320992022-09-29 12:42:13 +0100376 monitor_puts(mon, ds->str);
Richard Henderson8ca80762017-09-14 09:41:12 -0700377 return;
378 }
379
Peter Crosthwaite37b9de42015-06-23 20:57:33 -0700380 if (!s.info.print_insn) {
381 monitor_printf(mon, "0x" TARGET_FMT_lx
382 ": Asm output not supported on this arch\n", pc);
383 return;
384 }
bellard9307c4c2004-04-04 12:57:25 +0000385
Alex Bennée43320992022-09-29 12:42:13 +0100386 for (i = 0; i < nb_insn; i++) {
387 g_string_append_printf(ds, "0x" TARGET_FMT_lx ": ", pc);
Peter Crosthwaite2de295c2015-06-23 20:57:32 -0700388 count = s.info.print_insn(pc, &s.info);
Alex Bennée43320992022-09-29 12:42:13 +0100389 g_string_append_c(ds, '\n');
390 if (count < 0) {
391 break;
392 }
bellard9307c4c2004-04-04 12:57:25 +0000393 pc += count;
394 }
Alex Bennée43320992022-09-29 12:42:13 +0100395
396 monitor_puts(mon, ds->str);
bellard9307c4c2004-04-04 12:57:25 +0000397}
398#endif