1dd56a484260c9f04b1513731b86f6edb974aa554cerion
2dd56a484260c9f04b1513731b86f6edb974aa554cerion/*---------------------------------------------------------------*/
3752f90673ebbb6b2f55fc5e46606dea371313713sewardj/*--- begin                              libvex_guest_ppc64.h ---*/
4dd56a484260c9f04b1513731b86f6edb974aa554cerion/*---------------------------------------------------------------*/
5dd56a484260c9f04b1513731b86f6edb974aa554cerion
6dd56a484260c9f04b1513731b86f6edb974aa554cerion/*
7752f90673ebbb6b2f55fc5e46606dea371313713sewardj   This file is part of Valgrind, a dynamic binary instrumentation
8752f90673ebbb6b2f55fc5e46606dea371313713sewardj   framework.
9dd56a484260c9f04b1513731b86f6edb974aa554cerion
10785952d4bf502fa756b2ac58595fd31fe0f88559sewardj   Copyright (C) 2004-2015 OpenWorks LLP
11752f90673ebbb6b2f55fc5e46606dea371313713sewardj      info@open-works.net
12dd56a484260c9f04b1513731b86f6edb974aa554cerion
13752f90673ebbb6b2f55fc5e46606dea371313713sewardj   This program is free software; you can redistribute it and/or
14752f90673ebbb6b2f55fc5e46606dea371313713sewardj   modify it under the terms of the GNU General Public License as
15752f90673ebbb6b2f55fc5e46606dea371313713sewardj   published by the Free Software Foundation; either version 2 of the
16752f90673ebbb6b2f55fc5e46606dea371313713sewardj   License, or (at your option) any later version.
17dd56a484260c9f04b1513731b86f6edb974aa554cerion
18752f90673ebbb6b2f55fc5e46606dea371313713sewardj   This program is distributed in the hope that it will be useful, but
19752f90673ebbb6b2f55fc5e46606dea371313713sewardj   WITHOUT ANY WARRANTY; without even the implied warranty of
20752f90673ebbb6b2f55fc5e46606dea371313713sewardj   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
21752f90673ebbb6b2f55fc5e46606dea371313713sewardj   General Public License for more details.
22752f90673ebbb6b2f55fc5e46606dea371313713sewardj
23752f90673ebbb6b2f55fc5e46606dea371313713sewardj   You should have received a copy of the GNU General Public License
24752f90673ebbb6b2f55fc5e46606dea371313713sewardj   along with this program; if not, write to the Free Software
25752f90673ebbb6b2f55fc5e46606dea371313713sewardj   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
26dd56a484260c9f04b1513731b86f6edb974aa554cerion   02110-1301, USA.
27dd56a484260c9f04b1513731b86f6edb974aa554cerion
28752f90673ebbb6b2f55fc5e46606dea371313713sewardj   The GNU General Public License is contained in the file COPYING.
29dd56a484260c9f04b1513731b86f6edb974aa554cerion
30dd56a484260c9f04b1513731b86f6edb974aa554cerion   Neither the names of the U.S. Department of Energy nor the
31dd56a484260c9f04b1513731b86f6edb974aa554cerion   University of California nor the names of its contributors may be
32dd56a484260c9f04b1513731b86f6edb974aa554cerion   used to endorse or promote products derived from this software
33dd56a484260c9f04b1513731b86f6edb974aa554cerion   without prior written permission.
34dd56a484260c9f04b1513731b86f6edb974aa554cerion*/
35dd56a484260c9f04b1513731b86f6edb974aa554cerion
36dd56a484260c9f04b1513731b86f6edb974aa554cerion#ifndef __LIBVEX_PUB_GUEST_PPC64_H
37dd56a484260c9f04b1513731b86f6edb974aa554cerion#define __LIBVEX_PUB_GUEST_PPC64_H
38dd56a484260c9f04b1513731b86f6edb974aa554cerion
39dd56a484260c9f04b1513731b86f6edb974aa554cerion#include "libvex_basictypes.h"
40dd56a484260c9f04b1513731b86f6edb974aa554cerion
41dd56a484260c9f04b1513731b86f6edb974aa554cerion/*
42dd56a484260c9f04b1513731b86f6edb974aa554cerion    volatile ==  caller-saved (not preserved across function calls)
43dd56a484260c9f04b1513731b86f6edb974aa554cerionnon-volatile ==  callee-saved (preserved across function calls)
44dd56a484260c9f04b1513731b86f6edb974aa554cerion
45dd56a484260c9f04b1513731b86f6edb974aa554cerionr0        Volatile register used in function prologs
46dd56a484260c9f04b1513731b86f6edb974aa554cerionr1        Stack frame pointer
47dd56a484260c9f04b1513731b86f6edb974aa554cerionr2        TOC pointer
48dd56a484260c9f04b1513731b86f6edb974aa554cerionr3        Volatile parameter and return value register
49dd56a484260c9f04b1513731b86f6edb974aa554cerionr4-r10    Volatile registers used for function parameters
50dd56a484260c9f04b1513731b86f6edb974aa554cerionr11       Volatile register used in calls by pointer and as an
51dd56a484260c9f04b1513731b86f6edb974aa554cerion          environment pointer for languages which require one
52dd56a484260c9f04b1513731b86f6edb974aa554cerionr12       Volatile register used for exception handling and glink code
53dd56a484260c9f04b1513731b86f6edb974aa554cerionr13       Reserved for use as system thread ID
54dd56a484260c9f04b1513731b86f6edb974aa554cerionr14-r31   Nonvolatile registers used for local variables
55dd56a484260c9f04b1513731b86f6edb974aa554cerion
56dd56a484260c9f04b1513731b86f6edb974aa554cerionf0        Volatile scratch register
57dd56a484260c9f04b1513731b86f6edb974aa554cerionf1-f4     Volatile floating point parameter and return value registers
58dd56a484260c9f04b1513731b86f6edb974aa554cerionf5-f13    Volatile floating point parameter registers
59dd56a484260c9f04b1513731b86f6edb974aa554cerionf14-f31   Nonvolatile registers
60dd56a484260c9f04b1513731b86f6edb974aa554cerion
61dd56a484260c9f04b1513731b86f6edb974aa554cerionLR        Link register (volatile)
62dd56a484260c9f04b1513731b86f6edb974aa554cerionCTR       Loop counter register (volatile)
63dd56a484260c9f04b1513731b86f6edb974aa554cerionXER       Fixed point exception register (volatile)
64dd56a484260c9f04b1513731b86f6edb974aa554cerionFPSCR     Floating point status and control register (volatile)
65dd56a484260c9f04b1513731b86f6edb974aa554cerion
66dd56a484260c9f04b1513731b86f6edb974aa554cerionCR0-CR1   Volatile condition code register fields
67dd56a484260c9f04b1513731b86f6edb974aa554cerionCR2-CR4   Nonvolatile condition code register fields
68dd56a484260c9f04b1513731b86f6edb974aa554cerionCR5-CR7   Volatile condition code register fields
69dd56a484260c9f04b1513731b86f6edb974aa554cerion
70dd56a484260c9f04b1513731b86f6edb974aa554cerionOn processors with the VMX feature.
71dd56a484260c9f04b1513731b86f6edb974aa554cerion
72dd56a484260c9f04b1513731b86f6edb974aa554cerionv0-v1     Volatile scratch registers
73dd56a484260c9f04b1513731b86f6edb974aa554cerionv2-v13    Volatile vector parameters registers
74dd56a484260c9f04b1513731b86f6edb974aa554cerionv14-v19   Volatile scratch registers
75dd56a484260c9f04b1513731b86f6edb974aa554cerionv20-v31   Non-volatile registers
76dd56a484260c9f04b1513731b86f6edb974aa554cerionvrsave    Non-volatile 32-bit register
77dd56a484260c9f04b1513731b86f6edb974aa554cerion*/
78dd56a484260c9f04b1513731b86f6edb974aa554cerion
79dd56a484260c9f04b1513731b86f6edb974aa554cerion
80dd56a484260c9f04b1513731b86f6edb974aa554cerion/*---------------------------------------------------------------*/
81dd56a484260c9f04b1513731b86f6edb974aa554cerion/*--- Vex's representation of the PPC64 CPU state             ---*/
82dd56a484260c9f04b1513731b86f6edb974aa554cerion/*---------------------------------------------------------------*/
83dd56a484260c9f04b1513731b86f6edb974aa554cerion
845ff11ddafe3e0080711657a1cf581e1a64dbf117sewardj#define VEX_GUEST_PPC64_REDIR_STACK_SIZE (16/*entries*/ * 2/*words per entry*/)
85be482aed27a2a57c2009eb0a68e42d1b19fdfdf6sewardj
86dd56a484260c9f04b1513731b86f6edb974aa554ceriontypedef
87dd56a484260c9f04b1513731b86f6edb974aa554cerion   struct {
883dee849ec7c38746749065e67dc53b75daa7617dsewardj     /* Event check fail addr, counter, and padding to make GPR0 16
893dee849ec7c38746749065e67dc53b75daa7617dsewardj        aligned. */
903dee849ec7c38746749065e67dc53b75daa7617dsewardj      /*   0 */ ULong  host_EvC_FAILADDR;
913dee849ec7c38746749065e67dc53b75daa7617dsewardj      /*   8 */ UInt   host_EvC_COUNTER;
923dee849ec7c38746749065e67dc53b75daa7617dsewardj      /*  12 */ UInt   pad0;
933dee849ec7c38746749065e67dc53b75daa7617dsewardj      /* Add 16 to all of the offsets below .. */
94dd56a484260c9f04b1513731b86f6edb974aa554cerion      /* General Purpose Registers */
95dd56a484260c9f04b1513731b86f6edb974aa554cerion      /*   0 */ ULong guest_GPR0;
96dd56a484260c9f04b1513731b86f6edb974aa554cerion      /*   8 */ ULong guest_GPR1;
97dd56a484260c9f04b1513731b86f6edb974aa554cerion      /*  16 */ ULong guest_GPR2;
98dd56a484260c9f04b1513731b86f6edb974aa554cerion      /*  24 */ ULong guest_GPR3;
99dd56a484260c9f04b1513731b86f6edb974aa554cerion      /*  32 */ ULong guest_GPR4;
100dd56a484260c9f04b1513731b86f6edb974aa554cerion      /*  40 */ ULong guest_GPR5;
101dd56a484260c9f04b1513731b86f6edb974aa554cerion      /*  48 */ ULong guest_GPR6;
102dd56a484260c9f04b1513731b86f6edb974aa554cerion      /*  56 */ ULong guest_GPR7;
103dd56a484260c9f04b1513731b86f6edb974aa554cerion      /*  64 */ ULong guest_GPR8;
104dd56a484260c9f04b1513731b86f6edb974aa554cerion      /*  72 */ ULong guest_GPR9;
105dd56a484260c9f04b1513731b86f6edb974aa554cerion      /*  80 */ ULong guest_GPR10;
106dd56a484260c9f04b1513731b86f6edb974aa554cerion      /*  88 */ ULong guest_GPR11;
107dd56a484260c9f04b1513731b86f6edb974aa554cerion      /*  96 */ ULong guest_GPR12;
108dd56a484260c9f04b1513731b86f6edb974aa554cerion      /* 104 */ ULong guest_GPR13;
109dd56a484260c9f04b1513731b86f6edb974aa554cerion      /* 112 */ ULong guest_GPR14;
110dd56a484260c9f04b1513731b86f6edb974aa554cerion      /* 120 */ ULong guest_GPR15;
111dd56a484260c9f04b1513731b86f6edb974aa554cerion      /* 128 */ ULong guest_GPR16;
112dd56a484260c9f04b1513731b86f6edb974aa554cerion      /* 136 */ ULong guest_GPR17;
113dd56a484260c9f04b1513731b86f6edb974aa554cerion      /* 144 */ ULong guest_GPR18;
114dd56a484260c9f04b1513731b86f6edb974aa554cerion      /* 152 */ ULong guest_GPR19;
115dd56a484260c9f04b1513731b86f6edb974aa554cerion      /* 160 */ ULong guest_GPR20;
116dd56a484260c9f04b1513731b86f6edb974aa554cerion      /* 168 */ ULong guest_GPR21;
117dd56a484260c9f04b1513731b86f6edb974aa554cerion      /* 176 */ ULong guest_GPR22;
118dd56a484260c9f04b1513731b86f6edb974aa554cerion      /* 184 */ ULong guest_GPR23;
119dd56a484260c9f04b1513731b86f6edb974aa554cerion      /* 192 */ ULong guest_GPR24;
120dd56a484260c9f04b1513731b86f6edb974aa554cerion      /* 200 */ ULong guest_GPR25;
121dd56a484260c9f04b1513731b86f6edb974aa554cerion      /* 208 */ ULong guest_GPR26;
122dd56a484260c9f04b1513731b86f6edb974aa554cerion      /* 216 */ ULong guest_GPR27;
123dd56a484260c9f04b1513731b86f6edb974aa554cerion      /* 224 */ ULong guest_GPR28;
124dd56a484260c9f04b1513731b86f6edb974aa554cerion      /* 232 */ ULong guest_GPR29;
125dd56a484260c9f04b1513731b86f6edb974aa554cerion      /* 240 */ ULong guest_GPR30;
126dd56a484260c9f04b1513731b86f6edb974aa554cerion      /* 248 */ ULong guest_GPR31;
127dd56a484260c9f04b1513731b86f6edb974aa554cerion
12866d5ef2c2a31fb52cdd4f02304489e30268ea13fsewardj      // Vector Registers, Floating Point Registers, and VSX Registers
12966d5ef2c2a31fb52cdd4f02304489e30268ea13fsewardj      // With ISA 2.06, the "Vector-Scalar Floating-point" category
13066d5ef2c2a31fb52cdd4f02304489e30268ea13fsewardj      // provides facilities to support vector and scalar binary floating-
13166d5ef2c2a31fb52cdd4f02304489e30268ea13fsewardj      // point operations.  A unified register file is an integral part
13266d5ef2c2a31fb52cdd4f02304489e30268ea13fsewardj      // of this new facility, combining floating point and vector registers
13366d5ef2c2a31fb52cdd4f02304489e30268ea13fsewardj      // using a 64x128-bit vector.  These are referred to as VSR[0..63].
13466d5ef2c2a31fb52cdd4f02304489e30268ea13fsewardj      // The floating point registers are now mapped into double word element 0
13566d5ef2c2a31fb52cdd4f02304489e30268ea13fsewardj      // of VSR[0..31]. The 32x128-bit vector registers defined by the "Vector
13666d5ef2c2a31fb52cdd4f02304489e30268ea13fsewardj      // Facility [Category: Vector]" are now mapped to VSR[32..63].
13766d5ef2c2a31fb52cdd4f02304489e30268ea13fsewardj
138478646f54befaba01cbceb40fd5e46cdf562fdb5sewardj      // IMPORTANT: the user of libvex must place the guest state so as
13966d5ef2c2a31fb52cdd4f02304489e30268ea13fsewardj      // to ensure that guest_VSR{0..63}, and any shadows thereof, are
140478646f54befaba01cbceb40fd5e46cdf562fdb5sewardj      // 16-aligned.
14166d5ef2c2a31fb52cdd4f02304489e30268ea13fsewardj
14266d5ef2c2a31fb52cdd4f02304489e30268ea13fsewardj      /*  256 */ U128 guest_VSR0;
14366d5ef2c2a31fb52cdd4f02304489e30268ea13fsewardj      /*  272 */ U128 guest_VSR1;
14466d5ef2c2a31fb52cdd4f02304489e30268ea13fsewardj      /*  288 */ U128 guest_VSR2;
14566d5ef2c2a31fb52cdd4f02304489e30268ea13fsewardj      /*  304 */ U128 guest_VSR3;
14666d5ef2c2a31fb52cdd4f02304489e30268ea13fsewardj      /*  320 */ U128 guest_VSR4;
14766d5ef2c2a31fb52cdd4f02304489e30268ea13fsewardj      /*  336 */ U128 guest_VSR5;
14866d5ef2c2a31fb52cdd4f02304489e30268ea13fsewardj      /*  352 */ U128 guest_VSR6;
14966d5ef2c2a31fb52cdd4f02304489e30268ea13fsewardj      /*  368 */ U128 guest_VSR7;
15066d5ef2c2a31fb52cdd4f02304489e30268ea13fsewardj      /*  384 */ U128 guest_VSR8;
15166d5ef2c2a31fb52cdd4f02304489e30268ea13fsewardj      /*  400 */ U128 guest_VSR9;
15266d5ef2c2a31fb52cdd4f02304489e30268ea13fsewardj      /*  416 */ U128 guest_VSR10;
15366d5ef2c2a31fb52cdd4f02304489e30268ea13fsewardj      /*  432 */ U128 guest_VSR11;
15466d5ef2c2a31fb52cdd4f02304489e30268ea13fsewardj      /*  448 */ U128 guest_VSR12;
15566d5ef2c2a31fb52cdd4f02304489e30268ea13fsewardj      /*  464 */ U128 guest_VSR13;
15666d5ef2c2a31fb52cdd4f02304489e30268ea13fsewardj      /*  480 */ U128 guest_VSR14;
15766d5ef2c2a31fb52cdd4f02304489e30268ea13fsewardj      /*  496 */ U128 guest_VSR15;
15866d5ef2c2a31fb52cdd4f02304489e30268ea13fsewardj      /*  512 */ U128 guest_VSR16;
15966d5ef2c2a31fb52cdd4f02304489e30268ea13fsewardj      /*  528 */ U128 guest_VSR17;
16066d5ef2c2a31fb52cdd4f02304489e30268ea13fsewardj      /*  544 */ U128 guest_VSR18;
16166d5ef2c2a31fb52cdd4f02304489e30268ea13fsewardj      /*  560 */ U128 guest_VSR19;
16266d5ef2c2a31fb52cdd4f02304489e30268ea13fsewardj      /*  576 */ U128 guest_VSR20;
16366d5ef2c2a31fb52cdd4f02304489e30268ea13fsewardj      /*  592 */ U128 guest_VSR21;
16466d5ef2c2a31fb52cdd4f02304489e30268ea13fsewardj      /*  608 */ U128 guest_VSR22;
16566d5ef2c2a31fb52cdd4f02304489e30268ea13fsewardj      /*  624 */ U128 guest_VSR23;
16666d5ef2c2a31fb52cdd4f02304489e30268ea13fsewardj      /*  640 */ U128 guest_VSR24;
16766d5ef2c2a31fb52cdd4f02304489e30268ea13fsewardj      /*  656 */ U128 guest_VSR25;
16866d5ef2c2a31fb52cdd4f02304489e30268ea13fsewardj      /*  672 */ U128 guest_VSR26;
16966d5ef2c2a31fb52cdd4f02304489e30268ea13fsewardj      /*  688 */ U128 guest_VSR27;
17066d5ef2c2a31fb52cdd4f02304489e30268ea13fsewardj      /*  704 */ U128 guest_VSR28;
17166d5ef2c2a31fb52cdd4f02304489e30268ea13fsewardj      /*  720 */ U128 guest_VSR29;
17266d5ef2c2a31fb52cdd4f02304489e30268ea13fsewardj      /*  736 */ U128 guest_VSR30;
17366d5ef2c2a31fb52cdd4f02304489e30268ea13fsewardj      /*  752 */ U128 guest_VSR31;
17466d5ef2c2a31fb52cdd4f02304489e30268ea13fsewardj      /*  768 */ U128 guest_VSR32;
17566d5ef2c2a31fb52cdd4f02304489e30268ea13fsewardj      /*  784 */ U128 guest_VSR33;
17666d5ef2c2a31fb52cdd4f02304489e30268ea13fsewardj      /*  800 */ U128 guest_VSR34;
17766d5ef2c2a31fb52cdd4f02304489e30268ea13fsewardj      /*  816 */ U128 guest_VSR35;
17866d5ef2c2a31fb52cdd4f02304489e30268ea13fsewardj      /*  832 */ U128 guest_VSR36;
17966d5ef2c2a31fb52cdd4f02304489e30268ea13fsewardj      /*  848 */ U128 guest_VSR37;
18066d5ef2c2a31fb52cdd4f02304489e30268ea13fsewardj      /*  864 */ U128 guest_VSR38;
18166d5ef2c2a31fb52cdd4f02304489e30268ea13fsewardj      /*  880 */ U128 guest_VSR39;
18266d5ef2c2a31fb52cdd4f02304489e30268ea13fsewardj      /*  896 */ U128 guest_VSR40;
18366d5ef2c2a31fb52cdd4f02304489e30268ea13fsewardj      /*  912 */ U128 guest_VSR41;
18466d5ef2c2a31fb52cdd4f02304489e30268ea13fsewardj      /*  928 */ U128 guest_VSR42;
18566d5ef2c2a31fb52cdd4f02304489e30268ea13fsewardj      /*  944 */ U128 guest_VSR43;
18666d5ef2c2a31fb52cdd4f02304489e30268ea13fsewardj      /*  960 */ U128 guest_VSR44;
18766d5ef2c2a31fb52cdd4f02304489e30268ea13fsewardj      /*  976 */ U128 guest_VSR45;
18866d5ef2c2a31fb52cdd4f02304489e30268ea13fsewardj      /*  992 */ U128 guest_VSR46;
18966d5ef2c2a31fb52cdd4f02304489e30268ea13fsewardj      /* 1008 */ U128 guest_VSR47;
19066d5ef2c2a31fb52cdd4f02304489e30268ea13fsewardj      /* 1024 */ U128 guest_VSR48;
19166d5ef2c2a31fb52cdd4f02304489e30268ea13fsewardj      /* 1040 */ U128 guest_VSR49;
19266d5ef2c2a31fb52cdd4f02304489e30268ea13fsewardj      /* 1056 */ U128 guest_VSR50;
19366d5ef2c2a31fb52cdd4f02304489e30268ea13fsewardj      /* 1072 */ U128 guest_VSR51;
19466d5ef2c2a31fb52cdd4f02304489e30268ea13fsewardj      /* 1088 */ U128 guest_VSR52;
19566d5ef2c2a31fb52cdd4f02304489e30268ea13fsewardj      /* 1104 */ U128 guest_VSR53;
19666d5ef2c2a31fb52cdd4f02304489e30268ea13fsewardj      /* 1120 */ U128 guest_VSR54;
19766d5ef2c2a31fb52cdd4f02304489e30268ea13fsewardj      /* 1136 */ U128 guest_VSR55;
19866d5ef2c2a31fb52cdd4f02304489e30268ea13fsewardj      /* 1152 */ U128 guest_VSR56;
19966d5ef2c2a31fb52cdd4f02304489e30268ea13fsewardj      /* 1168 */ U128 guest_VSR57;
20066d5ef2c2a31fb52cdd4f02304489e30268ea13fsewardj      /* 1184 */ U128 guest_VSR58;
20166d5ef2c2a31fb52cdd4f02304489e30268ea13fsewardj      /* 1200 */ U128 guest_VSR59;
20266d5ef2c2a31fb52cdd4f02304489e30268ea13fsewardj      /* 1216 */ U128 guest_VSR60;
20366d5ef2c2a31fb52cdd4f02304489e30268ea13fsewardj      /* 1232 */ U128 guest_VSR61;
20466d5ef2c2a31fb52cdd4f02304489e30268ea13fsewardj      /* 1248 */ U128 guest_VSR62;
20566d5ef2c2a31fb52cdd4f02304489e30268ea13fsewardj      /* 1264 */ U128 guest_VSR63;
20666d5ef2c2a31fb52cdd4f02304489e30268ea13fsewardj
20766d5ef2c2a31fb52cdd4f02304489e30268ea13fsewardj      /* 1280 */ ULong guest_CIA;    // IP (no arch visible register)
20866d5ef2c2a31fb52cdd4f02304489e30268ea13fsewardj      /* 1288 */ ULong guest_LR;     // Link Register
20966d5ef2c2a31fb52cdd4f02304489e30268ea13fsewardj      /* 1296 */ ULong guest_CTR;    // Count Register
210dd56a484260c9f04b1513731b86f6edb974aa554cerion
211dd56a484260c9f04b1513731b86f6edb974aa554cerion      /* XER pieces */
21266d5ef2c2a31fb52cdd4f02304489e30268ea13fsewardj      /* 1304 */ UChar guest_XER_SO; /* in lsb */
21366d5ef2c2a31fb52cdd4f02304489e30268ea13fsewardj      /* 1305 */ UChar guest_XER_OV; /* in lsb */
21466d5ef2c2a31fb52cdd4f02304489e30268ea13fsewardj      /* 1306 */ UChar guest_XER_CA; /* in lsb */
21566d5ef2c2a31fb52cdd4f02304489e30268ea13fsewardj      /* 1307 */ UChar guest_XER_BC; /* all bits */
216dd56a484260c9f04b1513731b86f6edb974aa554cerion
217dd56a484260c9f04b1513731b86f6edb974aa554cerion      /* CR pieces */
21866d5ef2c2a31fb52cdd4f02304489e30268ea13fsewardj      /* 1308 */ UChar guest_CR0_321; /* in [3:1] */
21966d5ef2c2a31fb52cdd4f02304489e30268ea13fsewardj      /* 1309 */ UChar guest_CR0_0;   /* in lsb */
22066d5ef2c2a31fb52cdd4f02304489e30268ea13fsewardj      /* 1310 */ UChar guest_CR1_321; /* in [3:1] */
22166d5ef2c2a31fb52cdd4f02304489e30268ea13fsewardj      /* 1311 */ UChar guest_CR1_0;   /* in lsb */
22266d5ef2c2a31fb52cdd4f02304489e30268ea13fsewardj      /* 1312 */ UChar guest_CR2_321; /* in [3:1] */
22366d5ef2c2a31fb52cdd4f02304489e30268ea13fsewardj      /* 1313 */ UChar guest_CR2_0;   /* in lsb */
22466d5ef2c2a31fb52cdd4f02304489e30268ea13fsewardj      /* 1314 */ UChar guest_CR3_321; /* in [3:1] */
22566d5ef2c2a31fb52cdd4f02304489e30268ea13fsewardj      /* 1315 */ UChar guest_CR3_0;   /* in lsb */
22666d5ef2c2a31fb52cdd4f02304489e30268ea13fsewardj      /* 1316 */ UChar guest_CR4_321; /* in [3:1] */
22766d5ef2c2a31fb52cdd4f02304489e30268ea13fsewardj      /* 1317 */ UChar guest_CR4_0;   /* in lsb */
22866d5ef2c2a31fb52cdd4f02304489e30268ea13fsewardj      /* 1318 */ UChar guest_CR5_321; /* in [3:1] */
22966d5ef2c2a31fb52cdd4f02304489e30268ea13fsewardj      /* 1319 */ UChar guest_CR5_0;   /* in lsb */
23066d5ef2c2a31fb52cdd4f02304489e30268ea13fsewardj      /* 1320 */ UChar guest_CR6_321; /* in [3:1] */
23166d5ef2c2a31fb52cdd4f02304489e30268ea13fsewardj      /* 1321 */ UChar guest_CR6_0;   /* in lsb */
23266d5ef2c2a31fb52cdd4f02304489e30268ea13fsewardj      /* 1322 */ UChar guest_CR7_321; /* in [3:1] */
23366d5ef2c2a31fb52cdd4f02304489e30268ea13fsewardj      /* 1323 */ UChar guest_CR7_0;   /* in lsb */
234dd56a484260c9f04b1513731b86f6edb974aa554cerion
235c6bbd470e9bd9898b84959227a406d3972d95f3bsewardj      /* FP Status and  Control Register fields. Only rounding mode fields
236c6bbd470e9bd9898b84959227a406d3972d95f3bsewardj	 are supported. */
237c6bbd470e9bd9898b84959227a406d3972d95f3bsewardj      /* 1324 */ UChar guest_FPROUND; // Binary Floating Point Rounding Mode
238c6bbd470e9bd9898b84959227a406d3972d95f3bsewardj      /* 1325 */ UChar guest_DFPROUND; // Decimal Floating Point Rounding Mode
239c6bbd470e9bd9898b84959227a406d3972d95f3bsewardj      /* 1326 */ UChar pad1;
240c6bbd470e9bd9898b84959227a406d3972d95f3bsewardj      /* 1327 */ UChar pad2;
241dd56a484260c9f04b1513731b86f6edb974aa554cerion
242dd56a484260c9f04b1513731b86f6edb974aa554cerion      /* Vector Save/Restore Register */
24366d5ef2c2a31fb52cdd4f02304489e30268ea13fsewardj      /* 1328 */ UInt guest_VRSAVE;
244dd56a484260c9f04b1513731b86f6edb974aa554cerion
245dd56a484260c9f04b1513731b86f6edb974aa554cerion      /* Vector Status and Control Register */
24666d5ef2c2a31fb52cdd4f02304489e30268ea13fsewardj      /* 1332 */ UInt guest_VSCR;
247dd56a484260c9f04b1513731b86f6edb974aa554cerion
2486ef84bed9bb3af22060eb1759788034602bbcc88florian      /* Emulation notes */
2496ef84bed9bb3af22060eb1759788034602bbcc88florian      /* 1336 */ UInt guest_EMNOTE;
250dd56a484260c9f04b1513731b86f6edb974aa554cerion
2517a3e39cc694e7bf1d4fa127c8f13eee70bda311acerion      /* gcc adds 4 bytes padding here: pre-empt it. */
25266d5ef2c2a31fb52cdd4f02304489e30268ea13fsewardj      /* 1340 */ UInt  padding;
2537a3e39cc694e7bf1d4fa127c8f13eee70bda311acerion
254dd56a484260c9f04b1513731b86f6edb974aa554cerion      /* For icbi: record start and length of area to invalidate */
25505f5e0172384dd2983fb16fbb7deebd74d71cd35sewardj      /* 1344 */ ULong guest_CMSTART;
25605f5e0172384dd2983fb16fbb7deebd74d71cd35sewardj      /* 1352 */ ULong guest_CMLEN;
257dd56a484260c9f04b1513731b86f6edb974aa554cerion
258ce02aa77bc02dbe225a068df0fb6b31faddedcdfsewardj      /* Used to record the unredirected guest address at the start of
259ce02aa77bc02dbe225a068df0fb6b31faddedcdfsewardj         a translation whose start has been redirected.  By reading
260ce02aa77bc02dbe225a068df0fb6b31faddedcdfsewardj         this pseudo-register shortly afterwards, the translation can
261ce02aa77bc02dbe225a068df0fb6b31faddedcdfsewardj         find out what the corresponding no-redirection address was.
262ce02aa77bc02dbe225a068df0fb6b31faddedcdfsewardj         Note, this is only set for wrap-style redirects, not for
263ce02aa77bc02dbe225a068df0fb6b31faddedcdfsewardj         replace-style ones. */
26466d5ef2c2a31fb52cdd4f02304489e30268ea13fsewardj      /* 1360 */ ULong guest_NRADDR;
26566d5ef2c2a31fb52cdd4f02304489e30268ea13fsewardj      /* 1368 */ ULong guest_NRADDR_GPR2;
266ce02aa77bc02dbe225a068df0fb6b31faddedcdfsewardj
267be482aed27a2a57c2009eb0a68e42d1b19fdfdf6sewardj     /* A grows-upwards stack for hidden saves/restores of LR and R2
268be482aed27a2a57c2009eb0a68e42d1b19fdfdf6sewardj        needed for function interception and wrapping on ppc64-linux.
269be482aed27a2a57c2009eb0a68e42d1b19fdfdf6sewardj        A horrible hack.  REDIR_SP points to the highest live entry,
270be482aed27a2a57c2009eb0a68e42d1b19fdfdf6sewardj        and so starts at -1. */
27166d5ef2c2a31fb52cdd4f02304489e30268ea13fsewardj      /* 1376 */ ULong guest_REDIR_SP;
27266d5ef2c2a31fb52cdd4f02304489e30268ea13fsewardj      /* 1384 */ ULong guest_REDIR_STACK[VEX_GUEST_PPC64_REDIR_STACK_SIZE];
273be482aed27a2a57c2009eb0a68e42d1b19fdfdf6sewardj
2742322360949754bdcaa87e5ea704480e0b267b09aflorian      /* Needed for Darwin: CIA at the last SC insn.  Used when backing up
275aca070a5b3418a6a9b01e3c57a7eb0fbb5050908sewardj         to restart a syscall that has been interrupted by a signal. */
27666d5ef2c2a31fb52cdd4f02304489e30268ea13fsewardj      /* 1640 */ ULong guest_IP_AT_SYSCALL;
277aca070a5b3418a6a9b01e3c57a7eb0fbb5050908sewardj
278aca070a5b3418a6a9b01e3c57a7eb0fbb5050908sewardj      /* SPRG3, which AIUI is readonly in user space.  Needed for
279aca070a5b3418a6a9b01e3c57a7eb0fbb5050908sewardj         threading on AIX. */
28066d5ef2c2a31fb52cdd4f02304489e30268ea13fsewardj      /* 1648 */ ULong guest_SPRG3_RO;
281aca070a5b3418a6a9b01e3c57a7eb0fbb5050908sewardj
2828943d02aa373f45c6e5fdcbe5947620285d442b1carll      /* 1656 */ ULong guest_TFHAR;     // Transaction Failure Handler Address Register
2838943d02aa373f45c6e5fdcbe5947620285d442b1carll      /* 1664 */ ULong guest_TEXASR;    // Transaction EXception And Summary Register
2848943d02aa373f45c6e5fdcbe5947620285d442b1carll      /* 1672 */ ULong guest_TFIAR;     // Transaction Failure Instruction Address Register
285ed013fe8f56c070823d15f31ec010093f5de00dacarll      /* 1680 */ ULong guest_PPR;       // Program Priority register
286ed013fe8f56c070823d15f31ec010093f5de00dacarll      /* 1688 */ UInt  guest_TEXASRU;   // Transaction EXception And Summary Register Upper
287ed013fe8f56c070823d15f31ec010093f5de00dacarll      /* 1692 */ UInt  guest_PSPB;      // Problem State Priority Boost register
288486db12d4767b5c2cc5ae764616e758f30ce21f5carll
289486db12d4767b5c2cc5ae764616e758f30ce21f5carll      /* Padding to make it have an 16-aligned size */
290ed013fe8f56c070823d15f31ec010093f5de00dacarll      /* 1696   UInt  padding1;  currently not needed */
291ed013fe8f56c070823d15f31ec010093f5de00dacarll      /* 1700   UInt  padding2;  currently not needed */
292ed013fe8f56c070823d15f31ec010093f5de00dacarll      /* 1708   UInt  padding3;  currently not needed */
2938943d02aa373f45c6e5fdcbe5947620285d442b1carll
294dd56a484260c9f04b1513731b86f6edb974aa554cerion   }
295dd56a484260c9f04b1513731b86f6edb974aa554cerion   VexGuestPPC64State;
296dd56a484260c9f04b1513731b86f6edb974aa554cerion
297dd56a484260c9f04b1513731b86f6edb974aa554cerion
298dd56a484260c9f04b1513731b86f6edb974aa554cerion/*---------------------------------------------------------------*/
299dd56a484260c9f04b1513731b86f6edb974aa554cerion/*--- Utility functions for PPC64 guest stuff.                ---*/
300dd56a484260c9f04b1513731b86f6edb974aa554cerion/*---------------------------------------------------------------*/
301dd56a484260c9f04b1513731b86f6edb974aa554cerion
302dd56a484260c9f04b1513731b86f6edb974aa554cerion/* ALL THE FOLLOWING ARE VISIBLE TO LIBRARY CLIENT */
303dd56a484260c9f04b1513731b86f6edb974aa554cerion
304dd56a484260c9f04b1513731b86f6edb974aa554cerion/* Initialise all guest PPC64 state. */
305dd56a484260c9f04b1513731b86f6edb974aa554cerionextern
306dd56a484260c9f04b1513731b86f6edb974aa554cerionvoid LibVEX_GuestPPC64_initialise ( /*OUT*/VexGuestPPC64State* vex_state );
307dd56a484260c9f04b1513731b86f6edb974aa554cerion
308dd56a484260c9f04b1513731b86f6edb974aa554cerion
309dd56a484260c9f04b1513731b86f6edb974aa554cerion/* Write the given native %CR value to the supplied VexGuestPPC64State
310dd56a484260c9f04b1513731b86f6edb974aa554cerion   structure.  Note, %CR is 32-bits even for ppc64. */
311dd56a484260c9f04b1513731b86f6edb974aa554cerionextern
312dd56a484260c9f04b1513731b86f6edb974aa554cerionvoid LibVEX_GuestPPC64_put_CR ( UInt cr_native,
313dd56a484260c9f04b1513731b86f6edb974aa554cerion                                /*OUT*/VexGuestPPC64State* vex_state );
314dd56a484260c9f04b1513731b86f6edb974aa554cerion
315dd56a484260c9f04b1513731b86f6edb974aa554cerion/* Extract from the supplied VexGuestPPC64State structure the
316dd56a484260c9f04b1513731b86f6edb974aa554cerion   corresponding native %CR value.  Note, %CR is 32-bits even for
317dd56a484260c9f04b1513731b86f6edb974aa554cerion   ppc64. */
318dd56a484260c9f04b1513731b86f6edb974aa554cerionextern
319efa834abaded25c8aff2f3923e476ef7cc1d0396florianUInt LibVEX_GuestPPC64_get_CR ( /*IN*/const VexGuestPPC64State* vex_state );
320dd56a484260c9f04b1513731b86f6edb974aa554cerion
321dd56a484260c9f04b1513731b86f6edb974aa554cerion
322dd56a484260c9f04b1513731b86f6edb974aa554cerion/* Write the given native %XER value to the supplied
323dd56a484260c9f04b1513731b86f6edb974aa554cerion   VexGuestPPC64State structure.  Note, %XER is 32-bits even for
324dd56a484260c9f04b1513731b86f6edb974aa554cerion   ppc64. */
325dd56a484260c9f04b1513731b86f6edb974aa554cerionextern
326dd56a484260c9f04b1513731b86f6edb974aa554cerionvoid LibVEX_GuestPPC64_put_XER ( UInt xer_native,
327dd56a484260c9f04b1513731b86f6edb974aa554cerion                                 /*OUT*/VexGuestPPC64State* vex_state );
328dd56a484260c9f04b1513731b86f6edb974aa554cerion
329dd56a484260c9f04b1513731b86f6edb974aa554cerion/* Extract from the supplied VexGuestPPC64State structure the
330dd56a484260c9f04b1513731b86f6edb974aa554cerion   corresponding native %XER value.  Note, %CR is 32-bits even for
331dd56a484260c9f04b1513731b86f6edb974aa554cerion   ppc64. */
332dd56a484260c9f04b1513731b86f6edb974aa554cerionextern
333efa834abaded25c8aff2f3923e476ef7cc1d0396florianUInt LibVEX_GuestPPC64_get_XER ( /*IN*/const VexGuestPPC64State* vex_state );
334dd56a484260c9f04b1513731b86f6edb974aa554cerion
335dd56a484260c9f04b1513731b86f6edb974aa554cerion#endif /* ndef __LIBVEX_PUB_GUEST_PPC64_H */
336dd56a484260c9f04b1513731b86f6edb974aa554cerion
337dd56a484260c9f04b1513731b86f6edb974aa554cerion
338dd56a484260c9f04b1513731b86f6edb974aa554cerion/*---------------------------------------------------------------*/
339dd56a484260c9f04b1513731b86f6edb974aa554cerion/*---                                    libvex_guest_ppc64.h ---*/
340dd56a484260c9f04b1513731b86f6edb974aa554cerion/*---------------------------------------------------------------*/
341