Commit | Line | Data |
---|---|---|
5769d3cd AC |
1 | /* Macro definitions for GDB on an S390. |
2 | Copyright 2001 Free Software Foundation, Inc. | |
3 | Contributed by D.J. Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com) | |
4 | for IBM Deutschland Entwicklung GmbH, IBM Corporation. | |
5 | ||
6 | This file is part of GDB. | |
7 | ||
8 | This program is free software; you can redistribute it and/or modify | |
9 | it under the terms of the GNU General Public License as published by | |
10 | the Free Software Foundation; either version 2 of the License, or | |
11 | (at your option) any later version. | |
12 | ||
13 | This program is distributed in the hope that it will be useful, | |
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 | GNU General Public License for more details. | |
17 | ||
18 | You should have received a copy of the GNU General Public License | |
19 | along with this program; if not, write to the Free Software | |
20 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA | |
21 | 02111-1307, USA. */ | |
22 | ||
23 | #if !defined(TM_S390_H) | |
24 | #define TM_S390_H 1 | |
25 | ||
26 | #define S390_NUM_GPRS (16) | |
27 | #define S390_GPR_SIZE REGISTER_SIZE | |
28 | #define S390_PSW_MASK_SIZE REGISTER_SIZE | |
29 | #define S390_PSW_ADDR_SIZE REGISTER_SIZE | |
30 | #define S390_NUM_FPRS (16) | |
31 | #define S390_FPR_SIZE (8) | |
32 | #define S390_FPC_SIZE (4) | |
33 | #define S390_FPC_PAD_SIZE (4) /* gcc insists on aligning the fpregs */ | |
34 | #define S390_NUM_CRS (16) | |
35 | #define S390_CR_SIZE REGISTER_SIZE | |
36 | #define S390_NUM_ACRS (16) | |
37 | #define S390_ACR_SIZE (4) | |
38 | ||
39 | #define S390_NUM_REGS (2+S390_NUM_GPRS+S390_NUM_ACRS+S390_NUM_CRS+1+S390_NUM_FPRS) | |
40 | #define S390_FIRST_ACR (2+S390_NUM_GPRS) | |
41 | #define S390_LAST_ACR (S390_FIRST_ACR+S390_NUM_ACRS-1) | |
42 | #define S390_FIRST_CR (S390_FIRST_ACR+S390_NUM_ACRS) | |
43 | #define S390_LAST_CR (S390_FIRST_CR+S390_NUM_CRS-1) | |
44 | ||
45 | #define S390_PSWM_REGNUM 0 | |
46 | #define S390_PC_REGNUM 1 | |
47 | #define S390_GP0_REGNUM 2 /* GPR register 0 */ | |
48 | #define S390_GP_LAST_REGNUM (S390_GP0_REGNUM+S390_NUM_GPRS-1) | |
49 | /* Usually return address */ | |
50 | #define S390_RETADDR_REGNUM (S390_GP0_REGNUM+14) | |
51 | /* Contains address of top of stack */ | |
52 | #define S390_SP_REGNUM (S390_GP0_REGNUM+15) | |
53 | /* needed in findvar.c still */ | |
54 | #define S390_FP_REGNUM S390_SP_REGNUM | |
55 | #define S390_FRAME_REGNUM (S390_GP0_REGNUM+11) | |
56 | #define S390_FPC_REGNUM (S390_GP0_REGNUM+S390_NUM_GPRS+S390_NUM_ACRS+S390_NUM_CRS) | |
57 | /* FPR (Floating point) register 0 */ | |
58 | #define S390_FP0_REGNUM (S390_FPC_REGNUM+1) | |
59 | /* Last floating point register */ | |
60 | #define S390_FPLAST_REGNUM (S390_FP0_REGNUM+S390_NUM_FPRS-1) | |
61 | #define S390_LAST_REGNUM S390_FPLAST_REGNUM | |
62 | ||
63 | ||
64 | #define S390_ACR0_OFFSET ((S390_PSW_MASK_SIZE+S390_PSW_ADDR_SIZE)+(S390_GPR_SIZE*S390_NUM_GPRS)) | |
65 | #define S390_CR0_OFFSET (S390_ACR0_OFFSET+(S390_ACR_SIZE*S390_NUM_ACRS)) | |
66 | #define S390_FPC_OFFSET (S390_CR0_OFFSET+(S390_CR_SIZE*S390_NUM_CRS)) | |
67 | #define S390_FP0_OFFSET (S390_FPC_OFFSET+(S390_FPC_SIZE+S390_FPC_PAD_SIZE)) | |
68 | #define S390_GPR6_STACK_OFFSET (GDB_TARGET_IS_ESAME ? 48:24) | |
69 | ||
70 | #define S390_REGISTER_BYTES ((4+4)+(4*S390_NUM_GPRS)+(4*S390_NUM_ACRS)+ \ | |
71 | (4*S390_NUM_CRS)+(S390_FPC_SIZE+S390_FPC_PAD_SIZE)+(S390_FPR_SIZE*S390_NUM_FPRS)) | |
72 | ||
73 | #define S390X_REGISTER_BYTES ((8+8)+(8*S390_NUM_GPRS)+(4*S390_NUM_ACRS)+ \ | |
74 | (8*S390_NUM_CRS)+(S390_FPC_SIZE+S390_FPC_PAD_SIZE)+(S390_FPR_SIZE*S390_NUM_FPRS)) | |
75 | ||
76 | #ifdef GDBSERVER | |
77 | ||
78 | int s390_register_byte (int reg_nr); | |
79 | #define REGISTER_BYTE(reg_nr) s390_register_byte(reg_nr) | |
80 | #define PC_REGNUM S390_PC_REGNUM | |
81 | #define NUM_REGS S390_NUM_REGS | |
82 | #define NUM_FREGS S390_NUM_FPRS | |
83 | #define FP_REGNUM S390_FP_REGNUM | |
84 | #define SP_REGNUM S390_SP_REGNUM | |
85 | /* Obviously ptrace for user program tracing cannot be allowed | |
86 | mess with control registers (except per registers for hardware watchpoints), | |
87 | when we add kernel debugging we may need to alter these macros. */ | |
88 | int s390_cannot_fetch_register (int regno); | |
89 | #define CANNOT_FETCH_REGISTER(regno) s390_cannot_fetch_register(regno) | |
90 | #define CANNOT_STORE_REGISTER(regno) s390_cannot_fetch_register(regno) | |
91 | ||
92 | #if CONFIG_ARCH_S390X | |
93 | ||
94 | int s390x_register_raw_size (int reg_nr); | |
95 | #define REGISTER_RAW_SIZE(reg_nr) s390x_register_raw_size(reg_nr) | |
96 | #define GDB_TARGET_IS_ESAME (1) | |
97 | #define REGISTER_SIZE (8) | |
98 | #define REGISTER_BYTES S390X_REGISTER_BYTES | |
99 | ||
100 | #else /* CONFIG_ARCH_S390X */ | |
101 | ||
102 | int s390_register_raw_size (int reg_nr); | |
103 | #define REGISTER_RAW_SIZE(reg_nr) s390_register_raw_size(reg_nr) | |
104 | #define GDB_TARGET_IS_ESAME (0) | |
105 | #define REGISTER_SIZE (4) | |
106 | #define REGISTER_BYTES S390_REGISTER_BYTES | |
107 | ||
108 | #endif /* CONFIG_ARCH_S390X */ | |
109 | ||
110 | #else /* GDBSERVER */ | |
111 | ||
b8b8b047 | 112 | #define GDB_TARGET_IS_ESAME (TARGET_ARCHITECTURE->mach == bfd_mach_s390_64) |
5769d3cd AC |
113 | |
114 | #endif /* GDBSERVER */ | |
115 | #endif /* ifndef TM_S390_H */ |