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 (libvex_guest_ppc32.h) is ---*/ |
cerion | 896a137 | 2005-01-25 12:24:25 +0000 | [diff] [blame] | 5 | /*--- Copyright (c) 2005 OpenWorks LLP. All rights reserved. ---*/ |
| 6 | /*--- ---*/ |
| 7 | /*---------------------------------------------------------------*/ |
| 8 | |
| 9 | /* |
| 10 | This file is part of LibVEX, a library for dynamic binary |
| 11 | instrumentation and translation. |
| 12 | |
| 13 | Copyright (C) 2005 OpenWorks, LLP. |
| 14 | |
| 15 | This program is free software; you can redistribute it and/or modify |
| 16 | it under the terms of the GNU General Public License as published by |
| 17 | the Free Software Foundation; Version 2 dated June 1991 of the |
| 18 | license. |
| 19 | |
| 20 | This program is distributed in the hope that it will be useful, |
| 21 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 22 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, or liability |
| 23 | for damages. See the GNU General Public License for more details. |
| 24 | |
| 25 | Neither the names of the U.S. Department of Energy nor the |
| 26 | University of California nor the names of its contributors may be |
| 27 | used to endorse or promote products derived from this software |
| 28 | without prior written permission. |
| 29 | |
| 30 | You should have received a copy of the GNU General Public License |
| 31 | along with this program; if not, write to the Free Software |
| 32 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 |
| 33 | USA. |
| 34 | */ |
| 35 | |
cerion | 1515db9 | 2005-01-25 17:21:23 +0000 | [diff] [blame] | 36 | #ifndef __LIBVEX_PUB_GUEST_PPC32_H |
| 37 | #define __LIBVEX_PUB_GUEST_PPC32_H |
cerion | 896a137 | 2005-01-25 12:24:25 +0000 | [diff] [blame] | 38 | |
| 39 | #include "libvex_basictypes.h" |
| 40 | #include "libvex_emwarn.h" |
| 41 | |
| 42 | |
| 43 | /*---------------------------------------------------------------*/ |
cerion | 1515db9 | 2005-01-25 17:21:23 +0000 | [diff] [blame] | 44 | /*--- Vex's representation of the PPC32 CPU state ---*/ |
cerion | 896a137 | 2005-01-25 12:24:25 +0000 | [diff] [blame] | 45 | /*---------------------------------------------------------------*/ |
| 46 | |
| 47 | typedef |
| 48 | struct { |
| 49 | // General Purpose Registers |
| 50 | UInt guest_GPR0; |
| 51 | UInt guest_GPR1; |
| 52 | UInt guest_GPR2; |
| 53 | UInt guest_GPR3; |
| 54 | UInt guest_GPR4; |
| 55 | UInt guest_GPR5; |
| 56 | UInt guest_GPR6; |
| 57 | UInt guest_GPR7; |
| 58 | UInt guest_GPR8; |
| 59 | UInt guest_GPR9; |
| 60 | UInt guest_GPR10; |
| 61 | UInt guest_GPR11; |
| 62 | UInt guest_GPR12; |
| 63 | UInt guest_GPR13; |
| 64 | UInt guest_GPR14; |
| 65 | UInt guest_GPR15; |
| 66 | UInt guest_GPR16; |
| 67 | UInt guest_GPR17; |
| 68 | UInt guest_GPR18; |
| 69 | UInt guest_GPR19; |
| 70 | UInt guest_GPR20; |
| 71 | UInt guest_GPR21; |
| 72 | UInt guest_GPR22; |
| 73 | UInt guest_GPR23; |
| 74 | UInt guest_GPR24; |
| 75 | UInt guest_GPR25; |
| 76 | UInt guest_GPR26; |
| 77 | UInt guest_GPR27; |
| 78 | UInt guest_GPR28; |
| 79 | UInt guest_GPR29; |
| 80 | UInt guest_GPR30; |
| 81 | UInt guest_GPR31; |
| 82 | |
cerion | 98d105a | 2005-02-04 16:13:58 +0000 | [diff] [blame^] | 83 | // Floating Point Registers |
| 84 | ULong guest_FPR0; |
| 85 | ULong guest_FPR1; |
| 86 | ULong guest_FPR2; |
| 87 | ULong guest_FPR3; |
| 88 | ULong guest_FPR4; |
| 89 | ULong guest_FPR5; |
| 90 | ULong guest_FPR6; |
| 91 | ULong guest_FPR7; |
| 92 | ULong guest_FPR8; |
| 93 | ULong guest_FPR9; |
| 94 | ULong guest_FPR10; |
| 95 | ULong guest_FPR11; |
| 96 | ULong guest_FPR12; |
| 97 | ULong guest_FPR13; |
| 98 | ULong guest_FPR14; |
| 99 | ULong guest_FPR15; |
| 100 | ULong guest_FPR16; |
| 101 | ULong guest_FPR17; |
| 102 | ULong guest_FPR18; |
| 103 | ULong guest_FPR19; |
| 104 | ULong guest_FPR20; |
| 105 | ULong guest_FPR21; |
| 106 | ULong guest_FPR22; |
| 107 | ULong guest_FPR23; |
| 108 | ULong guest_FPR24; |
| 109 | ULong guest_FPR25; |
| 110 | ULong guest_FPR26; |
| 111 | ULong guest_FPR27; |
| 112 | ULong guest_FPR28; |
| 113 | ULong guest_FPR29; |
| 114 | ULong guest_FPR30; |
| 115 | ULong guest_FPR31; |
| 116 | |
cerion | 62bec57 | 2005-02-01 21:29:39 +0000 | [diff] [blame] | 117 | UInt guest_CIA; // Current Instruction Address (no arch visible register) |
cerion | 896a137 | 2005-01-25 12:24:25 +0000 | [diff] [blame] | 118 | UInt guest_LR; // Link Register |
| 119 | UInt guest_CTR; // Count Register |
| 120 | |
cerion | 91ad536 | 2005-01-27 23:02:41 +0000 | [diff] [blame] | 121 | /* thunk used to calculate CR0 flags. */ |
| 122 | UChar guest_CC_OP; // boolean: 0=> dep1=result 1=> dep1=flags |
| 123 | UInt guest_CC_DEP1; // Result of last op | flags |
cerion | 62bec57 | 2005-02-01 21:29:39 +0000 | [diff] [blame] | 124 | UChar guest_CC_DEP2; // XER_SO |
cerion | 896a137 | 2005-01-25 12:24:25 +0000 | [diff] [blame] | 125 | |
cerion | 7aa4bbc | 2005-01-29 09:32:07 +0000 | [diff] [blame] | 126 | // CR1:7: Used for 'compare' ops (bits 0:4 not used - thunk used for this) |
| 127 | UInt guest_CR1to7; |
cerion | e77ce01 | 2005-01-25 16:56:18 +0000 | [diff] [blame] | 128 | |
cerion | 98d105a | 2005-02-04 16:13:58 +0000 | [diff] [blame^] | 129 | UInt guest_FPSCR; // Floating Point Status and Control Register |
| 130 | |
cerion | e77ce01 | 2005-01-25 16:56:18 +0000 | [diff] [blame] | 131 | /* XER */ |
| 132 | UChar guest_XER_SO; // Summary Overflow |
| 133 | UChar guest_XER_OV; // Overflow |
| 134 | UChar guest_XER_CA; // Carry |
cerion | c19d5e1 | 2005-02-01 15:56:25 +0000 | [diff] [blame] | 135 | UChar guest_XER_BC; // Byte Count |
cerion | 896a137 | 2005-01-25 12:24:25 +0000 | [diff] [blame] | 136 | |
| 137 | /* Emulation warnings */ |
| 138 | UInt guest_EMWARN; |
| 139 | |
| 140 | /* Padding to make it have an 8-aligned size */ |
cerion | 62bec57 | 2005-02-01 21:29:39 +0000 | [diff] [blame] | 141 | // UChar padding_1b1; |
| 142 | // UChar padding_1b2; |
| 143 | // UChar padding_1b3; |
cerion | 98d105a | 2005-02-04 16:13:58 +0000 | [diff] [blame^] | 144 | // UInt padding_4b; |
cerion | 896a137 | 2005-01-25 12:24:25 +0000 | [diff] [blame] | 145 | } |
cerion | 1515db9 | 2005-01-25 17:21:23 +0000 | [diff] [blame] | 146 | VexGuestPPC32State; |
cerion | 896a137 | 2005-01-25 12:24:25 +0000 | [diff] [blame] | 147 | |
| 148 | |
| 149 | /*---------------------------------------------------------------*/ |
cerion | 1515db9 | 2005-01-25 17:21:23 +0000 | [diff] [blame] | 150 | /*--- Utility functions for PPC32 guest stuff. ---*/ |
cerion | 896a137 | 2005-01-25 12:24:25 +0000 | [diff] [blame] | 151 | /*---------------------------------------------------------------*/ |
| 152 | |
| 153 | /* ALL THE FOLLOWING ARE VISIBLE TO LIBRARY CLIENT */ |
| 154 | |
cerion | 1515db9 | 2005-01-25 17:21:23 +0000 | [diff] [blame] | 155 | /* Initialise all guest PPC32 state. */ |
cerion | 896a137 | 2005-01-25 12:24:25 +0000 | [diff] [blame] | 156 | |
| 157 | extern |
cerion | 1515db9 | 2005-01-25 17:21:23 +0000 | [diff] [blame] | 158 | void LibVEX_GuestPPC32_initialise ( /*OUT*/VexGuestPPC32State* vex_state ); |
cerion | 896a137 | 2005-01-25 12:24:25 +0000 | [diff] [blame] | 159 | |
cerion | 1515db9 | 2005-01-25 17:21:23 +0000 | [diff] [blame] | 160 | /* Calculate the PPC32 flag state from the saved data. */ |
cerion | 896a137 | 2005-01-25 12:24:25 +0000 | [diff] [blame] | 161 | |
| 162 | extern |
cerion | 1515db9 | 2005-01-25 17:21:23 +0000 | [diff] [blame] | 163 | UInt LibVEX_GuestPPC32_get_flags ( /*IN*/VexGuestPPC32State* vex_state ); |
cerion | 896a137 | 2005-01-25 12:24:25 +0000 | [diff] [blame] | 164 | |
| 165 | |
cerion | 1515db9 | 2005-01-25 17:21:23 +0000 | [diff] [blame] | 166 | #endif /* ndef __LIBVEX_PUB_GUEST_PPC32_H */ |
cerion | 896a137 | 2005-01-25 12:24:25 +0000 | [diff] [blame] | 167 | |
| 168 | |
| 169 | /*---------------------------------------------------------------*/ |
cerion | 1515db9 | 2005-01-25 17:21:23 +0000 | [diff] [blame] | 170 | /*--- libvex_guest_ppc32.h ---*/ |
cerion | 896a137 | 2005-01-25 12:24:25 +0000 | [diff] [blame] | 171 | /*---------------------------------------------------------------*/ |