]> code.ossystems Code Review - openembedded-core.git/blob
ca66bc73fb8d672f7321d30c54e5f31d32bae5c8
[openembedded-core.git] /
1 From 0bf4b0ac18d1ea41b32ad781d214b295ca1998f3 Mon Sep 17 00:00:00 2001
2 From: Aneesh Bansal <aneesh.bansal@freescale.com>
3 Date: Mon, 21 Nov 2011 17:31:39 +0530
4 Subject: [PATCH] Added support for PPC instructions mfatbu, mfatbl.
5
6 Signed-off-by: Aneesh Bansal <aneesh.bansal@freescale.com>
7 ---
8 Currently Valgrind 3.7.0 does not have support for PPC instructions mfatbu and mfatbl. When we run a USDPAA application with VALGRIND, the following error is given by valgrind :
9 dis_proc_ctl(ppc)(mfspr,SPR)(0x20F)
10 disInstr(ppc): unhandled instruction: 0x7C0F82A6
11
12
13  VEX/priv/guest_ppc_defs.h    |    2 ++
14  VEX/priv/guest_ppc_helpers.c |   18 ++++++++++++++++++
15  VEX/priv/guest_ppc_toIR.c    |   22 ++++++++++++++++++++++
16  3 files changed, 42 insertions(+), 0 deletions(-)
17
18 diff --git a/VEX/priv/guest_ppc_defs.h b/VEX/priv/guest_ppc_defs.h
19 index dd3c62e..11a34aa 100644
20 --- a/VEX/priv/guest_ppc_defs.h
21 +++ b/VEX/priv/guest_ppc_defs.h
22 @@ -146,6 +146,8 @@ extern UInt ppc32g_dirtyhelper_MFSPR_268_269 ( UInt );
23  
24  extern UInt ppc32g_dirtyhelper_MFSPR_287 ( void );
25  
26 +extern UInt ppc32g_dirtyhelper_MFSPR_526_527 ( UInt );
27 +
28  extern void ppc32g_dirtyhelper_LVS ( VexGuestPPC32State* gst,
29                                       UInt vD_idx, UInt sh,
30                                       UInt shift_right );
31 diff --git a/VEX/priv/guest_ppc_helpers.c b/VEX/priv/guest_ppc_helpers.c
32 index 11aa428..b49ea3f 100644
33 --- a/VEX/priv/guest_ppc_helpers.c
34 +++ b/VEX/priv/guest_ppc_helpers.c
35 @@ -119,6 +119,24 @@ UInt ppc32g_dirtyhelper_MFSPR_287 ( void )
36  #  endif
37  }
38  
39 +/* CALLED FROM GENERATED CODE */
40 +/* DIRTY HELPER (non-referentially transparent) */
41 +UInt ppc32g_dirtyhelper_MFSPR_526_527 ( UInt r527 )
42 +{
43 +#  if defined(__powerpc__) || defined(_AIX)
44 +   UInt spr;
45 +   if (r527) {
46 +      __asm__ __volatile__("mfspr %0,527" : "=b"(spr));
47 +   } else {
48 +      __asm__ __volatile__("mfspr %0,526" : "=b"(spr));
49 +   }
50 +   return spr;
51 +#  else
52 +   return 0;
53 +#  endif
54 +}
55 +
56 +
57  
58  /* CALLED FROM GENERATED CODE */
59  /* DIRTY HELPER (reads guest state, writes guest mem) */
60 diff --git a/VEX/priv/guest_ppc_toIR.c b/VEX/priv/guest_ppc_toIR.c
61 index f8d220d..37c8974 100644
62 --- a/VEX/priv/guest_ppc_toIR.c
63 +++ b/VEX/priv/guest_ppc_toIR.c
64 @@ -5657,6 +5657,28 @@ static Bool dis_proc_ctl ( VexAbiInfo* vbi, UInt theInstr )
65           break;
66        }
67  
68 +
69 +      case 526 /* 0x20E */:
70 +      case 527 /* 0x20F */: {
71 +         UInt     arg  = SPR==526 ? 0 : 1;
72 +         IRTemp   val  = newTemp(Ity_I32);
73 +         IRExpr** args = mkIRExprVec_1( mkU32(arg) );
74 +         IRDirty* d    = unsafeIRDirty_1_N(
75 +                            val,
76 +                            0/*regparms*/,
77 +                            "ppc32g_dirtyhelper_MFSPR_526_527",
78 +                            fnptr_to_fnentry
79 +                               (vbi, &ppc32g_dirtyhelper_MFSPR_526_527),
80 +                            args
81 +                         );
82 +         /* execute the dirty call, dumping the result in val. */
83 +         stmt( IRStmt_Dirty(d) );
84 +         putIReg( rD_addr,
85 +                  mkWidenFrom32(ty, mkexpr(val), False/*unsigned*/) );
86 +         DIP("mfspr r%u,%u", rD_addr, (UInt)SPR);
87 +         break;
88 +      }
89 +
90        default:
91           vex_printf("dis_proc_ctl(ppc)(mfspr,SPR)(0x%x)\n", SPR);
92           return False;
93 -- 
94 1.7.0.4