2 /*---------------------------------------------------------------*/
3 /*--- begin libvex_guest_arm.h ---*/
4 /*---------------------------------------------------------------*/
7 This file is part of Valgrind, a dynamic binary instrumentation
10 Copyright (C) 2004-2010 OpenWorks LLP
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, write to the Free Software
25 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
28 The GNU General Public License is contained in the file COPYING.
31 #ifndef __LIBVEX_PUB_GUEST_ARM_H
32 #define __LIBVEX_PUB_GUEST_ARM_H
34 #include "libvex_basictypes.h"
35 #include "libvex_emwarn.h"
38 /*---------------------------------------------------------------*/
39 /*--- Vex's representation of the ARM CPU state. ---*/
40 /*---------------------------------------------------------------*/
58 UInt guest_R13; /* stack pointer */
59 UInt guest_R14; /* link register */
60 UInt guest_R15; /* program counter */
62 /* 4-word thunk used to calculate N(sign) Z(zero) C(carry,
63 unsigned overflow) and V(signed overflow) flags. */
70 /* Various pseudo-regs mandated by Vex or Valgrind. */
71 /* Emulation warnings */
74 /* For clflush: record start and length of area to invalidate */
78 /* Used to record the unredirected guest address at the start of
79 a translation whose start has been redirected. By reading
80 this pseudo-register shortly afterwards, the translation can
81 find out what the corresponding no-redirection address was.
82 Note, this is only set for wrap-style redirects, not for
83 replace-style ones. */
86 /* Needed for Darwin (but mandated for all guest architectures):
87 program counter at the last syscall insn (int 0x80/81/82,
88 sysenter, syscall, svc). Used when backing up to restart a
89 syscall that has been interrupted by a signal. */
91 UInt guest_IP_AT_SYSCALL;
93 /* VFP state. D0 .. D15 must be 8-aligned. */
94 /* 104 -- I guess there's 4 bytes of padding just prior to this? */
113 /* Not a town in Cornwall, but instead the TPIDRURO, on of the
114 Thread ID registers present in CP15 (the system control
115 coprocessor), register set "c13", register 3 (the User
116 Read-only Thread ID Register). arm-linux apparently uses it
117 to hold the TLS pointer for the thread. It's read-only in
118 user space. On Linux it is set in user space by various
119 thread-related syscalls. */
122 /* Padding to make it have an 16-aligned size */
129 /*---------------------------------------------------------------*/
130 /*--- Utility functions for ARM guest stuff. ---*/
131 /*---------------------------------------------------------------*/
133 /* ALL THE FOLLOWING ARE VISIBLE TO LIBRARY CLIENT */
135 /* Initialise all guest ARM state. */
138 void LibVEX_GuestARM_initialise ( /*OUT*/VexGuestARMState* vex_state );
140 /* Calculate the ARM flag state from the saved data. */
143 UInt LibVEX_GuestARM_get_cpsr ( /*IN*/VexGuestARMState* vex_state );
146 #endif /* ndef __LIBVEX_PUB_GUEST_ARM_H */
149 /*---------------------------------------------------------------*/
150 /*--- libvex_guest_arm.h ---*/
151 /*---------------------------------------------------------------*/