sewardj | d584f8f | 2004-11-22 16:02:34 +0000 | [diff] [blame] | 1 | |
| 2 | /*---------------------------------------------------------------*/ |
| 3 | /*--- ---*/ |
| 4 | /*--- This file (libvex_guest_arm.h) is ---*/ |
sewardj | dbcfae7 | 2005-08-02 11:14:04 +0000 | [diff] [blame] | 5 | /*--- Copyright (C) OpenWorks LLP. All rights reserved. ---*/ |
sewardj | d584f8f | 2004-11-22 16:02:34 +0000 | [diff] [blame] | 6 | /*--- ---*/ |
| 7 | /*---------------------------------------------------------------*/ |
| 8 | |
| 9 | /* |
| 10 | This file is part of LibVEX, a library for dynamic binary |
| 11 | instrumentation and translation. |
| 12 | |
sewardj | a33e9a4 | 2006-06-05 23:13:19 +0000 | [diff] [blame] | 13 | Copyright (C) 2004-2006 OpenWorks LLP. All rights reserved. |
sewardj | d584f8f | 2004-11-22 16:02:34 +0000 | [diff] [blame] | 14 | |
sewardj | 7bd6ffe | 2005-08-03 16:07:36 +0000 | [diff] [blame] | 15 | This library is made available under a dual licensing scheme. |
sewardj | d584f8f | 2004-11-22 16:02:34 +0000 | [diff] [blame] | 16 | |
sewardj | 7bd6ffe | 2005-08-03 16:07:36 +0000 | [diff] [blame] | 17 | 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. |
sewardj | d584f8f | 2004-11-22 16:02:34 +0000 | [diff] [blame] | 40 | |
| 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. |
sewardj | d584f8f | 2004-11-22 16:02:34 +0000 | [diff] [blame] | 45 | */ |
| 46 | |
| 47 | #ifndef __LIBVEX_PUB_GUEST_ARM_H |
| 48 | #define __LIBVEX_PUB_GUEST_ARM_H |
| 49 | |
| 50 | #include "libvex_basictypes.h" |
njn | d93ee4c | 2004-11-30 11:37:48 +0000 | [diff] [blame] | 51 | #include "libvex_emwarn.h" |
sewardj | d584f8f | 2004-11-22 16:02:34 +0000 | [diff] [blame] | 52 | |
sewardj | 2a9ad02 | 2004-11-25 02:46:58 +0000 | [diff] [blame] | 53 | |
sewardj | d584f8f | 2004-11-22 16:02:34 +0000 | [diff] [blame] | 54 | /*---------------------------------------------------------------*/ |
| 55 | /*--- Vex's representation of the ARM CPU state. ---*/ |
| 56 | /*---------------------------------------------------------------*/ |
| 57 | |
sewardj | 2a9ad02 | 2004-11-25 02:46:58 +0000 | [diff] [blame] | 58 | /* R13 traditionally used as the stack pointer ? */ |
| 59 | |
sewardj | d584f8f | 2004-11-22 16:02:34 +0000 | [diff] [blame] | 60 | typedef |
| 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; |
cerion | cee3031 | 2004-12-17 20:30:21 +0000 | [diff] [blame] | 75 | |
| 76 | /* aka the stack pointer */ |
sewardj | d584f8f | 2004-11-22 16:02:34 +0000 | [diff] [blame] | 77 | UInt guest_R13; |
sewardj | d584f8f | 2004-11-22 16:02:34 +0000 | [diff] [blame] | 78 | |
sewardj | 2a9ad02 | 2004-11-25 02:46:58 +0000 | [diff] [blame] | 79 | /* aka the link register */ |
| 80 | UInt guest_R14; |
| 81 | |
| 82 | /* Program counter. */ |
sewardj | d584f8f | 2004-11-22 16:02:34 +0000 | [diff] [blame] | 83 | UInt guest_R15; |
| 84 | |
sewardj | 2a9ad02 | 2004-11-25 02:46:58 +0000 | [diff] [blame] | 85 | /* System call number copied in here from swi insn literal |
| 86 | field. */ |
sewardj | e77b88b | 2004-11-24 11:22:31 +0000 | [diff] [blame] | 87 | UInt guest_SYSCALLNO; |
| 88 | |
sewardj | 2a9ad02 | 2004-11-25 02:46:58 +0000 | [diff] [blame] | 89 | /* 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 | |
sewardj | 893aada | 2004-11-29 19:57:54 +0000 | [diff] [blame] | 95 | /* Emulation warnings */ |
| 96 | UInt guest_EMWARN; |
| 97 | |
sewardj | d584f8f | 2004-11-22 16:02:34 +0000 | [diff] [blame] | 98 | /* Padding to make it have an 8-aligned size */ |
cerion | ce57cd2 | 2004-12-10 10:46:16 +0000 | [diff] [blame] | 99 | UInt padding; |
sewardj | d584f8f | 2004-11-22 16:02:34 +0000 | [diff] [blame] | 100 | } |
| 101 | VexGuestARMState; |
| 102 | |
| 103 | |
sewardj | fb183d2 | 2004-12-03 11:55:29 +0000 | [diff] [blame] | 104 | /*---------------------------------------------------------------*/ |
| 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 | |
| 112 | extern |
| 113 | void LibVEX_GuestARM_initialise ( /*OUT*/VexGuestARMState* vex_state ); |
| 114 | |
| 115 | /* Calculate the ARM flag state from the saved data. */ |
| 116 | |
| 117 | extern |
| 118 | UInt LibVEX_GuestARM_get_flags ( /*IN*/VexGuestARMState* vex_state ); |
| 119 | |
| 120 | |
sewardj | d584f8f | 2004-11-22 16:02:34 +0000 | [diff] [blame] | 121 | #endif /* ndef __LIBVEX_PUB_GUEST_ARM_H */ |
| 122 | |
sewardj | fb183d2 | 2004-12-03 11:55:29 +0000 | [diff] [blame] | 123 | |
sewardj | d584f8f | 2004-11-22 16:02:34 +0000 | [diff] [blame] | 124 | /*---------------------------------------------------------------*/ |
| 125 | /*--- libvex_guest_arm.h ---*/ |
| 126 | /*---------------------------------------------------------------*/ |