14bb0738eSEd Maste //===-- RegisterContextLinux_s390x.cpp --------------------------*- C++ -*-===// 24bb0738eSEd Maste // 34bb0738eSEd Maste // The LLVM Compiler Infrastructure 44bb0738eSEd Maste // 54bb0738eSEd Maste // This file is distributed under the University of Illinois Open Source 64bb0738eSEd Maste // License. See LICENSE.TXT for details. 74bb0738eSEd Maste // 84bb0738eSEd Maste //===----------------------------------------------------------------------===// 94bb0738eSEd Maste 104bb0738eSEd Maste #include "RegisterContextLinux_s390x.h" 11*435933ddSDimitry Andric #include "RegisterContextPOSIX_s390x.h" 124bb0738eSEd Maste 134bb0738eSEd Maste using namespace lldb_private; 144bb0738eSEd Maste using namespace lldb; 154bb0738eSEd Maste 164bb0738eSEd Maste //--------------------------------------------------------------------------- 174bb0738eSEd Maste // Include RegisterInfos_s390x to declare our g_register_infos_s390x structure. 184bb0738eSEd Maste //--------------------------------------------------------------------------- 194bb0738eSEd Maste #define DECLARE_REGISTER_INFOS_S390X_STRUCT 204bb0738eSEd Maste #include "RegisterInfos_s390x.h" 214bb0738eSEd Maste #undef DECLARE_REGISTER_INFOS_S390X_STRUCT 224bb0738eSEd Maste GetRegisterInfoPtr(const ArchSpec & target_arch)23*435933ddSDimitry Andricstatic const RegisterInfo *GetRegisterInfoPtr(const ArchSpec &target_arch) { 24*435933ddSDimitry Andric switch (target_arch.GetMachine()) { 254bb0738eSEd Maste case llvm::Triple::systemz: 264bb0738eSEd Maste return g_register_infos_s390x; 274bb0738eSEd Maste default: 284bb0738eSEd Maste assert(false && "Unhandled target architecture."); 294bb0738eSEd Maste return nullptr; 304bb0738eSEd Maste } 314bb0738eSEd Maste } 324bb0738eSEd Maste GetRegisterInfoCount(const ArchSpec & target_arch)33*435933ddSDimitry Andricstatic uint32_t GetRegisterInfoCount(const ArchSpec &target_arch) { 34*435933ddSDimitry Andric switch (target_arch.GetMachine()) { 354bb0738eSEd Maste case llvm::Triple::systemz: 364bb0738eSEd Maste return k_num_registers_s390x; 374bb0738eSEd Maste default: 384bb0738eSEd Maste assert(false && "Unhandled target architecture."); 394bb0738eSEd Maste return 0; 404bb0738eSEd Maste } 414bb0738eSEd Maste } 424bb0738eSEd Maste GetUserRegisterInfoCount(const ArchSpec & target_arch)43*435933ddSDimitry Andricstatic uint32_t GetUserRegisterInfoCount(const ArchSpec &target_arch) { 44*435933ddSDimitry Andric switch (target_arch.GetMachine()) { 454bb0738eSEd Maste case llvm::Triple::systemz: 464bb0738eSEd Maste return k_num_user_registers_s390x + k_num_linux_registers_s390x; 474bb0738eSEd Maste default: 484bb0738eSEd Maste assert(false && "Unhandled target architecture."); 494bb0738eSEd Maste return 0; 504bb0738eSEd Maste } 514bb0738eSEd Maste } 524bb0738eSEd Maste RegisterContextLinux_s390x(const ArchSpec & target_arch)53*435933ddSDimitry AndricRegisterContextLinux_s390x::RegisterContextLinux_s390x( 54*435933ddSDimitry Andric const ArchSpec &target_arch) 554bb0738eSEd Maste : lldb_private::RegisterInfoInterface(target_arch), 564bb0738eSEd Maste m_register_info_p(GetRegisterInfoPtr(target_arch)), 574bb0738eSEd Maste m_register_info_count(GetRegisterInfoCount(target_arch)), 58*435933ddSDimitry Andric m_user_register_count(GetUserRegisterInfoCount(target_arch)) {} 594bb0738eSEd Maste 604bb0738eSEd Maste const std::vector<lldb_private::RegisterInfo> * GetDynamicRegisterInfoP() const61*435933ddSDimitry AndricRegisterContextLinux_s390x::GetDynamicRegisterInfoP() const { 624bb0738eSEd Maste return &d_register_infos; 634bb0738eSEd Maste } 644bb0738eSEd Maste GetRegisterInfo() const65*435933ddSDimitry Andricconst RegisterInfo *RegisterContextLinux_s390x::GetRegisterInfo() const { 664bb0738eSEd Maste return m_register_info_p; 674bb0738eSEd Maste } 684bb0738eSEd Maste GetRegisterCount() const69*435933ddSDimitry Andricuint32_t RegisterContextLinux_s390x::GetRegisterCount() const { 704bb0738eSEd Maste return m_register_info_count; 714bb0738eSEd Maste } 724bb0738eSEd Maste GetUserRegisterCount() const73*435933ddSDimitry Andricuint32_t RegisterContextLinux_s390x::GetUserRegisterCount() const { 744bb0738eSEd Maste return m_user_register_count; 754bb0738eSEd Maste } 764bb0738eSEd Maste GetGPRSize() const77*435933ddSDimitry Andricsize_t RegisterContextLinux_s390x::GetGPRSize() const { return 0; } 78