pyvex 9.2.193__cp310-cp310-macosx_10_12_x86_64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pyvex/__init__.py +92 -0
- pyvex/_register_info.py +1800 -0
- pyvex/arches.py +94 -0
- pyvex/block.py +697 -0
- pyvex/const.py +426 -0
- pyvex/const_val.py +26 -0
- pyvex/data_ref.py +55 -0
- pyvex/enums.py +156 -0
- pyvex/errors.py +31 -0
- pyvex/expr.py +974 -0
- pyvex/include/libvex.h +1029 -0
- pyvex/include/libvex_basictypes.h +236 -0
- pyvex/include/libvex_emnote.h +142 -0
- pyvex/include/libvex_guest_amd64.h +252 -0
- pyvex/include/libvex_guest_arm.h +224 -0
- pyvex/include/libvex_guest_arm64.h +203 -0
- pyvex/include/libvex_guest_mips32.h +175 -0
- pyvex/include/libvex_guest_mips64.h +173 -0
- pyvex/include/libvex_guest_offsets.h +941 -0
- pyvex/include/libvex_guest_ppc32.h +298 -0
- pyvex/include/libvex_guest_ppc64.h +343 -0
- pyvex/include/libvex_guest_riscv64.h +148 -0
- pyvex/include/libvex_guest_s390x.h +201 -0
- pyvex/include/libvex_guest_tilegx.h +149 -0
- pyvex/include/libvex_guest_x86.h +322 -0
- pyvex/include/libvex_ir.h +3113 -0
- pyvex/include/libvex_s390x_common.h +123 -0
- pyvex/include/libvex_trc_values.h +99 -0
- pyvex/include/pyvex.h +96 -0
- pyvex/lib/libpyvex.dylib +0 -0
- pyvex/lifting/__init__.py +18 -0
- pyvex/lifting/gym/README.md +7 -0
- pyvex/lifting/gym/__init__.py +5 -0
- pyvex/lifting/gym/aarch64_spotter.py +40 -0
- pyvex/lifting/gym/arm_spotter.py +427 -0
- pyvex/lifting/gym/x86_spotter.py +129 -0
- pyvex/lifting/libvex.py +117 -0
- pyvex/lifting/lift_function.py +304 -0
- pyvex/lifting/lifter.py +124 -0
- pyvex/lifting/post_processor.py +16 -0
- pyvex/lifting/util/__init__.py +14 -0
- pyvex/lifting/util/instr_helper.py +422 -0
- pyvex/lifting/util/lifter_helper.py +154 -0
- pyvex/lifting/util/syntax_wrapper.py +312 -0
- pyvex/lifting/util/vex_helper.py +301 -0
- pyvex/lifting/zerodivision.py +71 -0
- pyvex/native.py +63 -0
- pyvex/py.typed +1 -0
- pyvex/stmt.py +740 -0
- pyvex/types.py +48 -0
- pyvex/utils.py +63 -0
- pyvex/vex_ffi.py +1453 -0
- pyvex-9.2.193.dist-info/METADATA +181 -0
- pyvex-9.2.193.dist-info/RECORD +59 -0
- pyvex-9.2.193.dist-info/WHEEL +6 -0
- pyvex-9.2.193.dist-info/licenses/LICENSE +24 -0
- pyvex-9.2.193.dist-info/licenses/pyvex_c/LICENSE +339 -0
- pyvex-9.2.193.dist-info/licenses/vex/LICENSE.GPL +340 -0
- pyvex-9.2.193.dist-info/licenses/vex/LICENSE.README +23 -0
|
@@ -0,0 +1,298 @@
|
|
|
1
|
+
|
|
2
|
+
/*---------------------------------------------------------------*/
|
|
3
|
+
/*--- begin libvex_guest_ppc32.h ---*/
|
|
4
|
+
/*---------------------------------------------------------------*/
|
|
5
|
+
|
|
6
|
+
/*
|
|
7
|
+
This file is part of Valgrind, a dynamic binary instrumentation
|
|
8
|
+
framework.
|
|
9
|
+
|
|
10
|
+
Copyright (C) 2004-2015 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
|
+
#ifndef __LIBVEX_PUB_GUEST_PPC32_H
|
|
37
|
+
#define __LIBVEX_PUB_GUEST_PPC32_H
|
|
38
|
+
|
|
39
|
+
#include "libvex_basictypes.h"
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
/*---------------------------------------------------------------*/
|
|
43
|
+
/*--- Vex's representation of the PPC32 CPU state ---*/
|
|
44
|
+
/*---------------------------------------------------------------*/
|
|
45
|
+
|
|
46
|
+
#define VEX_GUEST_PPC32_REDIR_STACK_SIZE (16/*entries*/ * 2/*words per entry*/)
|
|
47
|
+
|
|
48
|
+
typedef
|
|
49
|
+
struct {
|
|
50
|
+
/* Event check fail addr and counter. */
|
|
51
|
+
/* 0 */ UInt host_EvC_FAILADDR;
|
|
52
|
+
/* 4 */ UInt host_EvC_COUNTER;
|
|
53
|
+
/* 8 */ UInt pad3;
|
|
54
|
+
/* 12 */ UInt pad4;
|
|
55
|
+
/* Add 16 to all the numbers below. Sigh. */
|
|
56
|
+
/* General Purpose Registers */
|
|
57
|
+
/* 0 */ UInt guest_GPR0;
|
|
58
|
+
/* 4 */ UInt guest_GPR1;
|
|
59
|
+
/* 8 */ UInt guest_GPR2;
|
|
60
|
+
/* 12 */ UInt guest_GPR3;
|
|
61
|
+
/* 16 */ UInt guest_GPR4;
|
|
62
|
+
/* 20 */ UInt guest_GPR5;
|
|
63
|
+
/* 24 */ UInt guest_GPR6;
|
|
64
|
+
/* 28 */ UInt guest_GPR7;
|
|
65
|
+
/* 32 */ UInt guest_GPR8;
|
|
66
|
+
/* 36 */ UInt guest_GPR9;
|
|
67
|
+
/* 40 */ UInt guest_GPR10;
|
|
68
|
+
/* 44 */ UInt guest_GPR11;
|
|
69
|
+
/* 48 */ UInt guest_GPR12;
|
|
70
|
+
/* 52 */ UInt guest_GPR13;
|
|
71
|
+
/* 56 */ UInt guest_GPR14;
|
|
72
|
+
/* 60 */ UInt guest_GPR15;
|
|
73
|
+
/* 64 */ UInt guest_GPR16;
|
|
74
|
+
/* 68 */ UInt guest_GPR17;
|
|
75
|
+
/* 72 */ UInt guest_GPR18;
|
|
76
|
+
/* 76 */ UInt guest_GPR19;
|
|
77
|
+
/* 80 */ UInt guest_GPR20;
|
|
78
|
+
/* 84 */ UInt guest_GPR21;
|
|
79
|
+
/* 88 */ UInt guest_GPR22;
|
|
80
|
+
/* 92 */ UInt guest_GPR23;
|
|
81
|
+
/* 96 */ UInt guest_GPR24;
|
|
82
|
+
/* 100 */ UInt guest_GPR25;
|
|
83
|
+
/* 104 */ UInt guest_GPR26;
|
|
84
|
+
/* 108 */ UInt guest_GPR27;
|
|
85
|
+
/* 112 */ UInt guest_GPR28;
|
|
86
|
+
/* 116 */ UInt guest_GPR29;
|
|
87
|
+
/* 120 */ UInt guest_GPR30;
|
|
88
|
+
/* 124 */ UInt guest_GPR31;
|
|
89
|
+
|
|
90
|
+
// Vector Registers, Floating Point Registers, and VSX Registers
|
|
91
|
+
// With ISA 2.06, the "Vector-Scalar Floating-point" category
|
|
92
|
+
// provides facilities to support vector and scalar binary floating-
|
|
93
|
+
// point operations. A unified register file is an integral part
|
|
94
|
+
// of this new facility, combining floating point and vector registers
|
|
95
|
+
// using a 64x128-bit vector. These are referred to as VSR[0..63].
|
|
96
|
+
// The floating point registers are now mapped into double word element 0
|
|
97
|
+
// of VSR[0..31]. The 32x128-bit vector registers defined by the "Vector
|
|
98
|
+
// Facility [Category: Vector]" are now mapped to VSR[32..63].
|
|
99
|
+
|
|
100
|
+
// IMPORTANT: the user of libvex must place the guest state so as
|
|
101
|
+
// to ensure that guest_VSR{0..63}, and any shadows thereof, are
|
|
102
|
+
// 16-aligned.
|
|
103
|
+
|
|
104
|
+
/* 128 */ U128 guest_VSR0;
|
|
105
|
+
/* 144 */ U128 guest_VSR1;
|
|
106
|
+
/* 160 */ U128 guest_VSR2;
|
|
107
|
+
/* 176 */ U128 guest_VSR3;
|
|
108
|
+
/* 192 */ U128 guest_VSR4;
|
|
109
|
+
/* 208 */ U128 guest_VSR5;
|
|
110
|
+
/* 224 */ U128 guest_VSR6;
|
|
111
|
+
/* 240 */ U128 guest_VSR7;
|
|
112
|
+
/* 256 */ U128 guest_VSR8;
|
|
113
|
+
/* 272 */ U128 guest_VSR9;
|
|
114
|
+
/* 288 */ U128 guest_VSR10;
|
|
115
|
+
/* 304 */ U128 guest_VSR11;
|
|
116
|
+
/* 320 */ U128 guest_VSR12;
|
|
117
|
+
/* 336 */ U128 guest_VSR13;
|
|
118
|
+
/* 352 */ U128 guest_VSR14;
|
|
119
|
+
/* 368 */ U128 guest_VSR15;
|
|
120
|
+
/* 384 */ U128 guest_VSR16;
|
|
121
|
+
/* 400 */ U128 guest_VSR17;
|
|
122
|
+
/* 416 */ U128 guest_VSR18;
|
|
123
|
+
/* 432 */ U128 guest_VSR19;
|
|
124
|
+
/* 448 */ U128 guest_VSR20;
|
|
125
|
+
/* 464 */ U128 guest_VSR21;
|
|
126
|
+
/* 480 */ U128 guest_VSR22;
|
|
127
|
+
/* 496 */ U128 guest_VSR23;
|
|
128
|
+
/* 512 */ U128 guest_VSR24;
|
|
129
|
+
/* 528 */ U128 guest_VSR25;
|
|
130
|
+
/* 544 */ U128 guest_VSR26;
|
|
131
|
+
/* 560 */ U128 guest_VSR27;
|
|
132
|
+
/* 576 */ U128 guest_VSR28;
|
|
133
|
+
/* 592 */ U128 guest_VSR29;
|
|
134
|
+
/* 608 */ U128 guest_VSR30;
|
|
135
|
+
/* 624 */ U128 guest_VSR31;
|
|
136
|
+
/* 640 */ U128 guest_VSR32;
|
|
137
|
+
/* 656 */ U128 guest_VSR33;
|
|
138
|
+
/* 672 */ U128 guest_VSR34;
|
|
139
|
+
/* 688 */ U128 guest_VSR35;
|
|
140
|
+
/* 704 */ U128 guest_VSR36;
|
|
141
|
+
/* 720 */ U128 guest_VSR37;
|
|
142
|
+
/* 736 */ U128 guest_VSR38;
|
|
143
|
+
/* 752 */ U128 guest_VSR39;
|
|
144
|
+
/* 768 */ U128 guest_VSR40;
|
|
145
|
+
/* 784 */ U128 guest_VSR41;
|
|
146
|
+
/* 800 */ U128 guest_VSR42;
|
|
147
|
+
/* 816 */ U128 guest_VSR43;
|
|
148
|
+
/* 832 */ U128 guest_VSR44;
|
|
149
|
+
/* 848 */ U128 guest_VSR45;
|
|
150
|
+
/* 864 */ U128 guest_VSR46;
|
|
151
|
+
/* 880 */ U128 guest_VSR47;
|
|
152
|
+
/* 896 */ U128 guest_VSR48;
|
|
153
|
+
/* 912 */ U128 guest_VSR49;
|
|
154
|
+
/* 928 */ U128 guest_VSR50;
|
|
155
|
+
/* 944 */ U128 guest_VSR51;
|
|
156
|
+
/* 960 */ U128 guest_VSR52;
|
|
157
|
+
/* 976 */ U128 guest_VSR53;
|
|
158
|
+
/* 992 */ U128 guest_VSR54;
|
|
159
|
+
/* 1008 */ U128 guest_VSR55;
|
|
160
|
+
/* 1024 */ U128 guest_VSR56;
|
|
161
|
+
/* 1040 */ U128 guest_VSR57;
|
|
162
|
+
/* 1056 */ U128 guest_VSR58;
|
|
163
|
+
/* 1072 */ U128 guest_VSR59;
|
|
164
|
+
/* 1088 */ U128 guest_VSR60;
|
|
165
|
+
/* 1104 */ U128 guest_VSR61;
|
|
166
|
+
/* 1120 */ U128 guest_VSR62;
|
|
167
|
+
/* 1136 */ U128 guest_VSR63;
|
|
168
|
+
|
|
169
|
+
/* 1152 */ UInt guest_CIA; // IP (no arch visible register)
|
|
170
|
+
/* 1156 */ UInt guest_LR; // Link Register
|
|
171
|
+
/* 1160 */ UInt guest_CTR; // Count Register
|
|
172
|
+
|
|
173
|
+
/* XER pieces */
|
|
174
|
+
/* 1164 */ UChar guest_XER_SO; /* in lsb */
|
|
175
|
+
/* 1165 */ UChar guest_XER_OV; /* in lsb */
|
|
176
|
+
/* 1166 */ UChar guest_XER_CA; /* in lsb */
|
|
177
|
+
/* 1167 */ UChar guest_XER_BC; /* all bits */
|
|
178
|
+
|
|
179
|
+
/* CR pieces */
|
|
180
|
+
/* 1168 */ UChar guest_CR0_321; /* in [3:1] */
|
|
181
|
+
/* 1169 */ UChar guest_CR0_0; /* in lsb */
|
|
182
|
+
/* 1170 */ UChar guest_CR1_321; /* in [3:1] */
|
|
183
|
+
/* 1171 */ UChar guest_CR1_0; /* in lsb */
|
|
184
|
+
/* 1172 */ UChar guest_CR2_321; /* in [3:1] */
|
|
185
|
+
/* 1173 */ UChar guest_CR2_0; /* in lsb */
|
|
186
|
+
/* 1174 */ UChar guest_CR3_321; /* in [3:1] */
|
|
187
|
+
/* 1175 */ UChar guest_CR3_0; /* in lsb */
|
|
188
|
+
/* 1176 */ UChar guest_CR4_321; /* in [3:1] */
|
|
189
|
+
/* 1177 */ UChar guest_CR4_0; /* in lsb */
|
|
190
|
+
/* 1178 */ UChar guest_CR5_321; /* in [3:1] */
|
|
191
|
+
/* 1179 */ UChar guest_CR5_0; /* in lsb */
|
|
192
|
+
/* 1180 */ UChar guest_CR6_321; /* in [3:1] */
|
|
193
|
+
/* 1181 */ UChar guest_CR6_0; /* in lsb */
|
|
194
|
+
/* 1182 */ UChar guest_CR7_321; /* in [3:1] */
|
|
195
|
+
/* 1183 */ UChar guest_CR7_0; /* in lsb */
|
|
196
|
+
|
|
197
|
+
/* FP Status and Control Register fields. Only rounding mode fields
|
|
198
|
+
* and Floating-point Condition Code (FPCC) fields in the FPSCR are
|
|
199
|
+
* supported.
|
|
200
|
+
*/
|
|
201
|
+
/* 1184 */ UChar guest_FPROUND; // Binary Floating Point Rounding Mode
|
|
202
|
+
/* 1185 */ UChar guest_DFPROUND; // Decimal Floating Point Rounding Mode
|
|
203
|
+
/* 1186 */ UChar guest_C_FPCC; // Floating-Point Result Class Descriptor
|
|
204
|
+
// and Floating-point Condition Code
|
|
205
|
+
/* 1187 */ UChar pad2;
|
|
206
|
+
|
|
207
|
+
/* Vector Save/Restore Register */
|
|
208
|
+
/* 1188 */ UInt guest_VRSAVE;
|
|
209
|
+
|
|
210
|
+
/* Vector Status and Control Register */
|
|
211
|
+
/* 1192 */ UInt guest_VSCR;
|
|
212
|
+
|
|
213
|
+
/* Emulation notes */
|
|
214
|
+
/* 1196 */ UInt guest_EMNOTE;
|
|
215
|
+
|
|
216
|
+
/* For icbi: record start and length of area to invalidate */
|
|
217
|
+
/* 1200 */ UInt guest_CMSTART;
|
|
218
|
+
/* 1204 */ UInt guest_CMLEN;
|
|
219
|
+
|
|
220
|
+
/* Used to record the unredirected guest address at the start of
|
|
221
|
+
a translation whose start has been redirected. By reading
|
|
222
|
+
this pseudo-register shortly afterwards, the translation can
|
|
223
|
+
find out what the corresponding no-redirection address was.
|
|
224
|
+
Note, this is only set for wrap-style redirects, not for
|
|
225
|
+
replace-style ones. */
|
|
226
|
+
/* 1208 */ UInt guest_NRADDR;
|
|
227
|
+
/* 1212 */ UInt guest_NRADDR_GPR2; /* needed by aix */
|
|
228
|
+
|
|
229
|
+
/* A grows-upwards stack for hidden saves/restores of LR and R2
|
|
230
|
+
needed for function interception and wrapping on ppc32-aix5.
|
|
231
|
+
A horrible hack. REDIR_SP points to the highest live entry,
|
|
232
|
+
and so starts at -1. */
|
|
233
|
+
/* 1216 */ UInt guest_REDIR_SP;
|
|
234
|
+
/* 1220 */ UInt guest_REDIR_STACK[VEX_GUEST_PPC32_REDIR_STACK_SIZE];
|
|
235
|
+
|
|
236
|
+
/* Needed for Darwin (but mandated for all guest architectures):
|
|
237
|
+
CIA at the last SC insn. Used when backing up to restart a
|
|
238
|
+
syscall that has been interrupted by a signal. */
|
|
239
|
+
/* 1348 */ UInt guest_IP_AT_SYSCALL;
|
|
240
|
+
|
|
241
|
+
/* SPRG3, which AIUI is readonly in user space. Needed for
|
|
242
|
+
threading on AIX. */
|
|
243
|
+
/* 1352 */ UInt guest_SPRG3_RO;
|
|
244
|
+
/* 1356 */ UInt padding1;
|
|
245
|
+
/* 1360 */ ULong guest_TFHAR; // Transaction Failure Handler Address Register
|
|
246
|
+
/* 1368 */ ULong guest_TEXASR; // Transaction EXception And Summary Register
|
|
247
|
+
/* 1376 */ ULong guest_TFIAR; // Transaction Failure Instruction Address Register
|
|
248
|
+
/* 1384 */ ULong guest_PPR; // Program Priority register
|
|
249
|
+
/* 1392 */ UInt guest_TEXASRU; // Transaction EXception And Summary Register Upper
|
|
250
|
+
/* 1396 */ UInt guest_PSPB; // Problem State Priority Boost register
|
|
251
|
+
/* Padding to make it have an 16-aligned size */
|
|
252
|
+
/* 1400 */ UInt padding2;
|
|
253
|
+
/* 1404 */ UInt padding3;
|
|
254
|
+
}
|
|
255
|
+
VexGuestPPC32State;
|
|
256
|
+
|
|
257
|
+
|
|
258
|
+
/*---------------------------------------------------------------*/
|
|
259
|
+
/*--- Utility functions for PPC32 guest stuff. ---*/
|
|
260
|
+
/*---------------------------------------------------------------*/
|
|
261
|
+
|
|
262
|
+
/* ALL THE FOLLOWING ARE VISIBLE TO LIBRARY CLIENT */
|
|
263
|
+
|
|
264
|
+
/* Initialise all guest PPC32 state. */
|
|
265
|
+
|
|
266
|
+
extern
|
|
267
|
+
void LibVEX_GuestPPC32_initialise ( /*OUT*/VexGuestPPC32State* vex_state );
|
|
268
|
+
|
|
269
|
+
|
|
270
|
+
/* Write the given native %CR value to the supplied VexGuestPPC32State
|
|
271
|
+
structure. */
|
|
272
|
+
extern
|
|
273
|
+
void LibVEX_GuestPPC32_put_CR ( UInt cr_native,
|
|
274
|
+
/*OUT*/VexGuestPPC32State* vex_state );
|
|
275
|
+
|
|
276
|
+
/* Extract from the supplied VexGuestPPC32State structure the
|
|
277
|
+
corresponding native %CR value. */
|
|
278
|
+
extern
|
|
279
|
+
UInt LibVEX_GuestPPC32_get_CR ( /*IN*/const VexGuestPPC32State* vex_state );
|
|
280
|
+
|
|
281
|
+
|
|
282
|
+
/* Write the given native %XER value to the supplied VexGuestPPC32State
|
|
283
|
+
structure. */
|
|
284
|
+
extern
|
|
285
|
+
void LibVEX_GuestPPC32_put_XER ( UInt xer_native,
|
|
286
|
+
/*OUT*/VexGuestPPC32State* vex_state );
|
|
287
|
+
|
|
288
|
+
/* Extract from the supplied VexGuestPPC32State structure the
|
|
289
|
+
corresponding native %XER value. */
|
|
290
|
+
extern
|
|
291
|
+
UInt LibVEX_GuestPPC32_get_XER ( /*IN*/const VexGuestPPC32State* vex_state );
|
|
292
|
+
|
|
293
|
+
#endif /* ndef __LIBVEX_PUB_GUEST_PPC32_H */
|
|
294
|
+
|
|
295
|
+
|
|
296
|
+
/*---------------------------------------------------------------*/
|
|
297
|
+
/*--- libvex_guest_ppc32.h ---*/
|
|
298
|
+
/*---------------------------------------------------------------*/
|
|
@@ -0,0 +1,343 @@
|
|
|
1
|
+
|
|
2
|
+
/*---------------------------------------------------------------*/
|
|
3
|
+
/*--- begin libvex_guest_ppc64.h ---*/
|
|
4
|
+
/*---------------------------------------------------------------*/
|
|
5
|
+
|
|
6
|
+
/*
|
|
7
|
+
This file is part of Valgrind, a dynamic binary instrumentation
|
|
8
|
+
framework.
|
|
9
|
+
|
|
10
|
+
Copyright (C) 2004-2015 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
|
+
#ifndef __LIBVEX_PUB_GUEST_PPC64_H
|
|
37
|
+
#define __LIBVEX_PUB_GUEST_PPC64_H
|
|
38
|
+
|
|
39
|
+
#include "libvex_basictypes.h"
|
|
40
|
+
|
|
41
|
+
/*
|
|
42
|
+
volatile == caller-saved (not preserved across function calls)
|
|
43
|
+
non-volatile == callee-saved (preserved across function calls)
|
|
44
|
+
|
|
45
|
+
r0 Volatile register used in function prologs
|
|
46
|
+
r1 Stack frame pointer
|
|
47
|
+
r2 TOC pointer
|
|
48
|
+
r3 Volatile parameter and return value register
|
|
49
|
+
r4-r10 Volatile registers used for function parameters
|
|
50
|
+
r11 Volatile register used in calls by pointer and as an
|
|
51
|
+
environment pointer for languages which require one
|
|
52
|
+
r12 Volatile register used for exception handling and glink code
|
|
53
|
+
r13 Reserved for use as system thread ID
|
|
54
|
+
r14-r31 Nonvolatile registers used for local variables
|
|
55
|
+
|
|
56
|
+
f0 Volatile scratch register
|
|
57
|
+
f1-f4 Volatile floating point parameter and return value registers
|
|
58
|
+
f5-f13 Volatile floating point parameter registers
|
|
59
|
+
f14-f31 Nonvolatile registers
|
|
60
|
+
|
|
61
|
+
LR Link register (volatile)
|
|
62
|
+
CTR Loop counter register (volatile)
|
|
63
|
+
XER Fixed point exception register (volatile)
|
|
64
|
+
FPSCR Floating point status and control register (volatile)
|
|
65
|
+
|
|
66
|
+
CR0-CR1 Volatile condition code register fields
|
|
67
|
+
CR2-CR4 Nonvolatile condition code register fields
|
|
68
|
+
CR5-CR7 Volatile condition code register fields
|
|
69
|
+
|
|
70
|
+
On processors with the VMX feature.
|
|
71
|
+
|
|
72
|
+
v0-v1 Volatile scratch registers
|
|
73
|
+
v2-v13 Volatile vector parameters registers
|
|
74
|
+
v14-v19 Volatile scratch registers
|
|
75
|
+
v20-v31 Non-volatile registers
|
|
76
|
+
vrsave Non-volatile 32-bit register
|
|
77
|
+
*/
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
/*---------------------------------------------------------------*/
|
|
81
|
+
/*--- Vex's representation of the PPC64 CPU state ---*/
|
|
82
|
+
/*---------------------------------------------------------------*/
|
|
83
|
+
|
|
84
|
+
#define VEX_GUEST_PPC64_REDIR_STACK_SIZE (16/*entries*/ * 2/*words per entry*/)
|
|
85
|
+
|
|
86
|
+
typedef
|
|
87
|
+
struct {
|
|
88
|
+
/* Event check fail addr, counter, and padding to make GPR0 16
|
|
89
|
+
aligned. */
|
|
90
|
+
/* 0 */ ULong host_EvC_FAILADDR;
|
|
91
|
+
/* 8 */ UInt host_EvC_COUNTER;
|
|
92
|
+
/* 12 */ UInt pad0;
|
|
93
|
+
/* Add 16 to all of the offsets below .. */
|
|
94
|
+
/* General Purpose Registers */
|
|
95
|
+
/* 0 */ ULong guest_GPR0;
|
|
96
|
+
/* 8 */ ULong guest_GPR1;
|
|
97
|
+
/* 16 */ ULong guest_GPR2;
|
|
98
|
+
/* 24 */ ULong guest_GPR3;
|
|
99
|
+
/* 32 */ ULong guest_GPR4;
|
|
100
|
+
/* 40 */ ULong guest_GPR5;
|
|
101
|
+
/* 48 */ ULong guest_GPR6;
|
|
102
|
+
/* 56 */ ULong guest_GPR7;
|
|
103
|
+
/* 64 */ ULong guest_GPR8;
|
|
104
|
+
/* 72 */ ULong guest_GPR9;
|
|
105
|
+
/* 80 */ ULong guest_GPR10;
|
|
106
|
+
/* 88 */ ULong guest_GPR11;
|
|
107
|
+
/* 96 */ ULong guest_GPR12;
|
|
108
|
+
/* 104 */ ULong guest_GPR13;
|
|
109
|
+
/* 112 */ ULong guest_GPR14;
|
|
110
|
+
/* 120 */ ULong guest_GPR15;
|
|
111
|
+
/* 128 */ ULong guest_GPR16;
|
|
112
|
+
/* 136 */ ULong guest_GPR17;
|
|
113
|
+
/* 144 */ ULong guest_GPR18;
|
|
114
|
+
/* 152 */ ULong guest_GPR19;
|
|
115
|
+
/* 160 */ ULong guest_GPR20;
|
|
116
|
+
/* 168 */ ULong guest_GPR21;
|
|
117
|
+
/* 176 */ ULong guest_GPR22;
|
|
118
|
+
/* 184 */ ULong guest_GPR23;
|
|
119
|
+
/* 192 */ ULong guest_GPR24;
|
|
120
|
+
/* 200 */ ULong guest_GPR25;
|
|
121
|
+
/* 208 */ ULong guest_GPR26;
|
|
122
|
+
/* 216 */ ULong guest_GPR27;
|
|
123
|
+
/* 224 */ ULong guest_GPR28;
|
|
124
|
+
/* 232 */ ULong guest_GPR29;
|
|
125
|
+
/* 240 */ ULong guest_GPR30;
|
|
126
|
+
/* 248 */ ULong guest_GPR31;
|
|
127
|
+
|
|
128
|
+
// Vector Registers, Floating Point Registers, and VSX Registers
|
|
129
|
+
// With ISA 2.06, the "Vector-Scalar Floating-point" category
|
|
130
|
+
// provides facilities to support vector and scalar binary floating-
|
|
131
|
+
// point operations. A unified register file is an integral part
|
|
132
|
+
// of this new facility, combining floating point and vector registers
|
|
133
|
+
// using a 64x128-bit vector. These are referred to as VSR[0..63].
|
|
134
|
+
// The floating point registers are now mapped into double word element 0
|
|
135
|
+
// of VSR[0..31]. The 32x128-bit vector registers defined by the "Vector
|
|
136
|
+
// Facility [Category: Vector]" are now mapped to VSR[32..63].
|
|
137
|
+
|
|
138
|
+
// IMPORTANT: the user of libvex must place the guest state so as
|
|
139
|
+
// to ensure that guest_VSR{0..63}, and any shadows thereof, are
|
|
140
|
+
// 16-aligned.
|
|
141
|
+
|
|
142
|
+
/* 256 */ U128 guest_VSR0;
|
|
143
|
+
/* 272 */ U128 guest_VSR1;
|
|
144
|
+
/* 288 */ U128 guest_VSR2;
|
|
145
|
+
/* 304 */ U128 guest_VSR3;
|
|
146
|
+
/* 320 */ U128 guest_VSR4;
|
|
147
|
+
/* 336 */ U128 guest_VSR5;
|
|
148
|
+
/* 352 */ U128 guest_VSR6;
|
|
149
|
+
/* 368 */ U128 guest_VSR7;
|
|
150
|
+
/* 384 */ U128 guest_VSR8;
|
|
151
|
+
/* 400 */ U128 guest_VSR9;
|
|
152
|
+
/* 416 */ U128 guest_VSR10;
|
|
153
|
+
/* 432 */ U128 guest_VSR11;
|
|
154
|
+
/* 448 */ U128 guest_VSR12;
|
|
155
|
+
/* 464 */ U128 guest_VSR13;
|
|
156
|
+
/* 480 */ U128 guest_VSR14;
|
|
157
|
+
/* 496 */ U128 guest_VSR15;
|
|
158
|
+
/* 512 */ U128 guest_VSR16;
|
|
159
|
+
/* 528 */ U128 guest_VSR17;
|
|
160
|
+
/* 544 */ U128 guest_VSR18;
|
|
161
|
+
/* 560 */ U128 guest_VSR19;
|
|
162
|
+
/* 576 */ U128 guest_VSR20;
|
|
163
|
+
/* 592 */ U128 guest_VSR21;
|
|
164
|
+
/* 608 */ U128 guest_VSR22;
|
|
165
|
+
/* 624 */ U128 guest_VSR23;
|
|
166
|
+
/* 640 */ U128 guest_VSR24;
|
|
167
|
+
/* 656 */ U128 guest_VSR25;
|
|
168
|
+
/* 672 */ U128 guest_VSR26;
|
|
169
|
+
/* 688 */ U128 guest_VSR27;
|
|
170
|
+
/* 704 */ U128 guest_VSR28;
|
|
171
|
+
/* 720 */ U128 guest_VSR29;
|
|
172
|
+
/* 736 */ U128 guest_VSR30;
|
|
173
|
+
/* 752 */ U128 guest_VSR31;
|
|
174
|
+
/* 768 */ U128 guest_VSR32;
|
|
175
|
+
/* 784 */ U128 guest_VSR33;
|
|
176
|
+
/* 800 */ U128 guest_VSR34;
|
|
177
|
+
/* 816 */ U128 guest_VSR35;
|
|
178
|
+
/* 832 */ U128 guest_VSR36;
|
|
179
|
+
/* 848 */ U128 guest_VSR37;
|
|
180
|
+
/* 864 */ U128 guest_VSR38;
|
|
181
|
+
/* 880 */ U128 guest_VSR39;
|
|
182
|
+
/* 896 */ U128 guest_VSR40;
|
|
183
|
+
/* 912 */ U128 guest_VSR41;
|
|
184
|
+
/* 928 */ U128 guest_VSR42;
|
|
185
|
+
/* 944 */ U128 guest_VSR43;
|
|
186
|
+
/* 960 */ U128 guest_VSR44;
|
|
187
|
+
/* 976 */ U128 guest_VSR45;
|
|
188
|
+
/* 992 */ U128 guest_VSR46;
|
|
189
|
+
/* 1008 */ U128 guest_VSR47;
|
|
190
|
+
/* 1024 */ U128 guest_VSR48;
|
|
191
|
+
/* 1040 */ U128 guest_VSR49;
|
|
192
|
+
/* 1056 */ U128 guest_VSR50;
|
|
193
|
+
/* 1072 */ U128 guest_VSR51;
|
|
194
|
+
/* 1088 */ U128 guest_VSR52;
|
|
195
|
+
/* 1104 */ U128 guest_VSR53;
|
|
196
|
+
/* 1120 */ U128 guest_VSR54;
|
|
197
|
+
/* 1136 */ U128 guest_VSR55;
|
|
198
|
+
/* 1152 */ U128 guest_VSR56;
|
|
199
|
+
/* 1168 */ U128 guest_VSR57;
|
|
200
|
+
/* 1184 */ U128 guest_VSR58;
|
|
201
|
+
/* 1200 */ U128 guest_VSR59;
|
|
202
|
+
/* 1216 */ U128 guest_VSR60;
|
|
203
|
+
/* 1232 */ U128 guest_VSR61;
|
|
204
|
+
/* 1248 */ U128 guest_VSR62;
|
|
205
|
+
/* 1264 */ U128 guest_VSR63;
|
|
206
|
+
|
|
207
|
+
/* 1280 */ ULong guest_CIA; // IP (no arch visible register)
|
|
208
|
+
/* 1288 */ ULong guest_LR; // Link Register
|
|
209
|
+
/* 1296 */ ULong guest_CTR; // Count Register
|
|
210
|
+
|
|
211
|
+
/* XER pieces */
|
|
212
|
+
/* 1304 */ UChar guest_XER_SO; /* in lsb */
|
|
213
|
+
/* 1305 */ UChar guest_XER_OV; /* in lsb */
|
|
214
|
+
/* 1306 */ UChar guest_XER_CA; /* in lsb */
|
|
215
|
+
/* 1307 */ UChar guest_XER_BC; /* all bits */
|
|
216
|
+
|
|
217
|
+
/* CR pieces */
|
|
218
|
+
/* 1308 */ UChar guest_CR0_321; /* in [3:1] */
|
|
219
|
+
/* 1309 */ UChar guest_CR0_0; /* in lsb */
|
|
220
|
+
/* 1310 */ UChar guest_CR1_321; /* in [3:1] */
|
|
221
|
+
/* 1311 */ UChar guest_CR1_0; /* in lsb */
|
|
222
|
+
/* 1312 */ UChar guest_CR2_321; /* in [3:1] */
|
|
223
|
+
/* 1313 */ UChar guest_CR2_0; /* in lsb */
|
|
224
|
+
/* 1314 */ UChar guest_CR3_321; /* in [3:1] */
|
|
225
|
+
/* 1315 */ UChar guest_CR3_0; /* in lsb */
|
|
226
|
+
/* 1316 */ UChar guest_CR4_321; /* in [3:1] */
|
|
227
|
+
/* 1317 */ UChar guest_CR4_0; /* in lsb */
|
|
228
|
+
/* 1318 */ UChar guest_CR5_321; /* in [3:1] */
|
|
229
|
+
/* 1319 */ UChar guest_CR5_0; /* in lsb */
|
|
230
|
+
/* 1320 */ UChar guest_CR6_321; /* in [3:1] */
|
|
231
|
+
/* 1321 */ UChar guest_CR6_0; /* in lsb */
|
|
232
|
+
/* 1322 */ UChar guest_CR7_321; /* in [3:1] */
|
|
233
|
+
/* 1323 */ UChar guest_CR7_0; /* in lsb */
|
|
234
|
+
|
|
235
|
+
/* FP Status and Control Register fields. Only rounding mode fields
|
|
236
|
+
* and Floating-point Condition Code (FPCC) fields are supported.
|
|
237
|
+
*/
|
|
238
|
+
/* 1324 */ UChar guest_FPROUND; // Binary Floating Point Rounding Mode
|
|
239
|
+
/* 1325 */ UChar guest_DFPROUND; // Decimal Floating Point Rounding Mode
|
|
240
|
+
/* 1326 */ UChar guest_C_FPCC; // Floating-point Condition Code
|
|
241
|
+
// and Floating-point Condition Code
|
|
242
|
+
|
|
243
|
+
/* 1327 */ UChar pad2;
|
|
244
|
+
|
|
245
|
+
/* Vector Save/Restore Register */
|
|
246
|
+
/* 1328 */ UInt guest_VRSAVE;
|
|
247
|
+
|
|
248
|
+
/* Vector Status and Control Register */
|
|
249
|
+
/* 1332 */ UInt guest_VSCR;
|
|
250
|
+
|
|
251
|
+
/* Emulation notes */
|
|
252
|
+
/* 1336 */ UInt guest_EMNOTE;
|
|
253
|
+
|
|
254
|
+
/* gcc adds 4 bytes padding here: pre-empt it. */
|
|
255
|
+
/* 1340 */ UInt padding;
|
|
256
|
+
|
|
257
|
+
/* For icbi: record start and length of area to invalidate */
|
|
258
|
+
/* 1344 */ ULong guest_CMSTART;
|
|
259
|
+
/* 1352 */ ULong guest_CMLEN;
|
|
260
|
+
|
|
261
|
+
/* Used to record the unredirected guest address at the start of
|
|
262
|
+
a translation whose start has been redirected. By reading
|
|
263
|
+
this pseudo-register shortly afterwards, the translation can
|
|
264
|
+
find out what the corresponding no-redirection address was.
|
|
265
|
+
Note, this is only set for wrap-style redirects, not for
|
|
266
|
+
replace-style ones. */
|
|
267
|
+
/* 1360 */ ULong guest_NRADDR;
|
|
268
|
+
/* 1368 */ ULong guest_NRADDR_GPR2;
|
|
269
|
+
|
|
270
|
+
/* A grows-upwards stack for hidden saves/restores of LR and R2
|
|
271
|
+
needed for function interception and wrapping on ppc64-linux.
|
|
272
|
+
A horrible hack. REDIR_SP points to the highest live entry,
|
|
273
|
+
and so starts at -1. */
|
|
274
|
+
/* 1376 */ ULong guest_REDIR_SP;
|
|
275
|
+
/* 1384 */ ULong guest_REDIR_STACK[VEX_GUEST_PPC64_REDIR_STACK_SIZE];
|
|
276
|
+
|
|
277
|
+
/* Needed for Darwin: CIA at the last SC insn. Used when backing up
|
|
278
|
+
to restart a syscall that has been interrupted by a signal. */
|
|
279
|
+
/* 1640 */ ULong guest_IP_AT_SYSCALL;
|
|
280
|
+
|
|
281
|
+
/* SPRG3, which AIUI is readonly in user space. Needed for
|
|
282
|
+
threading on AIX. */
|
|
283
|
+
/* 1648 */ ULong guest_SPRG3_RO;
|
|
284
|
+
|
|
285
|
+
/* 1656 */ ULong guest_TFHAR; // Transaction Failure Handler Address Register
|
|
286
|
+
/* 1664 */ ULong guest_TEXASR; // Transaction EXception And Summary Register
|
|
287
|
+
/* 1672 */ ULong guest_TFIAR; // Transaction Failure Instruction Address Register
|
|
288
|
+
/* 1680 */ ULong guest_PPR; // Program Priority register
|
|
289
|
+
/* 1688 */ UInt guest_TEXASRU; // Transaction EXception And Summary Register Upper
|
|
290
|
+
/* 1692 */ UInt guest_PSPB; // Problem State Priority Boost register
|
|
291
|
+
|
|
292
|
+
/* Padding to make it have an 16-aligned size */
|
|
293
|
+
/* 1696 UInt padding1; currently not needed */
|
|
294
|
+
/* 1700 UInt padding2; currently not needed */
|
|
295
|
+
/* 1708 UInt padding3; currently not needed */
|
|
296
|
+
|
|
297
|
+
}
|
|
298
|
+
VexGuestPPC64State;
|
|
299
|
+
|
|
300
|
+
|
|
301
|
+
/*---------------------------------------------------------------*/
|
|
302
|
+
/*--- Utility functions for PPC64 guest stuff. ---*/
|
|
303
|
+
/*---------------------------------------------------------------*/
|
|
304
|
+
|
|
305
|
+
/* ALL THE FOLLOWING ARE VISIBLE TO LIBRARY CLIENT */
|
|
306
|
+
|
|
307
|
+
/* Initialise all guest PPC64 state. */
|
|
308
|
+
extern
|
|
309
|
+
void LibVEX_GuestPPC64_initialise ( /*OUT*/VexGuestPPC64State* vex_state );
|
|
310
|
+
|
|
311
|
+
|
|
312
|
+
/* Write the given native %CR value to the supplied VexGuestPPC64State
|
|
313
|
+
structure. Note, %CR is 32-bits even for ppc64. */
|
|
314
|
+
extern
|
|
315
|
+
void LibVEX_GuestPPC64_put_CR ( UInt cr_native,
|
|
316
|
+
/*OUT*/VexGuestPPC64State* vex_state );
|
|
317
|
+
|
|
318
|
+
/* Extract from the supplied VexGuestPPC64State structure the
|
|
319
|
+
corresponding native %CR value. Note, %CR is 32-bits even for
|
|
320
|
+
ppc64. */
|
|
321
|
+
extern
|
|
322
|
+
UInt LibVEX_GuestPPC64_get_CR ( /*IN*/const VexGuestPPC64State* vex_state );
|
|
323
|
+
|
|
324
|
+
|
|
325
|
+
/* Write the given native %XER value to the supplied
|
|
326
|
+
VexGuestPPC64State structure. Note, %XER is 32-bits even for
|
|
327
|
+
ppc64. */
|
|
328
|
+
extern
|
|
329
|
+
void LibVEX_GuestPPC64_put_XER ( UInt xer_native,
|
|
330
|
+
/*OUT*/VexGuestPPC64State* vex_state );
|
|
331
|
+
|
|
332
|
+
/* Extract from the supplied VexGuestPPC64State structure the
|
|
333
|
+
corresponding native %XER value. Note, %CR is 32-bits even for
|
|
334
|
+
ppc64. */
|
|
335
|
+
extern
|
|
336
|
+
UInt LibVEX_GuestPPC64_get_XER ( /*IN*/const VexGuestPPC64State* vex_state );
|
|
337
|
+
|
|
338
|
+
#endif /* ndef __LIBVEX_PUB_GUEST_PPC64_H */
|
|
339
|
+
|
|
340
|
+
|
|
341
|
+
/*---------------------------------------------------------------*/
|
|
342
|
+
/*--- libvex_guest_ppc64.h ---*/
|
|
343
|
+
/*---------------------------------------------------------------*/
|