All of lore.kernel.org
 help / color / mirror / Atom feed
From: "John R. Hogerhuis" <jhoger@speakeasy.net>
To: Fabrice Bellard <fabrice@bellard.org>, qemu-devel@nongnu.org
Cc: tamlin@algonet.se
Subject: Re: [Qemu-devel] .previous in exec-all.h
Date: Thu, 25 Mar 2004 01:41:25 -0800	[thread overview]
Message-ID: <1080207685.10208.23.camel@aragorn> (raw)
In-Reply-To: <405B5EE2.1050506@bellard.org>

[-- Attachment #1: Type: text/plain, Size: 359 bytes --]

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.



[-- Attachment #2: dyngen.patch --]
[-- Type: text/x-patch, Size: 1597 bytes --]

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);

  parent reply	other threads:[~2004-03-25  9:41 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-03-16 18:26 [Qemu-devel] .previous in exec-all.h John R. Hogerhuis
2004-03-16 18:32 ` Mark IJbema
2004-03-19 18:34 ` Pierre d'Herbemont
2004-03-19 20:32   ` John R. Hogerhuis
2004-03-19 20:58     ` Fabrice Bellard
2004-03-19 21:10       ` John R. Hogerhuis
2004-03-25  9:41       ` John R. Hogerhuis [this message]
2004-03-26  0:43         ` John R. Hogerhuis
2004-03-19 21:03     ` [Qemu-devel] Win32 port [was: .previous in exec-all.h] Mike Nordell
2004-03-20 19:50     ` [Qemu-devel] .previous in exec-all.h Pierre d'Herbemont

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1080207685.10208.23.camel@aragorn \
    --to=jhoger@speakeasy.net \
    --cc=fabrice@bellard.org \
    --cc=jhoger@pobox.com \
    --cc=qemu-devel@nongnu.org \
    --cc=tamlin@algonet.se \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.