blob: 6d8ef5c3f836babb0c3fcd97d3886b5690f1aa9b [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
11 Copyright IBM Corp. 2010-2011
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
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
florian8844a632012-04-13 04:04:06 +000054/* Where the dispatcher saves the r2 contents. */
florian1b2768a2011-09-25 00:05:31 +000055#define S390_OFFSET_SAVED_R2 160+96
56
sewardj2019a972011-03-07 16:04:07 +000057/* Where client's FPC register is saved. */
58#define S390_OFFSET_SAVED_FPC_C 160+88
59
60/* Where valgrind's FPC register is saved. */
61#define S390_OFFSET_SAVED_FPC_V 160+80
62
63/* Where client code will save the link register before calling a helper. */
64#define S390_OFFSET_SAVED_LR 160+72
65
66/* Location of saved guest state pointer */
67#define S390_OFFSET_SAVED_GSP 160+64
68
69/* Size of frame allocated by VG_(run_innerloop)
70 Need size for
71 8 FPRs
florian1b2768a2011-09-25 00:05:31 +000072 + 3 GPRs (SAVED_GSP, SAVED_LR, and SAVED_R2)
sewardj2019a972011-03-07 16:04:07 +000073 + 2 FPCs (SAVED_FPC_C and SAVED_FPC_V).
74
75 Additionally, we need a standard frame for helper functions being called
76 from client code. (See figure 1-16 in zSeries ABI) */
florian1b2768a2011-09-25 00:05:31 +000077#define S390_INNERLOOP_FRAME_SIZE ((8+3+2)*8 + 160)
sewardj2019a972011-03-07 16:04:07 +000078
79
80/*--------------------------------------------------------------*/
81/*--- Miscellaneous ---*/
82/*--------------------------------------------------------------*/
83
84/* Number of arguments that can be passed in registers */
85#define S390_NUM_GPRPARMS 5
86
florian933065d2011-07-11 01:48:02 +000087/* Number of double words needed to store all facility bits. */
88#define S390_NUM_FACILITY_DW 2
89
florian8844a632012-04-13 04:04:06 +000090/* The length of the instructions issued by s390_tchain_load64 */
91#define S390_TCHAIN_LOAD64_LEN 16
92
93/* The length of the call insn (BASR) used in translation chaining */
94#define S390_TCHAIN_CALL_LEN 2
95
sewardj2019a972011-03-07 16:04:07 +000096#endif /* __LIBVEX_PUB_S390X_H */
97
98/*--------------------------------------------------------------------*/
99/*--- end libvex_s390x_common.h ---*/
100/*--------------------------------------------------------------------*/