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. _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
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; */
176 /*---------------------------------------------------------------*/
177 /*--- Utility functions for ARM64 guest stuff. ---*/
178 /*---------------------------------------------------------------*/
180 /* ALL THE FOLLOWING ARE VISIBLE TO LIBRARY CLIENT */
182 /* Initialise all guest ARM64 state. */
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. */
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
196 ULong
LibVEX_GuestARM64_get_fpsr ( /*IN*/
197 const VexGuestARM64State
* vex_state
);
199 /* Set the ARM64 FPSR representation from the given FPSR value. */
201 void LibVEX_GuestARM64_set_fpsr ( /*MOD*/VexGuestARM64State
* vex_state
,
205 #endif /* ndef __LIBVEX_PUB_GUEST_ARM64_H */
208 /*---------------------------------------------------------------*/
209 /*--- libvex_guest_arm64.h ---*/
210 /*---------------------------------------------------------------*/