blob: 0f4bc039020842abe930c1b0d559e3a3376b48f9 [file] [log] [blame]
cerion896a1372005-01-25 12:24:25 +00001
2/*---------------------------------------------------------------*/
3/*--- ---*/
cerion1515db92005-01-25 17:21:23 +00004/*--- This file (guest-ppc32/gdefs.h) is ---*/
sewardjdbcfae72005-08-02 11:14:04 +00005/*--- Copyright (C) OpenWorks LLP. All rights reserved. ---*/
cerion896a1372005-01-25 12:24:25 +00006/*--- ---*/
7/*---------------------------------------------------------------*/
8
9/*
10 This file is part of LibVEX, a library for dynamic binary
11 instrumentation and translation.
12
sewardj7bd6ffe2005-08-03 16:07:36 +000013 Copyright (C) 2004-2005 OpenWorks LLP. All rights reserved.
cerion896a1372005-01-25 12:24:25 +000014
sewardj7bd6ffe2005-08-03 16:07:36 +000015 This library is made available under a dual licensing scheme.
cerion896a1372005-01-25 12:24:25 +000016
sewardj7bd6ffe2005-08-03 16:07:36 +000017 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
23 02110-1301, USA.
24
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.
28
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.
cerion896a1372005-01-25 12:24:25 +000040
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.
cerion896a1372005-01-25 12:24:25 +000045*/
46
cerion1515db92005-01-25 17:21:23 +000047/* Only to be used within the guest-ppc32 directory. */
cerion896a1372005-01-25 12:24:25 +000048
49
cerion1515db92005-01-25 17:21:23 +000050#ifndef __LIBVEX_GUEST_PPC32_DEFS_H
51#define __LIBVEX_GUEST_PPC32_DEFS_H
cerion896a1372005-01-25 12:24:25 +000052
sewardj9e6491a2005-07-02 19:24:10 +000053
54/*---------------------------------------------------------*/
55/*--- ppc32 to IR conversion ---*/
56/*---------------------------------------------------------*/
57
58/* Convert one ppc32 insn to IR. See the type DisOneInstrFn in
59 bb_to_IR.h. */
60extern
61DisResult disInstr_PPC32 ( IRBB* irbb,
62 Bool put_IP,
63 Bool (*resteerOkFn) ( Addr64 ),
64 UChar* guest_code,
65 Long delta,
66 Addr64 guest_IP,
67 VexArchInfo* archinfo,
68 Bool host_bigendian );
69
70/* Used by the optimiser to specialise calls to helpers. */
71extern
72IRExpr* guest_ppc32_spechelper ( HChar* function_name,
73 IRExpr** args );
74
cerionf0de28c2005-12-13 20:21:11 +000075extern
76IRExpr* guest_ppc64_spechelper ( HChar* function_name,
77 IRExpr** args );
78
sewardj9e6491a2005-07-02 19:24:10 +000079/* Describes to the optimser which part of the guest state require
80 precise memory exceptions. This is logically part of the guest
81 state description. */
82extern
83Bool guest_ppc32_state_requires_precise_mem_exns ( Int, Int );
84
cerionf0de28c2005-12-13 20:21:11 +000085extern
86Bool guest_ppc64_state_requires_precise_mem_exns ( Int, Int );
87
sewardj9e6491a2005-07-02 19:24:10 +000088extern
89VexGuestLayout ppc32Guest_layout;
90
cerionf0de28c2005-12-13 20:21:11 +000091extern
92VexGuestLayout ppc64Guest_layout;
93
sewardj9e6491a2005-07-02 19:24:10 +000094
cerion094d1392005-06-20 13:45:57 +000095/* FP Rounding mode - different encoding to IR */
96typedef
97 enum {
98 PPC32rm_NEAREST = 0,
99 PPC32rm_NegINF = 1,
100 PPC32rm_PosINF = 2,
101 PPC32rm_ZERO = 3
102 } PPC32RoundingMode;
103
104/* Floating point comparison values - different encoding to IR */
105typedef
106 enum {
107 PPC32cr_LT = 0x8,
108 PPC32cr_GT = 0x4,
109 PPC32cr_EQ = 0x2,
110 PPC32cr_UN = 0x1
111 }
112 PPC32CmpF64Result;
cerion896a1372005-01-25 12:24:25 +0000113
cerionae694622005-01-28 17:52:47 +0000114/*
cerione9d361a2005-03-04 17:35:29 +0000115 Enumeration for xer_ca/ov calculation helper functions
116*/
cerionae694622005-01-28 17:52:47 +0000117enum {
sewardj20ef5472005-07-21 14:48:31 +0000118 /* 0 */ PPC32G_FLAG_OP_ADD=0, // addc[o], addic
119 /* 1 */ PPC32G_FLAG_OP_ADDE, // adde[o], addme[o], addze[o]
120 /* 2 */ PPC32G_FLAG_OP_DIVW, // divwo
121 /* 3 */ PPC32G_FLAG_OP_DIVWU, // divwuo
122 /* 4 */ PPC32G_FLAG_OP_MULLW, // mullwo
123 /* 5 */ PPC32G_FLAG_OP_NEG, // nego
124 /* 6 */ PPC32G_FLAG_OP_SUBF, // subfo
125 /* 7 */ PPC32G_FLAG_OP_SUBFC, // subfc[o]
126 /* 8 */ PPC32G_FLAG_OP_SUBFE, // subfe[o], subfme[o], subfze[o]
127 /* 9 */ PPC32G_FLAG_OP_SUBFI, // subfic
128 /* 10 */ PPC32G_FLAG_OP_SRAW, // sraw
129 /* 11 */ PPC32G_FLAG_OP_SRAWI, // srawi
cerionf0de28c2005-12-13 20:21:11 +0000130 /* 12 */ PPC32G_FLAG_OP_SRAD, // srad
131 /* 13 */ PPC32G_FLAG_OP_SRADI, // sradi
cerionb85e8bb2005-02-16 08:54:33 +0000132 PPC32G_FLAG_OP_NUMBER
cerionae694622005-01-28 17:52:47 +0000133};
134
cerion896a1372005-01-25 12:24:25 +0000135
sewardj73a91972005-09-06 10:25:46 +0000136/*---------------------------------------------------------*/
cerion225a0342005-09-12 20:49:09 +0000137/*--- ppc32 guest helpers ---*/
sewardj73a91972005-09-06 10:25:46 +0000138/*---------------------------------------------------------*/
139
140/* --- CLEAN HELPERS --- */
141
142/* none, right now */
143
144/* --- DIRTY HELPERS --- */
145
146extern ULong ppc32g_dirtyhelper_MFTB ( void );
147
cerion6f6c6a02005-09-13 18:41:09 +0000148extern void ppc32g_dirtyhelper_LVS ( VexGuestPPC32State* gst,
149 UInt vD_idx, UInt sh,
sewardjd1470942005-10-22 02:01:16 +0000150 UInt shift_right );
sewardj73a91972005-09-06 10:25:46 +0000151
cerion1515db92005-01-25 17:21:23 +0000152#endif /* ndef __LIBVEX_GUEST_PPC32_DEFS_H */
cerion896a1372005-01-25 12:24:25 +0000153
154/*---------------------------------------------------------------*/
cerion1515db92005-01-25 17:21:23 +0000155/*--- end guest-ppc32/gdefs.h ---*/
cerion896a1372005-01-25 12:24:25 +0000156/*---------------------------------------------------------------*/