blob: 5b21b349e78299c45fe4583564c93b975ada664a [file] [log] [blame]
florian8844a632012-04-13 04:04:06 +00001/* -*- mode: C; c-basic-offset: 3; -*- */
sewardj2019a972011-03-07 16:04:07 +00002
3/*--------------------------------------------------------------------*/
4/*--- Common defs for s390x libvex_s390x_common.h ---*/
5/*--------------------------------------------------------------------*/
6
7/*
8 This file is part of Valgrind, a dynamic binary instrumentation
9 framework.
10
Elliott Hughesed398002017-06-21 14:41:24 -070011 Copyright IBM Corp. 2010-2017
sewardj2019a972011-03-07 16:04:07 +000012
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
sewardj2019a972011-03-07 16:04:07 +000031#ifndef __LIBVEX_PUB_S390X_H
32#define __LIBVEX_PUB_S390X_H
33
34/* This file includes definitions for s390.
35
36 It must be suitable for inclusion in assembler source files. */
37
38
39/*--------------------------------------------------------------*/
40/*--- Dedicated registers ---*/
41/*--------------------------------------------------------------*/
42
43#define S390_REGNO_RETURN_VALUE 2
florian8844a632012-04-13 04:04:06 +000044#define S390_REGNO_TCHAIN_SCRATCH 12
sewardj2019a972011-03-07 16:04:07 +000045#define S390_REGNO_GUEST_STATE_POINTER 13
46#define S390_REGNO_LINK_REGISTER 14
47#define S390_REGNO_STACK_POINTER 15
48
49
50/*--------------------------------------------------------------*/
51/*--- Offsets in the stack frame allocated by the dispatcher ---*/
52/*--------------------------------------------------------------*/
53
florian203b9982013-02-02 22:58:25 +000054/* Dispatcher will save 8 FPRs at offsets 160 + 0 ... 160 + 56 */
55
florian8844a632012-04-13 04:04:06 +000056/* Where the dispatcher saves the r2 contents. */
florian203b9982013-02-02 22:58:25 +000057#define S390_OFFSET_SAVED_R2 160+80
florian1b2768a2011-09-25 00:05:31 +000058
sewardj2019a972011-03-07 16:04:07 +000059/* Where client's FPC register is saved. */
florian203b9982013-02-02 22:58:25 +000060#define S390_OFFSET_SAVED_FPC_C 160+72
sewardj2019a972011-03-07 16:04:07 +000061
62/* Where valgrind's FPC register is saved. */
florian203b9982013-02-02 22:58:25 +000063#define S390_OFFSET_SAVED_FPC_V 160+64
sewardj2019a972011-03-07 16:04:07 +000064
florian35878282012-05-28 02:58:19 +000065/* Size of frame allocated by VG_(disp_run_translations)
sewardj2019a972011-03-07 16:04:07 +000066 Need size for
67 8 FPRs
florian203b9982013-02-02 22:58:25 +000068 + 1 GPR (SAVED_R2)
sewardj2019a972011-03-07 16:04:07 +000069 + 2 FPCs (SAVED_FPC_C and SAVED_FPC_V).
70
71 Additionally, we need a standard frame for helper functions being called
72 from client code. (See figure 1-16 in zSeries ABI) */
florian203b9982013-02-02 22:58:25 +000073#define S390_INNERLOOP_FRAME_SIZE ((8+1+2)*8 + 160)
sewardj2019a972011-03-07 16:04:07 +000074
75
76/*--------------------------------------------------------------*/
florianaec8e052012-12-09 17:26:32 +000077/*--- Facility bits ---*/
78/*--------------------------------------------------------------*/
79
80/* The value of the macro is the number of the facility bit as per POP. */
81#define S390_FAC_MSA 17 // message-security-assist
82#define S390_FAC_LDISP 18 // long displacement
83#define S390_FAC_HFPMAS 20 // HFP multiply-and-add-subtract
84#define S390_FAC_EIMM 21 // extended immediate
85#define S390_FAC_HFPUNX 23 // HFP unnormalized extension
86#define S390_FAC_ETF2 24 // ETF2-enhancement
87#define S390_FAC_STCKF 25 // store clock fast insn
88#define S390_FAC_PENH 26 // parsing-enhancement
89#define S390_FAC_ETF3 30 // ETF3-enhancement
90#define S390_FAC_XCPUT 31 // extract-CPU-time
91#define S390_FAC_GIE 34 // general insn extension
92#define S390_FAC_EXEXT 35 // execute extension
93#define S390_FAC_FPEXT 37 // floating-point extension
94#define S390_FAC_FPSE 41 // floating-point support enhancement
95#define S390_FAC_DFP 42 // decimal floating point
96#define S390_FAC_PFPO 44 // perform floating point operation insn
97#define S390_FAC_HIGHW 45 // high-word extension
98#define S390_FAC_LSC 45 // load/store on condition
99#define S390_FAC_DFPZC 48 // DFP zoned-conversion
100#define S390_FAC_MISC 49 // miscellaneous insn
101#define S390_FAC_CTREXE 50 // constrained transactional execution
102#define S390_FAC_TREXE 73 // transactional execution
103#define S390_FAC_MSA4 77 // message-security-assist 4
104
105
106/*--------------------------------------------------------------*/
sewardj2019a972011-03-07 16:04:07 +0000107/*--- Miscellaneous ---*/
108/*--------------------------------------------------------------*/
109
110/* Number of arguments that can be passed in registers */
111#define S390_NUM_GPRPARMS 5
112
florian933065d2011-07-11 01:48:02 +0000113/* Number of double words needed to store all facility bits. */
114#define S390_NUM_FACILITY_DW 2
115
sewardj2019a972011-03-07 16:04:07 +0000116#endif /* __LIBVEX_PUB_S390X_H */
117
118/*--------------------------------------------------------------------*/
119/*--- end libvex_s390x_common.h ---*/
120/*--------------------------------------------------------------------*/