From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.30) id 1B6RMc-0000UB-F8 for qemu-devel@nongnu.org; Thu, 25 Mar 2004 04:41:26 -0500 Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.30) id 1B6RM6-0000MW-8X for qemu-devel@nongnu.org; Thu, 25 Mar 2004 04:41:25 -0500 Received: from [216.254.0.202] (helo=mail2.speakeasy.net) by monty-python.gnu.org with esmtp (TLSv1:DES-CBC3-SHA:168) (Exim 4.30) id 1B6RM5-0000LX-Lq for qemu-devel@nongnu.org; Thu, 25 Mar 2004 04:40:53 -0500 Subject: Re: [Qemu-devel] .previous in exec-all.h From: "John R. Hogerhuis" In-Reply-To: <405B5EE2.1050506@bellard.org> References: <1079461610.13515.34.camel@aragorn> <069E8780-79D4-11D8-A09D-000A2796D230@free.fr> <1079728362.20081.84.camel@aragorn> <405B5EE2.1050506@bellard.org> Content-Type: multipart/mixed; boundary="=-cp584HfzOTdPRQFgZoDZ" Message-Id: <1080207685.10208.23.camel@aragorn> Mime-Version: 1.0 Date: Thu, 25 Mar 2004 01:41:25 -0800 Reply-To: jhoger@pobox.com, qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Fabrice Bellard , qemu-devel@nongnu.org Cc: tamlin@algonet.se --=-cp584HfzOTdPRQFgZoDZ Content-Type: text/plain Content-Transfer-Encoding: 7bit Here's an experimental patch to dyngen.c which generates the machine code as byte arrays into op.h basically as I described. Unfortunately I'm having problems with my cvs qemu at the moment (when I run qemu I end up in the command line 'monitor' but I don't get a guest window...), but from the op.h I generated, it *looks* like it is working... -- John. --=-cp584HfzOTdPRQFgZoDZ Content-Disposition: attachment; filename=dyngen.patch Content-Type: text/x-patch; name=dyngen.patch; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 7bit 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); --=-cp584HfzOTdPRQFgZoDZ--