cerion | 896a137 | 2005-01-25 12:24:25 +0000 | [diff] [blame] | 1 | |
| 2 | /*---------------------------------------------------------------*/ |
| 3 | /*--- ---*/ |
cerion | 1515db9 | 2005-01-25 17:21:23 +0000 | [diff] [blame] | 4 | /*--- This file (guest-ppc32/gdefs.h) is ---*/ |
sewardj | dbcfae7 | 2005-08-02 11:14:04 +0000 | [diff] [blame] | 5 | /*--- Copyright (C) OpenWorks LLP. All rights reserved. ---*/ |
cerion | 896a137 | 2005-01-25 12:24:25 +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 | 7bd6ffe | 2005-08-03 16:07:36 +0000 | [diff] [blame] | 13 | Copyright (C) 2004-2005 OpenWorks LLP. All rights reserved. |
cerion | 896a137 | 2005-01-25 12:24:25 +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. |
cerion | 896a137 | 2005-01-25 12:24:25 +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. |
cerion | 896a137 | 2005-01-25 12:24:25 +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. |
cerion | 896a137 | 2005-01-25 12:24:25 +0000 | [diff] [blame] | 45 | */ |
| 46 | |
cerion | 1515db9 | 2005-01-25 17:21:23 +0000 | [diff] [blame] | 47 | /* Only to be used within the guest-ppc32 directory. */ |
cerion | 896a137 | 2005-01-25 12:24:25 +0000 | [diff] [blame] | 48 | |
| 49 | |
cerion | 1515db9 | 2005-01-25 17:21:23 +0000 | [diff] [blame] | 50 | #ifndef __LIBVEX_GUEST_PPC32_DEFS_H |
| 51 | #define __LIBVEX_GUEST_PPC32_DEFS_H |
cerion | 896a137 | 2005-01-25 12:24:25 +0000 | [diff] [blame] | 52 | |
sewardj | 9e6491a | 2005-07-02 19:24:10 +0000 | [diff] [blame] | 53 | |
| 54 | /*---------------------------------------------------------*/ |
| 55 | /*--- ppc32 to IR conversion ---*/ |
| 56 | /*---------------------------------------------------------*/ |
| 57 | |
| 58 | /* Convert one ppc32 insn to IR. See the type DisOneInstrFn in |
| 59 | bb_to_IR.h. */ |
| 60 | extern |
| 61 | DisResult disInstr_PPC32 ( IRBB* irbb, |
| 62 | Bool put_IP, |
| 63 | Bool (*resteerOkFn) ( Addr64 ), |
| 64 | UChar* guest_code, |
| 65 | Long delta, |
| 66 | Addr64 guest_IP, |
| 67 | VexArchInfo* archinfo, |
| 68 | Bool host_bigendian ); |
| 69 | |
| 70 | /* Used by the optimiser to specialise calls to helpers. */ |
| 71 | extern |
| 72 | IRExpr* guest_ppc32_spechelper ( HChar* function_name, |
| 73 | IRExpr** args ); |
| 74 | |
cerion | f0de28c | 2005-12-13 20:21:11 +0000 | [diff] [blame^] | 75 | extern |
| 76 | IRExpr* guest_ppc64_spechelper ( HChar* function_name, |
| 77 | IRExpr** args ); |
| 78 | |
sewardj | 9e6491a | 2005-07-02 19:24:10 +0000 | [diff] [blame] | 79 | /* Describes to the optimser which part of the guest state require |
| 80 | precise memory exceptions. This is logically part of the guest |
| 81 | state description. */ |
| 82 | extern |
| 83 | Bool guest_ppc32_state_requires_precise_mem_exns ( Int, Int ); |
| 84 | |
cerion | f0de28c | 2005-12-13 20:21:11 +0000 | [diff] [blame^] | 85 | extern |
| 86 | Bool guest_ppc64_state_requires_precise_mem_exns ( Int, Int ); |
| 87 | |
sewardj | 9e6491a | 2005-07-02 19:24:10 +0000 | [diff] [blame] | 88 | extern |
| 89 | VexGuestLayout ppc32Guest_layout; |
| 90 | |
cerion | f0de28c | 2005-12-13 20:21:11 +0000 | [diff] [blame^] | 91 | extern |
| 92 | VexGuestLayout ppc64Guest_layout; |
| 93 | |
sewardj | 9e6491a | 2005-07-02 19:24:10 +0000 | [diff] [blame] | 94 | |
cerion | 094d139 | 2005-06-20 13:45:57 +0000 | [diff] [blame] | 95 | /* FP Rounding mode - different encoding to IR */ |
| 96 | typedef |
| 97 | enum { |
| 98 | PPC32rm_NEAREST = 0, |
| 99 | PPC32rm_NegINF = 1, |
| 100 | PPC32rm_PosINF = 2, |
| 101 | PPC32rm_ZERO = 3 |
| 102 | } PPC32RoundingMode; |
| 103 | |
| 104 | /* Floating point comparison values - different encoding to IR */ |
| 105 | typedef |
| 106 | enum { |
| 107 | PPC32cr_LT = 0x8, |
| 108 | PPC32cr_GT = 0x4, |
| 109 | PPC32cr_EQ = 0x2, |
| 110 | PPC32cr_UN = 0x1 |
| 111 | } |
| 112 | PPC32CmpF64Result; |
cerion | 896a137 | 2005-01-25 12:24:25 +0000 | [diff] [blame] | 113 | |
cerion | ae69462 | 2005-01-28 17:52:47 +0000 | [diff] [blame] | 114 | /* |
cerion | e9d361a | 2005-03-04 17:35:29 +0000 | [diff] [blame] | 115 | Enumeration for xer_ca/ov calculation helper functions |
| 116 | */ |
cerion | ae69462 | 2005-01-28 17:52:47 +0000 | [diff] [blame] | 117 | enum { |
sewardj | 20ef547 | 2005-07-21 14:48:31 +0000 | [diff] [blame] | 118 | /* 0 */ PPC32G_FLAG_OP_ADD=0, // addc[o], addic |
| 119 | /* 1 */ PPC32G_FLAG_OP_ADDE, // adde[o], addme[o], addze[o] |
| 120 | /* 2 */ PPC32G_FLAG_OP_DIVW, // divwo |
| 121 | /* 3 */ PPC32G_FLAG_OP_DIVWU, // divwuo |
| 122 | /* 4 */ PPC32G_FLAG_OP_MULLW, // mullwo |
| 123 | /* 5 */ PPC32G_FLAG_OP_NEG, // nego |
| 124 | /* 6 */ PPC32G_FLAG_OP_SUBF, // subfo |
| 125 | /* 7 */ PPC32G_FLAG_OP_SUBFC, // subfc[o] |
| 126 | /* 8 */ PPC32G_FLAG_OP_SUBFE, // subfe[o], subfme[o], subfze[o] |
| 127 | /* 9 */ PPC32G_FLAG_OP_SUBFI, // subfic |
| 128 | /* 10 */ PPC32G_FLAG_OP_SRAW, // sraw |
| 129 | /* 11 */ PPC32G_FLAG_OP_SRAWI, // srawi |
cerion | f0de28c | 2005-12-13 20:21:11 +0000 | [diff] [blame^] | 130 | /* 12 */ PPC32G_FLAG_OP_SRAD, // srad |
| 131 | /* 13 */ PPC32G_FLAG_OP_SRADI, // sradi |
cerion | b85e8bb | 2005-02-16 08:54:33 +0000 | [diff] [blame] | 132 | PPC32G_FLAG_OP_NUMBER |
cerion | ae69462 | 2005-01-28 17:52:47 +0000 | [diff] [blame] | 133 | }; |
| 134 | |
cerion | 896a137 | 2005-01-25 12:24:25 +0000 | [diff] [blame] | 135 | |
sewardj | 73a9197 | 2005-09-06 10:25:46 +0000 | [diff] [blame] | 136 | /*---------------------------------------------------------*/ |
cerion | 225a034 | 2005-09-12 20:49:09 +0000 | [diff] [blame] | 137 | /*--- ppc32 guest helpers ---*/ |
sewardj | 73a9197 | 2005-09-06 10:25:46 +0000 | [diff] [blame] | 138 | /*---------------------------------------------------------*/ |
| 139 | |
| 140 | /* --- CLEAN HELPERS --- */ |
| 141 | |
| 142 | /* none, right now */ |
| 143 | |
| 144 | /* --- DIRTY HELPERS --- */ |
| 145 | |
| 146 | extern ULong ppc32g_dirtyhelper_MFTB ( void ); |
| 147 | |
cerion | 6f6c6a0 | 2005-09-13 18:41:09 +0000 | [diff] [blame] | 148 | extern void ppc32g_dirtyhelper_LVS ( VexGuestPPC32State* gst, |
| 149 | UInt vD_idx, UInt sh, |
sewardj | d147094 | 2005-10-22 02:01:16 +0000 | [diff] [blame] | 150 | UInt shift_right ); |
sewardj | 73a9197 | 2005-09-06 10:25:46 +0000 | [diff] [blame] | 151 | |
cerion | 1515db9 | 2005-01-25 17:21:23 +0000 | [diff] [blame] | 152 | #endif /* ndef __LIBVEX_GUEST_PPC32_DEFS_H */ |
cerion | 896a137 | 2005-01-25 12:24:25 +0000 | [diff] [blame] | 153 | |
| 154 | /*---------------------------------------------------------------*/ |
cerion | 1515db9 | 2005-01-25 17:21:23 +0000 | [diff] [blame] | 155 | /*--- end guest-ppc32/gdefs.h ---*/ |
cerion | 896a137 | 2005-01-25 12:24:25 +0000 | [diff] [blame] | 156 | /*---------------------------------------------------------------*/ |