LLDB  mainline
RegisterInfos_s390x.h
Go to the documentation of this file.
1 //===-- RegisterInfos_s390x.h -----------------------------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #include <stddef.h>
10 
11 #include "llvm/Support/Compiler.h"
12 
13 
14 #ifdef DECLARE_REGISTER_INFOS_S390X_STRUCT
15 
16 // Computes the offset of the given GPR in the user data area.
17 #define GPR_OFFSET(num) (16 + 8 * num)
18 // Computes the offset of the given ACR in the user data area.
19 #define ACR_OFFSET(num) (16 + 8 * 16 + 4 * num)
20 // Computes the offset of the given FPR in the extended data area.
21 #define FPR_OFFSET(num) (8 + 8 * num)
22 
23 // RegisterKind: EHFrame, DWARF, Generic, Process Plugin, LLDB
24 
25 #define DEFINE_GPR(name, size, offset, alt, generic) \
26  { \
27  #name, alt, size, offset, eEncodingUint, eFormatHex, \
28  {dwarf_##name##_s390x, dwarf_##name##_s390x, generic, \
29  LLDB_INVALID_REGNUM, lldb_##name##_s390x }, \
30  NULL, NULL, NULL, 0 \
31  }
32 
33 #define DEFINE_GPR_NODWARF(name, size, offset, alt, generic) \
34  { \
35  #name, alt, size, offset, eEncodingUint, eFormatHex, \
36  {LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, generic, \
37  LLDB_INVALID_REGNUM, lldb_##name##_s390x }, \
38  NULL, NULL, NULL, 0 \
39  }
40 
41 #define DEFINE_FPR(name, size, offset) \
42  { \
43  #name, NULL, size, offset, eEncodingUint, eFormatHex, \
44  {dwarf_##name##_s390x, dwarf_##name##_s390x, LLDB_INVALID_REGNUM, \
45  LLDB_INVALID_REGNUM, lldb_##name##_s390x }, \
46  NULL, NULL, NULL, 0 \
47  }
48 
49 #define DEFINE_FPR_NODWARF(name, size, offset) \
50  { \
51  #name, NULL, size, offset, eEncodingUint, eFormatHex, \
52  {LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, \
53  LLDB_INVALID_REGNUM, lldb_##name##_s390x }, \
54  NULL, NULL, NULL, 0 \
55  }
56 
57 static RegisterInfo g_register_infos_s390x[] = {
58  // General purpose registers.
59  DEFINE_GPR(r0, 8, GPR_OFFSET(0), nullptr, LLDB_INVALID_REGNUM),
60  DEFINE_GPR(r1, 8, GPR_OFFSET(1), nullptr, LLDB_INVALID_REGNUM),
66  DEFINE_GPR(r7, 8, GPR_OFFSET(7), nullptr, LLDB_INVALID_REGNUM),
67  DEFINE_GPR(r8, 8, GPR_OFFSET(8), nullptr, LLDB_INVALID_REGNUM),
68  DEFINE_GPR(r9, 8, GPR_OFFSET(9), nullptr, LLDB_INVALID_REGNUM),
69  DEFINE_GPR(r10, 8, GPR_OFFSET(10), nullptr, LLDB_INVALID_REGNUM),
71  DEFINE_GPR(r12, 8, GPR_OFFSET(12), nullptr, LLDB_INVALID_REGNUM),
72  DEFINE_GPR(r13, 8, GPR_OFFSET(13), nullptr, LLDB_INVALID_REGNUM),
73  DEFINE_GPR(r14, 8, GPR_OFFSET(14), nullptr, LLDB_INVALID_REGNUM),
75  DEFINE_GPR(acr0, 4, ACR_OFFSET(0), nullptr, LLDB_INVALID_REGNUM),
76  DEFINE_GPR(acr1, 4, ACR_OFFSET(1), nullptr, LLDB_INVALID_REGNUM),
77  DEFINE_GPR(acr2, 4, ACR_OFFSET(2), nullptr, LLDB_INVALID_REGNUM),
78  DEFINE_GPR(acr3, 4, ACR_OFFSET(3), nullptr, LLDB_INVALID_REGNUM),
79  DEFINE_GPR(acr4, 4, ACR_OFFSET(4), nullptr, LLDB_INVALID_REGNUM),
80  DEFINE_GPR(acr5, 4, ACR_OFFSET(5), nullptr, LLDB_INVALID_REGNUM),
81  DEFINE_GPR(acr6, 4, ACR_OFFSET(6), nullptr, LLDB_INVALID_REGNUM),
82  DEFINE_GPR(acr7, 4, ACR_OFFSET(7), nullptr, LLDB_INVALID_REGNUM),
83  DEFINE_GPR(acr8, 4, ACR_OFFSET(8), nullptr, LLDB_INVALID_REGNUM),
84  DEFINE_GPR(acr9, 4, ACR_OFFSET(9), nullptr, LLDB_INVALID_REGNUM),
85  DEFINE_GPR(acr10, 4, ACR_OFFSET(10), nullptr, LLDB_INVALID_REGNUM),
86  DEFINE_GPR(acr11, 4, ACR_OFFSET(11), nullptr, LLDB_INVALID_REGNUM),
87  DEFINE_GPR(acr12, 4, ACR_OFFSET(12), nullptr, LLDB_INVALID_REGNUM),
88  DEFINE_GPR(acr13, 4, ACR_OFFSET(13), nullptr, LLDB_INVALID_REGNUM),
89  DEFINE_GPR(acr14, 4, ACR_OFFSET(14), nullptr, LLDB_INVALID_REGNUM),
90  DEFINE_GPR(acr15, 4, ACR_OFFSET(15), nullptr, LLDB_INVALID_REGNUM),
91  DEFINE_GPR(pswm, 8, 0, "flags", LLDB_REGNUM_GENERIC_FLAGS),
92  DEFINE_GPR(pswa, 8, 8, "pc", LLDB_REGNUM_GENERIC_PC),
93 
94  // Floating point registers.
95  DEFINE_FPR(f0, 8, FPR_OFFSET(0)), DEFINE_FPR(f1, 8, FPR_OFFSET(1)),
96  DEFINE_FPR(f2, 8, FPR_OFFSET(2)), DEFINE_FPR(f3, 8, FPR_OFFSET(3)),
97  DEFINE_FPR(f4, 8, FPR_OFFSET(4)), DEFINE_FPR(f5, 8, FPR_OFFSET(5)),
98  DEFINE_FPR(f6, 8, FPR_OFFSET(6)), DEFINE_FPR(f7, 8, FPR_OFFSET(7)),
99  DEFINE_FPR(f8, 8, FPR_OFFSET(8)), DEFINE_FPR(f9, 8, FPR_OFFSET(9)),
100  DEFINE_FPR(f10, 8, FPR_OFFSET(10)), DEFINE_FPR(f11, 8, FPR_OFFSET(11)),
101  DEFINE_FPR(f12, 8, FPR_OFFSET(12)), DEFINE_FPR(f13, 8, FPR_OFFSET(13)),
102  DEFINE_FPR(f14, 8, FPR_OFFSET(14)), DEFINE_FPR(f15, 8, FPR_OFFSET(15)),
103  DEFINE_FPR_NODWARF(fpc, 4, 0),
104 
105  // Linux operating-specific info.
106  DEFINE_GPR_NODWARF(orig_r2, 8, 16 + 16 * 8 + 16 * 4, nullptr,
108  DEFINE_GPR_NODWARF(last_break, 8, 0, nullptr, LLDB_INVALID_REGNUM),
109  DEFINE_GPR_NODWARF(system_call, 4, 0, nullptr, LLDB_INVALID_REGNUM),
110 };
111 
112 static_assert((sizeof(g_register_infos_s390x) /
113  sizeof(g_register_infos_s390x[0])) == k_num_registers_s390x,
114  "g_register_infos_s390x has wrong number of register infos");
115 
116 #undef GPR_OFFSET
117 #undef ACR_OFFSET
118 #undef FPR_OFFSET
119 #undef DEFINE_GPR
120 #undef DEFINE_GPR_NODWARF
121 #undef DEFINE_FPR
122 #undef DEFINE_FPR_NODWARF
123 
124 #endif // DECLARE_REGISTER_INFOS_S390X_STRUCT
#define LLDB_REGNUM_GENERIC_PC
Definition: lldb-defines.h:63
#define GPR_OFFSET(idx)
#define LLDB_REGNUM_GENERIC_ARG4
Definition: lldb-defines.h:74
#define LLDB_REGNUM_GENERIC_ARG2
Definition: lldb-defines.h:70
#define LLDB_REGNUM_GENERIC_SP
Definition: lldb-defines.h:64
#define LLDB_REGNUM_GENERIC_ARG5
Definition: lldb-defines.h:76
#define LLDB_REGNUM_GENERIC_ARG1
Definition: lldb-defines.h:68
#define LLDB_REGNUM_GENERIC_FP
Definition: lldb-defines.h:65
#define FPR_OFFSET(regname)
#define LLDB_REGNUM_GENERIC_FLAGS
Definition: lldb-defines.h:67
#define DEFINE_GPR(reg, alt, kind1, kind2, kind3, kind4)
#define LLDB_REGNUM_GENERIC_ARG3
Definition: lldb-defines.h:72
#define LLDB_INVALID_REGNUM
Definition: lldb-defines.h:90