qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [patch] Move PPC to GOTO_TB


From: Paul Brook
Subject: [Qemu-devel] [patch] Move PPC to GOTO_TB
Date: Sun, 11 Sep 2005 12:02:49 +0100
User-agent: KMail/1.7.2

The attached patch migrates the PowerPC target from JUMP_TB to GOTO_TB.

Paul
Index: target-ppc/op.c
===================================================================
RCS file: /cvsroot/qemu/qemu/target-ppc/op.c,v
retrieving revision 1.20
diff -c -p -r1.20 op.c
*** target-ppc/op.c     4 Jul 2005 22:17:05 -0000       1.20
--- target-ppc/op.c     11 Sep 2005 11:00:33 -0000
*************** PPC_OP(setlr)
*** 451,459 ****
      regs->lr = PARAM1;
  }
  
! PPC_OP(b)
  {
!     JUMP_TB(b1, PARAM1, 0, PARAM2);
  }
  
  PPC_OP(b_T1)
--- 451,464 ----
      regs->lr = PARAM1;
  }
  
! PPC_OP(goto_tb0)
  {
!     GOTO_TB(op_goto_tb0, PARAM1, 0);
! }
! 
! PPC_OP(goto_tb1)
! {
!     GOTO_TB(op_goto_tb1, PARAM1, 1);
  }
  
  PPC_OP(b_T1)
*************** PPC_OP(b_T1)
*** 461,473 ****
      regs->nip = T1 & ~3;
  }
  
! PPC_OP(btest) 
  {
!     if (T0) {
!         JUMP_TB(btest, PARAM1, 0, PARAM2);
!     } else {
!         JUMP_TB(btest, PARAM1, 1, PARAM3);
!     }
      RETURN();
  }
  
--- 466,475 ----
      regs->nip = T1 & ~3;
  }
  
! PPC_OP(jz_T0)
  {
!     if (!T0)
!         GOTO_LABEL_PARAM(1);
      RETURN();
  }
  
Index: target-ppc/translate.c
===================================================================
RCS file: /cvsroot/qemu/qemu/target-ppc/translate.c,v
retrieving revision 1.35
diff -c -p -r1.35 translate.c
*** target-ppc/translate.c      2 Jul 2005 22:09:27 -0000       1.35
--- target-ppc/translate.c      11 Sep 2005 11:00:34 -0000
***************
*** 30,35 ****
--- 30,41 ----
  //#define DO_SINGLE_STEP
  //#define PPC_DEBUG_DISAS
  
+ #ifdef USE_DIRECT_JUMP
+ #define TBPARAM(x)
+ #else
+ #define TBPARAM(x) (long)(x)
+ #endif
+ 
  enum {
  #define DEF(s, n, copy_size) INDEX_op_ ## s,
  #include "opc.h"
*************** GEN_HANDLER(stfiwx, 0x1F, 0x17, 0x1E, 0x
*** 1721,1726 ****
--- 1727,1744 ----
  
  /***                                Branch                                 
***/
  
+ static inline gen_jmp_tb(long tb, int n, uint32_t dest)
+ {
+     if (n == 0)
+         gen_op_goto_tb0(TBPARAM(tb));
+     else
+         gen_op_goto_tb1(TBPARAM(tb));
+     gen_op_set_T1(dest);
+     gen_op_b_T1();
+     gen_op_set_T0(tb + n);
+     gen_op_exit_tb();
+ }
+ 
  /* b ba bl bla */
  GEN_HANDLER(b, 0x12, 0xFF, 0xFF, 0x00000000, PPC_FLOW)
  {
*************** GEN_HANDLER(b, 0x12, 0xFF, 0xFF, 0x00000
*** 1736,1742 ****
      if (LK(ctx->opcode)) {
          gen_op_setlr(ctx->nip);
      }
!     gen_op_b((long)ctx->tb, target);
      ctx->exception = EXCP_BRANCH;
  }
  
--- 1754,1760 ----
      if (LK(ctx->opcode)) {
          gen_op_setlr(ctx->nip);
      }
!     gen_jmp_tb((long)ctx->tb, 0, target);
      ctx->exception = EXCP_BRANCH;
  }
  
*************** static inline void gen_bcond(DisasContex
*** 1787,1793 ****
          case 4:                                                               
          case 6:                                                               
              if (type == BCOND_IM) {
!                 gen_op_b((long)ctx->tb, target);
              } else {
                  gen_op_b_T1();
              }
--- 1805,1811 ----
          case 4:                                                               
          case 6:                                                               
              if (type == BCOND_IM) {
!                 gen_jmp_tb((long)ctx->tb, 0, target);
              } else {
                  gen_op_b_T1();
              }
*************** static inline void gen_bcond(DisasContex
*** 1827,1833 ****
          }                                                                     
      }                                                                         
      if (type == BCOND_IM) {
!         gen_op_btest((long)ctx->tb, target, ctx->nip);
      } else {
          gen_op_btest_T1(ctx->nip);
      }
--- 1845,1855 ----
          }                                                                     
      }                                                                         
      if (type == BCOND_IM) {
!         int l1 = gen_new_label();
!         gen_op_jz_T0(l1);
!         gen_jmp_tb((long)ctx->tb, 0, target);
!         gen_set_label(l1);
!         gen_jmp_tb((long)ctx->tb, 1, ctx->nip);
      } else {
          gen_op_btest_T1(ctx->nip);
      }
*************** int gen_intermediate_code_internal (CPUS
*** 2459,2464 ****
--- 2481,2487 ----
      gen_opc_ptr = gen_opc_buf;
      gen_opc_end = gen_opc_buf + OPC_MAX_SIZE;
      gen_opparam_ptr = gen_opparam_buf;
+     nb_gen_labels = 0;
      ctx.nip = pc_start;
      ctx.tb = tb;
      ctx.exception = EXCP_NONE;
*************** int gen_intermediate_code_internal (CPUS
*** 2575,2581 ****
  #endif
      }
      if (ctx.exception == EXCP_NONE) {
!         gen_op_b((unsigned long)ctx.tb, ctx.nip);
      } else if (ctx.exception != EXCP_BRANCH) {
          gen_op_set_T0(0);
      }
--- 2598,2604 ----
  #endif
      }
      if (ctx.exception == EXCP_NONE) {
!         gen_jmp_tb((long)ctx.tb, 0, ctx.nip);
      } else if (ctx.exception != EXCP_BRANCH) {
          gen_op_set_T0(0);
      }

reply via email to

[Prev in Thread] Current Thread [Next in Thread]