qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [patch] mnemonic asm names and clobber list
@ 2004-09-04 17:09 Rafael Ávila de Espíndola
  0 siblings, 0 replies; only message in thread
From: Rafael Ávila de Espíndola @ 2004-09-04 17:09 UTC (permalink / raw)
  To: qemu-devel


[-- Attachment #1.1: Type: text/plain, Size: 194 bytes --]

The attached patch changes the "%n" in the inline asm used with CODE_COPY to 
the more readable format %[mnemonic]. The patch also adds some missing 
registers to the clobber list.

Rafael

[-- Attachment #1.2: qemu.patch --]
[-- Type: text/x-diff, Size: 4821 bytes --]

Index: cpu-exec.c
===================================================================
RCS file: /cvsroot/qemu/qemu/cpu-exec.c,v
retrieving revision 1.38
diff -u -r1.38 cpu-exec.c
--- cpu-exec.c	14 Jul 2004 17:20:55 -0000	1.38
+++ cpu-exec.c	4 Sep 2004 15:59:52 -0000
@@ -471,60 +471,61 @@
         asm(".globl exec_loop\n"
             "\n"
             "debug1:\n"
+            "    movl %[FUNC], %%eax\n"
             "    pushl %%ebp\n"
-            "    fs movl %10, %9\n"
-            "    fs movl %11, %%eax\n"
+            "    fs movl %%eax, %[TMP0]\n"
+            "    fs movl %[DFR], %%eax\n"
             "    andl $0x400, %%eax\n"
-            "    fs orl %8, %%eax\n"
+            "    fs orl %[CCSRC], %%eax\n"
             "    pushl %%eax\n"
             "    popf\n"
-            "    fs movl %%esp, %12\n"
-            "    fs movl %0, %%eax\n"
-            "    fs movl %1, %%ecx\n"
-            "    fs movl %2, %%edx\n"
-            "    fs movl %3, %%ebx\n"
-            "    fs movl %4, %%esp\n"
-            "    fs movl %5, %%ebp\n"
-            "    fs movl %6, %%esi\n"
-            "    fs movl %7, %%edi\n"
-            "    fs jmp *%9\n"
+            "    fs movl %%esp, %[SESP]\n"
+            "    fs movl %[EAX], %%eax\n"
+            "    fs movl %[ECX], %%ecx\n"
+            "    fs movl %[EDX], %%edx\n"
+            "    fs movl %[EBX], %%ebx\n"
+            "    fs movl %[ESP], %%esp\n"
+            "    fs movl %[EBP], %%ebp\n"
+            "    fs movl %[ESI], %%esi\n"
+            "    fs movl %[EDI], %%edi\n"
+            "    fs jmp *%[TMP0]\n"
             "exec_loop:\n"
-            "    fs movl %%esp, %4\n"
-            "    fs movl %12, %%esp\n"
-            "    fs movl %%eax, %0\n"
-            "    fs movl %%ecx, %1\n"
-            "    fs movl %%edx, %2\n"
-            "    fs movl %%ebx, %3\n"
-            "    fs movl %%ebp, %5\n"
-            "    fs movl %%esi, %6\n"
-            "    fs movl %%edi, %7\n"
+            "    fs movl %%esp, %[ESP]\n"
+            "    fs movl %[SESP], %%esp\n"
+            "    fs movl %%eax, %[EAX]\n"
+            "    fs movl %%ecx, %[ECX]\n"
+            "    fs movl %%edx, %[EDX]\n"
+            "    fs movl %%ebx, %[EBX]\n"
+            "    fs movl %%ebp, %[EBP]\n"
+            "    fs movl %%esi, %[ESI]\n"
+            "    fs movl %%edi, %[EDI]\n"
             "    pushf\n"
             "    popl %%eax\n"
             "    movl %%eax, %%ecx\n"
             "    andl $0x400, %%ecx\n"
             "    shrl $9, %%ecx\n"
             "    andl $0x8d5, %%eax\n"
-            "    fs movl %%eax, %8\n"
+            "    fs movl %%eax, %[CCSRC]\n"
             "    movl $1, %%eax\n"
             "    subl %%ecx, %%eax\n"
-            "    fs movl %%eax, %11\n"
-            "    fs movl %9, %%ebx\n" /* get T0 value */
+            "    fs movl %%eax, %[DFR]\n"
+            "    fs movl %[TMP0], %[T0]\n" /* T0  must match the value present in env->tmp0*/
             "    popl %%ebp\n"
-            :
-            : "m" (*(uint8_t *)offsetof(CPUState, regs[0])),
-            "m" (*(uint8_t *)offsetof(CPUState, regs[1])),
-            "m" (*(uint8_t *)offsetof(CPUState, regs[2])),
-            "m" (*(uint8_t *)offsetof(CPUState, regs[3])),
-            "m" (*(uint8_t *)offsetof(CPUState, regs[4])),
-            "m" (*(uint8_t *)offsetof(CPUState, regs[5])),
-            "m" (*(uint8_t *)offsetof(CPUState, regs[6])),
-            "m" (*(uint8_t *)offsetof(CPUState, regs[7])),
-            "m" (*(uint8_t *)offsetof(CPUState, cc_src)),
-            "m" (*(uint8_t *)offsetof(CPUState, tmp0)),
-            "a" (gen_func),
-            "m" (*(uint8_t *)offsetof(CPUState, df)),
-            "m" (*(uint8_t *)offsetof(CPUState, saved_esp))
-            : "%ecx", "%edx"
+            : [T0]    "=b" (T0)
+            : [EAX]   "m" (*(uint8_t *)offsetof(CPUState, regs[R_EAX])),
+              [ECX]   "m" (*(uint8_t *)offsetof(CPUState, regs[R_ECX])),
+              [EDX]   "m" (*(uint8_t *)offsetof(CPUState, regs[R_EDX])),
+              [EBX]   "m" (*(uint8_t *)offsetof(CPUState, regs[R_EBX])),
+              [ESP]   "m" (*(uint8_t *)offsetof(CPUState, regs[R_ESP])),
+              [EBP]   "m" (*(uint8_t *)offsetof(CPUState, regs[R_EBP])),
+              [ESI]   "m" (*(uint8_t *)offsetof(CPUState, regs[R_ESI])),
+              [EDI]   "m" (*(uint8_t *)offsetof(CPUState, regs[R_EDI])),
+              [CCSRC] "m" (*(uint8_t *)offsetof(CPUState, cc_src)),
+              [TMP0]  "m" (*(uint8_t *)offsetof(CPUState, tmp0)),
+              [DFR]   "m" (*(uint8_t *)offsetof(CPUState, df)),
+              [SESP]  "m" (*(uint8_t *)offsetof(CPUState, saved_esp)),
+              [FUNC]  "m" (gen_func)
+		     :  "%eax", "%ecx", "%edx", "%ebp", "%edi", "%esi", "memory"
             );
     }
 }

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2004-09-04 17:11 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-09-04 17:09 [Qemu-devel] [patch] mnemonic asm names and clobber list Rafael Ávila de Espíndola

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).