2 /*---------------------------------------------------------------*/
3 /*--- begin guest_ppc_defs.h ---*/
4 /*---------------------------------------------------------------*/
7 This file is part of Valgrind, a dynamic binary instrumentation
10 Copyright (C) 2004-2010 OpenWorks LLP
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.
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.
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
28 The GNU General Public License is contained in the file COPYING.
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.
36 /* Only to be used within the guest-ppc directory. */
39 #ifndef __VEX_GUEST_PPC_DEFS_H
40 #define __VEX_GUEST_PPC_DEFS_H
43 /*---------------------------------------------------------*/
44 /*--- ppc to IR conversion ---*/
45 /*---------------------------------------------------------*/
47 /* Convert one ppc insn to IR. See the type DisOneInstrFn in
50 DisResult disInstr_PPC ( IRSB* irbb,
52 Bool (*resteerOkFn) ( void*, Addr64 ),
54 void* callback_opaque,
59 VexArchInfo* archinfo,
61 Bool host_bigendian );
63 /* Used by the optimiser to specialise calls to helpers. */
65 IRExpr* guest_ppc32_spechelper ( HChar* function_name,
69 IRExpr* guest_ppc64_spechelper ( HChar* function_name,
72 /* Describes to the optimser which part of the guest state require
73 precise memory exceptions. This is logically part of the guest
76 Bool guest_ppc32_state_requires_precise_mem_exns ( Int, Int );
79 Bool guest_ppc64_state_requires_precise_mem_exns ( Int, Int );
82 VexGuestLayout ppc32Guest_layout;
85 VexGuestLayout ppc64Guest_layout;
88 /* FP Rounding mode - different encoding to IR */
97 /* Floating point comparison values - different encoding to IR */
108 Enumeration for xer_ca/ov calculation helper functions
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
129 /*---------------------------------------------------------*/
130 /*--- ppc guest helpers ---*/
131 /*---------------------------------------------------------*/
133 /* --- CLEAN HELPERS --- */
135 /* none, right now */
137 /* --- DIRTY HELPERS --- */
139 extern ULong ppcg_dirtyhelper_MFTB ( void );
141 extern UInt ppc32g_dirtyhelper_MFSPR_268_269 ( UInt );
143 extern UInt ppc32g_dirtyhelper_MFSPR_287 ( void );
145 extern void ppc32g_dirtyhelper_LVS ( VexGuestPPC32State* gst,
146 UInt vD_idx, UInt sh,
149 extern void ppc64g_dirtyhelper_LVS ( VexGuestPPC64State* gst,
150 UInt vD_idx, UInt sh,
153 #endif /* ndef __VEX_GUEST_PPC_DEFS_H */
155 /*---------------------------------------------------------------*/
156 /*--- end guest_ppc_defs.h ---*/
157 /*---------------------------------------------------------------*/