2
/*---------------------------------------------------------------*/
4
/*--- This file (guest-ppc/gdefs.h) is ---*/
5
/*--- Copyright (C) OpenWorks LLP. All rights reserved. ---*/
7
/*---------------------------------------------------------------*/
10
This file is part of LibVEX, a library for dynamic binary
11
instrumentation and translation.
13
Copyright (C) 2004-2006 OpenWorks LLP. All rights reserved.
15
This library is made available under a dual licensing scheme.
17
If you link LibVEX against other code all of which is itself
18
licensed under the GNU General Public License, version 2 dated June
19
1991 ("GPL v2"), then you may use LibVEX under the terms of the GPL
20
v2, as appearing in the file LICENSE.GPL. If the file LICENSE.GPL
21
is missing, you can obtain a copy of the GPL v2 from the Free
22
Software Foundation Inc., 51 Franklin St, Fifth Floor, Boston, MA
25
For any other uses of LibVEX, you must first obtain a commercial
26
license from OpenWorks LLP. Please contact info@open-works.co.uk
27
for information about commercial licensing.
29
This software is provided by OpenWorks LLP "as is" and any express
30
or implied warranties, including, but not limited to, the implied
31
warranties of merchantability and fitness for a particular purpose
32
are disclaimed. In no event shall OpenWorks LLP be liable for any
33
direct, indirect, incidental, special, exemplary, or consequential
34
damages (including, but not limited to, procurement of substitute
35
goods or services; loss of use, data, or profits; or business
36
interruption) however caused and on any theory of liability,
37
whether in contract, strict liability, or tort (including
38
negligence or otherwise) arising in any way out of the use of this
39
software, even if advised of the possibility of such damage.
41
Neither the names of the U.S. Department of Energy nor the
42
University of California nor the names of its contributors may be
43
used to endorse or promote products derived from this software
44
without prior written permission.
47
/* Only to be used within the guest-ppc directory. */
50
#ifndef __LIBVEX_GUEST_PPC_DEFS_H
51
#define __LIBVEX_GUEST_PPC_DEFS_H
54
/*---------------------------------------------------------*/
55
/*--- ppc to IR conversion ---*/
56
/*---------------------------------------------------------*/
58
/* Convert one ppc insn to IR. See the type DisOneInstrFn in
61
DisResult disInstr_PPC ( IRBB* irbb,
63
Bool (*resteerOkFn) ( void*, Addr64 ),
64
void* callback_opaque,
69
VexArchInfo* archinfo,
70
Bool host_bigendian );
72
/* Used by the optimiser to specialise calls to helpers. */
74
IRExpr* guest_ppc32_spechelper ( HChar* function_name,
78
IRExpr* guest_ppc64_spechelper ( HChar* function_name,
81
/* Describes to the optimser which part of the guest state require
82
precise memory exceptions. This is logically part of the guest
85
Bool guest_ppc32_state_requires_precise_mem_exns ( Int, Int );
88
Bool guest_ppc64_state_requires_precise_mem_exns ( Int, Int );
91
VexGuestLayout ppc32Guest_layout;
94
VexGuestLayout ppc64Guest_layout;
97
/* FP Rounding mode - different encoding to IR */
106
/* Floating point comparison values - different encoding to IR */
117
Enumeration for xer_ca/ov calculation helper functions
120
/* 0 */ PPCG_FLAG_OP_ADD=0, // addc[o], addic
121
/* 1 */ PPCG_FLAG_OP_ADDE, // adde[o], addme[o], addze[o]
122
/* 2 */ PPCG_FLAG_OP_DIVW, // divwo
123
/* 3 */ PPCG_FLAG_OP_DIVWU, // divwuo
124
/* 4 */ PPCG_FLAG_OP_MULLW, // mullwo
125
/* 5 */ PPCG_FLAG_OP_NEG, // nego
126
/* 6 */ PPCG_FLAG_OP_SUBF, // subfo
127
/* 7 */ PPCG_FLAG_OP_SUBFC, // subfc[o]
128
/* 8 */ PPCG_FLAG_OP_SUBFE, // subfe[o], subfme[o], subfze[o]
129
/* 9 */ PPCG_FLAG_OP_SUBFI, // subfic
130
/* 10 */ PPCG_FLAG_OP_SRAW, // sraw
131
/* 11 */ PPCG_FLAG_OP_SRAWI, // srawi
132
/* 12 */ PPCG_FLAG_OP_SRAD, // srad
133
/* 13 */ PPCG_FLAG_OP_SRADI, // sradi
138
/*---------------------------------------------------------*/
139
/*--- ppc guest helpers ---*/
140
/*---------------------------------------------------------*/
142
/* --- CLEAN HELPERS --- */
144
/* none, right now */
146
/* --- DIRTY HELPERS --- */
148
extern ULong ppcg_dirtyhelper_MFTB ( void );
150
extern void ppc32g_dirtyhelper_LVS ( VexGuestPPC32State* gst,
151
UInt vD_idx, UInt sh,
154
extern void ppc64g_dirtyhelper_LVS ( VexGuestPPC64State* gst,
155
UInt vD_idx, UInt sh,
158
#endif /* ndef __LIBVEX_GUEST_PPC_DEFS_H */
160
/*---------------------------------------------------------------*/
161
/*--- end guest-ppc/gdefs.h ---*/
162
/*---------------------------------------------------------------*/