]> rtime.felk.cvut.cz Git - l4.git/blob - l4/pkg/valgrind/src/valgrind-3.6.0-svn/VEX/pub/libvex_guest_arm.h
664bfb786b5a4fe91a5f327b1fd8029a55082ceb
[l4.git] / l4 / pkg / valgrind / src / valgrind-3.6.0-svn / VEX / pub / libvex_guest_arm.h
1
2 /*---------------------------------------------------------------*/
3 /*--- begin                                libvex_guest_arm.h ---*/
4 /*---------------------------------------------------------------*/
5
6 /*
7    This file is part of Valgrind, a dynamic binary instrumentation
8    framework.
9
10    Copyright (C) 2004-2010 OpenWorks LLP
11       info@open-works.net
12
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.
17
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.
22
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
26    02110-1301, USA.
27
28    The GNU General Public License is contained in the file COPYING.
29 */
30
31 #ifndef __LIBVEX_PUB_GUEST_ARM_H
32 #define __LIBVEX_PUB_GUEST_ARM_H
33
34 #include "libvex_basictypes.h"
35 #include "libvex_emwarn.h"
36
37
38 /*---------------------------------------------------------------*/
39 /*--- Vex's representation of the ARM CPU state.              ---*/
40 /*---------------------------------------------------------------*/
41
42 typedef
43    struct {
44       /* 0 */
45       UInt guest_R0;
46       UInt guest_R1;
47       UInt guest_R2;
48       UInt guest_R3;
49       UInt guest_R4;
50       UInt guest_R5;
51       UInt guest_R6;
52       UInt guest_R7;
53       UInt guest_R8;
54       UInt guest_R9;
55       UInt guest_R10;
56       UInt guest_R11;
57       UInt guest_R12;
58       UInt guest_R13;     /* stack pointer */
59       UInt guest_R14;     /* link register */
60       UInt guest_R15;     /* program counter */
61
62       /* 4-word thunk used to calculate N(sign) Z(zero) C(carry,
63          unsigned overflow) and V(signed overflow) flags. */
64       /* 64 */
65       UInt guest_CC_OP;
66       UInt guest_CC_DEP1;
67       UInt guest_CC_DEP2;
68       UInt guest_CC_NDEP;
69
70       /* Various pseudo-regs mandated by Vex or Valgrind. */
71       /* Emulation warnings */
72       UInt guest_EMWARN;
73
74       /* For clflush: record start and length of area to invalidate */
75       UInt guest_TISTART;
76       UInt guest_TILEN;
77
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. */
84       UInt guest_NRADDR;
85
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. */
90       /* 96 */
91       UInt guest_IP_AT_SYSCALL;
92
93       /* VFP state.  D0 .. D15 must be 8-aligned. */
94       /* 104 -- I guess there's 4 bytes of padding just prior to this? */
95       ULong guest_D0;
96       ULong guest_D1;
97       ULong guest_D2;
98       ULong guest_D3;
99       ULong guest_D4;
100       ULong guest_D5;
101       ULong guest_D6;
102       ULong guest_D7;
103       ULong guest_D8;
104       ULong guest_D9;
105       ULong guest_D10;
106       ULong guest_D11;
107       ULong guest_D12;
108       ULong guest_D13;
109       ULong guest_D14;
110       ULong guest_D15;
111       UInt  guest_FPSCR;
112
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. */
120       UInt guest_TPIDRURO;
121
122       /* Padding to make it have an 16-aligned size */
123       /* UInt padding1; */
124       /* UInt padding2; */
125    }
126    VexGuestARMState;
127
128
129 /*---------------------------------------------------------------*/
130 /*--- Utility functions for ARM guest stuff.                  ---*/
131 /*---------------------------------------------------------------*/
132
133 /* ALL THE FOLLOWING ARE VISIBLE TO LIBRARY CLIENT */
134
135 /* Initialise all guest ARM state. */
136
137 extern
138 void LibVEX_GuestARM_initialise ( /*OUT*/VexGuestARMState* vex_state );
139
140 /* Calculate the ARM flag state from the saved data. */
141
142 extern
143 UInt LibVEX_GuestARM_get_cpsr ( /*IN*/VexGuestARMState* vex_state );
144
145
146 #endif /* ndef __LIBVEX_PUB_GUEST_ARM_H */
147
148
149 /*---------------------------------------------------------------*/
150 /*---                                      libvex_guest_arm.h ---*/
151 /*---------------------------------------------------------------*/