1 //===-- RegisterContextLinux_s390x.cpp --------------------------*- C++ -*-===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is distributed under the University of Illinois Open Source 6 // License. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 10 #include "RegisterContextLinux_s390x.h" 11 #include "RegisterContextPOSIX_s390x.h" 12 13 using namespace lldb_private; 14 using namespace lldb; 15 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 22 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; 27 default: 28 assert(false && "Unhandled target architecture."); 29 return nullptr; 30 } 31 } 32 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; 37 default: 38 assert(false && "Unhandled target architecture."); 39 return 0; 40 } 41 } 42 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; 47 default: 48 assert(false && "Unhandled target architecture."); 49 return 0; 50 } 51 } 52 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)) {} 59 60 const std::vector<lldb_private::RegisterInfo> * 61 RegisterContextLinux_s390x::GetDynamicRegisterInfoP() const { 62 return &d_register_infos; 63 } 64 65 const RegisterInfo *RegisterContextLinux_s390x::GetRegisterInfo() const { 66 return m_register_info_p; 67 } 68 69 uint32_t RegisterContextLinux_s390x::GetRegisterCount() const { 70 return m_register_info_count; 71 } 72 73 uint32_t RegisterContextLinux_s390x::GetUserRegisterCount() const { 74 return m_user_register_count; 75 } 76 77 size_t RegisterContextLinux_s390x::GetGPRSize() const { return 0; } 78