1 //===-- RegisterContextLinux_mips.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 //===---------------------------------------------------------------------===//
13 // For eh_frame and DWARF Register numbers
14 #include "RegisterContextLinux_mips.h"
16 // Internal codes for mips registers
17 #include "lldb-mips-linux-register-enums.h"
19 // For GP and FP buffers
20 #include "RegisterContext_mips.h"
22 using namespace lldb_private;
25 //---------------------------------------------------------------------------
26 // Include RegisterInfos_mips to declare our g_register_infos_mips structure.
27 //---------------------------------------------------------------------------
28 #define DECLARE_REGISTER_INFOS_MIPS_STRUCT
29 #include "RegisterInfos_mips.h"
30 #undef DECLARE_REGISTER_INFOS_MIPS_STRUCT
32 uint32_t GetUserRegisterInfoCount(bool msa_present) {
34 return static_cast<uint32_t>(k_num_user_registers_mips);
35 return static_cast<uint32_t>(k_num_user_registers_mips -
36 k_num_msa_registers_mips);
39 RegisterContextLinux_mips::RegisterContextLinux_mips(
40 const ArchSpec &target_arch, bool msa_present)
41 : RegisterInfoInterface(target_arch),
42 m_user_register_count(GetUserRegisterInfoCount(msa_present)) {}
44 size_t RegisterContextLinux_mips::GetGPRSize() const {
45 return sizeof(GPR_linux_mips);
48 const RegisterInfo *RegisterContextLinux_mips::GetRegisterInfo() const {
49 switch (m_target_arch.GetMachine()) {
50 case llvm::Triple::mips:
51 case llvm::Triple::mipsel:
52 return g_register_infos_mips;
54 assert(false && "Unhandled target architecture.");
59 uint32_t RegisterContextLinux_mips::GetRegisterCount() const {
60 return static_cast<uint32_t>(sizeof(g_register_infos_mips) /
61 sizeof(g_register_infos_mips[0]));
64 uint32_t RegisterContextLinux_mips::GetUserRegisterCount() const {
65 return static_cast<uint32_t>(m_user_register_count);