1 //===-- RegisterContextLinux_s390x.cpp ------------------------------------===//
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
7 //===----------------------------------------------------------------------===//
9 #include "RegisterContextLinux_s390x.h"
10 #include "RegisterContextPOSIX_s390x.h"
12 using namespace lldb_private
;
15 // Include RegisterInfos_s390x to declare our g_register_infos_s390x structure.
16 #define DECLARE_REGISTER_INFOS_S390X_STRUCT
17 #include "RegisterInfos_s390x.h"
18 #undef DECLARE_REGISTER_INFOS_S390X_STRUCT
20 static const RegisterInfo
*GetRegisterInfoPtr(const ArchSpec
&target_arch
) {
21 switch (target_arch
.GetMachine()) {
22 case llvm::Triple::systemz
:
23 return g_register_infos_s390x
;
25 assert(false && "Unhandled target architecture.");
30 static uint32_t GetRegisterInfoCount(const ArchSpec
&target_arch
) {
31 switch (target_arch
.GetMachine()) {
32 case llvm::Triple::systemz
:
33 return k_num_registers_s390x
;
35 assert(false && "Unhandled target architecture.");
40 static uint32_t GetUserRegisterInfoCount(const ArchSpec
&target_arch
) {
41 switch (target_arch
.GetMachine()) {
42 case llvm::Triple::systemz
:
43 return k_num_user_registers_s390x
+ k_num_linux_registers_s390x
;
45 assert(false && "Unhandled target architecture.");
50 RegisterContextLinux_s390x::RegisterContextLinux_s390x(
51 const ArchSpec
&target_arch
)
52 : lldb_private::RegisterInfoInterface(target_arch
),
53 m_register_info_p(GetRegisterInfoPtr(target_arch
)),
54 m_register_info_count(GetRegisterInfoCount(target_arch
)),
55 m_user_register_count(GetUserRegisterInfoCount(target_arch
)) {}
57 const RegisterInfo
*RegisterContextLinux_s390x::GetRegisterInfo() const {
58 return m_register_info_p
;
61 uint32_t RegisterContextLinux_s390x::GetRegisterCount() const {
62 return m_register_info_count
;
65 uint32_t RegisterContextLinux_s390x::GetUserRegisterCount() const {
66 return m_user_register_count
;
69 size_t RegisterContextLinux_s390x::GetGPRSize() const { return 0; }