2 /*---------------------------------------------------------------*/
3 /*--- begin libvex_guest_arm64.h ---*/
4 /*---------------------------------------------------------------*/
7 This file is part of Valgrind, a dynamic binary instrumentation
10 Copyright (C) 2013-2017 OpenWorks
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 /*---------------------------------------------------------------*/
41 /* Event check fail addr and counter. */
42 /* 0 */ ULong host_EvC_FAILADDR
;
43 /* 8 */ UInt host_EvC_COUNTER
;
76 ULong guest_X30
; /* link register */
80 /* 4-word thunk used to calculate N(sign) Z(zero) C(carry,
81 unsigned overflow) and V(signed overflow) flags. */
87 /* User-space thread register? */
88 ULong guest_TPIDR_EL0
;
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. */
131 /* Various pseudo-regs mandated by Vex or Valgrind. */
132 /* Emulation notes */
135 /* For clflush/clinval: record start and length of area */
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. */
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. */
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; */
172 /*---------------------------------------------------------------*/
173 /*--- Utility functions for ARM64 guest stuff. ---*/
174 /*---------------------------------------------------------------*/
176 /* ALL THE FOLLOWING ARE VISIBLE TO LIBRARY CLIENT */
178 /* Initialise all guest ARM64 state. */
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. */
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
192 ULong
LibVEX_GuestARM64_get_fpsr ( /*IN*/
193 const VexGuestARM64State
* vex_state
);
195 /* Set the ARM64 FPSR representation from the given FPSR value. */
197 void LibVEX_GuestARM64_set_fpsr ( /*MOD*/VexGuestARM64State
* vex_state
,
201 #endif /* ndef __LIBVEX_PUB_GUEST_ARM64_H */
204 /*---------------------------------------------------------------*/
205 /*--- libvex_guest_arm64.h ---*/
206 /*---------------------------------------------------------------*/