Bug 439685 compiler warning in callgrind/main.c
[valgrind.git] / VEX / pub / libvex_guest_arm64.h
blob91d06bd754facd84e6455c8984638b64880ce0fd
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. _LO64 and _HI64
161 contain the original contents of _ADDR+0 .. _ADDR+15, but only _SIZE
162 number of bytes of it. The remaining 16-_SIZE bytes of them must be
163 zero. */
164 ULong guest_LLSC_SIZE; // 0==no current transaction, else 1,2,4,8 or 16.
165 ULong guest_LLSC_ADDR; // Address of transaction.
166 ULong guest_LLSC_DATA_LO64; // Original value at _ADDR+0.
167 ULong guest_LLSC_DATA_HI64; // Original value at _ADDR+8.
169 /* Padding to make it have an 16-aligned size */
170 /* UInt pad_end_0; */
171 /* ULong pad_end_1; */
173 VexGuestARM64State;
176 /*---------------------------------------------------------------*/
177 /*--- Utility functions for ARM64 guest stuff. ---*/
178 /*---------------------------------------------------------------*/
180 /* ALL THE FOLLOWING ARE VISIBLE TO LIBRARY CLIENT */
182 /* Initialise all guest ARM64 state. */
184 extern
185 void LibVEX_GuestARM64_initialise ( /*OUT*/VexGuestARM64State* vex_state );
187 /* Calculate the ARM64 flag state from the saved data, in the format
188 32x0:n:z:c:v:28x0. */
189 extern
190 ULong LibVEX_GuestARM64_get_nzcv ( /*IN*/
191 const VexGuestARM64State* vex_state );
193 /* Calculate the ARM64 FPSR state from the saved data, in the format
194 36x0:qc:27x0 */
195 extern
196 ULong LibVEX_GuestARM64_get_fpsr ( /*IN*/
197 const VexGuestARM64State* vex_state );
199 /* Set the ARM64 FPSR representation from the given FPSR value. */
200 extern
201 void LibVEX_GuestARM64_set_fpsr ( /*MOD*/VexGuestARM64State* vex_state,
202 ULong fpsr );
205 #endif /* ndef __LIBVEX_PUB_GUEST_ARM64_H */
208 /*---------------------------------------------------------------*/
209 /*--- libvex_guest_arm64.h ---*/
210 /*---------------------------------------------------------------*/