1 //===-- RegisterContextLinux_s390x.cpp --------------------------*- C++ -*-===// 2 // 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 6 // 7 //===----------------------------------------------------------------------===// 8 9 #include "RegisterContextLinux_s390x.h" 10 #include "RegisterContextPOSIX_s390x.h" 11 12 using namespace lldb_private; 13 using namespace lldb; 14 15 //--------------------------------------------------------------------------- 16 // Include RegisterInfos_s390x to declare our g_register_infos_s390x structure. 17 //--------------------------------------------------------------------------- 18 #define DECLARE_REGISTER_INFOS_S390X_STRUCT 19 #include "RegisterInfos_s390x.h" 20 #undef DECLARE_REGISTER_INFOS_S390X_STRUCT 21 22 static const RegisterInfo *GetRegisterInfoPtr(const ArchSpec &target_arch) { 23 switch (target_arch.GetMachine()) { 24 case llvm::Triple::systemz: 25 return g_register_infos_s390x; 26 default: 27 assert(false && "Unhandled target architecture."); 28 return nullptr; 29 } 30 } 31 32 static uint32_t GetRegisterInfoCount(const ArchSpec &target_arch) { 33 switch (target_arch.GetMachine()) { 34 case llvm::Triple::systemz: 35 return k_num_registers_s390x; 36 default: 37 assert(false && "Unhandled target architecture."); 38 return 0; 39 } 40 } 41 42 static uint32_t GetUserRegisterInfoCount(const ArchSpec &target_arch) { 43 switch (target_arch.GetMachine()) { 44 case llvm::Triple::systemz: 45 return k_num_user_registers_s390x + k_num_linux_registers_s390x; 46 default: 47 assert(false && "Unhandled target architecture."); 48 return 0; 49 } 50 } 51 52 RegisterContextLinux_s390x::RegisterContextLinux_s390x( 53 const ArchSpec &target_arch) 54 : lldb_private::RegisterInfoInterface(target_arch), 55 m_register_info_p(GetRegisterInfoPtr(target_arch)), 56 m_register_info_count(GetRegisterInfoCount(target_arch)), 57 m_user_register_count(GetUserRegisterInfoCount(target_arch)) {} 58 59 const std::vector<lldb_private::RegisterInfo> * 60 RegisterContextLinux_s390x::GetDynamicRegisterInfoP() const { 61 return &d_register_infos; 62 } 63 64 const RegisterInfo *RegisterContextLinux_s390x::GetRegisterInfo() const { 65 return m_register_info_p; 66 } 67 68 uint32_t RegisterContextLinux_s390x::GetRegisterCount() const { 69 return m_register_info_count; 70 } 71 72 uint32_t RegisterContextLinux_s390x::GetUserRegisterCount() const { 73 return m_user_register_count; 74 } 75 76 size_t RegisterContextLinux_s390x::GetGPRSize() const { return 0; } 77