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,
67 IRStmt** precedingStmts,
68 Int n_precedingStmts );
71 IRExpr* guest_ppc64_spechelper ( HChar* function_name,
73 IRStmt** precedingStmts,
74 Int n_precedingStmts );
76 /* Describes to the optimser which part of the guest state require
77 precise memory exceptions. This is logically part of the guest
80 Bool guest_ppc32_state_requires_precise_mem_exns ( Int, Int );
83 Bool guest_ppc64_state_requires_precise_mem_exns ( Int, Int );
86 VexGuestLayout ppc32Guest_layout;
89 VexGuestLayout ppc64Guest_layout;
92 /* FP Rounding mode - different encoding to IR */
101 /* Floating point comparison values - different encoding to IR */
112 Enumeration for xer_ca/ov calculation helper functions
115 /* 0 */ PPCG_FLAG_OP_ADD=0, // addc[o], addic
116 /* 1 */ PPCG_FLAG_OP_ADDE, // adde[o], addme[o], addze[o]
117 /* 2 */ PPCG_FLAG_OP_DIVW, // divwo
118 /* 3 */ PPCG_FLAG_OP_DIVWU, // divwuo
119 /* 4 */ PPCG_FLAG_OP_MULLW, // mullwo
120 /* 5 */ PPCG_FLAG_OP_NEG, // nego
121 /* 6 */ PPCG_FLAG_OP_SUBF, // subfo
122 /* 7 */ PPCG_FLAG_OP_SUBFC, // subfc[o]
123 /* 8 */ PPCG_FLAG_OP_SUBFE, // subfe[o], subfme[o], subfze[o]
124 /* 9 */ PPCG_FLAG_OP_SUBFI, // subfic
125 /* 10 */ PPCG_FLAG_OP_SRAW, // sraw
126 /* 11 */ PPCG_FLAG_OP_SRAWI, // srawi
127 /* 12 */ PPCG_FLAG_OP_SRAD, // srad
128 /* 13 */ PPCG_FLAG_OP_SRADI, // sradi
133 /*---------------------------------------------------------*/
134 /*--- ppc guest helpers ---*/
135 /*---------------------------------------------------------*/
137 /* --- CLEAN HELPERS --- */
139 /* none, right now */
141 /* --- DIRTY HELPERS --- */
143 extern ULong ppcg_dirtyhelper_MFTB ( void );
145 extern UInt ppc32g_dirtyhelper_MFSPR_268_269 ( UInt );
147 extern UInt ppc32g_dirtyhelper_MFSPR_287 ( void );
149 extern void ppc32g_dirtyhelper_LVS ( VexGuestPPC32State* gst,
150 UInt vD_idx, UInt sh,
153 extern void ppc64g_dirtyhelper_LVS ( VexGuestPPC64State* gst,
154 UInt vD_idx, UInt sh,
157 #endif /* ndef __VEX_GUEST_PPC_DEFS_H */
159 /*---------------------------------------------------------------*/
160 /*--- end guest_ppc_defs.h ---*/
161 /*---------------------------------------------------------------*/