drd/drd_pthread_intercepts: Add a workaround for what is probably a compiler bug
[valgrind.git] / VEX / pub / libvex_guest_arm64.h
blob39b6ecdc2e2427d8ec7539042d04cebf8ed7ebd2
2 /*---------------------------------------------------------------*/
3 /*--- begin libvex_guest_arm64.h ---*/
4 /*---------------------------------------------------------------*/
6 /*
7 This file is part of Valgrind, a dynamic binary instrumentation
8 framework.
10 Copyright (C) 2013-2017 OpenWorks
11 info@open-works.net
13 This program is free software; you can redistribute it and/or
14 modify it under the terms of the GNU General Public License as
15 published by the Free Software Foundation; either version 2 of the
16 License, or (at your option) any later version.
18 This program is distributed in the hope that it will be useful, but
19 WITHOUT ANY WARRANTY; without even the implied warranty of
20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 General Public License for more details.
23 You should have received a copy of the GNU General Public License
24 along with this program; if not, see <http://www.gnu.org/licenses/>.
26 The GNU General Public License is contained in the file COPYING.
29 #ifndef __LIBVEX_PUB_GUEST_ARM64_H
30 #define __LIBVEX_PUB_GUEST_ARM64_H
32 #include "libvex_basictypes.h"
35 /*---------------------------------------------------------------*/
36 /*--- Vex's representation of the ARM64 CPU state. ---*/
37 /*---------------------------------------------------------------*/
39 typedef
40 struct {
41 /* Event check fail addr and counter. */
42 /* 0 */ ULong host_EvC_FAILADDR;
43 /* 8 */ UInt host_EvC_COUNTER;
44 /* 12 */ UInt pad0;
45 /* 16 */
46 ULong guest_X0;
47 ULong guest_X1;
48 ULong guest_X2;
49 ULong guest_X3;
50 ULong guest_X4;
51 ULong guest_X5;
52 ULong guest_X6;
53 ULong guest_X7;
54 ULong guest_X8;
55 ULong guest_X9;
56 ULong guest_X10;
57 ULong guest_X11;
58 ULong guest_X12;
59 ULong guest_X13;
60 ULong guest_X14;
61 ULong guest_X15;
62 ULong guest_X16;
63 ULong guest_X17;
64 ULong guest_X18;
65 ULong guest_X19;
66 ULong guest_X20;
67 ULong guest_X21;
68 ULong guest_X22;
69 ULong guest_X23;
70 ULong guest_X24;
71 ULong guest_X25;
72 ULong guest_X26;
73 ULong guest_X27;
74 ULong guest_X28;
75 ULong guest_X29;
76 ULong guest_X30; /* link register */
77 ULong guest_XSP;
78 ULong guest_PC;
80 /* 4-word thunk used to calculate N(sign) Z(zero) C(carry,
81 unsigned overflow) and V(signed overflow) flags. */
82 ULong guest_CC_OP;
83 ULong guest_CC_DEP1;
84 ULong guest_CC_DEP2;
85 ULong guest_CC_NDEP;
87 /* User-space thread register? */
88 ULong guest_TPIDR_EL0;
90 /* FP/SIMD state */
91 U128 guest_Q0;
92 U128 guest_Q1;
93 U128 guest_Q2;
94 U128 guest_Q3;
95 U128 guest_Q4;
96 U128 guest_Q5;
97 U128 guest_Q6;
98 U128 guest_Q7;
99 U128 guest_Q8;
100 U128 guest_Q9;
101 U128 guest_Q10;
102 U128 guest_Q11;
103 U128 guest_Q12;
104 U128 guest_Q13;
105 U128 guest_Q14;
106 U128 guest_Q15;
107 U128 guest_Q16;
108 U128 guest_Q17;
109 U128 guest_Q18;
110 U128 guest_Q19;
111 U128 guest_Q20;
112 U128 guest_Q21;
113 U128 guest_Q22;
114 U128 guest_Q23;
115 U128 guest_Q24;
116 U128 guest_Q25;
117 U128 guest_Q26;
118 U128 guest_Q27;
119 U128 guest_Q28;
120 U128 guest_Q29;
121 U128 guest_Q30;
122 U128 guest_Q31;
124 /* A 128-bit value which is used to represent the FPSR.QC (sticky
125 saturation) flag, when necessary. If the value stored here
126 is zero, FPSR.QC is currently zero. If it is any other value,
127 FPSR.QC is currently one. We don't currently represent any
128 other bits of FPSR, so this is all that that is for FPSR. */
129 U128 guest_QCFLAG;
131 /* Various pseudo-regs mandated by Vex or Valgrind. */
132 /* Emulation notes */
133 UInt guest_EMNOTE;
135 /* For clflush/clinval: record start and length of area */
136 ULong guest_CMSTART;
137 ULong guest_CMLEN;
139 /* Used to record the unredirected guest address at the start of
140 a translation whose start has been redirected. By reading
141 this pseudo-register shortly afterwards, the translation can
142 find out what the corresponding no-redirection address was.
143 Note, this is only set for wrap-style redirects, not for
144 replace-style ones. */
145 ULong guest_NRADDR;
147 /* Needed for Darwin (but mandated for all guest architectures):
148 program counter at the last syscall insn (int 0x80/81/82,
149 sysenter, syscall, svc). Used when backing up to restart a
150 syscall that has been interrupted by a signal. */
151 ULong guest_IP_AT_SYSCALL;
153 /* The complete FPCR. Default value seems to be zero. We
154 ignore all bits except 23 and 22, which are the rounding
155 mode. The guest is unconstrained in what values it can write
156 to and read from this register, but the emulation only takes
157 note of bits 23 and 22. */
158 UInt guest_FPCR;
160 /* Fallback LL/SC support. See bugs 344524 and 369459. */
161 ULong guest_LLSC_SIZE; // 0==no current transaction, else 1,2,4 or 8.
162 ULong guest_LLSC_ADDR; // Address of transaction.
163 ULong guest_LLSC_DATA; // Original value at _ADDR, zero-extended.
165 /* Padding to make it have an 16-aligned size */
166 /* UInt pad_end_0; */
167 ULong pad_end_1;
169 VexGuestARM64State;
172 /*---------------------------------------------------------------*/
173 /*--- Utility functions for ARM64 guest stuff. ---*/
174 /*---------------------------------------------------------------*/
176 /* ALL THE FOLLOWING ARE VISIBLE TO LIBRARY CLIENT */
178 /* Initialise all guest ARM64 state. */
180 extern
181 void LibVEX_GuestARM64_initialise ( /*OUT*/VexGuestARM64State* vex_state );
183 /* Calculate the ARM64 flag state from the saved data, in the format
184 32x0:n:z:c:v:28x0. */
185 extern
186 ULong LibVEX_GuestARM64_get_nzcv ( /*IN*/
187 const VexGuestARM64State* vex_state );
189 /* Calculate the ARM64 FPSR state from the saved data, in the format
190 36x0:qc:27x0 */
191 extern
192 ULong LibVEX_GuestARM64_get_fpsr ( /*IN*/
193 const VexGuestARM64State* vex_state );
195 /* Set the ARM64 FPSR representation from the given FPSR value. */
196 extern
197 void LibVEX_GuestARM64_set_fpsr ( /*MOD*/VexGuestARM64State* vex_state,
198 ULong fpsr );
201 #endif /* ndef __LIBVEX_PUB_GUEST_ARM64_H */
204 /*---------------------------------------------------------------*/
205 /*--- libvex_guest_arm64.h ---*/
206 /*---------------------------------------------------------------*/