1 //===-- RegisterContextLinux_s390x.cpp --------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #include "RegisterContextLinux_s390x.h"
11 #include "RegisterContextPOSIX_s390x.h"
13 using namespace lldb_private;
16 //---------------------------------------------------------------------------
17 // Include RegisterInfos_s390x to declare our g_register_infos_s390x structure.
18 //---------------------------------------------------------------------------
19 #define DECLARE_REGISTER_INFOS_S390X_STRUCT
20 #include "RegisterInfos_s390x.h"
21 #undef DECLARE_REGISTER_INFOS_S390X_STRUCT
23 static const RegisterInfo *GetRegisterInfoPtr(const ArchSpec &target_arch) {
24 switch (target_arch.GetMachine()) {
25 case llvm::Triple::systemz:
26 return g_register_infos_s390x;
28 assert(false && "Unhandled target architecture.");
33 static uint32_t GetRegisterInfoCount(const ArchSpec &target_arch) {
34 switch (target_arch.GetMachine()) {
35 case llvm::Triple::systemz:
36 return k_num_registers_s390x;
38 assert(false && "Unhandled target architecture.");
43 static uint32_t GetUserRegisterInfoCount(const ArchSpec &target_arch) {
44 switch (target_arch.GetMachine()) {
45 case llvm::Triple::systemz:
46 return k_num_user_registers_s390x + k_num_linux_registers_s390x;
48 assert(false && "Unhandled target architecture.");
53 RegisterContextLinux_s390x::RegisterContextLinux_s390x(
54 const ArchSpec &target_arch)
55 : lldb_private::RegisterInfoInterface(target_arch),
56 m_register_info_p(GetRegisterInfoPtr(target_arch)),
57 m_register_info_count(GetRegisterInfoCount(target_arch)),
58 m_user_register_count(GetUserRegisterInfoCount(target_arch)) {}
60 const std::vector<lldb_private::RegisterInfo> *
61 RegisterContextLinux_s390x::GetDynamicRegisterInfoP() const {
62 return &d_register_infos;
65 const RegisterInfo *RegisterContextLinux_s390x::GetRegisterInfo() const {
66 return m_register_info_p;
69 uint32_t RegisterContextLinux_s390x::GetRegisterCount() const {
70 return m_register_info_count;
73 uint32_t RegisterContextLinux_s390x::GetUserRegisterCount() const {
74 return m_user_register_count;
77 size_t RegisterContextLinux_s390x::GetGPRSize() const { return 0; }