pyvex 9.2.189__cp312-cp312-win_amd64.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.
Files changed (60) hide show
  1. pyvex/__init__.py +92 -0
  2. pyvex/_register_info.py +1800 -0
  3. pyvex/arches.py +94 -0
  4. pyvex/block.py +697 -0
  5. pyvex/const.py +426 -0
  6. pyvex/const_val.py +26 -0
  7. pyvex/data_ref.py +55 -0
  8. pyvex/enums.py +156 -0
  9. pyvex/errors.py +31 -0
  10. pyvex/expr.py +974 -0
  11. pyvex/include/libvex.h +1029 -0
  12. pyvex/include/libvex_basictypes.h +236 -0
  13. pyvex/include/libvex_emnote.h +142 -0
  14. pyvex/include/libvex_guest_amd64.h +252 -0
  15. pyvex/include/libvex_guest_arm.h +224 -0
  16. pyvex/include/libvex_guest_arm64.h +203 -0
  17. pyvex/include/libvex_guest_mips32.h +175 -0
  18. pyvex/include/libvex_guest_mips64.h +173 -0
  19. pyvex/include/libvex_guest_offsets.h +941 -0
  20. pyvex/include/libvex_guest_ppc32.h +298 -0
  21. pyvex/include/libvex_guest_ppc64.h +343 -0
  22. pyvex/include/libvex_guest_riscv64.h +148 -0
  23. pyvex/include/libvex_guest_s390x.h +201 -0
  24. pyvex/include/libvex_guest_tilegx.h +149 -0
  25. pyvex/include/libvex_guest_x86.h +322 -0
  26. pyvex/include/libvex_ir.h +3113 -0
  27. pyvex/include/libvex_s390x_common.h +123 -0
  28. pyvex/include/libvex_trc_values.h +99 -0
  29. pyvex/include/pyvex.h +96 -0
  30. pyvex/lib/pyvex.dll +0 -0
  31. pyvex/lib/pyvex.lib +0 -0
  32. pyvex/lifting/__init__.py +18 -0
  33. pyvex/lifting/gym/README.md +7 -0
  34. pyvex/lifting/gym/__init__.py +5 -0
  35. pyvex/lifting/gym/aarch64_spotter.py +40 -0
  36. pyvex/lifting/gym/arm_spotter.py +427 -0
  37. pyvex/lifting/gym/x86_spotter.py +129 -0
  38. pyvex/lifting/libvex.py +117 -0
  39. pyvex/lifting/lift_function.py +304 -0
  40. pyvex/lifting/lifter.py +124 -0
  41. pyvex/lifting/post_processor.py +16 -0
  42. pyvex/lifting/util/__init__.py +14 -0
  43. pyvex/lifting/util/instr_helper.py +422 -0
  44. pyvex/lifting/util/lifter_helper.py +154 -0
  45. pyvex/lifting/util/syntax_wrapper.py +312 -0
  46. pyvex/lifting/util/vex_helper.py +301 -0
  47. pyvex/lifting/zerodivision.py +71 -0
  48. pyvex/native.py +63 -0
  49. pyvex/py.typed +1 -0
  50. pyvex/stmt.py +740 -0
  51. pyvex/types.py +48 -0
  52. pyvex/utils.py +63 -0
  53. pyvex/vex_ffi.py +1452 -0
  54. pyvex-9.2.189.dist-info/METADATA +181 -0
  55. pyvex-9.2.189.dist-info/RECORD +60 -0
  56. pyvex-9.2.189.dist-info/WHEEL +5 -0
  57. pyvex-9.2.189.dist-info/licenses/LICENSE +24 -0
  58. pyvex-9.2.189.dist-info/licenses/pyvex_c/LICENSE +339 -0
  59. pyvex-9.2.189.dist-info/licenses/vex/LICENSE.GPL +340 -0
  60. pyvex-9.2.189.dist-info/licenses/vex/LICENSE.README +23 -0
@@ -0,0 +1,236 @@
1
+
2
+ /*---------------------------------------------------------------*/
3
+ /*--- begin libvex_basictypes.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_BASICTYPES_H
37
+ #define __LIBVEX_BASICTYPES_H
38
+
39
+ /* This is where we bootstrap msvc compatibility */
40
+ #ifndef _MSC_VER /* gcc/clang/etc stuff */
41
+ #define LIKELY(x) __builtin_expect(!!(x), 1)
42
+ #define UNLIKELY(x) __builtin_expect(!!(x), 0)
43
+ #define CAST_AS(x) (__typeof__(x))
44
+
45
+ #else /* msvc stuff */
46
+ #define LIKELY(x) (x)
47
+ #define UNLIKELY(x) (x)
48
+ #define CAST_AS(x)
49
+
50
+ #define __builtin_memset memset
51
+ #define __builtin_memcpy memcpy
52
+ #define __PRETTY_FUNCTION__ __FUNCDNAME__
53
+
54
+ #define __attribute__(x)
55
+ #define __attribute(x)
56
+ #define __inline__
57
+ #define inline
58
+ #endif
59
+
60
+ /* It is important that the sizes of the following data types (on the
61
+ host) are as stated. LibVEX_Init therefore checks these at
62
+ startup. */
63
+
64
+ /* Always 8 bits. */
65
+ typedef unsigned char UChar;
66
+ typedef signed char Char;
67
+ typedef char HChar; /* signfulness depends on host */
68
+ /* Only to be used for printf etc
69
+ format strings */
70
+
71
+ /* Always 16 bits. */
72
+ typedef unsigned short UShort;
73
+ typedef signed short Short;
74
+
75
+ /* Always 32 bits. */
76
+ typedef unsigned int UInt;
77
+ typedef signed int Int;
78
+
79
+ /* Always 64 bits. */
80
+ typedef unsigned long long int ULong;
81
+ typedef signed long long int Long;
82
+
83
+ /* Equivalent of C's size_t type. The type is unsigned and has this
84
+ storage requirement:
85
+ 32 bits on a 32-bit architecture
86
+ 64 bits on a 64-bit architecture. */
87
+ typedef unsigned long SizeT;
88
+
89
+ /* Always 128 bits. */
90
+ typedef UInt U128[4];
91
+
92
+ /* Always 256 bits. */
93
+ typedef UInt U256[8];
94
+
95
+ /* A union for doing 128-bit vector primitives conveniently. */
96
+ typedef
97
+ union {
98
+ UChar w8[16];
99
+ UShort w16[8];
100
+ UInt w32[4];
101
+ ULong w64[2];
102
+ }
103
+ V128;
104
+
105
+ /* A union for doing 256-bit vector primitives conveniently. */
106
+ typedef
107
+ union {
108
+ UChar w8[32];
109
+ UShort w16[16];
110
+ UInt w32[8];
111
+ ULong w64[4];
112
+ }
113
+ V256;
114
+
115
+ /* Floating point. */
116
+ typedef float Float; /* IEEE754 single-precision (32-bit) value */
117
+ typedef double Double; /* IEEE754 double-precision (64-bit) value */
118
+
119
+ /* Bool is always 8 bits. */
120
+ typedef unsigned char Bool;
121
+ #define True ((Bool)1)
122
+ #define False ((Bool)0)
123
+
124
+ /* Use this to coerce the result of a C comparison to a Bool. This is
125
+ useful when compiling with Intel icc with ultra-paranoid
126
+ compilation flags (-Wall). */
127
+ static inline Bool toBool ( Int x ) {
128
+ Int r = (x == 0) ? False : True;
129
+ return (Bool)r;
130
+ }
131
+ static inline UChar toUChar ( Int x ) {
132
+ x &= 0xFF;
133
+ return (UChar)x;
134
+ }
135
+ static inline HChar toHChar ( Int x ) {
136
+ x &= 0xFF;
137
+ return (HChar)x;
138
+ }
139
+ static inline UShort toUShort ( Int x ) {
140
+ x &= 0xFFFF;
141
+ return (UShort)x;
142
+ }
143
+ static inline Short toShort ( Int x ) {
144
+ x &= 0xFFFF;
145
+ return (Short)x;
146
+ }
147
+ static inline UInt toUInt ( Long x ) {
148
+ x &= 0xFFFFFFFFLL;
149
+ return (UInt)x;
150
+ }
151
+
152
+ /* 32/64 bit addresses. */
153
+ typedef UInt Addr32;
154
+ typedef ULong Addr64;
155
+
156
+ /* An address. In order to analyze 64-bit guests on 32-bit hosts, this must be
157
+ 64 bits wide. */
158
+ typedef Addr64 Addr;
159
+
160
+
161
+ /* Something which has the same size as void* on the host. That is,
162
+ it is 32 bits on a 32-bit host and 64 bits on a 64-bit host, and so
163
+ it can safely be coerced to and from a pointer type on the host
164
+ machine. */
165
+ #ifdef _WIN64
166
+ typedef unsigned long long HWord;
167
+ #else
168
+ typedef unsigned long HWord;
169
+ #endif
170
+
171
+ /* Set up VEX_HOST_WORDSIZE and VEX_REGPARM. */
172
+ #undef VEX_HOST_WORDSIZE
173
+ #undef VEX_REGPARM
174
+
175
+ /* The following 4 work OK for Linux. */
176
+ #if defined(__x86_64__) || defined(_WIN64)
177
+ # define VEX_HOST_WORDSIZE 8
178
+ # define VEX_REGPARM(_n) /* */
179
+
180
+ #elif defined(__i386__)
181
+ # define VEX_HOST_WORDSIZE 4
182
+ # define VEX_REGPARM(_n) __attribute__((regparm(_n)))
183
+
184
+ #elif defined(_WIN32) && !defined(_WIN64)
185
+ # define VEX_HOST_WORDSIZE 4
186
+ # define VEX_REGPARM(_n) /* ought to be __fastcall */
187
+
188
+ #elif defined(__powerpc__) && defined(__powerpc64__)
189
+ # define VEX_HOST_WORDSIZE 8
190
+ # define VEX_REGPARM(_n) /* */
191
+
192
+ #elif defined(__powerpc__) && !defined(__powerpc64__)
193
+ # define VEX_HOST_WORDSIZE 4
194
+ # define VEX_REGPARM(_n) /* */
195
+
196
+ #elif defined(__arm__) && !defined(__aarch64__)
197
+ # define VEX_HOST_WORDSIZE 4
198
+ # define VEX_REGPARM(_n) /* */
199
+
200
+ #elif defined(__aarch64__) && !defined(__arm__)
201
+ # define VEX_HOST_WORDSIZE 8
202
+ # define VEX_REGPARM(_n) /* */
203
+
204
+ #elif defined(__s390x__)
205
+ # define VEX_HOST_WORDSIZE 8
206
+ # define VEX_REGPARM(_n) /* */
207
+
208
+ #elif defined(__mips__) && (__mips == 64)
209
+ # define VEX_HOST_WORDSIZE 8
210
+ # define VEX_REGPARM(_n) /* */
211
+
212
+ #elif defined(__mips__) && (__mips != 64)
213
+ # define VEX_HOST_WORDSIZE 4
214
+ # define VEX_REGPARM(_n) /* */
215
+
216
+ #elif defined(__riscv) && defined(__riscv_xlen)
217
+ # if (__riscv_xlen == 64)
218
+ # define VEX_HOST_WORDSIZE 8
219
+ # define VEX_REGPARM(_n) /* */
220
+ # endif
221
+
222
+ #elif defined(__tilegx__)
223
+ # define VEX_HOST_WORDSIZE 8
224
+ # define VEX_REGPARM(_n) /* */
225
+
226
+ #else
227
+ # error "Vex: Fatal: Can't establish the host architecture"
228
+ #endif
229
+
230
+
231
+ #endif /* ndef __LIBVEX_BASICTYPES_H */
232
+
233
+ /*---------------------------------------------------------------*/
234
+ /*--- libvex_basictypes.h ---*/
235
+ /*---------------------------------------------------------------*/
236
+
@@ -0,0 +1,142 @@
1
+
2
+ /*---------------------------------------------------------------*/
3
+ /*--- begin libvex_emnote.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_EMNOTE_H
37
+ #define __LIBVEX_EMNOTE_H
38
+
39
+ #include "libvex_basictypes.h"
40
+
41
+ /* VEX can sometimes generate code which returns to the dispatcher
42
+ with the guest state pointer set to VEX_TRC_JMP_EMWARN or
43
+ VEX_TRC_JMP_EMFAIL. This means that VEX is trying to tell Valgrind
44
+ something noteworthy about emulation progress. For example, that Valgrind
45
+ is doing imprecise emulation in some sense. The guest's pseudo-register
46
+ "guest_EMNOTE" will hold a value of type VexEmNote, which describes
47
+ the nature of the warning. Currently the limitations that are
48
+ warned about apply primarily to floating point support.
49
+
50
+ All guest states must have a 32-bit (UInt) guest_EMNOTE pseudo-
51
+ register, that emulation warnings can be written in to.
52
+
53
+ Note that guest_EMNOTE only carries a valid value at the jump
54
+ marked as VEX_TRC_JMP_EMWARN / VEX_TRC_JMP_EMFAIL. You can't assume
55
+ it will continue to carry a valid value from any amount of time after
56
+ the jump.
57
+ */
58
+
59
+ typedef
60
+ enum {
61
+ /* no note indicated */
62
+ EmNote_NONE=0,
63
+
64
+ /* unmasking x87 FP exceptions is not supported */
65
+ EmWarn_X86_x87exns,
66
+
67
+ /* change of x87 FP precision away from 64-bit (mantissa) */
68
+ EmWarn_X86_x87precision,
69
+
70
+ /* unmasking SSE FP exceptions is not supported */
71
+ EmWarn_X86_sseExns,
72
+
73
+ /* setting mxcsr.fz is not supported */
74
+ EmWarn_X86_fz,
75
+
76
+ /* setting mxcsr.daz is not supported */
77
+ EmWarn_X86_daz,
78
+
79
+ /* settings to %eflags.ac (alignment check) are noted but ignored */
80
+ EmWarn_X86_acFlag,
81
+
82
+ /* unmasking PPC32/64 FP exceptions is not supported */
83
+ EmWarn_PPCexns,
84
+
85
+ /* overflow/underflow of the PPC64 _REDIR stack (ppc64 only) */
86
+ EmWarn_PPC64_redir_overflow,
87
+ EmWarn_PPC64_redir_underflow,
88
+
89
+ /* insn specifies a rounding mode other than "according to FPC"
90
+ which requires the floating point extension facility. But that
91
+ facility is not available on this host */
92
+ EmWarn_S390X_fpext_rounding,
93
+
94
+ /* insn (e.g. srnmb) specifies an invalid rounding mode */
95
+ EmWarn_S390X_invalid_rounding,
96
+
97
+ /* stfle insn is not supported on this host */
98
+ EmFail_S390X_stfle,
99
+
100
+ /* stckf insn is not supported on this host */
101
+ EmFail_S390X_stckf,
102
+
103
+ /* ecag insn is not supported on this host */
104
+ EmFail_S390X_ecag,
105
+
106
+ /* pfpo insn is not supported on this host */
107
+ EmFail_S390X_pfpo,
108
+
109
+ /* DFP insns are not supported on this host */
110
+ EmFail_S390X_DFP_insn,
111
+
112
+ /* insn needs floating point extension facility which is not
113
+ available on this host */
114
+ EmFail_S390X_fpext,
115
+
116
+ /* GPR 0 contains invalid rounding mode for PFPO instruction */
117
+ EmFail_S390X_invalid_PFPO_rounding_mode,
118
+
119
+ /* The function code specified in GPR 0 executed by PFPO
120
+ instruction is invalid */
121
+ EmFail_S390X_invalid_PFPO_function,
122
+
123
+ /* some insn needs vector facility which is not available on this host */
124
+ EmFail_S390X_vx,
125
+
126
+ /* ppno insn is not supported on this host */
127
+ EmFail_S390X_ppno,
128
+
129
+ EmNote_NUMBER
130
+ }
131
+ VexEmNote;
132
+
133
+
134
+ /* Produces a short string describing the warning. */
135
+ extern const HChar* LibVEX_EmNote_string ( VexEmNote );
136
+
137
+
138
+ #endif /* ndef __LIBVEX_EMNOTE_H */
139
+
140
+ /*---------------------------------------------------------------*/
141
+ /*--- libvex_emnote.h ---*/
142
+ /*---------------------------------------------------------------*/
@@ -0,0 +1,252 @@
1
+
2
+ /*---------------------------------------------------------------*/
3
+ /*--- begin libvex_guest_amd64.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_AMD64_H
37
+ #define __LIBVEX_PUB_GUEST_AMD64_H
38
+
39
+ #include "libvex_basictypes.h"
40
+ #include "libvex_emnote.h"
41
+
42
+
43
+ /*---------------------------------------------------------------*/
44
+ /*--- Vex's representation of the AMD64 CPU state. ---*/
45
+ /*---------------------------------------------------------------*/
46
+
47
+ /* See detailed comments at the top of libvex_guest_x86.h for
48
+ further info. This representation closely follows the
49
+ x86 representation.
50
+ */
51
+
52
+
53
+ typedef
54
+ struct {
55
+ /* Event check fail addr, counter, and padding to make RAX 16
56
+ aligned. */
57
+ /* 0 */ ULong host_EvC_FAILADDR;
58
+ /* 8 */ UInt host_EvC_COUNTER;
59
+ /* 12 */ UInt pad0;
60
+ /* 16 */ ULong guest_RAX;
61
+ /* 24 */ ULong guest_RCX;
62
+ /* 32 */ ULong guest_RDX;
63
+ /* 40 */ ULong guest_RBX;
64
+ /* 48 */ ULong guest_RSP;
65
+ /* 56 */ ULong guest_RBP;
66
+ /* 64 */ ULong guest_RSI;
67
+ /* 72 */ ULong guest_RDI;
68
+ /* 80 */ ULong guest_R8;
69
+ /* 88 */ ULong guest_R9;
70
+ /* 96 */ ULong guest_R10;
71
+ /* 104 */ ULong guest_R11;
72
+ /* 112 */ ULong guest_R12;
73
+ /* 120 */ ULong guest_R13;
74
+ /* 128 */ ULong guest_R14;
75
+ /* 136 */ ULong guest_R15;
76
+ /* 4-word thunk used to calculate O S Z A C P flags. */
77
+ /* 144 */ ULong guest_CC_OP;
78
+ /* 152 */ ULong guest_CC_DEP1;
79
+ /* 160 */ ULong guest_CC_DEP2;
80
+ /* 168 */ ULong guest_CC_NDEP;
81
+ /* The D flag is stored here, encoded as either -1 or +1 */
82
+ /* 176 */ ULong guest_DFLAG;
83
+ /* 184 */ ULong guest_RIP;
84
+ /* Bit 18 (AC) of eflags stored here, as either 0 or 1. */
85
+ /* ... */ ULong guest_ACFLAG;
86
+ /* Bit 21 (ID) of eflags stored here, as either 0 or 1. */
87
+ /* 192 */ ULong guest_IDFLAG;
88
+ /* Probably a lot more stuff too.
89
+ D,ID flags
90
+ 16 128-bit SSE registers
91
+ all the old x87 FPU gunk
92
+ segment registers */
93
+
94
+ /* HACK to e.g. make tls on amd64-linux/solaris work. %fs only ever seems
95
+ to hold a constant value (zero on linux main thread, 0x63 in other
96
+ threads), and so guest_FS_CONST holds
97
+ the 64-bit offset associated with this constant %fs value. */
98
+ /* 200 */ ULong guest_FS_CONST;
99
+
100
+ /* YMM registers. Note that these must be allocated
101
+ consecutively in order that the SSE4.2 PCMP{E,I}STR{I,M}
102
+ helpers can treat them as an array. YMM16 is a fake reg used
103
+ as an intermediary in handling aforementioned insns. */
104
+ /* 208 */ULong guest_SSEROUND;
105
+ /* 216 */U256 guest_YMM0;
106
+ U256 guest_YMM1;
107
+ U256 guest_YMM2;
108
+ U256 guest_YMM3;
109
+ U256 guest_YMM4;
110
+ U256 guest_YMM5;
111
+ U256 guest_YMM6;
112
+ U256 guest_YMM7;
113
+ U256 guest_YMM8;
114
+ U256 guest_YMM9;
115
+ U256 guest_YMM10;
116
+ U256 guest_YMM11;
117
+ U256 guest_YMM12;
118
+ U256 guest_YMM13;
119
+ U256 guest_YMM14;
120
+ U256 guest_YMM15;
121
+ U256 guest_YMM16;
122
+
123
+ // Control registers
124
+ ULong guest_CR0;
125
+ ULong guest_CR1;
126
+ ULong guest_CR2;
127
+ ULong guest_CR3;
128
+ ULong guest_CR4;
129
+ ULong guest_CR5;
130
+ ULong guest_CR6;
131
+ ULong guest_CR7;
132
+ ULong guest_CR8;
133
+ ULong guest_CR9;
134
+ ULong guest_CR10;
135
+ ULong guest_CR11;
136
+ ULong guest_CR12;
137
+ ULong guest_CR13;
138
+ ULong guest_CR14;
139
+ ULong guest_CR15;
140
+
141
+ /* FPU */
142
+ /* Note. Setting guest_FTOP to be ULong messes up the
143
+ delicately-balanced PutI/GetI optimisation machinery.
144
+ Therefore best to leave it as a UInt. */
145
+ UInt guest_FTOP;
146
+ UInt pad1;
147
+ ULong guest_FPREG[8];
148
+ UChar guest_FPTAG[8];
149
+ ULong guest_FPROUND;
150
+ ULong guest_FC3210;
151
+
152
+ /* Emulation notes */
153
+ UInt guest_EMNOTE;
154
+ UInt pad2;
155
+
156
+ /* Translation-invalidation area description. Not used on amd64
157
+ (there is no invalidate-icache insn), but needed so as to
158
+ allow users of the library to uniformly assume that the guest
159
+ state contains these two fields -- otherwise there is
160
+ compilation breakage. On amd64, these two fields are set to
161
+ zero by LibVEX_GuestAMD64_initialise and then should be
162
+ ignored forever thereafter. */
163
+ ULong guest_CMSTART;
164
+ ULong guest_CMLEN;
165
+
166
+ /* Used to record the unredirected guest address at the start of
167
+ a translation whose start has been redirected. By reading
168
+ this pseudo-register shortly afterwards, the translation can
169
+ find out what the corresponding no-redirection address was.
170
+ Note, this is only set for wrap-style redirects, not for
171
+ replace-style ones. */
172
+ ULong guest_NRADDR;
173
+
174
+ /* Used for Darwin syscall dispatching. */
175
+ ULong guest_SC_CLASS;
176
+
177
+ /* HACK to make e.g. tls on darwin work, wine on linux work, ...
178
+ %gs only ever seems to hold a constant value (e.g. 0x60 on darwin,
179
+ 0x6b on linux), and so guest_GS_CONST holds the 64-bit offset
180
+ associated with this constant %gs value. (A direct analogue
181
+ of the %fs-const hack for amd64-linux/solaris). */
182
+ ULong guest_GS_CONST;
183
+
184
+ /* Needed for Darwin (but mandated for all guest architectures):
185
+ RIP at the last syscall insn (int 0x80/81/82, sysenter,
186
+ syscall). Used when backing up to restart a syscall that has
187
+ been interrupted by a signal. */
188
+ ULong guest_IP_AT_SYSCALL;
189
+
190
+ /* Segment registers. */
191
+ UShort guest_CS;
192
+ UShort guest_DS;
193
+ UShort guest_ES;
194
+ UShort guest_FS;
195
+ UShort guest_GS;
196
+ UShort guest_SS;
197
+
198
+ /* Padding to make it have an 16-aligned size */
199
+ UInt pad4;
200
+ ULong pad3;
201
+ }
202
+ VexGuestAMD64State;
203
+
204
+
205
+
206
+ /*---------------------------------------------------------------*/
207
+ /*--- Utility functions for amd64 guest stuff. ---*/
208
+ /*---------------------------------------------------------------*/
209
+
210
+ /* ALL THE FOLLOWING ARE VISIBLE TO LIBRARY CLIENT */
211
+
212
+ /* Initialise all guest amd64 state. The FPU is put in default
213
+ mode. */
214
+ extern
215
+ void LibVEX_GuestAMD64_initialise ( /*OUT*/VexGuestAMD64State* vex_state );
216
+
217
+
218
+ /* Extract from the supplied VexGuestAMD64State structure the
219
+ corresponding native %rflags value. */
220
+ extern
221
+ ULong LibVEX_GuestAMD64_get_rflags ( /*IN*/const VexGuestAMD64State* vex_state );
222
+
223
+ /* Put rflags into the given state. */
224
+ extern
225
+ void LibVEX_GuestAMD64_put_rflags ( ULong rflags,
226
+ /*MOD*/VexGuestAMD64State* vex_state );
227
+
228
+ /* Set the carry flag in the given state to 'new_carry_flag', which
229
+ should be zero or one. */
230
+ extern
231
+ void
232
+ LibVEX_GuestAMD64_put_rflag_c ( ULong new_carry_flag,
233
+ /*MOD*/VexGuestAMD64State* vex_state );
234
+
235
+ /* Do FXSAVE from the supplied VexGuestAMD64tate structure and store the
236
+ result at the given address which represents a buffer of at least 416
237
+ bytes. */
238
+ extern
239
+ void LibVEX_GuestAMD64_fxsave ( /*IN*/VexGuestAMD64State* gst,
240
+ /*OUT*/HWord fp_state );
241
+
242
+ /* Do FXRSTOR from the supplied address and store read values to the given
243
+ VexGuestAMD64State structure. */
244
+ extern
245
+ VexEmNote LibVEX_GuestAMD64_fxrstor ( /*IN*/HWord fp_state,
246
+ /*MOD*/VexGuestAMD64State* gst );
247
+
248
+ #endif /* ndef __LIBVEX_PUB_GUEST_AMD64_H */
249
+
250
+ /*---------------------------------------------------------------*/
251
+ /*--- libvex_guest_amd64.h ---*/
252
+ /*---------------------------------------------------------------*/