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 "RegisterContextPOSIX_s390x.h" 11 #include "RegisterContextLinux_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 * 24 GetRegisterInfoPtr(const ArchSpec &target_arch) 25 { 26 switch (target_arch.GetMachine()) 27 { 28 case llvm::Triple::systemz: 29 return g_register_infos_s390x; 30 default: 31 assert(false && "Unhandled target architecture."); 32 return nullptr; 33 } 34 } 35 36 static uint32_t 37 GetRegisterInfoCount(const ArchSpec &target_arch) 38 { 39 switch (target_arch.GetMachine()) 40 { 41 case llvm::Triple::systemz: 42 return k_num_registers_s390x; 43 default: 44 assert(false && "Unhandled target architecture."); 45 return 0; 46 } 47 } 48 49 static uint32_t 50 GetUserRegisterInfoCount(const ArchSpec &target_arch) 51 { 52 switch (target_arch.GetMachine()) 53 { 54 case llvm::Triple::systemz: 55 return k_num_user_registers_s390x + k_num_linux_registers_s390x; 56 default: 57 assert(false && "Unhandled target architecture."); 58 return 0; 59 } 60 } 61 62 RegisterContextLinux_s390x::RegisterContextLinux_s390x(const ArchSpec &target_arch) 63 : lldb_private::RegisterInfoInterface(target_arch), 64 m_register_info_p(GetRegisterInfoPtr(target_arch)), 65 m_register_info_count(GetRegisterInfoCount(target_arch)), 66 m_user_register_count(GetUserRegisterInfoCount(target_arch)) 67 { 68 } 69 70 const std::vector<lldb_private::RegisterInfo> * 71 RegisterContextLinux_s390x::GetDynamicRegisterInfoP() const 72 { 73 return &d_register_infos; 74 } 75 76 const RegisterInfo * 77 RegisterContextLinux_s390x::GetRegisterInfo() const 78 { 79 return m_register_info_p; 80 } 81 82 uint32_t 83 RegisterContextLinux_s390x::GetRegisterCount() const 84 { 85 return m_register_info_count; 86 } 87 88 uint32_t 89 RegisterContextLinux_s390x::GetUserRegisterCount() const 90 { 91 return m_user_register_count; 92 } 93 94 size_t 95 RegisterContextLinux_s390x::GetGPRSize() const 96 { 97 return 0; 98 } 99