|
||||
File indexing completed on 2025-01-18 10:13:29
0001 0002 /*---------------------------------------------------------------*/ 0003 /*--- begin libvex_guest_ppc32.h ---*/ 0004 /*---------------------------------------------------------------*/ 0005 0006 /* 0007 This file is part of Valgrind, a dynamic binary instrumentation 0008 framework. 0009 0010 Copyright (C) 2004-2017 OpenWorks LLP 0011 info@open-works.net 0012 0013 This program is free software; you can redistribute it and/or 0014 modify it under the terms of the GNU General Public License as 0015 published by the Free Software Foundation; either version 2 of the 0016 License, or (at your option) any later version. 0017 0018 This program is distributed in the hope that it will be useful, but 0019 WITHOUT ANY WARRANTY; without even the implied warranty of 0020 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0021 General Public License for more details. 0022 0023 You should have received a copy of the GNU General Public License 0024 along with this program; if not, see <http://www.gnu.org/licenses/>. 0025 0026 The GNU General Public License is contained in the file COPYING. 0027 0028 Neither the names of the U.S. Department of Energy nor the 0029 University of California nor the names of its contributors may be 0030 used to endorse or promote products derived from this software 0031 without prior written permission. 0032 */ 0033 0034 #ifndef __LIBVEX_PUB_GUEST_PPC32_H 0035 #define __LIBVEX_PUB_GUEST_PPC32_H 0036 0037 #include "libvex_basictypes.h" 0038 0039 0040 /*---------------------------------------------------------------*/ 0041 /*--- Vex's representation of the PPC32 CPU state ---*/ 0042 /*---------------------------------------------------------------*/ 0043 0044 #define VEX_GUEST_PPC32_REDIR_STACK_SIZE (16/*entries*/ * 2/*words per entry*/) 0045 0046 typedef 0047 struct { 0048 /* Event check fail addr and counter. */ 0049 /* 0 */ UInt host_EvC_FAILADDR; 0050 /* 4 */ UInt host_EvC_COUNTER; 0051 /* 8 */ UInt pad3; 0052 /* 12 */ UInt pad4; 0053 /* Add 16 to all the numbers below. Sigh. */ 0054 /* General Purpose Registers */ 0055 /* 0 */ UInt guest_GPR0; 0056 /* 4 */ UInt guest_GPR1; 0057 /* 8 */ UInt guest_GPR2; 0058 /* 12 */ UInt guest_GPR3; 0059 /* 16 */ UInt guest_GPR4; 0060 /* 20 */ UInt guest_GPR5; 0061 /* 24 */ UInt guest_GPR6; 0062 /* 28 */ UInt guest_GPR7; 0063 /* 32 */ UInt guest_GPR8; 0064 /* 36 */ UInt guest_GPR9; 0065 /* 40 */ UInt guest_GPR10; 0066 /* 44 */ UInt guest_GPR11; 0067 /* 48 */ UInt guest_GPR12; 0068 /* 52 */ UInt guest_GPR13; 0069 /* 56 */ UInt guest_GPR14; 0070 /* 60 */ UInt guest_GPR15; 0071 /* 64 */ UInt guest_GPR16; 0072 /* 68 */ UInt guest_GPR17; 0073 /* 72 */ UInt guest_GPR18; 0074 /* 76 */ UInt guest_GPR19; 0075 /* 80 */ UInt guest_GPR20; 0076 /* 84 */ UInt guest_GPR21; 0077 /* 88 */ UInt guest_GPR22; 0078 /* 92 */ UInt guest_GPR23; 0079 /* 96 */ UInt guest_GPR24; 0080 /* 100 */ UInt guest_GPR25; 0081 /* 104 */ UInt guest_GPR26; 0082 /* 108 */ UInt guest_GPR27; 0083 /* 112 */ UInt guest_GPR28; 0084 /* 116 */ UInt guest_GPR29; 0085 /* 120 */ UInt guest_GPR30; 0086 /* 124 */ UInt guest_GPR31; 0087 0088 // Vector Registers, Floating Point Registers, and VSX Registers 0089 // With ISA 2.06, the "Vector-Scalar Floating-point" category 0090 // provides facilities to support vector and scalar binary floating- 0091 // point operations. A unified register file is an integral part 0092 // of this new facility, combining floating point and vector registers 0093 // using a 64x128-bit vector. These are referred to as VSR[0..63]. 0094 // The floating point registers are now mapped into double word element 0 0095 // of VSR[0..31]. The 32x128-bit vector registers defined by the "Vector 0096 // Facility [Category: Vector]" are now mapped to VSR[32..63]. 0097 0098 // IMPORTANT: the user of libvex must place the guest state so as 0099 // to ensure that guest_VSR{0..63}, and any shadows thereof, are 0100 // 16-aligned. 0101 0102 /* 128 */ U128 guest_VSR0; 0103 /* 144 */ U128 guest_VSR1; 0104 /* 160 */ U128 guest_VSR2; 0105 /* 176 */ U128 guest_VSR3; 0106 /* 192 */ U128 guest_VSR4; 0107 /* 208 */ U128 guest_VSR5; 0108 /* 224 */ U128 guest_VSR6; 0109 /* 240 */ U128 guest_VSR7; 0110 /* 256 */ U128 guest_VSR8; 0111 /* 272 */ U128 guest_VSR9; 0112 /* 288 */ U128 guest_VSR10; 0113 /* 304 */ U128 guest_VSR11; 0114 /* 320 */ U128 guest_VSR12; 0115 /* 336 */ U128 guest_VSR13; 0116 /* 352 */ U128 guest_VSR14; 0117 /* 368 */ U128 guest_VSR15; 0118 /* 384 */ U128 guest_VSR16; 0119 /* 400 */ U128 guest_VSR17; 0120 /* 416 */ U128 guest_VSR18; 0121 /* 432 */ U128 guest_VSR19; 0122 /* 448 */ U128 guest_VSR20; 0123 /* 464 */ U128 guest_VSR21; 0124 /* 480 */ U128 guest_VSR22; 0125 /* 496 */ U128 guest_VSR23; 0126 /* 512 */ U128 guest_VSR24; 0127 /* 528 */ U128 guest_VSR25; 0128 /* 544 */ U128 guest_VSR26; 0129 /* 560 */ U128 guest_VSR27; 0130 /* 576 */ U128 guest_VSR28; 0131 /* 592 */ U128 guest_VSR29; 0132 /* 608 */ U128 guest_VSR30; 0133 /* 624 */ U128 guest_VSR31; 0134 /* 640 */ U128 guest_VSR32; 0135 /* 656 */ U128 guest_VSR33; 0136 /* 672 */ U128 guest_VSR34; 0137 /* 688 */ U128 guest_VSR35; 0138 /* 704 */ U128 guest_VSR36; 0139 /* 720 */ U128 guest_VSR37; 0140 /* 736 */ U128 guest_VSR38; 0141 /* 752 */ U128 guest_VSR39; 0142 /* 768 */ U128 guest_VSR40; 0143 /* 784 */ U128 guest_VSR41; 0144 /* 800 */ U128 guest_VSR42; 0145 /* 816 */ U128 guest_VSR43; 0146 /* 832 */ U128 guest_VSR44; 0147 /* 848 */ U128 guest_VSR45; 0148 /* 864 */ U128 guest_VSR46; 0149 /* 880 */ U128 guest_VSR47; 0150 /* 896 */ U128 guest_VSR48; 0151 /* 912 */ U128 guest_VSR49; 0152 /* 928 */ U128 guest_VSR50; 0153 /* 944 */ U128 guest_VSR51; 0154 /* 960 */ U128 guest_VSR52; 0155 /* 976 */ U128 guest_VSR53; 0156 /* 992 */ U128 guest_VSR54; 0157 /* 1008 */ U128 guest_VSR55; 0158 /* 1024 */ U128 guest_VSR56; 0159 /* 1040 */ U128 guest_VSR57; 0160 /* 1056 */ U128 guest_VSR58; 0161 /* 1072 */ U128 guest_VSR59; 0162 /* 1088 */ U128 guest_VSR60; 0163 /* 1104 */ U128 guest_VSR61; 0164 /* 1120 */ U128 guest_VSR62; 0165 /* 1136 */ U128 guest_VSR63; 0166 0167 /* 1152 */ UInt guest_CIA; // IP (no arch visible register) 0168 /* 1156 */ UInt guest_LR; // Link Register 0169 /* 1160 */ UInt guest_CTR; // Count Register 0170 0171 /* XER pieces */ 0172 /* 1164 */ UChar guest_XER_SO; /* in lsb */ 0173 /* 1165 */ UChar guest_XER_OV; /* in lsb */ 0174 /* 1166 */ UChar guest_XER_OV32; /* in lsb */ 0175 /* 1167 */ UChar guest_XER_CA; /* in lsb */ 0176 /* 1168 */ UChar guest_XER_CA32; /* in lsb */ 0177 /* 1169 */ UChar guest_XER_BC; /* all bits */ 0178 0179 /* CR pieces */ 0180 /* 1170 */ UChar guest_CR0_321; /* in [3:1] */ 0181 /* 1171 */ UChar guest_CR0_0; /* in lsb */ 0182 /* 1172 */ UChar guest_CR1_321; /* in [3:1] */ 0183 /* 1173 */ UChar guest_CR1_0; /* in lsb */ 0184 /* 1174 */ UChar guest_CR2_321; /* in [3:1] */ 0185 /* 1175 */ UChar guest_CR2_0; /* in lsb */ 0186 /* 1176 */ UChar guest_CR3_321; /* in [3:1] */ 0187 /* 1177 */ UChar guest_CR3_0; /* in lsb */ 0188 /* 1178 */ UChar guest_CR4_321; /* in [3:1] */ 0189 /* 1179 */ UChar guest_CR4_0; /* in lsb */ 0190 /* 1180 */ UChar guest_CR5_321; /* in [3:1] */ 0191 /* 1181 */ UChar guest_CR5_0; /* in lsb */ 0192 /* 1182 */ UChar guest_CR6_321; /* in [3:1] */ 0193 /* 1183 */ UChar guest_CR6_0; /* in lsb */ 0194 /* 1184 */ UChar guest_CR7_321; /* in [3:1] */ 0195 /* 1185 */ UChar guest_CR7_0; /* in lsb */ 0196 0197 /* FP Status and Control Register fields. Only rounding mode fields 0198 * and Floating-point Condition Code (FPCC) fields in the FPSCR are 0199 * supported. 0200 */ 0201 /* 1186 */ UChar guest_FPROUND; // Binary Floating Point Rounding Mode 0202 /* 1187 */ UChar guest_DFPROUND; // Decimal Floating Point Rounding Mode 0203 /* 1188 */ UChar guest_C_FPCC; // Floating-Point Result Class Descriptor 0204 // and Floating-point Condition Code 0205 /* 1189 */ UChar pad0; 0206 /* 1190 */ UChar pad1; 0207 /* 1191 */ UChar pad2; 0208 0209 /* Vector Save/Restore Register */ 0210 /* 1192 */ UInt guest_VRSAVE; 0211 0212 /* Vector Status and Control Register */ 0213 /* 1196 */ UInt guest_VSCR; 0214 0215 /* Emulation notes */ 0216 /* 1200 */ UInt guest_EMNOTE; 0217 0218 /* For icbi: record start and length of area to invalidate */ 0219 /* 1204 */ UInt guest_CMSTART; 0220 /* 1208 */ UInt guest_CMLEN; 0221 0222 /* Used to record the unredirected guest address at the start of 0223 a translation whose start has been redirected. By reading 0224 this pseudo-register shortly afterwards, the translation can 0225 find out what the corresponding no-redirection address was. 0226 Note, this is only set for wrap-style redirects, not for 0227 replace-style ones. */ 0228 /* 1212 */ UInt guest_NRADDR; 0229 /* 1216 */ UInt guest_NRADDR_GPR2; /* needed by aix */ 0230 0231 /* A grows-upwards stack for hidden saves/restores of LR and R2 0232 needed for function interception and wrapping on ppc32-aix5. 0233 A horrible hack. REDIR_SP points to the highest live entry, 0234 and so starts at -1. */ 0235 /* 1220 */ UInt guest_REDIR_SP; 0236 /* 1224 */ UInt guest_REDIR_STACK[VEX_GUEST_PPC32_REDIR_STACK_SIZE]; 0237 0238 /* Needed for Darwin (but mandated for all guest architectures): 0239 CIA at the last SC insn. Used when backing up to restart a 0240 syscall that has been interrupted by a signal. */ 0241 /* 134C */ UInt guest_IP_AT_SYSCALL; 0242 0243 /* SPRG3, which AIUI is readonly in user space. Needed for 0244 threading on AIX. */ 0245 /* 1356 */ UInt guest_SPRG3_RO; 0246 /* 1360 */ UInt padding1; 0247 /* 1364 */ ULong guest_TFHAR; // Transaction Failure Handler Address Register 0248 /* 1372 */ ULong guest_TEXASR; // Transaction EXception And Summary Register 0249 /* 1380 */ ULong guest_TFIAR; // Transaction Failure Instruction Address Register 0250 /* 1388 */ ULong guest_PPR; // Program Priority register 0251 /* 1396 */ UInt guest_TEXASRU; // Transaction EXception And Summary Register Upper 0252 /* 1400 */ UInt guest_PSPB; // Problem State Priority Boost register 0253 /* 1404 */ ULong guest_DSCR; // Data Stream Control register 0254 0255 /* ISA 3.1 Accumulators. There are eight accumulators each contains four 0256 128-bit rows. Declare each acculator and row explicitly, then use a 0257 helper to map ACC[i][row] to the explicitly declared entry. 0258 Technically not supported in 32-bit mode but needs to be defined. */ 0259 /* 1412 */ U128 guest_ACC_0_r0; 0260 /* 1428 */ U128 guest_ACC_0_r1; 0261 /* 1444 */ U128 guest_ACC_0_r2; 0262 /* 1460 */ U128 guest_ACC_0_r3; 0263 /* 1476 */ U128 guest_ACC_1_r0; 0264 /* 1492 */ U128 guest_ACC_1_r1; 0265 /* 1508 */ U128 guest_ACC_1_r2; 0266 /* 1524 */ U128 guest_ACC_1_r3; 0267 /* 1540 */ U128 guest_ACC_2_r0; 0268 /* 1556 */ U128 guest_ACC_2_r1; 0269 /* 1572 */ U128 guest_ACC_2_r2; 0270 /* 1588 */ U128 guest_ACC_2_r3; 0271 /* 1604 */ U128 guest_ACC_3_r0; 0272 /* 1620 */ U128 guest_ACC_3_r1; 0273 /* 1636 */ U128 guest_ACC_3_r2; 0274 /* 1652 */ U128 guest_ACC_3_r3; 0275 /* 1668 */ U128 guest_ACC_4_r0; 0276 /* 1684 */ U128 guest_ACC_4_r1; 0277 /* 1700 */ U128 guest_ACC_4_r2; 0278 /* 1716 */ U128 guest_ACC_4_r3; 0279 /* 1732 */ U128 guest_ACC_5_r0; 0280 /* 1748 */ U128 guest_ACC_5_r1; 0281 /* 1780 */ U128 guest_ACC_5_r2; 0282 /* 1796 */ U128 guest_ACC_5_r3; 0283 /* 1812 */ U128 guest_ACC_6_r0; 0284 /* 1828 */ U128 guest_ACC_6_r1; 0285 /* 1844 */ U128 guest_ACC_6_r2; 0286 /* 1860 */ U128 guest_ACC_6_r3; 0287 /* 1876 */ U128 guest_ACC_7_r0; 0288 /* 1892 */ U128 guest_ACC_7_r1; 0289 /* 1908 */ U128 guest_ACC_7_r2; 0290 /* 1924 */ U128 guest_ACC_7_r3; 0291 0292 /* Padding to make it have an 16-aligned size */ 0293 /* 1940 */ UInt guest_syscall_flag; 0294 /* 1944 * UInt padding2; */ 0295 } 0296 VexGuestPPC32State; 0297 0298 0299 /*---------------------------------------------------------------*/ 0300 /*--- Utility functions for PPC32 guest stuff. ---*/ 0301 /*---------------------------------------------------------------*/ 0302 0303 /* ALL THE FOLLOWING ARE VISIBLE TO LIBRARY CLIENT */ 0304 0305 /* Initialise all guest PPC32 state. */ 0306 0307 extern 0308 void LibVEX_GuestPPC32_initialise ( /*OUT*/VexGuestPPC32State* vex_state ); 0309 0310 0311 /* Write the given native %CR value to the supplied VexGuestPPC32State 0312 structure. */ 0313 extern 0314 void LibVEX_GuestPPC32_put_CR ( UInt cr_native, 0315 /*OUT*/VexGuestPPC32State* vex_state ); 0316 0317 /* Extract from the supplied VexGuestPPC32State structure the 0318 corresponding native %CR value. */ 0319 extern 0320 UInt LibVEX_GuestPPC32_get_CR ( /*IN*/const VexGuestPPC32State* vex_state ); 0321 0322 0323 /* Write the given native %XER value to the supplied VexGuestPPC32State 0324 structure. */ 0325 extern 0326 void LibVEX_GuestPPC32_put_XER ( UInt xer_native, 0327 /*OUT*/VexGuestPPC32State* vex_state ); 0328 0329 /* Extract from the supplied VexGuestPPC32State structure the 0330 corresponding native %XER value. */ 0331 extern 0332 UInt LibVEX_GuestPPC32_get_XER ( /*IN*/const VexGuestPPC32State* vex_state ); 0333 0334 #endif /* ndef __LIBVEX_PUB_GUEST_PPC32_H */ 0335 0336 0337 /*---------------------------------------------------------------*/ 0338 /*--- libvex_guest_ppc32.h ---*/ 0339 /*---------------------------------------------------------------*/
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |