]> rtime.felk.cvut.cz Git - l4.git/blob - l4/pkg/valgrind/src/valgrind-3.6.0-svn/VEX/priv/guest_ppc_defs.h
36dbbc697458aceae47dffd0d19574a7cd26454d
[l4.git] / l4 / pkg / valgrind / src / valgrind-3.6.0-svn / VEX / priv / guest_ppc_defs.h
1
2 /*---------------------------------------------------------------*/
3 /*--- begin                                  guest_ppc_defs.h ---*/
4 /*---------------------------------------------------------------*/
5
6 /*
7    This file is part of Valgrind, a dynamic binary instrumentation
8    framework.
9
10    Copyright (C) 2004-2010 OpenWorks LLP
11       info@open-works.net
12
13    This program is free software; you can redistribute it and/or
14    modify it under the terms of the GNU General Public License as
15    published by the Free Software Foundation; either version 2 of the
16    License, or (at your option) any later version.
17
18    This program is distributed in the hope that it will be useful, but
19    WITHOUT ANY WARRANTY; without even the implied warranty of
20    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
21    General Public License for more details.
22
23    You should have received a copy of the GNU General Public License
24    along with this program; if not, write to the Free Software
25    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
26    02110-1301, USA.
27
28    The GNU General Public License is contained in the file COPYING.
29
30    Neither the names of the U.S. Department of Energy nor the
31    University of California nor the names of its contributors may be
32    used to endorse or promote products derived from this software
33    without prior written permission.
34 */
35
36 /* Only to be used within the guest-ppc directory. */
37
38
39 #ifndef __VEX_GUEST_PPC_DEFS_H
40 #define __VEX_GUEST_PPC_DEFS_H
41
42
43 /*---------------------------------------------------------*/
44 /*--- ppc to IR conversion                              ---*/
45 /*---------------------------------------------------------*/
46
47 /* Convert one ppc insn to IR.  See the type DisOneInstrFn in
48    bb_to_IR.h. */
49 extern
50 DisResult disInstr_PPC ( IRSB*        irbb,
51                          Bool         put_IP,
52                          Bool         (*resteerOkFn) ( void*, Addr64 ),
53                          Bool         resteerCisOk,
54                          void*        callback_opaque,
55                          UChar*       guest_code,
56                          Long         delta,
57                          Addr64       guest_IP,
58                          VexArch      guest_arch,
59                          VexArchInfo* archinfo,
60                          VexAbiInfo*  abiinfo,
61                          Bool         host_bigendian );
62
63 /* Used by the optimiser to specialise calls to helpers. */
64 extern
65 IRExpr* guest_ppc32_spechelper ( HChar* function_name,
66                                  IRExpr** args );
67
68 extern
69 IRExpr* guest_ppc64_spechelper ( HChar* function_name,
70                                  IRExpr** args );
71
72 /* Describes to the optimser which part of the guest state require
73    precise memory exceptions.  This is logically part of the guest
74    state description. */
75 extern 
76 Bool guest_ppc32_state_requires_precise_mem_exns ( Int, Int );
77
78 extern 
79 Bool guest_ppc64_state_requires_precise_mem_exns ( Int, Int );
80
81 extern
82 VexGuestLayout ppc32Guest_layout;
83
84 extern
85 VexGuestLayout ppc64Guest_layout;
86
87
88 /* FP Rounding mode - different encoding to IR */
89 typedef
90    enum {
91       PPCrm_NEAREST = 0,
92       PPCrm_NegINF  = 1,
93       PPCrm_PosINF  = 2,
94       PPCrm_ZERO    = 3
95    } PPCRoundingMode;
96
97 /* Floating point comparison values - different encoding to IR */
98 typedef
99    enum {
100       PPCcr_LT = 0x8,
101       PPCcr_GT = 0x4,
102       PPCcr_EQ = 0x2,
103       PPCcr_UN = 0x1
104    }
105    PPCCmpF64Result;
106
107 /*
108   Enumeration for xer_ca/ov calculation helper functions
109 */
110 enum {
111    /* 0  */ PPCG_FLAG_OP_ADD=0,   // addc[o], addic
112    /* 1  */ PPCG_FLAG_OP_ADDE,    // adde[o], addme[o], addze[o]
113    /* 2  */ PPCG_FLAG_OP_DIVW,    // divwo
114    /* 3  */ PPCG_FLAG_OP_DIVWU,   // divwuo
115    /* 4  */ PPCG_FLAG_OP_MULLW,   // mullwo
116    /* 5  */ PPCG_FLAG_OP_NEG,     // nego
117    /* 6  */ PPCG_FLAG_OP_SUBF,    // subfo
118    /* 7  */ PPCG_FLAG_OP_SUBFC,   // subfc[o]
119    /* 8  */ PPCG_FLAG_OP_SUBFE,   // subfe[o], subfme[o], subfze[o]
120    /* 9  */ PPCG_FLAG_OP_SUBFI,   // subfic
121    /* 10 */ PPCG_FLAG_OP_SRAW,    // sraw
122    /* 11 */ PPCG_FLAG_OP_SRAWI,   // srawi
123    /* 12 */ PPCG_FLAG_OP_SRAD,    // srad
124    /* 13 */ PPCG_FLAG_OP_SRADI,   // sradi
125    PPCG_FLAG_OP_NUMBER
126 };
127
128
129 /*---------------------------------------------------------*/
130 /*--- ppc guest helpers                                 ---*/
131 /*---------------------------------------------------------*/
132
133 /* --- CLEAN HELPERS --- */
134
135 /* none, right now */
136
137 /* --- DIRTY HELPERS --- */
138
139 extern ULong ppcg_dirtyhelper_MFTB ( void );
140
141 extern UInt ppc32g_dirtyhelper_MFSPR_268_269 ( UInt );
142
143 extern UInt ppc32g_dirtyhelper_MFSPR_287 ( void );
144
145 extern void ppc32g_dirtyhelper_LVS ( VexGuestPPC32State* gst,
146                                      UInt vD_idx, UInt sh,
147                                      UInt shift_right );
148
149 extern void ppc64g_dirtyhelper_LVS ( VexGuestPPC64State* gst,
150                                      UInt vD_idx, UInt sh,
151                                      UInt shift_right );
152
153 #endif /* ndef __VEX_GUEST_PPC_DEFS_H */
154
155 /*---------------------------------------------------------------*/
156 /*--- end                                    guest_ppc_defs.h ---*/
157 /*---------------------------------------------------------------*/