1 //===-- NativeRegisterContextLinux_arm.h ---------------------*- 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 #if defined(__arm__) // arm register context only needed on arm devices 11 12 #ifndef lldb_NativeRegisterContextLinux_arm_h 13 #define lldb_NativeRegisterContextLinux_arm_h 14 15 #include "Plugins/Process/Linux/NativeRegisterContextLinux.h" 16 #include "Plugins/Process/Utility/lldb-arm-register-enums.h" 17 18 namespace lldb_private { 19 namespace process_linux { 20 21 class NativeProcessLinux; 22 23 class NativeRegisterContextLinux_arm : public NativeRegisterContextLinux 24 { 25 public: 26 NativeRegisterContextLinux_arm (const ArchSpec& target_arch, 27 NativeThreadProtocol &native_thread, 28 uint32_t concrete_frame_idx); 29 30 uint32_t 31 GetRegisterSetCount () const override; 32 33 const RegisterSet * 34 GetRegisterSet (uint32_t set_index) const override; 35 36 uint32_t 37 GetUserRegisterCount() const override; 38 39 Error 40 ReadRegister (const RegisterInfo *reg_info, RegisterValue ®_value) override; 41 42 Error 43 WriteRegister (const RegisterInfo *reg_info, const RegisterValue ®_value) override; 44 45 Error 46 ReadAllRegisterValues (lldb::DataBufferSP &data_sp) override; 47 48 Error 49 WriteAllRegisterValues (const lldb::DataBufferSP &data_sp) override; 50 51 protected: 52 void* 53 GetGPRBuffer() override { return &m_gpr_arm; } 54 55 void* 56 GetFPRBuffer() override { return &m_fpr; } 57 58 size_t 59 GetFPRSize() override { return sizeof(m_fpr); } 60 61 private: 62 struct RegInfo 63 { 64 uint32_t num_registers; 65 uint32_t num_gpr_registers; 66 uint32_t num_fpr_registers; 67 68 uint32_t last_gpr; 69 uint32_t first_fpr; 70 uint32_t last_fpr; 71 72 uint32_t first_fpr_v; 73 uint32_t last_fpr_v; 74 75 uint32_t gpr_flags; 76 }; 77 78 struct QReg 79 { 80 uint8_t bytes[16]; 81 }; 82 83 struct FPU 84 { 85 union { 86 uint32_t s[32]; 87 uint64_t d[32]; 88 QReg q[16]; // the 128-bit NEON registers 89 } floats; 90 uint32_t fpscr; 91 }; 92 93 uint32_t m_gpr_arm[k_num_gpr_registers_arm]; 94 RegInfo m_reg_info; 95 FPU m_fpr; 96 97 bool 98 IsGPR(unsigned reg) const; 99 100 bool 101 IsFPR(unsigned reg) const; 102 }; 103 104 } // namespace process_linux 105 } // namespace lldb_private 106 107 #endif // #ifndef lldb_NativeRegisterContextLinux_arm_h 108 109 #endif // defined(__arm__) 110