Skip to contentSkip to conversation

[5910] target-ppc: convert SPR accesses to TCG

Qemu-devel Aurelien Jarno 4 participants 6 messages Dec 7, 2008

lore
Share & tools
lore
#0 lore raw

Revision: 5910

          http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=5910
Author:   aurel32
Date:     2008-12-07 13:40:29 +0000 (Sun, 07 Dec 2008)

Log Message:
-----------
target-ppc: convert SPR accesses to TCG

Modified Paths:
--------------
trunk/configure
trunk/target-ppc/cpu.h
trunk/target-ppc/exec.h
trunk/target-ppc/helper.c
trunk/target-ppc/helper.h
trunk/target-ppc/op_helper.c
trunk/target-ppc/translate.c
trunk/target-ppc/translate_init.c

Removed Paths:
-------------
trunk/target-ppc/op.c
trunk/target-ppc/op_helper.h

Modified: trunk/configure
===================================================================

configure +0 -8
@@ -1605,39 +1605,31 @@
   ;;
   ppc)
     echo "TARGET_ARCH=ppc" >> $config_mak
-    echo "CONFIG_DYNGEN_OP=yes" >> $config_mak
     echo "#define TARGET_ARCH \"ppc\"" >> $config_h
     echo "#define TARGET_PPC 1" >> $config_h
-    echo "#define CONFIG_DYNGEN_OP 1" >> $config_h
   ;;
   ppcemb)
     echo "TARGET_ARCH=ppcemb" >> $config_mak
     echo "TARGET_ABI_DIR=ppc" >> $config_mak
-    echo "CONFIG_DYNGEN_OP=yes" >> $config_mak
     echo "#define TARGET_ARCH \"ppcemb\"" >> $config_h
     echo "#define TARGET_PPC 1" >> $config_h
     echo "#define TARGET_PPCEMB 1" >> $config_h
-    echo "#define CONFIG_DYNGEN_OP 1" >> $config_h
   ;;
   ppc64)
     echo "TARGET_ARCH=ppc64" >> $config_mak
     echo "TARGET_ABI_DIR=ppc" >> $config_mak
-    echo "CONFIG_DYNGEN_OP=yes" >> $config_mak
     echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
     echo "#define TARGET_PPC 1" >> $config_h
     echo "#define TARGET_PPC64 1" >> $config_h
-    echo "#define CONFIG_DYNGEN_OP 1" >> $config_h
   ;;
   ppc64abi32)
     echo "TARGET_ARCH=ppc64" >> $config_mak
     echo "TARGET_ABI_DIR=ppc" >> $config_mak
     echo "TARGET_ARCH2=ppc64abi32" >> $config_mak
-    echo "CONFIG_DYNGEN_OP=yes" >> $config_mak
     echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
     echo "#define TARGET_PPC 1" >> $config_h
     echo "#define TARGET_PPC64 1" >> $config_h
     echo "#define TARGET_ABI32 1" >> $config_h
-    echo "#define CONFIG_DYNGEN_OP 1" >> $config_h
   ;;
   sh4|sh4eb)
     echo "TARGET_ARCH=sh4" >> $config_mak

Modified: trunk/target-ppc/cpu.h
===================================================================

target-ppc/cpu.h +14 -27

65 lines not on this page · raw message

Modified: trunk/target-ppc/exec.h
===================================================================

target-ppc/exec.h +0 -13
@@ -32,21 +32,8 @@
 #define USE_PRECISE_EMULATION 0
 
 register struct CPUPPCState *env asm(AREG0);
-#if TARGET_LONG_BITS > HOST_LONG_BITS
-/* no registers can be used */
-#define T0 (env->t0)
 #define TDX "%016" PRIx64
-#else
-register target_ulong T0 asm(AREG1);
-#define TDX "%016lx"
-#endif
 
-#if defined (DEBUG_OP)
-# define RETURN() __asm__ __volatile__("nop" : : : "memory");
-#else
-# define RETURN() __asm__ __volatile__("" : : : "memory");
-#endif
-
 #if !defined(CONFIG_USER_ONLY)
 #include "softmmu_exec.h"
 #endif /* !defined(CONFIG_USER_ONLY) */

Modified: trunk/target-ppc/helper.c
===================================================================

target-ppc/helper.c +8 -38

101 lines not on this page · raw message

Modified: trunk/target-ppc/helper.h
===================================================================

target-ppc/helper.h +39 -2

52 lines not on this page · raw message

Deleted: trunk/target-ppc/op.c
===================================================================

target-ppc/op.c +0 -320

320 lines not on this page · raw message

Modified: trunk/target-ppc/op_helper.c
===================================================================

target-ppc/op_helper.c +182 -45

287 lines not on this page · raw message

Deleted: trunk/target-ppc/op_helper.h
===================================================================

target-ppc/op_helper.h +0 -38
@@ -1,38 +0,0 @@
-/*
- *  PowerPC emulation helpers header for qemu.
- *
- *  Copyright (c) 2003-2007 Jocelyn Mayer
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-/* Registers load and stores */
-#if defined(TARGET_PPC64)
-void do_store_pri (int prio);
-#endif
-target_ulong ppc_load_dump_spr (int sprn);
-void ppc_store_dump_spr (int sprn, target_ulong val);
-
-/* Misc */
-/* POWER / PowerPC 601 specific helpers */
-#if !defined(CONFIG_USER_ONLY)
-void do_store_hid0_601 (void);
-#endif
-
-/* PowerPC 403 specific helpers */
-#if !defined(CONFIG_USER_ONLY)
-void do_load_403_pb (int num);
-void do_store_403_pb (int num);
-#endif

Modified: trunk/target-ppc/translate.c
===================================================================

target-ppc/translate.c +5 -17
@@ -38,7 +38,7 @@
 #define GDBSTUB_SINGLE_STEP 0x4
 
 /* Include definitions for instructions classes and implementations flags */
-//#define DO_SINGLE_STEP
+#define DO_SINGLE_STEP
 //#define PPC_DEBUG_DISAS
 //#define DO_PPC_STATISTICS
 //#define OPTIMIZE_FPRF_UPDATE
@@ -71,9 +71,6 @@
 static TCGv_i32 cpu_fpscr;
 static TCGv_i32 cpu_access_type;
 
-/* dyngen register indexes */
-static TCGv cpu_T[1];
-
 #include "gen-icount.h"
 
 void ppc_translate_init(void)
@@ -86,11 +83,6 @@
         return;
 
     cpu_env = tcg_global_reg_new_ptr(TCG_AREG0, "env");
-#if TARGET_LONG_BITS > HOST_LONG_BITS
-    cpu_T[0] = tcg_global_mem_new(TCG_AREG0, offsetof(CPUState, t0), "T0");
-#else
-    cpu_T[0] = tcg_global_reg_new(TCG_AREG1, "T0");
-#endif
 
     p = cpu_reg_names;
 
@@ -3886,7 +3878,7 @@
 /* mfspr */
 static always_inline void gen_op_mfspr (DisasContext *ctx)
 {
-    void (*read_cb)(void *opaque, int sprn);
+    void (*read_cb)(void *opaque, int gprn, int sprn);
     uint32_t sprn = SPR(ctx->opcode);
 
 #if !defined(CONFIG_USER_ONLY)
@@ -3899,8 +3891,7 @@
         read_cb = ctx->spr_cb[sprn].uea_read;
     if (likely(read_cb != NULL)) {
         if (likely(read_cb != SPR_NOACCESS)) {
-            (*read_cb)(ctx, sprn);
-            tcg_gen_mov_tl(cpu_gpr[rD(ctx->opcode)], cpu_T[0]);
+            (*read_cb)(ctx, rD(ctx->opcode), sprn);
         } else {
             /* Privilege exception */
             /* This is a hack to avoid warnings when running Linux:
@@ -3972,7 +3963,6 @@
         GEN_EXCP_PRIVREG(ctx);
         return;
     }
-    tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rS(ctx->opcode)]);
     if (ctx->opcode & 0x00010000) {
         /* Special form that does not need any synchronisation */
         TCGv t0 = tcg_temp_new();
@@ -4004,7 +3994,6 @@
         GEN_EXCP_PRIVREG(ctx);
         return;
     }
-    tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rS(ctx->opcode)]);
     if (ctx->opcode & 0x00010000) {
         /* Special form that does not need any synchronisation */
         TCGv t0 = tcg_temp_new();
@@ -4041,7 +4030,7 @@
 /* mtspr */
 GEN_HANDLER(mtspr, 0x1F, 0x13, 0x0E, 0x00000001, PPC_MISC)
 {
-    void (*write_cb)(void *opaque, int sprn);
+    void (*write_cb)(void *opaque, int sprn, int gprn);
     uint32_t sprn = SPR(ctx->opcode);
 
 #if !defined(CONFIG_USER_ONLY)
@@ -4054,8 +4043,7 @@
         write_cb = ctx->spr_cb[sprn].uea_write;
     if (likely(write_cb != NULL)) {
         if (likely(write_cb != SPR_NOACCESS)) {
-            tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rS(ctx->opcode)]);
-            (*write_cb)(ctx, sprn);
+            (*write_cb)(ctx, sprn, rS(ctx->opcode));
         } else {
             /* Privilege exception */
             if (loglevel != 0) {

Modified: trunk/target-ppc/translate_init.c
===================================================================

target-ppc/translate_init.c +177 -132

548 lines not on this page · raw message

#1 lore raw
Quoted 11 lines · Aurelien Jarno

Revision: 5910

          http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=5910

Author: aurel32
Date: 2008-12-07 13:40:29 +0000 (Sun, 07 Dec 2008)

Log Message:
-----------
target-ppc: convert SPR accesses to TCG

Quoted 8 lines

--- trunk/target-ppc/translate.c 2008-12-07 13:40:15 UTC (rev 5909)
+++ trunk/target-ppc/translate.c 2008-12-07 13:40:29 UTC (rev 5910)
@@ -38,7 +38,7 @@
#define GDBSTUB_SINGLE_STEP 0x4

/* Include definitions for instructions classes and implementations flags */
-//#define DO_SINGLE_STEP
+#define DO_SINGLE_STEP

Now every instruction is single stepped.

#2 lore raw
Quoted 17 lines · Blue Swirl
Quoted 16 lines · Aurelien Jarno

Revision: 5910

          http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=5910

Author: aurel32
Date: 2008-12-07 13:40:29 +0000 (Sun, 07 Dec 2008)

Log Message:
-----------
target-ppc: convert SPR accesses to TCG

--- trunk/target-ppc/translate.c 2008-12-07 13:40:15 UTC (rev 5909)
+++ trunk/target-ppc/translate.c 2008-12-07 13:40:29 UTC (rev 5910)
@@ -38,7 +38,7 @@
#define GDBSTUB_SINGLE_STEP 0x4

Quoted 6 lines
Quoted 3 lines

/* Include definitions for instructions classes and implementations flags */
-//#define DO_SINGLE_STEP
+#define DO_SINGLE_STEP

Now every instruction is single stepped.

Good catch. I have enabled it for debugging purpose, and then forget to disable it again. That should be fixed now. Thanks.

Signature · 4 lines
  .''`.  Aurelien Jarno	            | GPG: 1024D/F1BCDB73
 : :' :  Debian developer           | Electrical Engineer
 `. `'   [email protected]         | [email protected]
   `-    people.debian.org/~aurel32 | www.aurel32.net
#3 lore raw

[Qemu-devel] Single stepping command line option? (was: [5910] target-ppc: convert SPR accesses to TCG)

Quoted 14 lines · Aurelien Jarno
Quoted 6 lines · Blue Swirl

On 12/7/08, Aurelien Jarno <[email protected]> wrote

Quoted 5 lines
target-ppc/translate.c 2008-12-07 13:40:29 UTC (rev 5910) renamed from target-ppc/translate.c 2008-12-07 13:40:15 UTC (rev 5909) +0 -0
@@ -38,7 +38,7 @@
 #define GDBSTUB_SINGLE_STEP 0x4
 
Quoted 6 lines

target-ppc/translate.c 2008-12-07 13:40:29 UTC (rev 5910)

Quoted 4 lines
target-ppc/translate.c 2008-12-07 13:40:29 UTC (rev 5910) renamed from target-ppc/translate.c 2008-12-07 13:40:15 UTC (rev 5909) +0 -0
 /* Include definitions for instructions classes and implementations

flags */

target-ppc/translate.c 2008-12-07 13:40:29 UTC (rev 5910) renamed from target-ppc/translate.c 2008-12-07 13:40:15 UTC (rev 5909) +1 -1
-//#define DO_SINGLE_STEP
+#define DO_SINGLE_STEP

Now every instruction is single stepped.

Quoted 2 lines

Good catch. I have enabled it for debugging purpose, and then forget to disable it again. That should be fixed now. Thanks.

What about replacing DO_SINGLE_STEP, MIPS_SINGLE_STEP and SH4_SINGLE_STEP (are there more of them?) by a command line option (-singlestep) which allows setting this at run time?

The increase in execution time can be neglected.

Maybe changing single stepping from the Qemu monitor might also be useful.

Regards
Stefan Weil

#4 lore raw

Re: [Qemu-devel] Single stepping command line option? (was: [5910] target-ppc: convert SPR accesses to TCG)

Quoted 5 lines · Stefan Weil

What about replacing DO_SINGLE_STEP, MIPS_SINGLE_STEP and SH4_SINGLE_STEP (are there more of them?) by a command line option (-singlestep) which allows setting this at run time?

The increase in execution time can be neglected.

I did it on my local copy and indeed it adds nothing measurable to execution time. That's very handy to have such an option.

Laurent

#5 lore raw

Re: [Qemu-devel] Single stepping command line option? (was: [5910] target-ppc: convert SPR accesses to TCG)

Quoted 9 lines · Laurent Desnogues
Quoted 5 lines · Stefan Weil

What about replacing DO_SINGLE_STEP, MIPS_SINGLE_STEP and SH4_SINGLE_STEP (are there more of them?) by a command line option (-singlestep) which allows setting this at run time?

The increase in execution time can be neglected.

I did it on my local copy and indeed it adds nothing measurable to execution time. That's very handy to have such an option.

I think a patch for that would be welcome.

Signature · 4 lines
  .''`.  Aurelien Jarno	            | GPG: 1024D/F1BCDB73
 : :' :  Debian developer           | Electrical Engineer
 `. `'   [email protected]         | [email protected]
   `-    people.debian.org/~aurel32 | www.aurel32.net