Home | History | Annotate | Download | only in pub
      1 
      2 /*--------------------------------------------------------------------*/
      3 /*--- Common defs for s390x                  libvex_s390x_common.h ---*/
      4 /*--------------------------------------------------------------------*/
      5 
      6 /*
      7    This file is part of Valgrind, a dynamic binary instrumentation
      8    framework.
      9 
     10    Copyright IBM Corp. 2010-2011
     11 
     12    This program is free software; you can redistribute it and/or
     13    modify it under the terms of the GNU General Public License as
     14    published by the Free Software Foundation; either version 2 of the
     15    License, or (at your option) any later version.
     16 
     17    This program is distributed in the hope that it will be useful, but
     18    WITHOUT ANY WARRANTY; without even the implied warranty of
     19    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     20    General Public License for more details.
     21 
     22    You should have received a copy of the GNU General Public License
     23    along with this program; if not, write to the Free Software
     24    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
     25    02110-1301, USA.
     26 
     27    The GNU General Public License is contained in the file COPYING.
     28 */
     29 
     30 /* -*- mode: C; c-basic-offset: 3; -*- */
     31 
     32 #ifndef __LIBVEX_PUB_S390X_H
     33 #define __LIBVEX_PUB_S390X_H
     34 
     35 /* This file includes definitions for s390.
     36 
     37    It must be suitable for inclusion in assembler source files. */
     38 
     39 
     40 /*--------------------------------------------------------------*/
     41 /*--- Dedicated registers                                    ---*/
     42 /*--------------------------------------------------------------*/
     43 
     44 #define S390_REGNO_RETURN_VALUE         2
     45 #define S390_REGNO_DISPATCH_CTR        12   /* Holds VG_(dispatch_ctr) */
     46 #define S390_REGNO_GUEST_STATE_POINTER 13
     47 #define S390_REGNO_LINK_REGISTER       14
     48 #define S390_REGNO_STACK_POINTER       15
     49 
     50 
     51 /*--------------------------------------------------------------*/
     52 /*--- Offsets in the stack frame allocated by the dispatcher ---*/
     53 /*--------------------------------------------------------------*/
     54 
     55 /* Where the profiling dispatcher saves the r2 contents. */
     56 #define S390_OFFSET_SAVED_R2 160+96
     57 
     58 /* Where client's FPC register is saved. */
     59 #define S390_OFFSET_SAVED_FPC_C 160+88
     60 
     61 /* Where valgrind's FPC register is saved. */
     62 #define S390_OFFSET_SAVED_FPC_V 160+80
     63 
     64 /* Where client code will save the link register before calling a helper. */
     65 #define S390_OFFSET_SAVED_LR 160+72
     66 
     67 /* Location of saved guest state pointer */
     68 #define S390_OFFSET_SAVED_GSP 160+64
     69 
     70 /* Size of frame allocated by VG_(run_innerloop)
     71    Need size for
     72        8 FPRs
     73      + 3 GPRs (SAVED_GSP, SAVED_LR, and SAVED_R2)
     74      + 2 FPCs (SAVED_FPC_C and SAVED_FPC_V).
     75 
     76    Additionally, we need a standard frame for helper functions being called
     77    from client code. (See figure 1-16 in zSeries ABI) */
     78 #define S390_INNERLOOP_FRAME_SIZE ((8+3+2)*8 + 160)
     79 
     80 
     81 /*--------------------------------------------------------------*/
     82 /*--- Miscellaneous                                          ---*/
     83 /*--------------------------------------------------------------*/
     84 
     85 /* Number of arguments that can be passed in registers */
     86 #define S390_NUM_GPRPARMS 5
     87 
     88 /* Number of double words needed to store all facility bits. */
     89 #define S390_NUM_FACILITY_DW 2
     90 
     91 #endif /* __LIBVEX_PUB_S390X_H */
     92 
     93 /*--------------------------------------------------------------------*/
     94 /*--- end                                    libvex_s390x_common.h ---*/
     95 /*--------------------------------------------------------------------*/
     96