2 /*--------------------------------------------------------------------*/
3 /*--- Contains machine-specific (guest-state-layout-specific) ---*/
4 /*--- support for origin tracking. ---*/
5 /*--- mc_machine.c ---*/
6 /*--------------------------------------------------------------------*/
9 This file is part of MemCheck, a heavyweight Valgrind tool for
10 detecting memory errors.
12 Copyright (C) 2008-2017 OpenWorks Ltd
15 This program is free software; you can redistribute it and/or
16 modify it under the terms of the GNU General Public License as
17 published by the Free Software Foundation; either version 2 of the
18 License, or (at your option) any later version.
20 This program is distributed in the hope that it will be useful, but
21 WITHOUT ANY WARRANTY; without even the implied warranty of
22 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
23 General Public License for more details.
25 You should have received a copy of the GNU General Public License
26 along with this program; if not, write to the Free Software
27 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
30 The GNU General Public License is contained in the file COPYING.
32 Neither the names of the U.S. Department of Energy nor the
33 University of California nor the names of its contributors may be
34 used to endorse or promote products derived from this software
35 without prior written permission.
38 #include "pub_tool_basics.h"
39 #include "pub_tool_poolalloc.h" // For mc_include.h
40 #include "pub_tool_hashtable.h" // For mc_include.h
41 #include "pub_tool_libcassert.h"
42 #include "pub_tool_libcprint.h"
43 #include "pub_tool_tooliface.h"
44 #include "pub_tool_guest.h" // VexGuestArchState
46 #include "mc_include.h"
48 #define MC_SIZEOF_GUEST_STATE sizeof(VexGuestArchState)
50 __attribute__((unused
))
51 static inline Bool
host_is_big_endian ( void ) {
53 return 0x1122 == *(UShort
*)(&x
);
56 __attribute__((unused
))
57 static inline Bool
host_is_little_endian ( void ) {
59 return 0x3344 == *(UShort
*)(&x
);
63 /* Let (offset,szB) describe a reference to the guest state section
66 This function returns the corresponding guest state reference to be
67 used for the origin tag (which of course will be in the second
68 shadow area), or -1 if this piece of guest state is not to be
71 Since origin tags are 32-bits long, we expect any returned value
72 (except -1) to be a multiple of 4, between 0 and
73 sizeof(guest-state)-4 inclusive.
75 This is inherently (guest-)architecture specific. For x86 and
76 amd64 we do some somewhat tricky things to give %AH .. %DH their
77 own tags. On ppc32/64 we do some marginally tricky things to give
78 all 16 %CR components their own tags.
80 This function only deals with references to the guest state whose
81 offsets are known at translation time (that is, references arising
82 from Put and Get). References whose offset is not known until run
83 time (that is, arise from PutI and GetI) are handled by
84 MC_(get_otrack_reg_array_equiv_int_type) below.
86 Note that since some guest state arrays (eg, the x86 FP reg stack)
87 are accessed both as arrays (eg, x87 insns) and directly (eg, MMX
88 insns), the two functions must be consistent for those sections of
89 guest state -- that is, they must both say the area is shadowed, or
92 This function is dependent on the host's endianness, hence we
93 assert that the use case is supported.
95 static Int
get_otrack_shadow_offset_wrk ( Int offset
, Int szB
); /*fwds*/
97 Int
MC_(get_otrack_shadow_offset
) ( Int offset
, Int szB
)
99 Int cand
= get_otrack_shadow_offset_wrk( offset
, szB
);
102 tl_assert(0 == (cand
& 3));
103 tl_assert(cand
<= MC_SIZEOF_GUEST_STATE
-4);
108 static Int
get_otrack_shadow_offset_wrk ( Int offset
, Int szB
)
110 /* -------------------- ppc64 -------------------- */
112 # if defined(VGA_ppc64be) || defined(VGA_ppc64le)
114 # define GOF(_fieldname) \
115 (offsetof(VexGuestPPC64State,guest_##_fieldname))
116 # define SZB(_fieldname) \
117 (sizeof(((VexGuestPPC64State*)0)->guest_##_fieldname))
123 #if defined(VGA_ppc64be)
124 tl_assert(host_is_big_endian());
125 #elif defined(VGA_ppc64le)
126 tl_assert(host_is_little_endian());
129 if (sz
== 8 || sz
== 4) {
130 /* The point of this is to achieve
131 if ((o == GOF(GPRn) && sz == 8) || (o == 4+GOF(GPRn) && sz == 4))
133 by testing ox instead of o, and setting ox back 4 bytes when sz == 4.
135 #if defined(VGA_ppc64le)
138 Int ox
= sz
== 8 ? o
: (o
- 4);
140 if (ox
== GOF(GPR0
)) return ox
;
141 if (ox
== GOF(GPR1
)) return ox
;
142 if (ox
== GOF(GPR2
)) return ox
;
143 if (ox
== GOF(GPR3
)) return ox
;
144 if (ox
== GOF(GPR4
)) return ox
;
145 if (ox
== GOF(GPR5
)) return ox
;
146 if (ox
== GOF(GPR6
)) return ox
;
147 if (ox
== GOF(GPR7
)) return ox
;
148 if (ox
== GOF(GPR8
)) return ox
;
149 if (ox
== GOF(GPR9
)) return ox
;
150 if (ox
== GOF(GPR10
)) return ox
;
151 if (ox
== GOF(GPR11
)) return ox
;
152 if (ox
== GOF(GPR12
)) return ox
;
153 if (ox
== GOF(GPR13
)) return ox
;
154 if (ox
== GOF(GPR14
)) return ox
;
155 if (ox
== GOF(GPR15
)) return ox
;
156 if (ox
== GOF(GPR16
)) return ox
;
157 if (ox
== GOF(GPR17
)) return ox
;
158 if (ox
== GOF(GPR18
)) return ox
;
159 if (ox
== GOF(GPR19
)) return ox
;
160 if (ox
== GOF(GPR20
)) return ox
;
161 if (ox
== GOF(GPR21
)) return ox
;
162 if (ox
== GOF(GPR22
)) return ox
;
163 if (ox
== GOF(GPR23
)) return ox
;
164 if (ox
== GOF(GPR24
)) return ox
;
165 if (ox
== GOF(GPR25
)) return ox
;
166 if (ox
== GOF(GPR26
)) return ox
;
167 if (ox
== GOF(GPR27
)) return ox
;
168 if (ox
== GOF(GPR28
)) return ox
;
169 if (ox
== GOF(GPR29
)) return ox
;
170 if (ox
== GOF(GPR30
)) return ox
;
171 if (ox
== GOF(GPR31
)) return ox
;
174 if (o
== GOF(LR
) && sz
== 8) return o
;
175 if (o
== GOF(CTR
) && sz
== 8) return o
;
177 if (o
== GOF(CIA
) && sz
== 8) return -1;
178 if (o
== GOF(IP_AT_SYSCALL
) && sz
== 8) return -1; /* slot unused */
179 if (o
== GOF(FPROUND
) && sz
== 1) return -1;
180 if (o
== GOF(DFPROUND
) && sz
== 1) return -1;
181 if (o
== GOF(C_FPCC
) && sz
== 1) return -1;
182 if (o
== GOF(EMNOTE
) && sz
== 4) return -1;
183 if (o
== GOF(CMSTART
) && sz
== 8) return -1;
184 if (o
== GOF(CMLEN
) && sz
== 8) return -1;
185 if (o
== GOF(VSCR
) && sz
== 4) return -1;
186 if (o
== GOF(VRSAVE
) && sz
== 4) return -1;
187 if (o
== GOF(REDIR_SP
) && sz
== 8) return -1;
188 if (o
== GOF(NRADDR
) && sz
== 8) return -1;
189 if (o
== GOF(NRADDR_GPR2
) && sz
== 8) return -1;
190 if (o
== GOF(REDIR_STACK
) && sz
== 8) return -1;
191 if (o
== GOF(TFHAR
) && sz
== 8) return -1;
192 if (o
== GOF(TEXASR
) && sz
== 8) return -1;
193 if (o
== GOF(TEXASRU
) && sz
== 8) return -1;
194 if (o
== GOF(TFIAR
) && sz
== 8) return -1;
195 if (o
== GOF(PPR
) && sz
== 8) return -1;
196 if (o
== GOF(PSPB
) && sz
== 8) return -1;
197 if (o
== GOF(DSCR
) && sz
== 8) return -1;
199 // With ISA 2.06, the "Vector-Scalar Floating-point" category
200 // provides facilities to support vector and scalar binary floating-
201 // point operations. A unified register file is an integral part
202 // of this new facility, combining floating point and vector registers
203 // using a 64x128-bit vector. These are referred to as VSR[0..63].
204 // The floating point registers are now mapped into double word element 0
205 // of VSR[0..31]. The 32x128-bit vector registers defined by the "Vector
206 // Facility [Category: Vector]" are now mapped to VSR[32..63].
208 // Floating point registers . . .
209 if (o
== GOF(VSR0
) && sz
== 8) return o
;
210 if (o
== GOF(VSR1
) && sz
== 8) return o
;
211 if (o
== GOF(VSR2
) && sz
== 8) return o
;
212 if (o
== GOF(VSR3
) && sz
== 8) return o
;
213 if (o
== GOF(VSR4
) && sz
== 8) return o
;
214 if (o
== GOF(VSR5
) && sz
== 8) return o
;
215 if (o
== GOF(VSR6
) && sz
== 8) return o
;
216 if (o
== GOF(VSR7
) && sz
== 8) return o
;
217 if (o
== GOF(VSR8
) && sz
== 8) return o
;
218 if (o
== GOF(VSR9
) && sz
== 8) return o
;
219 if (o
== GOF(VSR10
) && sz
== 8) return o
;
220 if (o
== GOF(VSR11
) && sz
== 8) return o
;
221 if (o
== GOF(VSR12
) && sz
== 8) return o
;
222 if (o
== GOF(VSR13
) && sz
== 8) return o
;
223 if (o
== GOF(VSR14
) && sz
== 8) return o
;
224 if (o
== GOF(VSR15
) && sz
== 8) return o
;
225 if (o
== GOF(VSR16
) && sz
== 8) return o
;
226 if (o
== GOF(VSR17
) && sz
== 8) return o
;
227 if (o
== GOF(VSR18
) && sz
== 8) return o
;
228 if (o
== GOF(VSR19
) && sz
== 8) return o
;
229 if (o
== GOF(VSR20
) && sz
== 8) return o
;
230 if (o
== GOF(VSR21
) && sz
== 8) return o
;
231 if (o
== GOF(VSR22
) && sz
== 8) return o
;
232 if (o
== GOF(VSR23
) && sz
== 8) return o
;
233 if (o
== GOF(VSR24
) && sz
== 8) return o
;
234 if (o
== GOF(VSR25
) && sz
== 8) return o
;
235 if (o
== GOF(VSR26
) && sz
== 8) return o
;
236 if (o
== GOF(VSR27
) && sz
== 8) return o
;
237 if (o
== GOF(VSR28
) && sz
== 8) return o
;
238 if (o
== GOF(VSR29
) && sz
== 8) return o
;
239 if (o
== GOF(VSR30
) && sz
== 8) return o
;
240 if (o
== GOF(VSR31
) && sz
== 8) return o
;
242 /* For the various byte sized XER/CR pieces, use offset 8
244 tl_assert(SZB(VSR0
) == 16);
245 if (o
== GOF(XER_SO
) && sz
== 1) return 8 +GOF(VSR0
);
246 if (o
== GOF(XER_OV
) && sz
== 1) return 8 +GOF(VSR1
);
247 if (o
== GOF(XER_CA
) && sz
== 1) return 8 +GOF(VSR2
);
248 if (o
== GOF(XER_BC
) && sz
== 1) return 8 +GOF(VSR3
);
250 if (o
== GOF(CR0_321
) && sz
== 1) return 8 +GOF(VSR4
);
251 if (o
== GOF(CR0_0
) && sz
== 1) return 8 +GOF(VSR5
);
252 if (o
== GOF(CR1_321
) && sz
== 1) return 8 +GOF(VSR6
);
253 if (o
== GOF(CR1_0
) && sz
== 1) return 8 +GOF(VSR7
);
254 if (o
== GOF(CR2_321
) && sz
== 1) return 8 +GOF(VSR8
);
255 if (o
== GOF(CR2_0
) && sz
== 1) return 8 +GOF(VSR9
);
256 if (o
== GOF(CR3_321
) && sz
== 1) return 8 +GOF(VSR10
);
257 if (o
== GOF(CR3_0
) && sz
== 1) return 8 +GOF(VSR11
);
258 if (o
== GOF(CR4_321
) && sz
== 1) return 8 +GOF(VSR12
);
259 if (o
== GOF(CR4_0
) && sz
== 1) return 8 +GOF(VSR13
);
260 if (o
== GOF(CR5_321
) && sz
== 1) return 8 +GOF(VSR14
);
261 if (o
== GOF(CR5_0
) && sz
== 1) return 8 +GOF(VSR15
);
262 if (o
== GOF(CR6_321
) && sz
== 1) return 8 +GOF(VSR16
);
263 if (o
== GOF(CR6_0
) && sz
== 1) return 8 +GOF(VSR17
);
264 if (o
== GOF(CR7_321
) && sz
== 1) return 8 +GOF(VSR18
);
265 if (o
== GOF(CR7_0
) && sz
== 1) return 8 +GOF(VSR19
);
267 /* Vector registers .. use offset 0 in VSR0 .. VSR63. */
268 if (o
>= GOF(VSR0
) && o
+sz
<= GOF(VSR0
) +SZB(VSR0
)) return 0+ GOF(VSR0
);
269 if (o
>= GOF(VSR1
) && o
+sz
<= GOF(VSR1
) +SZB(VSR1
)) return 0+ GOF(VSR1
);
270 if (o
>= GOF(VSR2
) && o
+sz
<= GOF(VSR2
) +SZB(VSR2
)) return 0+ GOF(VSR2
);
271 if (o
>= GOF(VSR3
) && o
+sz
<= GOF(VSR3
) +SZB(VSR3
)) return 0+ GOF(VSR3
);
272 if (o
>= GOF(VSR4
) && o
+sz
<= GOF(VSR4
) +SZB(VSR4
)) return 0+ GOF(VSR4
);
273 if (o
>= GOF(VSR5
) && o
+sz
<= GOF(VSR5
) +SZB(VSR5
)) return 0+ GOF(VSR5
);
274 if (o
>= GOF(VSR6
) && o
+sz
<= GOF(VSR6
) +SZB(VSR6
)) return 0+ GOF(VSR6
);
275 if (o
>= GOF(VSR7
) && o
+sz
<= GOF(VSR7
) +SZB(VSR7
)) return 0+ GOF(VSR7
);
276 if (o
>= GOF(VSR8
) && o
+sz
<= GOF(VSR8
) +SZB(VSR8
)) return 0+ GOF(VSR8
);
277 if (o
>= GOF(VSR9
) && o
+sz
<= GOF(VSR9
) +SZB(VSR9
)) return 0+ GOF(VSR9
);
278 if (o
>= GOF(VSR10
) && o
+sz
<= GOF(VSR10
)+SZB(VSR10
)) return 0+ GOF(VSR10
);
279 if (o
>= GOF(VSR11
) && o
+sz
<= GOF(VSR11
)+SZB(VSR11
)) return 0+ GOF(VSR11
);
280 if (o
>= GOF(VSR12
) && o
+sz
<= GOF(VSR12
)+SZB(VSR12
)) return 0+ GOF(VSR12
);
281 if (o
>= GOF(VSR13
) && o
+sz
<= GOF(VSR13
)+SZB(VSR13
)) return 0+ GOF(VSR13
);
282 if (o
>= GOF(VSR14
) && o
+sz
<= GOF(VSR14
)+SZB(VSR14
)) return 0+ GOF(VSR14
);
283 if (o
>= GOF(VSR15
) && o
+sz
<= GOF(VSR15
)+SZB(VSR15
)) return 0+ GOF(VSR15
);
284 if (o
>= GOF(VSR16
) && o
+sz
<= GOF(VSR16
)+SZB(VSR16
)) return 0+ GOF(VSR16
);
285 if (o
>= GOF(VSR17
) && o
+sz
<= GOF(VSR17
)+SZB(VSR17
)) return 0+ GOF(VSR17
);
286 if (o
>= GOF(VSR18
) && o
+sz
<= GOF(VSR18
)+SZB(VSR18
)) return 0+ GOF(VSR18
);
287 if (o
>= GOF(VSR19
) && o
+sz
<= GOF(VSR19
)+SZB(VSR19
)) return 0+ GOF(VSR19
);
288 if (o
>= GOF(VSR20
) && o
+sz
<= GOF(VSR20
)+SZB(VSR20
)) return 0+ GOF(VSR20
);
289 if (o
>= GOF(VSR21
) && o
+sz
<= GOF(VSR21
)+SZB(VSR21
)) return 0+ GOF(VSR21
);
290 if (o
>= GOF(VSR22
) && o
+sz
<= GOF(VSR22
)+SZB(VSR22
)) return 0+ GOF(VSR22
);
291 if (o
>= GOF(VSR23
) && o
+sz
<= GOF(VSR23
)+SZB(VSR23
)) return 0+ GOF(VSR23
);
292 if (o
>= GOF(VSR24
) && o
+sz
<= GOF(VSR24
)+SZB(VSR24
)) return 0+ GOF(VSR24
);
293 if (o
>= GOF(VSR25
) && o
+sz
<= GOF(VSR25
)+SZB(VSR25
)) return 0+ GOF(VSR25
);
294 if (o
>= GOF(VSR26
) && o
+sz
<= GOF(VSR26
)+SZB(VSR26
)) return 0+ GOF(VSR26
);
295 if (o
>= GOF(VSR27
) && o
+sz
<= GOF(VSR27
)+SZB(VSR27
)) return 0+ GOF(VSR27
);
296 if (o
>= GOF(VSR28
) && o
+sz
<= GOF(VSR28
)+SZB(VSR28
)) return 0+ GOF(VSR28
);
297 if (o
>= GOF(VSR29
) && o
+sz
<= GOF(VSR29
)+SZB(VSR29
)) return 0+ GOF(VSR29
);
298 if (o
>= GOF(VSR30
) && o
+sz
<= GOF(VSR30
)+SZB(VSR30
)) return 0+ GOF(VSR30
);
299 if (o
>= GOF(VSR31
) && o
+sz
<= GOF(VSR31
)+SZB(VSR31
)) return 0+ GOF(VSR31
);
300 if (o
>= GOF(VSR32
) && o
+sz
<= GOF(VSR32
)+SZB(VSR32
)) return 0+ GOF(VSR32
);
301 if (o
>= GOF(VSR33
) && o
+sz
<= GOF(VSR33
)+SZB(VSR33
)) return 0+ GOF(VSR33
);
302 if (o
>= GOF(VSR34
) && o
+sz
<= GOF(VSR34
)+SZB(VSR34
)) return 0+ GOF(VSR34
);
303 if (o
>= GOF(VSR35
) && o
+sz
<= GOF(VSR35
)+SZB(VSR35
)) return 0+ GOF(VSR35
);
304 if (o
>= GOF(VSR36
) && o
+sz
<= GOF(VSR36
)+SZB(VSR36
)) return 0+ GOF(VSR36
);
305 if (o
>= GOF(VSR37
) && o
+sz
<= GOF(VSR37
)+SZB(VSR37
)) return 0+ GOF(VSR37
);
306 if (o
>= GOF(VSR38
) && o
+sz
<= GOF(VSR38
)+SZB(VSR38
)) return 0+ GOF(VSR38
);
307 if (o
>= GOF(VSR39
) && o
+sz
<= GOF(VSR39
)+SZB(VSR39
)) return 0+ GOF(VSR39
);
308 if (o
>= GOF(VSR40
) && o
+sz
<= GOF(VSR40
)+SZB(VSR40
)) return 0+ GOF(VSR40
);
309 if (o
>= GOF(VSR41
) && o
+sz
<= GOF(VSR41
)+SZB(VSR41
)) return 0+ GOF(VSR41
);
310 if (o
>= GOF(VSR42
) && o
+sz
<= GOF(VSR42
)+SZB(VSR42
)) return 0+ GOF(VSR42
);
311 if (o
>= GOF(VSR43
) && o
+sz
<= GOF(VSR43
)+SZB(VSR43
)) return 0+ GOF(VSR43
);
312 if (o
>= GOF(VSR44
) && o
+sz
<= GOF(VSR44
)+SZB(VSR44
)) return 0+ GOF(VSR44
);
313 if (o
>= GOF(VSR45
) && o
+sz
<= GOF(VSR45
)+SZB(VSR45
)) return 0+ GOF(VSR45
);
314 if (o
>= GOF(VSR46
) && o
+sz
<= GOF(VSR46
)+SZB(VSR46
)) return 0+ GOF(VSR46
);
315 if (o
>= GOF(VSR47
) && o
+sz
<= GOF(VSR47
)+SZB(VSR47
)) return 0+ GOF(VSR47
);
316 if (o
>= GOF(VSR48
) && o
+sz
<= GOF(VSR48
)+SZB(VSR48
)) return 0+ GOF(VSR48
);
317 if (o
>= GOF(VSR49
) && o
+sz
<= GOF(VSR49
)+SZB(VSR49
)) return 0+ GOF(VSR49
);
318 if (o
>= GOF(VSR50
) && o
+sz
<= GOF(VSR50
)+SZB(VSR50
)) return 0+ GOF(VSR50
);
319 if (o
>= GOF(VSR51
) && o
+sz
<= GOF(VSR51
)+SZB(VSR51
)) return 0+ GOF(VSR51
);
320 if (o
>= GOF(VSR52
) && o
+sz
<= GOF(VSR52
)+SZB(VSR52
)) return 0+ GOF(VSR52
);
321 if (o
>= GOF(VSR53
) && o
+sz
<= GOF(VSR53
)+SZB(VSR53
)) return 0+ GOF(VSR53
);
322 if (o
>= GOF(VSR54
) && o
+sz
<= GOF(VSR54
)+SZB(VSR54
)) return 0+ GOF(VSR54
);
323 if (o
>= GOF(VSR55
) && o
+sz
<= GOF(VSR55
)+SZB(VSR55
)) return 0+ GOF(VSR55
);
324 if (o
>= GOF(VSR56
) && o
+sz
<= GOF(VSR56
)+SZB(VSR56
)) return 0+ GOF(VSR56
);
325 if (o
>= GOF(VSR57
) && o
+sz
<= GOF(VSR57
)+SZB(VSR57
)) return 0+ GOF(VSR57
);
326 if (o
>= GOF(VSR58
) && o
+sz
<= GOF(VSR58
)+SZB(VSR58
)) return 0+ GOF(VSR58
);
327 if (o
>= GOF(VSR59
) && o
+sz
<= GOF(VSR59
)+SZB(VSR59
)) return 0+ GOF(VSR59
);
328 if (o
>= GOF(VSR60
) && o
+sz
<= GOF(VSR60
)+SZB(VSR60
)) return 0+ GOF(VSR60
);
329 if (o
>= GOF(VSR61
) && o
+sz
<= GOF(VSR61
)+SZB(VSR61
)) return 0+ GOF(VSR61
);
330 if (o
>= GOF(VSR62
) && o
+sz
<= GOF(VSR62
)+SZB(VSR62
)) return 0+ GOF(VSR62
);
331 if (o
>= GOF(VSR63
) && o
+sz
<= GOF(VSR63
)+SZB(VSR63
)) return 0+ GOF(VSR63
);
333 VG_(printf
)("MC_(get_otrack_shadow_offset)(ppc64)(off=%d,sz=%d)\n",
339 /* -------------------- ppc32 -------------------- */
341 # elif defined(VGA_ppc32)
343 # define GOF(_fieldname) \
344 (offsetof(VexGuestPPC32State,guest_##_fieldname))
345 # define SZB(_fieldname) \
346 (sizeof(((VexGuestPPC32State*)0)->guest_##_fieldname))
351 if (o
== GOF(GPR0
) && sz
== 4) return o
;
352 if (o
== GOF(GPR1
) && sz
== 4) return o
;
353 if (o
== GOF(GPR2
) && sz
== 4) return o
;
354 if (o
== GOF(GPR3
) && sz
== 4) return o
;
355 if (o
== GOF(GPR4
) && sz
== 4) return o
;
356 if (o
== GOF(GPR5
) && sz
== 4) return o
;
357 if (o
== GOF(GPR6
) && sz
== 4) return o
;
358 if (o
== GOF(GPR7
) && sz
== 4) return o
;
359 if (o
== GOF(GPR8
) && sz
== 4) return o
;
360 if (o
== GOF(GPR9
) && sz
== 4) return o
;
361 if (o
== GOF(GPR10
) && sz
== 4) return o
;
362 if (o
== GOF(GPR11
) && sz
== 4) return o
;
363 if (o
== GOF(GPR12
) && sz
== 4) return o
;
364 if (o
== GOF(GPR13
) && sz
== 4) return o
;
365 if (o
== GOF(GPR14
) && sz
== 4) return o
;
366 if (o
== GOF(GPR15
) && sz
== 4) return o
;
367 if (o
== GOF(GPR16
) && sz
== 4) return o
;
368 if (o
== GOF(GPR17
) && sz
== 4) return o
;
369 if (o
== GOF(GPR18
) && sz
== 4) return o
;
370 if (o
== GOF(GPR19
) && sz
== 4) return o
;
371 if (o
== GOF(GPR20
) && sz
== 4) return o
;
372 if (o
== GOF(GPR21
) && sz
== 4) return o
;
373 if (o
== GOF(GPR22
) && sz
== 4) return o
;
374 if (o
== GOF(GPR23
) && sz
== 4) return o
;
375 if (o
== GOF(GPR24
) && sz
== 4) return o
;
376 if (o
== GOF(GPR25
) && sz
== 4) return o
;
377 if (o
== GOF(GPR26
) && sz
== 4) return o
;
378 if (o
== GOF(GPR27
) && sz
== 4) return o
;
379 if (o
== GOF(GPR28
) && sz
== 4) return o
;
380 if (o
== GOF(GPR29
) && sz
== 4) return o
;
381 if (o
== GOF(GPR30
) && sz
== 4) return o
;
382 if (o
== GOF(GPR31
) && sz
== 4) return o
;
384 if (o
== GOF(LR
) && sz
== 4) return o
;
385 if (o
== GOF(CTR
) && sz
== 4) return o
;
387 if (o
== GOF(CIA
) && sz
== 4) return -1;
388 if (o
== GOF(IP_AT_SYSCALL
) && sz
== 4) return -1; /* slot unused */
389 if (o
== GOF(FPROUND
) && sz
== 1) return -1;
390 if (o
== GOF(DFPROUND
) && sz
== 1) return -1;
391 if (o
== GOF(VRSAVE
) && sz
== 4) return -1;
392 if (o
== GOF(EMNOTE
) && sz
== 4) return -1;
393 if (o
== GOF(CMSTART
) && sz
== 4) return -1;
394 if (o
== GOF(CMLEN
) && sz
== 4) return -1;
395 if (o
== GOF(VSCR
) && sz
== 4) return -1;
396 if (o
== GOF(REDIR_SP
) && sz
== 4) return -1;
397 if (o
== GOF(SPRG3_RO
) && sz
== 4) return -1;
399 // With ISA 2.06, the "Vector-Scalar Floating-point" category
400 // provides facilities to support vector and scalar binary floating-
401 // point operations. A unified register file is an integral part
402 // of this new facility, combining floating point and vector registers
403 // using a 64x128-bit vector. These are referred to as VSR[0..63].
404 // The floating point registers are now mapped into double word element 0
405 // of VSR[0..31]. The 32x128-bit vector registers defined by the "Vector
406 // Facility [Category: Vector]" are now mapped to VSR[32..63].
408 // Floating point registers . . .
409 if (o
== GOF(VSR0
) && sz
== 8) return o
;
410 if (o
== GOF(VSR1
) && sz
== 8) return o
;
411 if (o
== GOF(VSR2
) && sz
== 8) return o
;
412 if (o
== GOF(VSR3
) && sz
== 8) return o
;
413 if (o
== GOF(VSR4
) && sz
== 8) return o
;
414 if (o
== GOF(VSR5
) && sz
== 8) return o
;
415 if (o
== GOF(VSR6
) && sz
== 8) return o
;
416 if (o
== GOF(VSR7
) && sz
== 8) return o
;
417 if (o
== GOF(VSR8
) && sz
== 8) return o
;
418 if (o
== GOF(VSR9
) && sz
== 8) return o
;
419 if (o
== GOF(VSR10
) && sz
== 8) return o
;
420 if (o
== GOF(VSR11
) && sz
== 8) return o
;
421 if (o
== GOF(VSR12
) && sz
== 8) return o
;
422 if (o
== GOF(VSR13
) && sz
== 8) return o
;
423 if (o
== GOF(VSR14
) && sz
== 8) return o
;
424 if (o
== GOF(VSR15
) && sz
== 8) return o
;
425 if (o
== GOF(VSR16
) && sz
== 8) return o
;
426 if (o
== GOF(VSR17
) && sz
== 8) return o
;
427 if (o
== GOF(VSR18
) && sz
== 8) return o
;
428 if (o
== GOF(VSR19
) && sz
== 8) return o
;
429 if (o
== GOF(VSR20
) && sz
== 8) return o
;
430 if (o
== GOF(VSR21
) && sz
== 8) return o
;
431 if (o
== GOF(VSR22
) && sz
== 8) return o
;
432 if (o
== GOF(VSR23
) && sz
== 8) return o
;
433 if (o
== GOF(VSR24
) && sz
== 8) return o
;
434 if (o
== GOF(VSR25
) && sz
== 8) return o
;
435 if (o
== GOF(VSR26
) && sz
== 8) return o
;
436 if (o
== GOF(VSR27
) && sz
== 8) return o
;
437 if (o
== GOF(VSR28
) && sz
== 8) return o
;
438 if (o
== GOF(VSR29
) && sz
== 8) return o
;
439 if (o
== GOF(VSR30
) && sz
== 8) return o
;
440 if (o
== GOF(VSR31
) && sz
== 8) return o
;
442 /* For the various byte sized XER/CR pieces, use offset 8
444 tl_assert(SZB(VSR0
) == 16);
445 if (o
== GOF(XER_SO
) && sz
== 1) return 8 +GOF(VSR0
);
446 if (o
== GOF(XER_OV
) && sz
== 1) return 8 +GOF(VSR1
);
447 if (o
== GOF(XER_CA
) && sz
== 1) return 8 +GOF(VSR2
);
448 if (o
== GOF(XER_BC
) && sz
== 1) return 8 +GOF(VSR3
);
450 if (o
== GOF(CR0_321
) && sz
== 1) return 8 +GOF(VSR4
);
451 if (o
== GOF(CR0_0
) && sz
== 1) return 8 +GOF(VSR5
);
452 if (o
== GOF(CR1_321
) && sz
== 1) return 8 +GOF(VSR6
);
453 if (o
== GOF(CR1_0
) && sz
== 1) return 8 +GOF(VSR7
);
454 if (o
== GOF(CR2_321
) && sz
== 1) return 8 +GOF(VSR8
);
455 if (o
== GOF(CR2_0
) && sz
== 1) return 8 +GOF(VSR9
);
456 if (o
== GOF(CR3_321
) && sz
== 1) return 8 +GOF(VSR10
);
457 if (o
== GOF(CR3_0
) && sz
== 1) return 8 +GOF(VSR11
);
458 if (o
== GOF(CR4_321
) && sz
== 1) return 8 +GOF(VSR12
);
459 if (o
== GOF(CR4_0
) && sz
== 1) return 8 +GOF(VSR13
);
460 if (o
== GOF(CR5_321
) && sz
== 1) return 8 +GOF(VSR14
);
461 if (o
== GOF(CR5_0
) && sz
== 1) return 8 +GOF(VSR15
);
462 if (o
== GOF(CR6_321
) && sz
== 1) return 8 +GOF(VSR16
);
463 if (o
== GOF(CR6_0
) && sz
== 1) return 8 +GOF(VSR17
);
464 if (o
== GOF(CR7_321
) && sz
== 1) return 8 +GOF(VSR18
);
465 if (o
== GOF(CR7_0
) && sz
== 1) return 8 +GOF(VSR19
);
467 /* Vector registers .. use offset 0 in VSR0 .. VSR63. */
468 if (o
>= GOF(VSR0
) && o
+sz
<= GOF(VSR0
) +SZB(VSR0
)) return 0+ GOF(VSR0
);
469 if (o
>= GOF(VSR1
) && o
+sz
<= GOF(VSR1
) +SZB(VSR1
)) return 0+ GOF(VSR1
);
470 if (o
>= GOF(VSR2
) && o
+sz
<= GOF(VSR2
) +SZB(VSR2
)) return 0+ GOF(VSR2
);
471 if (o
>= GOF(VSR3
) && o
+sz
<= GOF(VSR3
) +SZB(VSR3
)) return 0+ GOF(VSR3
);
472 if (o
>= GOF(VSR4
) && o
+sz
<= GOF(VSR4
) +SZB(VSR4
)) return 0+ GOF(VSR4
);
473 if (o
>= GOF(VSR5
) && o
+sz
<= GOF(VSR5
) +SZB(VSR5
)) return 0+ GOF(VSR5
);
474 if (o
>= GOF(VSR6
) && o
+sz
<= GOF(VSR6
) +SZB(VSR6
)) return 0+ GOF(VSR6
);
475 if (o
>= GOF(VSR7
) && o
+sz
<= GOF(VSR7
) +SZB(VSR7
)) return 0+ GOF(VSR7
);
476 if (o
>= GOF(VSR8
) && o
+sz
<= GOF(VSR8
) +SZB(VSR8
)) return 0+ GOF(VSR8
);
477 if (o
>= GOF(VSR9
) && o
+sz
<= GOF(VSR9
) +SZB(VSR9
)) return 0+ GOF(VSR9
);
478 if (o
>= GOF(VSR10
) && o
+sz
<= GOF(VSR10
)+SZB(VSR10
)) return 0+ GOF(VSR10
);
479 if (o
>= GOF(VSR11
) && o
+sz
<= GOF(VSR11
)+SZB(VSR11
)) return 0+ GOF(VSR11
);
480 if (o
>= GOF(VSR12
) && o
+sz
<= GOF(VSR12
)+SZB(VSR12
)) return 0+ GOF(VSR12
);
481 if (o
>= GOF(VSR13
) && o
+sz
<= GOF(VSR13
)+SZB(VSR13
)) return 0+ GOF(VSR13
);
482 if (o
>= GOF(VSR14
) && o
+sz
<= GOF(VSR14
)+SZB(VSR14
)) return 0+ GOF(VSR14
);
483 if (o
>= GOF(VSR15
) && o
+sz
<= GOF(VSR15
)+SZB(VSR15
)) return 0+ GOF(VSR15
);
484 if (o
>= GOF(VSR16
) && o
+sz
<= GOF(VSR16
)+SZB(VSR16
)) return 0+ GOF(VSR16
);
485 if (o
>= GOF(VSR17
) && o
+sz
<= GOF(VSR17
)+SZB(VSR17
)) return 0+ GOF(VSR17
);
486 if (o
>= GOF(VSR18
) && o
+sz
<= GOF(VSR18
)+SZB(VSR18
)) return 0+ GOF(VSR18
);
487 if (o
>= GOF(VSR19
) && o
+sz
<= GOF(VSR19
)+SZB(VSR19
)) return 0+ GOF(VSR19
);
488 if (o
>= GOF(VSR20
) && o
+sz
<= GOF(VSR20
)+SZB(VSR20
)) return 0+ GOF(VSR20
);
489 if (o
>= GOF(VSR21
) && o
+sz
<= GOF(VSR21
)+SZB(VSR21
)) return 0+ GOF(VSR21
);
490 if (o
>= GOF(VSR22
) && o
+sz
<= GOF(VSR22
)+SZB(VSR22
)) return 0+ GOF(VSR22
);
491 if (o
>= GOF(VSR23
) && o
+sz
<= GOF(VSR23
)+SZB(VSR23
)) return 0+ GOF(VSR23
);
492 if (o
>= GOF(VSR24
) && o
+sz
<= GOF(VSR24
)+SZB(VSR24
)) return 0+ GOF(VSR24
);
493 if (o
>= GOF(VSR25
) && o
+sz
<= GOF(VSR25
)+SZB(VSR25
)) return 0+ GOF(VSR25
);
494 if (o
>= GOF(VSR26
) && o
+sz
<= GOF(VSR26
)+SZB(VSR26
)) return 0+ GOF(VSR26
);
495 if (o
>= GOF(VSR27
) && o
+sz
<= GOF(VSR27
)+SZB(VSR27
)) return 0+ GOF(VSR27
);
496 if (o
>= GOF(VSR28
) && o
+sz
<= GOF(VSR28
)+SZB(VSR28
)) return 0+ GOF(VSR28
);
497 if (o
>= GOF(VSR29
) && o
+sz
<= GOF(VSR29
)+SZB(VSR29
)) return 0+ GOF(VSR29
);
498 if (o
>= GOF(VSR30
) && o
+sz
<= GOF(VSR30
)+SZB(VSR30
)) return 0+ GOF(VSR30
);
499 if (o
>= GOF(VSR31
) && o
+sz
<= GOF(VSR31
)+SZB(VSR31
)) return 0+ GOF(VSR31
);
500 if (o
>= GOF(VSR32
) && o
+sz
<= GOF(VSR32
)+SZB(VSR32
)) return 0+ GOF(VSR32
);
501 if (o
>= GOF(VSR33
) && o
+sz
<= GOF(VSR33
)+SZB(VSR33
)) return 0+ GOF(VSR33
);
502 if (o
>= GOF(VSR34
) && o
+sz
<= GOF(VSR34
)+SZB(VSR34
)) return 0+ GOF(VSR34
);
503 if (o
>= GOF(VSR35
) && o
+sz
<= GOF(VSR35
)+SZB(VSR35
)) return 0+ GOF(VSR35
);
504 if (o
>= GOF(VSR36
) && o
+sz
<= GOF(VSR36
)+SZB(VSR36
)) return 0+ GOF(VSR36
);
505 if (o
>= GOF(VSR37
) && o
+sz
<= GOF(VSR37
)+SZB(VSR37
)) return 0+ GOF(VSR37
);
506 if (o
>= GOF(VSR38
) && o
+sz
<= GOF(VSR38
)+SZB(VSR38
)) return 0+ GOF(VSR38
);
507 if (o
>= GOF(VSR39
) && o
+sz
<= GOF(VSR39
)+SZB(VSR39
)) return 0+ GOF(VSR39
);
508 if (o
>= GOF(VSR40
) && o
+sz
<= GOF(VSR40
)+SZB(VSR40
)) return 0+ GOF(VSR40
);
509 if (o
>= GOF(VSR41
) && o
+sz
<= GOF(VSR41
)+SZB(VSR41
)) return 0+ GOF(VSR41
);
510 if (o
>= GOF(VSR42
) && o
+sz
<= GOF(VSR42
)+SZB(VSR42
)) return 0+ GOF(VSR42
);
511 if (o
>= GOF(VSR43
) && o
+sz
<= GOF(VSR43
)+SZB(VSR43
)) return 0+ GOF(VSR43
);
512 if (o
>= GOF(VSR44
) && o
+sz
<= GOF(VSR44
)+SZB(VSR44
)) return 0+ GOF(VSR44
);
513 if (o
>= GOF(VSR45
) && o
+sz
<= GOF(VSR45
)+SZB(VSR45
)) return 0+ GOF(VSR45
);
514 if (o
>= GOF(VSR46
) && o
+sz
<= GOF(VSR46
)+SZB(VSR46
)) return 0+ GOF(VSR46
);
515 if (o
>= GOF(VSR47
) && o
+sz
<= GOF(VSR47
)+SZB(VSR47
)) return 0+ GOF(VSR47
);
516 if (o
>= GOF(VSR48
) && o
+sz
<= GOF(VSR48
)+SZB(VSR48
)) return 0+ GOF(VSR48
);
517 if (o
>= GOF(VSR49
) && o
+sz
<= GOF(VSR49
)+SZB(VSR49
)) return 0+ GOF(VSR49
);
518 if (o
>= GOF(VSR50
) && o
+sz
<= GOF(VSR50
)+SZB(VSR50
)) return 0+ GOF(VSR50
);
519 if (o
>= GOF(VSR51
) && o
+sz
<= GOF(VSR51
)+SZB(VSR51
)) return 0+ GOF(VSR51
);
520 if (o
>= GOF(VSR52
) && o
+sz
<= GOF(VSR52
)+SZB(VSR52
)) return 0+ GOF(VSR52
);
521 if (o
>= GOF(VSR53
) && o
+sz
<= GOF(VSR53
)+SZB(VSR53
)) return 0+ GOF(VSR53
);
522 if (o
>= GOF(VSR54
) && o
+sz
<= GOF(VSR54
)+SZB(VSR54
)) return 0+ GOF(VSR54
);
523 if (o
>= GOF(VSR55
) && o
+sz
<= GOF(VSR55
)+SZB(VSR55
)) return 0+ GOF(VSR55
);
524 if (o
>= GOF(VSR56
) && o
+sz
<= GOF(VSR56
)+SZB(VSR56
)) return 0+ GOF(VSR56
);
525 if (o
>= GOF(VSR57
) && o
+sz
<= GOF(VSR57
)+SZB(VSR57
)) return 0+ GOF(VSR57
);
526 if (o
>= GOF(VSR58
) && o
+sz
<= GOF(VSR58
)+SZB(VSR58
)) return 0+ GOF(VSR58
);
527 if (o
>= GOF(VSR59
) && o
+sz
<= GOF(VSR59
)+SZB(VSR59
)) return 0+ GOF(VSR59
);
528 if (o
>= GOF(VSR60
) && o
+sz
<= GOF(VSR60
)+SZB(VSR60
)) return 0+ GOF(VSR60
);
529 if (o
>= GOF(VSR61
) && o
+sz
<= GOF(VSR61
)+SZB(VSR61
)) return 0+ GOF(VSR61
);
530 if (o
>= GOF(VSR62
) && o
+sz
<= GOF(VSR62
)+SZB(VSR62
)) return 0+ GOF(VSR62
);
531 if (o
>= GOF(VSR63
) && o
+sz
<= GOF(VSR63
)+SZB(VSR63
)) return 0+ GOF(VSR63
);
533 VG_(printf
)("MC_(get_otrack_shadow_offset)(ppc32)(off=%d,sz=%d)\n",
539 /* -------------------- amd64 -------------------- */
541 # elif defined(VGA_amd64)
543 # define GOF(_fieldname) \
544 (offsetof(VexGuestAMD64State,guest_##_fieldname))
545 # define SZB(_fieldname) \
546 (sizeof(((VexGuestAMD64State*)0)->guest_##_fieldname))
549 Bool is1248
= sz
== 8 || sz
== 4 || sz
== 2 || sz
== 1;
551 tl_assert(host_is_little_endian());
553 if (o
== GOF(RAX
) && is1248
) return o
;
554 if (o
== GOF(RCX
) && is1248
) return o
;
555 if (o
== GOF(RDX
) && is1248
) return o
;
556 if (o
== GOF(RBX
) && is1248
) return o
;
557 if (o
== GOF(RSP
) && is1248
) return o
;
558 if (o
== GOF(RBP
) && is1248
) return o
;
559 if (o
== GOF(RSI
) && is1248
) return o
;
560 if (o
== GOF(RDI
) && is1248
) return o
;
561 if (o
== GOF(R8
) && is1248
) return o
;
562 if (o
== GOF(R9
) && is1248
) return o
;
563 if (o
== GOF(R10
) && is1248
) return o
;
564 if (o
== GOF(R11
) && is1248
) return o
;
565 if (o
== GOF(R12
) && is1248
) return o
;
566 if (o
== GOF(R13
) && is1248
) return o
;
567 if (o
== GOF(R14
) && is1248
) return o
;
568 if (o
== GOF(R15
) && is1248
) return o
;
570 if (o
== GOF(CC_DEP1
) && sz
== 8) return o
;
571 if (o
== GOF(CC_DEP2
) && sz
== 8) return o
;
573 if (o
== GOF(CC_OP
) && sz
== 8) return -1; /* slot used for %AH */
574 if (o
== GOF(CC_NDEP
) && sz
== 8) return -1; /* slot used for %BH */
575 if (o
== GOF(DFLAG
) && sz
== 8) return -1; /* slot used for %CH */
576 if (o
== GOF(RIP
) && sz
== 8) return -1; /* slot unused */
577 if (o
== GOF(IP_AT_SYSCALL
) && sz
== 8) return -1; /* slot unused */
578 if (o
== GOF(IDFLAG
) && sz
== 8) return -1; /* slot used for %DH */
579 if (o
== GOF(ACFLAG
) && sz
== 8) return -1; /* slot unused */
580 if (o
== GOF(FS_CONST
) && sz
== 8) return -1; /* slot unused */
581 if (o
== GOF(GS_CONST
) && sz
== 8) return -1; /* slot unused */
582 if (o
== GOF(CMSTART
) && sz
== 8) return -1; /* slot unused */
583 if (o
== GOF(CMLEN
) && sz
== 8) return -1; /* slot unused */
584 if (o
== GOF(NRADDR
) && sz
== 8) return -1; /* slot unused */
586 /* Treat %AH, %BH, %CH, %DH as independent registers. To do this
587 requires finding 4 unused 32-bit slots in the second-shadow
588 guest state, respectively: CC_OP CC_NDEP DFLAG IDFLAG, since
589 none of those are tracked. */
590 tl_assert(SZB(CC_OP
) == 8);
591 tl_assert(SZB(CC_NDEP
) == 8);
592 tl_assert(SZB(IDFLAG
) == 8);
593 tl_assert(SZB(DFLAG
) == 8);
595 if (o
== 1+ GOF(RAX
) && szB
== 1) return GOF(CC_OP
);
596 if (o
== 1+ GOF(RBX
) && szB
== 1) return GOF(CC_NDEP
);
597 if (o
== 1+ GOF(RCX
) && szB
== 1) return GOF(DFLAG
);
598 if (o
== 1+ GOF(RDX
) && szB
== 1) return GOF(IDFLAG
);
600 /* skip XMM and FP admin stuff */
601 if (o
== GOF(SSEROUND
) && szB
== 8) return -1;
602 if (o
== GOF(FTOP
) && szB
== 4) return -1;
603 if (o
== GOF(FPROUND
) && szB
== 8) return -1;
604 if (o
== GOF(EMNOTE
) && szB
== 4) return -1;
605 if (o
== GOF(FC3210
) && szB
== 8) return -1;
608 if (o
>= GOF(YMM0
) && o
+sz
<= GOF(YMM0
) +SZB(YMM0
)) return GOF(YMM0
);
609 if (o
>= GOF(YMM1
) && o
+sz
<= GOF(YMM1
) +SZB(YMM1
)) return GOF(YMM1
);
610 if (o
>= GOF(YMM2
) && o
+sz
<= GOF(YMM2
) +SZB(YMM2
)) return GOF(YMM2
);
611 if (o
>= GOF(YMM3
) && o
+sz
<= GOF(YMM3
) +SZB(YMM3
)) return GOF(YMM3
);
612 if (o
>= GOF(YMM4
) && o
+sz
<= GOF(YMM4
) +SZB(YMM4
)) return GOF(YMM4
);
613 if (o
>= GOF(YMM5
) && o
+sz
<= GOF(YMM5
) +SZB(YMM5
)) return GOF(YMM5
);
614 if (o
>= GOF(YMM6
) && o
+sz
<= GOF(YMM6
) +SZB(YMM6
)) return GOF(YMM6
);
615 if (o
>= GOF(YMM7
) && o
+sz
<= GOF(YMM7
) +SZB(YMM7
)) return GOF(YMM7
);
616 if (o
>= GOF(YMM8
) && o
+sz
<= GOF(YMM8
) +SZB(YMM8
)) return GOF(YMM8
);
617 if (o
>= GOF(YMM9
) && o
+sz
<= GOF(YMM9
) +SZB(YMM9
)) return GOF(YMM9
);
618 if (o
>= GOF(YMM10
) && o
+sz
<= GOF(YMM10
)+SZB(YMM10
)) return GOF(YMM10
);
619 if (o
>= GOF(YMM11
) && o
+sz
<= GOF(YMM11
)+SZB(YMM11
)) return GOF(YMM11
);
620 if (o
>= GOF(YMM12
) && o
+sz
<= GOF(YMM12
)+SZB(YMM12
)) return GOF(YMM12
);
621 if (o
>= GOF(YMM13
) && o
+sz
<= GOF(YMM13
)+SZB(YMM13
)) return GOF(YMM13
);
622 if (o
>= GOF(YMM14
) && o
+sz
<= GOF(YMM14
)+SZB(YMM14
)) return GOF(YMM14
);
623 if (o
>= GOF(YMM15
) && o
+sz
<= GOF(YMM15
)+SZB(YMM15
)) return GOF(YMM15
);
624 if (o
>= GOF(YMM16
) && o
+sz
<= GOF(YMM16
)+SZB(YMM16
)) return GOF(YMM16
);
626 /* MMX accesses to FP regs. Need to allow for 32-bit references
627 due to dirty helpers for frstor etc, which reference the entire
628 64-byte block in one go. */
629 if (o
>= GOF(FPREG
[0])
630 && o
+sz
<= GOF(FPREG
[0])+SZB(FPREG
[0])) return GOF(FPREG
[0]);
631 if (o
>= GOF(FPREG
[1])
632 && o
+sz
<= GOF(FPREG
[1])+SZB(FPREG
[1])) return GOF(FPREG
[1]);
633 if (o
>= GOF(FPREG
[2])
634 && o
+sz
<= GOF(FPREG
[2])+SZB(FPREG
[2])) return GOF(FPREG
[2]);
635 if (o
>= GOF(FPREG
[3])
636 && o
+sz
<= GOF(FPREG
[3])+SZB(FPREG
[3])) return GOF(FPREG
[3]);
637 if (o
>= GOF(FPREG
[4])
638 && o
+sz
<= GOF(FPREG
[4])+SZB(FPREG
[4])) return GOF(FPREG
[4]);
639 if (o
>= GOF(FPREG
[5])
640 && o
+sz
<= GOF(FPREG
[5])+SZB(FPREG
[5])) return GOF(FPREG
[5]);
641 if (o
>= GOF(FPREG
[6])
642 && o
+sz
<= GOF(FPREG
[6])+SZB(FPREG
[6])) return GOF(FPREG
[6]);
643 if (o
>= GOF(FPREG
[7])
644 && o
+sz
<= GOF(FPREG
[7])+SZB(FPREG
[7])) return GOF(FPREG
[7]);
646 /* Map high halves of %RAX,%RCX,%RDX,%RBX to the whole register.
647 This is needed because the general handling of dirty helper
648 calls is done in 4 byte chunks. Hence we will see these.
649 Currently we only expect to see artefacts from CPUID. */
650 if (o
== 4+ GOF(RAX
) && sz
== 4) return GOF(RAX
);
651 if (o
== 4+ GOF(RCX
) && sz
== 4) return GOF(RCX
);
652 if (o
== 4+ GOF(RDX
) && sz
== 4) return GOF(RDX
);
653 if (o
== 4+ GOF(RBX
) && sz
== 4) return GOF(RBX
);
655 VG_(printf
)("MC_(get_otrack_shadow_offset)(amd64)(off=%d,sz=%d)\n",
661 /* --------------------- x86 --------------------- */
663 # elif defined(VGA_x86)
665 # define GOF(_fieldname) \
666 (offsetof(VexGuestX86State,guest_##_fieldname))
667 # define SZB(_fieldname) \
668 (sizeof(((VexGuestX86State*)0)->guest_##_fieldname))
672 Bool is124
= sz
== 4 || sz
== 2 || sz
== 1;
674 tl_assert(host_is_little_endian());
676 if (o
== GOF(EAX
) && is124
) return o
;
677 if (o
== GOF(ECX
) && is124
) return o
;
678 if (o
== GOF(EDX
) && is124
) return o
;
679 if (o
== GOF(EBX
) && is124
) return o
;
680 if (o
== GOF(ESP
) && is124
) return o
;
681 if (o
== GOF(EBP
) && is124
) return o
;
682 if (o
== GOF(ESI
) && is124
) return o
;
683 if (o
== GOF(EDI
) && is124
) return o
;
685 if (o
== GOF(CC_DEP1
) && sz
== 4) return o
;
686 if (o
== GOF(CC_DEP2
) && sz
== 4) return o
;
688 if (o
== GOF(CC_OP
) && sz
== 4) return -1; /* slot used for %AH */
689 if (o
== GOF(CC_NDEP
) && sz
== 4) return -1; /* slot used for %BH */
690 if (o
== GOF(DFLAG
) && sz
== 4) return -1; /* slot used for %CH */
691 if (o
== GOF(EIP
) && sz
== 4) return -1; /* slot unused */
692 if (o
== GOF(IP_AT_SYSCALL
) && sz
== 4) return -1; /* slot unused */
693 if (o
== GOF(IDFLAG
) && sz
== 4) return -1; /* slot used for %DH */
694 if (o
== GOF(ACFLAG
) && sz
== 4) return -1; /* slot unused */
695 if (o
== GOF(CMSTART
) && sz
== 4) return -1; /* slot unused */
696 if (o
== GOF(CMLEN
) && sz
== 4) return -1; /* slot unused */
697 if (o
== GOF(NRADDR
) && sz
== 4) return -1; /* slot unused */
699 /* Treat %AH, %BH, %CH, %DH as independent registers. To do this
700 requires finding 4 unused 32-bit slots in the second-shadow
701 guest state, respectively: CC_OP CC_NDEP DFLAG IDFLAG since none
702 of those are tracked. */
703 tl_assert(SZB(CC_OP
) == 4);
704 tl_assert(SZB(CC_NDEP
) == 4);
705 tl_assert(SZB(DFLAG
) == 4);
706 tl_assert(SZB(IDFLAG
) == 4);
707 if (o
== 1+ GOF(EAX
) && szB
== 1) return GOF(CC_OP
);
708 if (o
== 1+ GOF(EBX
) && szB
== 1) return GOF(CC_NDEP
);
709 if (o
== 1+ GOF(ECX
) && szB
== 1) return GOF(DFLAG
);
710 if (o
== 1+ GOF(EDX
) && szB
== 1) return GOF(IDFLAG
);
712 /* skip XMM and FP admin stuff */
713 if (o
== GOF(SSEROUND
) && szB
== 4) return -1;
714 if (o
== GOF(FTOP
) && szB
== 4) return -1;
715 if (o
== GOF(FPROUND
) && szB
== 4) return -1;
716 if (o
== GOF(EMNOTE
) && szB
== 4) return -1;
717 if (o
== GOF(FC3210
) && szB
== 4) return -1;
720 if (o
>= GOF(XMM0
) && o
+sz
<= GOF(XMM0
)+SZB(XMM0
)) return GOF(XMM0
);
721 if (o
>= GOF(XMM1
) && o
+sz
<= GOF(XMM1
)+SZB(XMM1
)) return GOF(XMM1
);
722 if (o
>= GOF(XMM2
) && o
+sz
<= GOF(XMM2
)+SZB(XMM2
)) return GOF(XMM2
);
723 if (o
>= GOF(XMM3
) && o
+sz
<= GOF(XMM3
)+SZB(XMM3
)) return GOF(XMM3
);
724 if (o
>= GOF(XMM4
) && o
+sz
<= GOF(XMM4
)+SZB(XMM4
)) return GOF(XMM4
);
725 if (o
>= GOF(XMM5
) && o
+sz
<= GOF(XMM5
)+SZB(XMM5
)) return GOF(XMM5
);
726 if (o
>= GOF(XMM6
) && o
+sz
<= GOF(XMM6
)+SZB(XMM6
)) return GOF(XMM6
);
727 if (o
>= GOF(XMM7
) && o
+sz
<= GOF(XMM7
)+SZB(XMM7
)) return GOF(XMM7
);
729 /* MMX accesses to FP regs. Need to allow for 32-bit references
730 due to dirty helpers for frstor etc, which reference the entire
731 64-byte block in one go. */
732 if (o
>= GOF(FPREG
[0])
733 && o
+sz
<= GOF(FPREG
[0])+SZB(FPREG
[0])) return GOF(FPREG
[0]);
734 if (o
>= GOF(FPREG
[1])
735 && o
+sz
<= GOF(FPREG
[1])+SZB(FPREG
[1])) return GOF(FPREG
[1]);
736 if (o
>= GOF(FPREG
[2])
737 && o
+sz
<= GOF(FPREG
[2])+SZB(FPREG
[2])) return GOF(FPREG
[2]);
738 if (o
>= GOF(FPREG
[3])
739 && o
+sz
<= GOF(FPREG
[3])+SZB(FPREG
[3])) return GOF(FPREG
[3]);
740 if (o
>= GOF(FPREG
[4])
741 && o
+sz
<= GOF(FPREG
[4])+SZB(FPREG
[4])) return GOF(FPREG
[4]);
742 if (o
>= GOF(FPREG
[5])
743 && o
+sz
<= GOF(FPREG
[5])+SZB(FPREG
[5])) return GOF(FPREG
[5]);
744 if (o
>= GOF(FPREG
[6])
745 && o
+sz
<= GOF(FPREG
[6])+SZB(FPREG
[6])) return GOF(FPREG
[6]);
746 if (o
>= GOF(FPREG
[7])
747 && o
+sz
<= GOF(FPREG
[7])+SZB(FPREG
[7])) return GOF(FPREG
[7]);
749 /* skip %GS and other segment related stuff. We could shadow
750 guest_LDT and guest_GDT, although it seems pointless.
751 guest_CS .. guest_SS are too small to shadow directly and it
752 also seems pointless to shadow them indirectly (that is, in
753 the style of %AH .. %DH). */
754 if (o
== GOF(CS
) && sz
== 2) return -1;
755 if (o
== GOF(DS
) && sz
== 2) return -1;
756 if (o
== GOF(ES
) && sz
== 2) return -1;
757 if (o
== GOF(FS
) && sz
== 2) return -1;
758 if (o
== GOF(GS
) && sz
== 2) return -1;
759 if (o
== GOF(SS
) && sz
== 2) return -1;
760 if (o
== GOF(LDT
) && sz
== 4) return -1;
761 if (o
== GOF(GDT
) && sz
== 4) return -1;
763 VG_(printf
)("MC_(get_otrack_shadow_offset)(x86)(off=%d,sz=%d)\n",
769 /* -------------------- s390x -------------------- */
771 # elif defined(VGA_s390x)
772 # define GOF(_fieldname) \
773 (offsetof(VexGuestS390XState,guest_##_fieldname))
777 tl_assert(host_is_big_endian());
779 /* no matter what byte(s) we change, we have changed the full 8 byte value
780 and need to track this change for the whole register */
781 if (o
>= GOF(r0
) && sz
<= 8 && o
<= (GOF(r15
) + 8 - sz
))
782 return GOF(r0
) + ((o
-GOF(r0
)) & -8) ;
785 /* fprs are accessed 4 or 8 byte at once. Again, we track that change for
787 NOTE: FPRs are mapped to first double word of VRs[0-15] */
788 if ((sz
== 8 || sz
== 4) && o
>= GOF(v0
) && o
<= GOF(v15
)+8-sz
)
789 return GOF(v0
) + ((o
-GOF(v0
)) & -8) ;
791 /* access registers are accessed 4 bytes at once */
792 if (sz
== 4 && o
>= GOF(a0
) && o
<= GOF(a15
))
795 /* no matter what byte(s) we change, we have changed the full 16 byte value
796 and need to track this change for the whole register */
797 if (o
>= GOF(v0
) && sz
<= 16 && o
<= (GOF(v31
) + 16 - sz
))
798 return GOF(v0
) + ((o
-GOF(v0
)) & -16) ;
800 /* we access the guest counter either fully or one of the 4byte words */
801 if (o
== GOF(counter
) && (sz
== 8 || sz
==4))
803 if (o
== GOF(counter
) + 4 && sz
== 4)
806 if (o
== GOF(EMNOTE
) && sz
== 4) return -1;
808 if (o
== GOF(CC_OP
) && sz
== 8) return -1;
809 /* We access CC_DEP1 either fully or bits [0:31] */
810 if (o
== GOF(CC_DEP1
) && (sz
== 8 || sz
==4))
812 if (o
== GOF(CC_DEP2
) && sz
== 8) return o
;
813 if (o
== GOF(CC_NDEP
) && sz
== 8) return -1;
814 if (o
== GOF(CMSTART
) && sz
== 8) return -1;
815 if (o
== GOF(CMLEN
) && sz
== 8) return -1;
816 if (o
== GOF(NRADDR
) && sz
== 8) return -1;
817 if (o
== GOF(IP_AT_SYSCALL
) && sz
== 8) return -1;
818 if (o
== GOF(fpc
) && sz
== 4) return -1;
819 if (o
== GOF(IA
) && sz
== 8) return -1;
820 if (o
== (GOF(IA
) + 4) && sz
== 4) return -1;
821 if (o
== GOF(SYSNO
) && sz
== 8) return -1;
822 VG_(printf
)("MC_(get_otrack_shadow_offset)(s390x)(off=%d,sz=%d)\n",
828 /* --------------------- arm --------------------- */
830 # elif defined(VGA_arm)
832 # define GOF(_fieldname) \
833 (offsetof(VexGuestARMState,guest_##_fieldname))
834 # define SZB(_fieldname) \
835 (sizeof(((VexGuestARMState*)0)->guest_##_fieldname))
840 tl_assert(host_is_little_endian());
842 if (o
== GOF(R0
) && sz
== 4) return o
;
843 if (o
== GOF(R1
) && sz
== 4) return o
;
844 if (o
== GOF(R2
) && sz
== 4) return o
;
845 if (o
== GOF(R3
) && sz
== 4) return o
;
846 if (o
== GOF(R4
) && sz
== 4) return o
;
847 if (o
== GOF(R5
) && sz
== 4) return o
;
848 if (o
== GOF(R6
) && sz
== 4) return o
;
849 if (o
== GOF(R7
) && sz
== 4) return o
;
850 if (o
== GOF(R8
) && sz
== 4) return o
;
851 if (o
== GOF(R9
) && sz
== 4) return o
;
852 if (o
== GOF(R10
) && sz
== 4) return o
;
853 if (o
== GOF(R11
) && sz
== 4) return o
;
854 if (o
== GOF(R12
) && sz
== 4) return o
;
855 if (o
== GOF(R13
) && sz
== 4) return o
;
856 if (o
== GOF(R14
) && sz
== 4) return o
;
858 /* EAZG: These may be completely wrong. */
859 if (o
== GOF(R15T
) && sz
== 4) return -1; /* slot unused */
860 if (o
== GOF(CC_OP
) && sz
== 4) return -1; /* slot unused */
862 if (o
== GOF(CC_DEP1
) && sz
== 4) return o
;
863 if (o
== GOF(CC_DEP2
) && sz
== 4) return o
;
865 if (o
== GOF(CC_NDEP
) && sz
== 4) return -1; /* slot unused */
867 if (o
== GOF(QFLAG32
) && sz
== 4) return o
;
869 if (o
== GOF(GEFLAG0
) && sz
== 4) return o
;
870 if (o
== GOF(GEFLAG1
) && sz
== 4) return o
;
871 if (o
== GOF(GEFLAG2
) && sz
== 4) return o
;
872 if (o
== GOF(GEFLAG3
) && sz
== 4) return o
;
874 //if (o == GOF(SYSCALLNO) && sz == 4) return -1; /* slot unused */
875 //if (o == GOF(CC) && sz == 4) return -1; /* slot unused */
876 //if (o == GOF(EMNOTE) && sz == 4) return -1; /* slot unused */
877 //if (o == GOF(CMSTART) && sz == 4) return -1; /* slot unused */
878 //if (o == GOF(NRADDR) && sz == 4) return -1; /* slot unused */
880 if (o
== GOF(FPSCR
) && sz
== 4) return -1;
881 if (o
== GOF(TPIDRURO
) && sz
== 4) return -1;
882 if (o
== GOF(TPIDRURW
) && sz
== 4) return -1;
883 if (o
== GOF(ITSTATE
) && sz
== 4) return -1;
885 /* Accesses to F or D registers */
886 if (sz
== 4 || sz
== 8) {
887 if (o
>= GOF(D0
) && o
+sz
<= GOF(D0
) +SZB(D0
)) return GOF(D0
);
888 if (o
>= GOF(D1
) && o
+sz
<= GOF(D1
) +SZB(D1
)) return GOF(D1
);
889 if (o
>= GOF(D2
) && o
+sz
<= GOF(D2
) +SZB(D2
)) return GOF(D2
);
890 if (o
>= GOF(D3
) && o
+sz
<= GOF(D3
) +SZB(D3
)) return GOF(D3
);
891 if (o
>= GOF(D4
) && o
+sz
<= GOF(D4
) +SZB(D4
)) return GOF(D4
);
892 if (o
>= GOF(D5
) && o
+sz
<= GOF(D5
) +SZB(D5
)) return GOF(D5
);
893 if (o
>= GOF(D6
) && o
+sz
<= GOF(D6
) +SZB(D6
)) return GOF(D6
);
894 if (o
>= GOF(D7
) && o
+sz
<= GOF(D7
) +SZB(D7
)) return GOF(D7
);
895 if (o
>= GOF(D8
) && o
+sz
<= GOF(D8
) +SZB(D8
)) return GOF(D8
);
896 if (o
>= GOF(D9
) && o
+sz
<= GOF(D9
) +SZB(D9
)) return GOF(D9
);
897 if (o
>= GOF(D10
) && o
+sz
<= GOF(D10
)+SZB(D10
)) return GOF(D10
);
898 if (o
>= GOF(D11
) && o
+sz
<= GOF(D11
)+SZB(D11
)) return GOF(D11
);
899 if (o
>= GOF(D12
) && o
+sz
<= GOF(D12
)+SZB(D12
)) return GOF(D12
);
900 if (o
>= GOF(D13
) && o
+sz
<= GOF(D13
)+SZB(D13
)) return GOF(D13
);
901 if (o
>= GOF(D14
) && o
+sz
<= GOF(D14
)+SZB(D14
)) return GOF(D14
);
902 if (o
>= GOF(D15
) && o
+sz
<= GOF(D15
)+SZB(D15
)) return GOF(D15
);
903 if (o
>= GOF(D16
) && o
+sz
<= GOF(D16
)+SZB(D16
)) return GOF(D16
);
904 if (o
>= GOF(D17
) && o
+sz
<= GOF(D17
)+SZB(D17
)) return GOF(D17
);
905 if (o
>= GOF(D18
) && o
+sz
<= GOF(D18
)+SZB(D18
)) return GOF(D18
);
906 if (o
>= GOF(D19
) && o
+sz
<= GOF(D19
)+SZB(D19
)) return GOF(D19
);
907 if (o
>= GOF(D20
) && o
+sz
<= GOF(D20
)+SZB(D20
)) return GOF(D20
);
908 if (o
>= GOF(D21
) && o
+sz
<= GOF(D21
)+SZB(D21
)) return GOF(D21
);
909 if (o
>= GOF(D22
) && o
+sz
<= GOF(D22
)+SZB(D22
)) return GOF(D22
);
910 if (o
>= GOF(D23
) && o
+sz
<= GOF(D23
)+SZB(D23
)) return GOF(D23
);
911 if (o
>= GOF(D24
) && o
+sz
<= GOF(D24
)+SZB(D24
)) return GOF(D24
);
912 if (o
>= GOF(D25
) && o
+sz
<= GOF(D25
)+SZB(D25
)) return GOF(D25
);
913 if (o
>= GOF(D26
) && o
+sz
<= GOF(D26
)+SZB(D26
)) return GOF(D26
);
914 if (o
>= GOF(D27
) && o
+sz
<= GOF(D27
)+SZB(D27
)) return GOF(D27
);
915 if (o
>= GOF(D28
) && o
+sz
<= GOF(D28
)+SZB(D28
)) return GOF(D28
);
916 if (o
>= GOF(D29
) && o
+sz
<= GOF(D29
)+SZB(D29
)) return GOF(D29
);
917 if (o
>= GOF(D30
) && o
+sz
<= GOF(D30
)+SZB(D30
)) return GOF(D30
);
918 if (o
>= GOF(D31
) && o
+sz
<= GOF(D31
)+SZB(D31
)) return GOF(D31
);
921 /* Accesses to Q registers */
923 if (o
>= GOF(D0
) && o
+sz
<= GOF(D0
) +2*SZB(D0
)) return GOF(D0
); // Q0
924 if (o
>= GOF(D2
) && o
+sz
<= GOF(D2
) +2*SZB(D2
)) return GOF(D2
); // Q1
925 if (o
>= GOF(D4
) && o
+sz
<= GOF(D4
) +2*SZB(D4
)) return GOF(D4
); // Q2
926 if (o
>= GOF(D6
) && o
+sz
<= GOF(D6
) +2*SZB(D6
)) return GOF(D6
); // Q3
927 if (o
>= GOF(D8
) && o
+sz
<= GOF(D8
) +2*SZB(D8
)) return GOF(D8
); // Q4
928 if (o
>= GOF(D10
) && o
+sz
<= GOF(D10
)+2*SZB(D10
)) return GOF(D10
); // Q5
929 if (o
>= GOF(D12
) && o
+sz
<= GOF(D12
)+2*SZB(D12
)) return GOF(D12
); // Q6
930 if (o
>= GOF(D14
) && o
+sz
<= GOF(D14
)+2*SZB(D14
)) return GOF(D14
); // Q7
931 if (o
>= GOF(D16
) && o
+sz
<= GOF(D16
)+2*SZB(D16
)) return GOF(D16
); // Q8
932 if (o
>= GOF(D18
) && o
+sz
<= GOF(D18
)+2*SZB(D18
)) return GOF(D18
); // Q9
933 if (o
>= GOF(D20
) && o
+sz
<= GOF(D20
)+2*SZB(D20
)) return GOF(D20
); // Q10
934 if (o
>= GOF(D22
) && o
+sz
<= GOF(D22
)+2*SZB(D22
)) return GOF(D22
); // Q11
935 if (o
>= GOF(D24
) && o
+sz
<= GOF(D24
)+2*SZB(D24
)) return GOF(D24
); // Q12
936 if (o
>= GOF(D26
) && o
+sz
<= GOF(D26
)+2*SZB(D26
)) return GOF(D26
); // Q13
937 if (o
>= GOF(D28
) && o
+sz
<= GOF(D28
)+2*SZB(D28
)) return GOF(D28
); // Q14
938 if (o
>= GOF(D30
) && o
+sz
<= GOF(D30
)+2*SZB(D30
)) return GOF(D30
); // Q15
941 if (o
== GOF(CMSTART
) && sz
== 4) return -1;
942 if (o
== GOF(CMLEN
) && sz
== 4) return -1;
944 VG_(printf
)("MC_(get_otrack_shadow_offset)(arm)(off=%d,sz=%d)\n",
950 /* --------------------- arm64 --------------------- */
952 # elif defined(VGA_arm64)
954 # define GOF(_fieldname) \
955 (offsetof(VexGuestARM64State,guest_##_fieldname))
956 # define SZB(_fieldname) \
957 (sizeof(((VexGuestARM64State*)0)->guest_##_fieldname))
961 Bool is48
= sz
== 8 || sz
== 4;
964 tl_assert(host_is_little_endian());
966 if (o
== GOF(X0
) && is48
) return o
;
967 if (o
== GOF(X1
) && is48
) return o
;
968 if (o
== GOF(X2
) && is48
) return o
;
969 if (o
== GOF(X3
) && is48
) return o
;
970 if (o
== GOF(X4
) && is48
) return o
;
971 if (o
== GOF(X5
) && is48
) return o
;
972 if (o
== GOF(X6
) && is48
) return o
;
973 if (o
== GOF(X7
) && is48
) return o
;
974 if (o
== GOF(X8
) && is48
) return o
;
975 if (o
== GOF(X9
) && is48
) return o
;
976 if (o
== GOF(X10
) && is48
) return o
;
977 if (o
== GOF(X11
) && is48
) return o
;
978 if (o
== GOF(X12
) && is48
) return o
;
979 if (o
== GOF(X13
) && is48
) return o
;
980 if (o
== GOF(X14
) && is48
) return o
;
981 if (o
== GOF(X15
) && is48
) return o
;
982 if (o
== GOF(X16
) && is48
) return o
;
983 if (o
== GOF(X17
) && is48
) return o
;
984 if (o
== GOF(X18
) && is48
) return o
;
985 if (o
== GOF(X19
) && is48
) return o
;
986 if (o
== GOF(X20
) && is48
) return o
;
987 if (o
== GOF(X21
) && is48
) return o
;
988 if (o
== GOF(X22
) && is48
) return o
;
989 if (o
== GOF(X23
) && is48
) return o
;
990 if (o
== GOF(X24
) && is48
) return o
;
991 if (o
== GOF(X25
) && is48
) return o
;
992 if (o
== GOF(X26
) && is48
) return o
;
993 if (o
== GOF(X27
) && is48
) return o
;
994 if (o
== GOF(X28
) && is48
) return o
;
995 if (o
== GOF(X29
) && is48
) return o
;
996 if (o
== GOF(X30
) && is48
) return o
;
997 if (o
== GOF(XSP
) && is48
) return o
;
999 if (o
== GOF(PC
) && is48
) return -1; // untracked
1000 if (o
== GOF(CC_DEP1
) && sz
== 8) return o
;
1001 if (o
== GOF(CC_DEP2
) && sz
== 8) return o
;
1003 if (o
== GOF(CC_OP
) && sz
== 8) return -1; // untracked
1004 if (o
== GOF(CC_NDEP
) && sz
== 8) return -1; // untracked
1005 if (o
== GOF(TPIDR_EL0
) && sz
== 8) return -1; // untracked
1007 if (o
>= GOF(Q0
) && o
+sz
<= GOF(Q0
) +SZB(Q0
)) return GOF(Q0
);
1008 if (o
>= GOF(Q1
) && o
+sz
<= GOF(Q1
) +SZB(Q1
)) return GOF(Q1
);
1009 if (o
>= GOF(Q2
) && o
+sz
<= GOF(Q2
) +SZB(Q2
)) return GOF(Q2
);
1010 if (o
>= GOF(Q3
) && o
+sz
<= GOF(Q3
) +SZB(Q3
)) return GOF(Q3
);
1011 if (o
>= GOF(Q4
) && o
+sz
<= GOF(Q4
) +SZB(Q4
)) return GOF(Q4
);
1012 if (o
>= GOF(Q5
) && o
+sz
<= GOF(Q5
) +SZB(Q5
)) return GOF(Q5
);
1013 if (o
>= GOF(Q6
) && o
+sz
<= GOF(Q6
) +SZB(Q6
)) return GOF(Q6
);
1014 if (o
>= GOF(Q7
) && o
+sz
<= GOF(Q7
) +SZB(Q7
)) return GOF(Q7
);
1015 if (o
>= GOF(Q8
) && o
+sz
<= GOF(Q8
) +SZB(Q8
)) return GOF(Q8
);
1016 if (o
>= GOF(Q9
) && o
+sz
<= GOF(Q9
) +SZB(Q9
)) return GOF(Q9
);
1017 if (o
>= GOF(Q10
) && o
+sz
<= GOF(Q10
)+SZB(Q10
)) return GOF(Q10
);
1018 if (o
>= GOF(Q11
) && o
+sz
<= GOF(Q11
)+SZB(Q11
)) return GOF(Q11
);
1019 if (o
>= GOF(Q12
) && o
+sz
<= GOF(Q12
)+SZB(Q12
)) return GOF(Q12
);
1020 if (o
>= GOF(Q13
) && o
+sz
<= GOF(Q13
)+SZB(Q13
)) return GOF(Q13
);
1021 if (o
>= GOF(Q14
) && o
+sz
<= GOF(Q14
)+SZB(Q14
)) return GOF(Q14
);
1022 if (o
>= GOF(Q15
) && o
+sz
<= GOF(Q15
)+SZB(Q15
)) return GOF(Q15
);
1023 if (o
>= GOF(Q16
) && o
+sz
<= GOF(Q16
)+SZB(Q16
)) return GOF(Q16
);
1024 if (o
>= GOF(Q17
) && o
+sz
<= GOF(Q17
)+SZB(Q17
)) return GOF(Q17
);
1025 if (o
>= GOF(Q18
) && o
+sz
<= GOF(Q18
)+SZB(Q18
)) return GOF(Q18
);
1026 if (o
>= GOF(Q19
) && o
+sz
<= GOF(Q19
)+SZB(Q19
)) return GOF(Q19
);
1027 if (o
>= GOF(Q20
) && o
+sz
<= GOF(Q20
)+SZB(Q20
)) return GOF(Q20
);
1028 if (o
>= GOF(Q21
) && o
+sz
<= GOF(Q21
)+SZB(Q21
)) return GOF(Q21
);
1029 if (o
>= GOF(Q22
) && o
+sz
<= GOF(Q22
)+SZB(Q22
)) return GOF(Q22
);
1030 if (o
>= GOF(Q23
) && o
+sz
<= GOF(Q23
)+SZB(Q23
)) return GOF(Q23
);
1031 if (o
>= GOF(Q24
) && o
+sz
<= GOF(Q24
)+SZB(Q24
)) return GOF(Q24
);
1032 if (o
>= GOF(Q25
) && o
+sz
<= GOF(Q25
)+SZB(Q25
)) return GOF(Q25
);
1033 if (o
>= GOF(Q26
) && o
+sz
<= GOF(Q26
)+SZB(Q26
)) return GOF(Q26
);
1034 if (o
>= GOF(Q27
) && o
+sz
<= GOF(Q27
)+SZB(Q27
)) return GOF(Q27
);
1035 if (o
>= GOF(Q28
) && o
+sz
<= GOF(Q28
)+SZB(Q28
)) return GOF(Q28
);
1036 if (o
>= GOF(Q29
) && o
+sz
<= GOF(Q29
)+SZB(Q29
)) return GOF(Q29
);
1037 if (o
>= GOF(Q30
) && o
+sz
<= GOF(Q30
)+SZB(Q30
)) return GOF(Q30
);
1038 if (o
>= GOF(Q31
) && o
+sz
<= GOF(Q31
)+SZB(Q31
)) return GOF(Q31
);
1040 if (o
== GOF(FPCR
) && sz
== 4) return -1; // untracked
1041 if (o
== GOF(QCFLAG
) && sz
== 16) return o
;
1043 if (o
== GOF(CMSTART
) && sz
== 8) return -1; // untracked
1044 if (o
== GOF(CMLEN
) && sz
== 8) return -1; // untracked
1046 if (o
== GOF(LLSC_SIZE
) && sz
== 8) return -1; // untracked
1047 if (o
== GOF(LLSC_ADDR
) && sz
== 8) return o
;
1048 if (o
== GOF(LLSC_DATA
) && sz
== 8) return o
;
1050 VG_(printf
)("MC_(get_otrack_shadow_offset)(arm64)(off=%d,sz=%d)\n",
1056 /* --------------------- mips32 --------------------- */
1058 # elif defined(VGA_mips32)
1060 # define GOF(_fieldname) \
1061 (offsetof(VexGuestMIPS32State,guest_##_fieldname))
1062 # define SZB(_fieldname) \
1063 (sizeof(((VexGuestMIPS32State*)0)->guest_##_fieldname))
1068 # if defined (VG_LITTLEENDIAN)
1069 tl_assert(host_is_little_endian());
1070 # elif defined (VG_BIGENDIAN)
1071 tl_assert(host_is_big_endian());
1073 # error "Unknown endianness"
1076 if (o
== GOF(r0
) && sz
== 4) return o
;
1077 if (o
== GOF(r1
) && sz
== 4) return o
;
1078 if (o
== GOF(r2
) && sz
== 4) return o
;
1079 if (o
== GOF(r3
) && sz
== 4) return o
;
1080 if (o
== GOF(r4
) && sz
== 4) return o
;
1081 if (o
== GOF(r5
) && sz
== 4) return o
;
1082 if (o
== GOF(r6
) && sz
== 4) return o
;
1083 if (o
== GOF(r7
) && sz
== 4) return o
;
1084 if (o
== GOF(r8
) && sz
== 4) return o
;
1085 if (o
== GOF(r9
) && sz
== 4) return o
;
1086 if (o
== GOF(r10
) && sz
== 4) return o
;
1087 if (o
== GOF(r11
) && sz
== 4) return o
;
1088 if (o
== GOF(r12
) && sz
== 4) return o
;
1089 if (o
== GOF(r13
) && sz
== 4) return o
;
1090 if (o
== GOF(r14
) && sz
== 4) return o
;
1091 if (o
== GOF(r15
) && sz
== 4) return o
;
1092 if (o
== GOF(r16
) && sz
== 4) return o
;
1093 if (o
== GOF(r17
) && sz
== 4) return o
;
1094 if (o
== GOF(r18
) && sz
== 4) return o
;
1095 if (o
== GOF(r19
) && sz
== 4) return o
;
1096 if (o
== GOF(r20
) && sz
== 4) return o
;
1097 if (o
== GOF(r21
) && sz
== 4) return o
;
1098 if (o
== GOF(r22
) && sz
== 4) return o
;
1099 if (o
== GOF(r23
) && sz
== 4) return o
;
1100 if (o
== GOF(r24
) && sz
== 4) return o
;
1101 if (o
== GOF(r25
) && sz
== 4) return o
;
1102 if (o
== GOF(r26
) && sz
== 4) return o
;
1103 if (o
== GOF(r27
) && sz
== 4) return o
;
1104 if (o
== GOF(r28
) && sz
== 4) return o
;
1105 if (o
== GOF(r29
) && sz
== 4) return o
;
1106 if (o
== GOF(r30
) && sz
== 4) return o
;
1107 if (o
== GOF(r31
) && sz
== 4) return o
;
1108 if (o
== GOF(PC
) && sz
== 4) return -1; /* slot unused */
1110 if (o
== GOF(HI
) && sz
== 4) return o
;
1111 if (o
== GOF(LO
) && sz
== 4) return o
;
1113 if (o
== GOF(FIR
) && sz
== 4) return -1; /* slot unused */
1114 if (o
== GOF(FCCR
) && sz
== 4) return -1; /* slot unused */
1115 if (o
== GOF(FEXR
) && sz
== 4) return -1; /* slot unused */
1116 if (o
== GOF(FENR
) && sz
== 4) return -1; /* slot unused */
1117 if (o
== GOF(FCSR
) && sz
== 4) return -1; /* slot unused */
1118 if (o
== GOF(ULR
) && sz
== 4) return -1;
1120 if (o
== GOF(EMNOTE
) && sz
== 4) return -1; /* slot unused */
1121 if (o
== GOF(CMSTART
) && sz
== 4) return -1; /* slot unused */
1122 if (o
== GOF(CMLEN
) && sz
== 4) return -1; /* slot unused */
1123 if (o
== GOF(NRADDR
) && sz
== 4) return -1; /* slot unused */
1125 if (o
>= GOF(f0
) && o
+sz
<= GOF(f0
) +SZB(f0
)) return GOF(f0
);
1126 if (o
>= GOF(f1
) && o
+sz
<= GOF(f1
) +SZB(f1
)) return GOF(f1
);
1127 if (o
>= GOF(f2
) && o
+sz
<= GOF(f2
) +SZB(f2
)) return GOF(f2
);
1128 if (o
>= GOF(f3
) && o
+sz
<= GOF(f3
) +SZB(f3
)) return GOF(f3
);
1129 if (o
>= GOF(f4
) && o
+sz
<= GOF(f4
) +SZB(f4
)) return GOF(f4
);
1130 if (o
>= GOF(f5
) && o
+sz
<= GOF(f5
) +SZB(f5
)) return GOF(f5
);
1131 if (o
>= GOF(f6
) && o
+sz
<= GOF(f6
) +SZB(f6
)) return GOF(f6
);
1132 if (o
>= GOF(f7
) && o
+sz
<= GOF(f7
) +SZB(f7
)) return GOF(f7
);
1133 if (o
>= GOF(f8
) && o
+sz
<= GOF(f8
) +SZB(f8
)) return GOF(f8
);
1134 if (o
>= GOF(f9
) && o
+sz
<= GOF(f9
) +SZB(f9
)) return GOF(f9
);
1135 if (o
>= GOF(f10
) && o
+sz
<= GOF(f10
)+SZB(f10
)) return GOF(f10
);
1136 if (o
>= GOF(f11
) && o
+sz
<= GOF(f11
)+SZB(f11
)) return GOF(f11
);
1137 if (o
>= GOF(f12
) && o
+sz
<= GOF(f12
)+SZB(f12
)) return GOF(f12
);
1138 if (o
>= GOF(f13
) && o
+sz
<= GOF(f13
)+SZB(f13
)) return GOF(f13
);
1139 if (o
>= GOF(f14
) && o
+sz
<= GOF(f14
)+SZB(f14
)) return GOF(f14
);
1140 if (o
>= GOF(f15
) && o
+sz
<= GOF(f15
)+SZB(f15
)) return GOF(f15
);
1142 if (o
>= GOF(f16
) && o
+sz
<= GOF(f16
)+SZB(f16
)) return GOF(f16
);
1143 if (o
>= GOF(f17
) && o
+sz
<= GOF(f17
) +SZB(f17
)) return GOF(f17
);
1144 if (o
>= GOF(f18
) && o
+sz
<= GOF(f18
) +SZB(f18
)) return GOF(f18
);
1145 if (o
>= GOF(f19
) && o
+sz
<= GOF(f19
) +SZB(f19
)) return GOF(f19
);
1146 if (o
>= GOF(f20
) && o
+sz
<= GOF(f20
) +SZB(f20
)) return GOF(f20
);
1147 if (o
>= GOF(f21
) && o
+sz
<= GOF(f21
) +SZB(f21
)) return GOF(f21
);
1148 if (o
>= GOF(f22
) && o
+sz
<= GOF(f22
) +SZB(f22
)) return GOF(f22
);
1149 if (o
>= GOF(f23
) && o
+sz
<= GOF(f23
) +SZB(f23
)) return GOF(f23
);
1150 if (o
>= GOF(f24
) && o
+sz
<= GOF(f24
) +SZB(f24
)) return GOF(f24
);
1151 if (o
>= GOF(f25
) && o
+sz
<= GOF(f25
) +SZB(f25
)) return GOF(f25
);
1152 if (o
>= GOF(f26
) && o
+sz
<= GOF(f26
)+SZB(f26
)) return GOF(f26
);
1153 if (o
>= GOF(f27
) && o
+sz
<= GOF(f27
)+SZB(f27
)) return GOF(f27
);
1154 if (o
>= GOF(f28
) && o
+sz
<= GOF(f28
)+SZB(f28
)) return GOF(f28
);
1155 if (o
>= GOF(f29
) && o
+sz
<= GOF(f29
)+SZB(f29
)) return GOF(f29
);
1156 if (o
>= GOF(f30
) && o
+sz
<= GOF(f30
)+SZB(f30
)) return GOF(f30
);
1157 if (o
>= GOF(f31
) && o
+sz
<= GOF(f31
)+SZB(f31
)) return GOF(f31
);
1160 if ((o
> GOF(NRADDR
)) && (o
<= GOF(NRADDR
) +12 )) return -1;
1162 /* MIPS32 DSP ASE(r2) specific registers. */
1163 if (o
== GOF(DSPControl
) && sz
== 4) return o
;
1164 if (o
== GOF(ac0
) && sz
== 8) return o
;
1165 if (o
== GOF(ac1
) && sz
== 8) return o
;
1166 if (o
== GOF(ac2
) && sz
== 8) return o
;
1167 if (o
== GOF(ac3
) && sz
== 8) return o
;
1169 if (o
== GOF(LLaddr
) && sz
== 4) return -1; /* slot unused */
1170 if (o
== GOF(LLdata
) && sz
== 4) return -1; /* slot unused */
1172 if (o
>= GOF(w0
) && o
+sz
<= GOF(w0
) + SZB(w0
)) return GOF(w0
);
1173 if (o
>= GOF(w1
) && o
+sz
<= GOF(w1
) + SZB(w1
)) return GOF(w1
);
1174 if (o
>= GOF(w2
) && o
+sz
<= GOF(w2
) + SZB(w2
)) return GOF(w2
);
1175 if (o
>= GOF(w3
) && o
+sz
<= GOF(w3
) + SZB(w3
)) return GOF(w3
);
1176 if (o
>= GOF(w4
) && o
+sz
<= GOF(w4
) + SZB(w4
)) return GOF(w4
);
1177 if (o
>= GOF(w5
) && o
+sz
<= GOF(w5
) + SZB(w5
)) return GOF(w5
);
1178 if (o
>= GOF(w6
) && o
+sz
<= GOF(w6
) + SZB(w6
)) return GOF(w6
);
1179 if (o
>= GOF(w7
) && o
+sz
<= GOF(w7
) + SZB(w7
)) return GOF(w7
);
1180 if (o
>= GOF(w8
) && o
+sz
<= GOF(w8
) + SZB(w8
)) return GOF(w8
);
1181 if (o
>= GOF(w9
) && o
+sz
<= GOF(w9
) + SZB(w9
)) return GOF(w9
);
1182 if (o
>= GOF(w10
) && o
+sz
<= GOF(w10
) + SZB(w10
)) return GOF(w10
);
1183 if (o
>= GOF(w11
) && o
+sz
<= GOF(w11
) + SZB(w11
)) return GOF(w11
);
1184 if (o
>= GOF(w12
) && o
+sz
<= GOF(w12
) + SZB(w12
)) return GOF(w12
);
1185 if (o
>= GOF(w13
) && o
+sz
<= GOF(w13
) + SZB(w13
)) return GOF(w13
);
1186 if (o
>= GOF(w14
) && o
+sz
<= GOF(w14
) + SZB(w14
)) return GOF(w14
);
1187 if (o
>= GOF(w15
) && o
+sz
<= GOF(w15
) + SZB(w15
)) return GOF(w15
);
1188 if (o
>= GOF(w16
) && o
+sz
<= GOF(w16
) + SZB(w16
)) return GOF(w16
);
1189 if (o
>= GOF(w17
) && o
+sz
<= GOF(w17
) + SZB(w17
)) return GOF(w17
);
1190 if (o
>= GOF(w18
) && o
+sz
<= GOF(w18
) + SZB(w18
)) return GOF(w18
);
1191 if (o
>= GOF(w19
) && o
+sz
<= GOF(w19
) + SZB(w19
)) return GOF(w19
);
1192 if (o
>= GOF(w20
) && o
+sz
<= GOF(w20
) + SZB(w20
)) return GOF(w20
);
1193 if (o
>= GOF(w21
) && o
+sz
<= GOF(w21
) + SZB(w21
)) return GOF(w21
);
1194 if (o
>= GOF(w22
) && o
+sz
<= GOF(w22
) + SZB(w22
)) return GOF(w22
);
1195 if (o
>= GOF(w23
) && o
+sz
<= GOF(w23
) + SZB(w23
)) return GOF(w23
);
1196 if (o
>= GOF(w24
) && o
+sz
<= GOF(w24
) + SZB(w24
)) return GOF(w24
);
1197 if (o
>= GOF(w25
) && o
+sz
<= GOF(w25
) + SZB(w25
)) return GOF(w25
);
1198 if (o
>= GOF(w26
) && o
+sz
<= GOF(w26
) + SZB(w26
)) return GOF(w26
);
1199 if (o
>= GOF(w27
) && o
+sz
<= GOF(w27
) + SZB(w27
)) return GOF(w27
);
1200 if (o
>= GOF(w28
) && o
+sz
<= GOF(w28
) + SZB(w28
)) return GOF(w28
);
1201 if (o
>= GOF(w29
) && o
+sz
<= GOF(w29
) + SZB(w29
)) return GOF(w29
);
1202 if (o
>= GOF(w30
) && o
+sz
<= GOF(w30
) + SZB(w30
)) return GOF(w30
);
1203 if (o
>= GOF(w31
) && o
+sz
<= GOF(w31
) + SZB(w31
)) return GOF(w31
);
1205 VG_(printf
)("MC_(get_otrack_shadow_offset)(mips)(off=%d,sz=%d)\n",
1211 /* --------------------- mips64 --------------------- */
1213 # elif defined(VGA_mips64)
1215 # define GOF(_fieldname) \
1216 (offsetof(VexGuestMIPS64State,guest_##_fieldname))
1217 # define SZB(_fieldname) \
1218 (sizeof(((VexGuestMIPS64State*)0)->guest_##_fieldname))
1223 #if defined (VG_LITTLEENDIAN)
1224 tl_assert(host_is_little_endian());
1225 #elif defined (VG_BIGENDIAN)
1226 tl_assert(host_is_big_endian());
1229 if (o
>= GOF(r0
) && sz
<= 8 && o
<= (GOF(r31
) + 8 - sz
))
1230 return GOF(r0
) + ((o
-GOF(r0
)) & -8) ;
1232 if (o
== GOF(PC
) && sz
== 8) return -1; /* slot unused */
1234 if (o
== GOF(HI
) && sz
== 8) return o
;
1235 if (o
== GOF(LO
) && sz
== 8) return o
;
1237 if (o
== GOF(FIR
) && sz
== 4) return -1; /* slot unused */
1238 if (o
== GOF(FCCR
) && sz
== 4) return -1; /* slot unused */
1239 if (o
== GOF(FEXR
) && sz
== 4) return -1; /* slot unused */
1240 if (o
== GOF(FENR
) && sz
== 4) return -1; /* slot unused */
1241 if (o
== GOF(FCSR
) && sz
== 4) return -1; /* slot unused */
1242 if (o
== GOF(ULR
) && sz
== 8) return o
;
1244 if (o
== GOF(EMNOTE
) && sz
== 4) return -1; /* slot unused */
1245 if (o
== GOF(CMSTART
) && sz
== 4) return -1; /* slot unused */
1246 if (o
== GOF(CMLEN
) && sz
== 4) return -1; /* slot unused */
1247 if (o
== GOF(NRADDR
) && sz
== 4) return -1; /* slot unused */
1249 if (o
>= GOF(f0
) && o
+sz
<= GOF(f0
) +SZB(f0
)) return GOF(f0
);
1250 if (o
>= GOF(f1
) && o
+sz
<= GOF(f1
) +SZB(f1
)) return GOF(f1
);
1251 if (o
>= GOF(f2
) && o
+sz
<= GOF(f2
) +SZB(f2
)) return GOF(f2
);
1252 if (o
>= GOF(f3
) && o
+sz
<= GOF(f3
) +SZB(f3
)) return GOF(f3
);
1253 if (o
>= GOF(f4
) && o
+sz
<= GOF(f4
) +SZB(f4
)) return GOF(f4
);
1254 if (o
>= GOF(f5
) && o
+sz
<= GOF(f5
) +SZB(f5
)) return GOF(f5
);
1255 if (o
>= GOF(f6
) && o
+sz
<= GOF(f6
) +SZB(f6
)) return GOF(f6
);
1256 if (o
>= GOF(f7
) && o
+sz
<= GOF(f7
) +SZB(f7
)) return GOF(f7
);
1257 if (o
>= GOF(f8
) && o
+sz
<= GOF(f8
) +SZB(f8
)) return GOF(f8
);
1258 if (o
>= GOF(f9
) && o
+sz
<= GOF(f9
) +SZB(f9
)) return GOF(f9
);
1259 if (o
>= GOF(f10
) && o
+sz
<= GOF(f10
)+SZB(f10
)) return GOF(f10
);
1260 if (o
>= GOF(f11
) && o
+sz
<= GOF(f11
)+SZB(f11
)) return GOF(f11
);
1261 if (o
>= GOF(f12
) && o
+sz
<= GOF(f12
)+SZB(f12
)) return GOF(f12
);
1262 if (o
>= GOF(f13
) && o
+sz
<= GOF(f13
)+SZB(f13
)) return GOF(f13
);
1263 if (o
>= GOF(f14
) && o
+sz
<= GOF(f14
)+SZB(f14
)) return GOF(f14
);
1264 if (o
>= GOF(f15
) && o
+sz
<= GOF(f15
)+SZB(f15
)) return GOF(f15
);
1265 if (o
>= GOF(f16
) && o
+sz
<= GOF(f16
)+SZB(f16
)) return GOF(f16
);
1266 if (o
>= GOF(f17
) && o
+sz
<= GOF(f17
)+SZB(f17
)) return GOF(f17
);
1267 if (o
>= GOF(f18
) && o
+sz
<= GOF(f18
)+SZB(f18
)) return GOF(f18
);
1268 if (o
>= GOF(f19
) && o
+sz
<= GOF(f19
)+SZB(f19
)) return GOF(f19
);
1269 if (o
>= GOF(f20
) && o
+sz
<= GOF(f20
)+SZB(f20
)) return GOF(f20
);
1270 if (o
>= GOF(f21
) && o
+sz
<= GOF(f21
)+SZB(f21
)) return GOF(f21
);
1271 if (o
>= GOF(f22
) && o
+sz
<= GOF(f22
)+SZB(f22
)) return GOF(f22
);
1272 if (o
>= GOF(f23
) && o
+sz
<= GOF(f23
)+SZB(f23
)) return GOF(f23
);
1273 if (o
>= GOF(f24
) && o
+sz
<= GOF(f24
)+SZB(f24
)) return GOF(f24
);
1274 if (o
>= GOF(f25
) && o
+sz
<= GOF(f25
)+SZB(f25
)) return GOF(f25
);
1275 if (o
>= GOF(f26
) && o
+sz
<= GOF(f26
)+SZB(f26
)) return GOF(f26
);
1276 if (o
>= GOF(f27
) && o
+sz
<= GOF(f27
)+SZB(f27
)) return GOF(f27
);
1277 if (o
>= GOF(f28
) && o
+sz
<= GOF(f28
)+SZB(f28
)) return GOF(f28
);
1278 if (o
>= GOF(f29
) && o
+sz
<= GOF(f29
)+SZB(f29
)) return GOF(f29
);
1279 if (o
>= GOF(f30
) && o
+sz
<= GOF(f30
)+SZB(f30
)) return GOF(f30
);
1280 if (o
>= GOF(f31
) && o
+sz
<= GOF(f31
)+SZB(f31
)) return GOF(f31
);
1282 if ((o
> GOF(NRADDR
)) && (o
<= GOF(NRADDR
) +12 )) return -1;
1284 if (o
== GOF(LLaddr
) && sz
== 8) return -1; /* slot unused */
1285 if (o
== GOF(LLdata
) && sz
== 8) return -1; /* slot unused */
1287 if (o
>= GOF(w0
) && o
+sz
<= GOF(w0
) + SZB(w0
)) return GOF(w0
);
1288 if (o
>= GOF(w1
) && o
+sz
<= GOF(w1
) + SZB(w1
)) return GOF(w1
);
1289 if (o
>= GOF(w2
) && o
+sz
<= GOF(w2
) + SZB(w2
)) return GOF(w2
);
1290 if (o
>= GOF(w3
) && o
+sz
<= GOF(w3
) + SZB(w3
)) return GOF(w3
);
1291 if (o
>= GOF(w4
) && o
+sz
<= GOF(w4
) + SZB(w4
)) return GOF(w4
);
1292 if (o
>= GOF(w5
) && o
+sz
<= GOF(w5
) + SZB(w5
)) return GOF(w5
);
1293 if (o
>= GOF(w6
) && o
+sz
<= GOF(w6
) + SZB(w6
)) return GOF(w6
);
1294 if (o
>= GOF(w7
) && o
+sz
<= GOF(w7
) + SZB(w7
)) return GOF(w7
);
1295 if (o
>= GOF(w8
) && o
+sz
<= GOF(w8
) + SZB(w8
)) return GOF(w8
);
1296 if (o
>= GOF(w9
) && o
+sz
<= GOF(w9
) + SZB(w9
)) return GOF(w9
);
1297 if (o
>= GOF(w10
) && o
+sz
<= GOF(w10
) + SZB(w10
)) return GOF(w10
);
1298 if (o
>= GOF(w11
) && o
+sz
<= GOF(w11
) + SZB(w11
)) return GOF(w11
);
1299 if (o
>= GOF(w12
) && o
+sz
<= GOF(w12
) + SZB(w12
)) return GOF(w12
);
1300 if (o
>= GOF(w13
) && o
+sz
<= GOF(w13
) + SZB(w13
)) return GOF(w13
);
1301 if (o
>= GOF(w14
) && o
+sz
<= GOF(w14
) + SZB(w14
)) return GOF(w14
);
1302 if (o
>= GOF(w15
) && o
+sz
<= GOF(w15
) + SZB(w15
)) return GOF(w15
);
1303 if (o
>= GOF(w16
) && o
+sz
<= GOF(w16
) + SZB(w16
)) return GOF(w16
);
1304 if (o
>= GOF(w17
) && o
+sz
<= GOF(w17
) + SZB(w17
)) return GOF(w17
);
1305 if (o
>= GOF(w18
) && o
+sz
<= GOF(w18
) + SZB(w18
)) return GOF(w18
);
1306 if (o
>= GOF(w19
) && o
+sz
<= GOF(w19
) + SZB(w19
)) return GOF(w19
);
1307 if (o
>= GOF(w20
) && o
+sz
<= GOF(w20
) + SZB(w20
)) return GOF(w20
);
1308 if (o
>= GOF(w21
) && o
+sz
<= GOF(w21
) + SZB(w21
)) return GOF(w21
);
1309 if (o
>= GOF(w22
) && o
+sz
<= GOF(w22
) + SZB(w22
)) return GOF(w22
);
1310 if (o
>= GOF(w23
) && o
+sz
<= GOF(w23
) + SZB(w23
)) return GOF(w23
);
1311 if (o
>= GOF(w24
) && o
+sz
<= GOF(w24
) + SZB(w24
)) return GOF(w24
);
1312 if (o
>= GOF(w25
) && o
+sz
<= GOF(w25
) + SZB(w25
)) return GOF(w25
);
1313 if (o
>= GOF(w26
) && o
+sz
<= GOF(w26
) + SZB(w26
)) return GOF(w26
);
1314 if (o
>= GOF(w27
) && o
+sz
<= GOF(w27
) + SZB(w27
)) return GOF(w27
);
1315 if (o
>= GOF(w28
) && o
+sz
<= GOF(w28
) + SZB(w28
)) return GOF(w28
);
1316 if (o
>= GOF(w29
) && o
+sz
<= GOF(w29
) + SZB(w29
)) return GOF(w29
);
1317 if (o
>= GOF(w30
) && o
+sz
<= GOF(w30
) + SZB(w30
)) return GOF(w30
);
1318 if (o
>= GOF(w31
) && o
+sz
<= GOF(w31
) + SZB(w31
)) return GOF(w31
);
1320 VG_(printf
)("MC_(get_otrack_shadow_offset)(mips)(off=%d,sz=%d)\n",
1327 # error "FIXME: not implemented for this architecture"
1332 /* Let 'arr' describe an indexed reference to a guest state section
1333 (guest state array).
1335 This function returns the corresponding guest state type to be used
1336 when indexing the corresponding array in the second shadow (origin
1337 tracking) area. If the array is not to be origin-tracked, return
1340 This function must agree with MC_(get_otrack_shadow_offset) above.
1341 See comments at the start of MC_(get_otrack_shadow_offset).
1343 IRType
MC_(get_otrack_reg_array_equiv_int_type
) ( IRRegArray
* arr
)
1345 /* -------------------- ppc64 -------------------- */
1346 # if defined(VGA_ppc64be) || defined(VGA_ppc64le)
1347 /* The redir stack. */
1348 if (arr
->base
== offsetof(VexGuestPPC64State
,guest_REDIR_STACK
[0])
1349 && arr
->elemTy
== Ity_I64
1350 && arr
->nElems
== VEX_GUEST_PPC64_REDIR_STACK_SIZE
)
1353 VG_(printf
)("get_reg_array_equiv_int_type(ppc64): unhandled: ");
1358 /* -------------------- ppc32 -------------------- */
1359 # elif defined(VGA_ppc32)
1360 /* The redir stack. */
1361 if (arr
->base
== offsetof(VexGuestPPC32State
,guest_REDIR_STACK
[0])
1362 && arr
->elemTy
== Ity_I32
1363 && arr
->nElems
== VEX_GUEST_PPC32_REDIR_STACK_SIZE
)
1366 VG_(printf
)("get_reg_array_equiv_int_type(ppc32): unhandled: ");
1371 /* -------------------- amd64 -------------------- */
1372 # elif defined(VGA_amd64)
1373 /* Ignore the FP tag array - pointless to shadow, and in any case
1374 the elements are too small */
1375 if (arr
->base
== offsetof(VexGuestAMD64State
,guest_FPTAG
)
1376 && arr
->elemTy
== Ity_I8
&& arr
->nElems
== 8)
1379 /* The FP register array */
1380 if (arr
->base
== offsetof(VexGuestAMD64State
,guest_FPREG
[0])
1381 && arr
->elemTy
== Ity_F64
&& arr
->nElems
== 8)
1384 VG_(printf
)("get_reg_array_equiv_int_type(amd64): unhandled: ");
1389 /* --------------------- x86 --------------------- */
1390 # elif defined(VGA_x86)
1391 /* Ignore the FP tag array - pointless to shadow, and in any case
1392 the elements are too small */
1393 if (arr
->base
== offsetof(VexGuestX86State
,guest_FPTAG
)
1394 && arr
->elemTy
== Ity_I8
&& arr
->nElems
== 8)
1397 /* The FP register array */
1398 if (arr
->base
== offsetof(VexGuestX86State
,guest_FPREG
[0])
1399 && arr
->elemTy
== Ity_F64
&& arr
->nElems
== 8)
1402 VG_(printf
)("get_reg_array_equiv_int_type(x86): unhandled: ");
1407 /* --------------------- arm --------------------- */
1408 # elif defined(VGA_arm)
1409 VG_(printf
)("get_reg_array_equiv_int_type(arm): unhandled: ");
1414 /* --------------------- arm64 --------------------- */
1415 # elif defined(VGA_arm64)
1416 VG_(printf
)("get_reg_array_equiv_int_type(arm64): unhandled: ");
1421 /* --------------------- s390x --------------------- */
1422 # elif defined(VGA_s390x)
1423 /* Should never het here because s390x does not use Ist_PutI
1427 /* --------------------- mips32 --------------------- */
1428 # elif defined(VGA_mips32)
1429 VG_(printf
)("get_reg_array_equiv_int_type(mips32): unhandled: ");
1434 /* --------------------- mips64 --------------------- */
1435 # elif defined(VGA_mips64)
1436 VG_(printf
)("get_reg_array_equiv_int_type(mips64): unhandled: ");
1442 # error "FIXME: not implemented for this architecture"
1447 /*--------------------------------------------------------------------*/
1448 /*--- end mc_machine.c ---*/
1449 /*--------------------------------------------------------------------*/