Index: dyngen.c =================================================================== RCS file: /cvsroot/qemu/qemu/dyngen.c,v retrieving revision 1.31 diff -u -r1.31 dyngen.c --- dyngen.c 17 Mar 2004 23:46:04 -0000 1.31 +++ dyngen.c 25 Mar 2004 09:26:03 -0000 @@ -652,7 +652,6 @@ } fprintf(outfile, ";\n"); } - fprintf(outfile, " extern void %s();\n", name); for(i = 0, rel = relocs;i < nb_relocs; i++, rel++) { if (rel->r_offset >= start_offset && @@ -672,6 +671,33 @@ fprintf(outfile, "extern char %s;\n", sym_name); } } + } + + /* convert the code into a static array of bytes */ + { + uint8_t *codep = text + start_offset; + int i = 0; + + fprintf(outfile, " static const char %s[] =\n", name); + fprintf(outfile, " {"); + while (i < copy_size) + { + + /* emit the next byte of array */ + fprintf (outfile, "'\\x%02X'", *codep); + + /* next byte */ + i++, codep++; + + /* exit loop if done */ + if (i >= copy_size) break; + + /* print comma, and also print newline if 8th byte */ + fprintf (outfile, ", "); + if (i%8 == 0) fprintf (outfile, "\n "); + } + + fprintf (outfile, "};\n\n"); } fprintf(outfile, " memcpy(gen_code_ptr, (void *)((char *)&%s+%d), %d);\n", name, start_offset - offset, copy_size);