Home | History | Annotate | Download | only in pub
      1 /* -*- mode: C; c-basic-offset: 3; -*- */
      2 
      3 /*---------------------------------------------------------------*/
      4 /*--- begin                              libvex_guest_s390x.h ---*/
      5 /*---------------------------------------------------------------*/
      6 
      7 /*
      8    This file is part of Valgrind, a dynamic binary instrumentation
      9    framework.
     10 
     11    Copyright IBM Corp. 2010-2017
     12 
     13    This program is free software; you can redistribute it and/or
     14    modify it under the terms of the GNU General Public License as
     15    published by the Free Software Foundation; either version 2 of the
     16    License, or (at your option) any later version.
     17 
     18    This program is distributed in the hope that it will be useful, but
     19    WITHOUT ANY WARRANTY; without even the implied warranty of
     20    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     21    General Public License for more details.
     22 
     23    You should have received a copy of the GNU General Public License
     24    along with this program; if not, write to the Free Software
     25    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
     26    02110-1301, USA.
     27 
     28    The GNU General Public License is contained in the file COPYING.
     29 */
     30 
     31 #ifndef __LIBVEX_PUB_GUEST_S390X_H
     32 #define __LIBVEX_PUB_GUEST_S390X_H
     33 
     34 #include "libvex_basictypes.h"
     35 
     36 /*------------------------------------------------------------*/
     37 /*--- Vex's representation of the s390 CPU state.          ---*/
     38 /*------------------------------------------------------------*/
     39 
     40 typedef struct {
     41 
     42 /*------------------------------------------------------------*/
     43 /*--- ar registers                                         ---*/
     44 /*------------------------------------------------------------*/
     45 
     46    /*    0 */  UInt guest_a0;
     47    /*    4 */  UInt guest_a1;
     48    /*    8 */  UInt guest_a2;
     49    /*   12 */  UInt guest_a3;
     50    /*   16 */  UInt guest_a4;
     51    /*   20 */  UInt guest_a5;
     52    /*   24 */  UInt guest_a6;
     53    /*   28 */  UInt guest_a7;
     54    /*   32 */  UInt guest_a8;
     55    /*   36 */  UInt guest_a9;
     56    /*   40 */  UInt guest_a10;
     57    /*   44 */  UInt guest_a11;
     58    /*   48 */  UInt guest_a12;
     59    /*   52 */  UInt guest_a13;
     60    /*   56 */  UInt guest_a14;
     61    /*   60 */  UInt guest_a15;
     62 
     63 /*------------------------------------------------------------*/
     64 /*--- fpr registers                                        ---*/
     65 /*------------------------------------------------------------*/
     66 
     67    /*   64 */  ULong guest_f0;
     68    /*   72 */  ULong guest_f1;
     69    /*   80 */  ULong guest_f2;
     70    /*   88 */  ULong guest_f3;
     71    /*   96 */  ULong guest_f4;
     72    /*  104 */  ULong guest_f5;
     73    /*  112 */  ULong guest_f6;
     74    /*  120 */  ULong guest_f7;
     75    /*  128 */  ULong guest_f8;
     76    /*  136 */  ULong guest_f9;
     77    /*  144 */  ULong guest_f10;
     78    /*  152 */  ULong guest_f11;
     79    /*  160 */  ULong guest_f12;
     80    /*  168 */  ULong guest_f13;
     81    /*  176 */  ULong guest_f14;
     82    /*  184 */  ULong guest_f15;
     83 
     84 /*------------------------------------------------------------*/
     85 /*--- gpr registers                                        ---*/
     86 /*------------------------------------------------------------*/
     87 
     88    /*  192 */  ULong guest_r0;
     89    /*  200 */  ULong guest_r1;
     90    /*  208 */  ULong guest_r2;
     91    /*  216 */  ULong guest_r3;
     92    /*  224 */  ULong guest_r4;
     93    /*  232 */  ULong guest_r5;
     94    /*  240 */  ULong guest_r6;
     95    /*  248 */  ULong guest_r7;
     96    /*  256 */  ULong guest_r8;
     97    /*  264 */  ULong guest_r9;
     98    /*  272 */  ULong guest_r10;
     99    /*  280 */  ULong guest_r11;
    100    /*  288 */  ULong guest_r12;
    101    /*  296 */  ULong guest_r13;
    102    /*  304 */  ULong guest_r14;
    103    /*  312 */  ULong guest_r15;
    104 
    105 /*------------------------------------------------------------*/
    106 /*--- S390 miscellaneous registers                         ---*/
    107 /*------------------------------------------------------------*/
    108 
    109    /*  320 */  ULong guest_counter;
    110    /*  328 */  UInt guest_fpc;
    111    /*  332 */  UChar unused[4]; /* 4-byte hole to get 8-byte alignment */
    112    /*  336 */  ULong guest_IA;
    113 
    114 /*------------------------------------------------------------*/
    115 /*--- S390 pseudo registers                                ---*/
    116 /*------------------------------------------------------------*/
    117 
    118    /*  344 */  ULong guest_SYSNO;
    119 
    120 /*------------------------------------------------------------*/
    121 /*--- 4-word thunk used to calculate the condition code    ---*/
    122 /*------------------------------------------------------------*/
    123 
    124    /*  352 */  ULong guest_CC_OP;
    125    /*  360 */  ULong guest_CC_DEP1;
    126    /*  368 */  ULong guest_CC_DEP2;
    127    /*  376 */  ULong guest_CC_NDEP;
    128 
    129 /*------------------------------------------------------------*/
    130 /*--- Pseudo registers. Required by all architectures      ---*/
    131 /*------------------------------------------------------------*/
    132 
    133    /* See comments at bottom of libvex.h */
    134    /*  384 */  ULong guest_NRADDR;
    135    /*  392 */  ULong guest_CMSTART;
    136    /*  400 */  ULong guest_CMLEN;
    137 
    138    /* Used when backing up to restart a syscall that has
    139       been interrupted by a signal. See also comment in
    140       libvex_ir.h */
    141    /*  408 */  ULong guest_IP_AT_SYSCALL;
    142 
    143    /* Emulation notes; see comments in libvex_emnote.h */
    144    /*  416 */  UInt guest_EMNOTE;
    145 
    146    /* For translation chaining */
    147    /*  420 */  UInt  host_EvC_COUNTER;
    148    /*  424 */  ULong host_EvC_FAILADDR;
    149 
    150 /*------------------------------------------------------------*/
    151 /*--- Force alignment to 16 bytes                          ---*/
    152 /*------------------------------------------------------------*/
    153    /*  432 */  UChar padding[0];
    154 
    155    /*  432 */  /* This is the size of the guest state */
    156 } VexGuestS390XState;
    157 
    158 
    159 /*------------------------------------------------------------*/
    160 /*--- Function prototypes                                  ---*/
    161 /*------------------------------------------------------------*/
    162 
    163 void LibVEX_GuestS390X_initialise(VexGuestS390XState *);
    164 
    165 /*------------------------------------------------------------*/
    166 /*--- Dedicated registers                                  ---*/
    167 /*------------------------------------------------------------*/
    168 
    169 #define guest_LR guest_r14  /* Link register */
    170 #define guest_SP guest_r15  /* Stack pointer */
    171 #define guest_FP guest_r11  /* Frame pointer */
    172 
    173 /*---------------------------------------------------------------*/
    174 /*--- end                                libvex_guest_s390x.h ---*/
    175 /*---------------------------------------------------------------*/
    176 
    177 #endif /* __LIBVEX_PUB_GUEST_S390X_H */
    178