blob: 5d3d1b90f84f0ad2ec4369b5f84126c1d7888e43 [file] [log] [blame]
sewardjd584f8f2004-11-22 16:02:34 +00001
2/*---------------------------------------------------------------*/
3/*--- ---*/
4/*--- This file (libvex_guest_arm.h) is ---*/
sewardjdbcfae72005-08-02 11:14:04 +00005/*--- Copyright (C) OpenWorks LLP. All rights reserved. ---*/
sewardjd584f8f2004-11-22 16:02:34 +00006/*--- ---*/
7/*---------------------------------------------------------------*/
8
9/*
10 This file is part of LibVEX, a library for dynamic binary
11 instrumentation and translation.
12
sewardj7bd6ffe2005-08-03 16:07:36 +000013 Copyright (C) 2004-2005 OpenWorks LLP. All rights reserved.
sewardjd584f8f2004-11-22 16:02:34 +000014
sewardj7bd6ffe2005-08-03 16:07:36 +000015 This library is made available under a dual licensing scheme.
sewardjd584f8f2004-11-22 16:02:34 +000016
sewardj7bd6ffe2005-08-03 16:07:36 +000017 If you link LibVEX against other code all of which is itself
18 licensed under the GNU General Public License, version 2 dated June
19 1991 ("GPL v2"), then you may use LibVEX under the terms of the GPL
20 v2, as appearing in the file LICENSE.GPL. If the file LICENSE.GPL
21 is missing, you can obtain a copy of the GPL v2 from the Free
22 Software Foundation Inc., 51 Franklin St, Fifth Floor, Boston, MA
23 02110-1301, USA.
24
25 For any other uses of LibVEX, you must first obtain a commercial
26 license from OpenWorks LLP. Please contact info@open-works.co.uk
27 for information about commercial licensing.
28
29 This software is provided by OpenWorks LLP "as is" and any express
30 or implied warranties, including, but not limited to, the implied
31 warranties of merchantability and fitness for a particular purpose
32 are disclaimed. In no event shall OpenWorks LLP be liable for any
33 direct, indirect, incidental, special, exemplary, or consequential
34 damages (including, but not limited to, procurement of substitute
35 goods or services; loss of use, data, or profits; or business
36 interruption) however caused and on any theory of liability,
37 whether in contract, strict liability, or tort (including
38 negligence or otherwise) arising in any way out of the use of this
39 software, even if advised of the possibility of such damage.
sewardjd584f8f2004-11-22 16:02:34 +000040
41 Neither the names of the U.S. Department of Energy nor the
42 University of California nor the names of its contributors may be
43 used to endorse or promote products derived from this software
44 without prior written permission.
sewardjd584f8f2004-11-22 16:02:34 +000045*/
46
47#ifndef __LIBVEX_PUB_GUEST_ARM_H
48#define __LIBVEX_PUB_GUEST_ARM_H
49
50#include "libvex_basictypes.h"
njnd93ee4c2004-11-30 11:37:48 +000051#include "libvex_emwarn.h"
sewardjd584f8f2004-11-22 16:02:34 +000052
sewardj2a9ad022004-11-25 02:46:58 +000053
sewardjd584f8f2004-11-22 16:02:34 +000054/*---------------------------------------------------------------*/
55/*--- Vex's representation of the ARM CPU state. ---*/
56/*---------------------------------------------------------------*/
57
sewardj2a9ad022004-11-25 02:46:58 +000058/* R13 traditionally used as the stack pointer ? */
59
sewardjd584f8f2004-11-22 16:02:34 +000060typedef
61 struct {
62 UInt guest_R0;
63 UInt guest_R1;
64 UInt guest_R2;
65 UInt guest_R3;
66 UInt guest_R4;
67 UInt guest_R5;
68 UInt guest_R6;
69 UInt guest_R7;
70 UInt guest_R8;
71 UInt guest_R9;
72 UInt guest_R10;
73 UInt guest_R11;
74 UInt guest_R12;
cerioncee30312004-12-17 20:30:21 +000075
76 /* aka the stack pointer */
sewardjd584f8f2004-11-22 16:02:34 +000077 UInt guest_R13;
sewardjd584f8f2004-11-22 16:02:34 +000078
sewardj2a9ad022004-11-25 02:46:58 +000079 /* aka the link register */
80 UInt guest_R14;
81
82 /* Program counter. */
sewardjd584f8f2004-11-22 16:02:34 +000083 UInt guest_R15;
84
sewardj2a9ad022004-11-25 02:46:58 +000085 /* System call number copied in here from swi insn literal
86 field. */
sewardje77b88b2004-11-24 11:22:31 +000087 UInt guest_SYSCALLNO;
88
sewardj2a9ad022004-11-25 02:46:58 +000089 /* 3-word thunk used to calculate N(sign) Z(zero) C(carry,
90 unsigned overflow) and V(signed overflow) flags. */
91 UInt guest_CC_OP;
92 UInt guest_CC_DEP1;
93 UInt guest_CC_DEP2;
94
sewardj893aada2004-11-29 19:57:54 +000095 /* Emulation warnings */
96 UInt guest_EMWARN;
97
sewardjd584f8f2004-11-22 16:02:34 +000098 /* Padding to make it have an 8-aligned size */
cerionce57cd22004-12-10 10:46:16 +000099 UInt padding;
sewardjd584f8f2004-11-22 16:02:34 +0000100 }
101 VexGuestARMState;
102
103
sewardjfb183d22004-12-03 11:55:29 +0000104/*---------------------------------------------------------------*/
105/*--- Utility functions for ARM guest stuff. ---*/
106/*---------------------------------------------------------------*/
107
108/* ALL THE FOLLOWING ARE VISIBLE TO LIBRARY CLIENT */
109
110/* Initialise all guest ARM state. */
111
112extern
113void LibVEX_GuestARM_initialise ( /*OUT*/VexGuestARMState* vex_state );
114
115/* Calculate the ARM flag state from the saved data. */
116
117extern
118UInt LibVEX_GuestARM_get_flags ( /*IN*/VexGuestARMState* vex_state );
119
120
sewardjd584f8f2004-11-22 16:02:34 +0000121#endif /* ndef __LIBVEX_PUB_GUEST_ARM_H */
122
sewardjfb183d22004-12-03 11:55:29 +0000123
sewardjd584f8f2004-11-22 16:02:34 +0000124/*---------------------------------------------------------------*/
125/*--- libvex_guest_arm.h ---*/
126/*---------------------------------------------------------------*/