1 //===-- NativeRegisterContextLinux_x86_64.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 11 #ifndef lldb_NativeRegisterContextLinux_x86_64_h 12 #define lldb_NativeRegisterContextLinux_x86_64_h 13 14 #include "lldb/Host/common/NativeRegisterContextRegisterInfo.h" 15 #include "Plugins/Process/Utility/RegisterContext_x86.h" 16 #include "Plugins/Process/Utility/lldb-x86-register-enums.h" 17 18 namespace lldb_private { 19 namespace process_linux { 20 21 class NativeProcessLinux; 22 23 class NativeRegisterContextLinux_x86_64 : public NativeRegisterContextRegisterInfo 24 { 25 public: 26 NativeRegisterContextLinux_x86_64 (NativeThreadProtocol &native_thread, uint32_t concrete_frame_idx, RegisterInfoInterface *reg_info_interface_p); 27 28 uint32_t 29 GetRegisterSetCount () const override; 30 31 const RegisterSet * 32 GetRegisterSet (uint32_t set_index) const override; 33 34 uint32_t 35 GetUserRegisterCount() const override; 36 37 Error 38 ReadRegister (const RegisterInfo *reg_info, RegisterValue ®_value) override; 39 40 Error 41 WriteRegister (const RegisterInfo *reg_info, const RegisterValue ®_value) override; 42 43 Error 44 ReadAllRegisterValues (lldb::DataBufferSP &data_sp) override; 45 46 Error 47 WriteAllRegisterValues (const lldb::DataBufferSP &data_sp) override; 48 49 Error 50 IsWatchpointHit(uint32_t wp_index, bool &is_hit) override; 51 52 Error 53 GetWatchpointHitIndex(uint32_t &wp_index) override; 54 55 Error 56 IsWatchpointVacant(uint32_t wp_index, bool &is_vacant) override; 57 58 bool 59 ClearHardwareWatchpoint(uint32_t wp_index) override; 60 61 Error 62 ClearAllHardwareWatchpoints () override; 63 64 Error 65 SetHardwareWatchpointWithIndex(lldb::addr_t addr, size_t size, 66 uint32_t watch_flags, uint32_t wp_index); 67 68 uint32_t 69 SetHardwareWatchpoint(lldb::addr_t addr, size_t size, 70 uint32_t watch_flags) override; 71 72 lldb::addr_t 73 GetWatchpointAddress(uint32_t wp_index) override; 74 75 uint32_t 76 NumSupportedHardwareWatchpoints() override; 77 78 private: 79 80 // Private member types. 81 enum FPRType 82 { 83 eFPRTypeNotValid = 0, 84 eFPRTypeFXSAVE, 85 eFPRTypeXSAVE 86 }; 87 88 // Info about register ranges. 89 struct RegInfo 90 { 91 uint32_t num_registers; 92 uint32_t num_gpr_registers; 93 uint32_t num_fpr_registers; 94 uint32_t num_avx_registers; 95 96 uint32_t last_gpr; 97 uint32_t first_fpr; 98 uint32_t last_fpr; 99 100 uint32_t first_st; 101 uint32_t last_st; 102 uint32_t first_mm; 103 uint32_t last_mm; 104 uint32_t first_xmm; 105 uint32_t last_xmm; 106 uint32_t first_ymm; 107 uint32_t last_ymm; 108 109 uint32_t first_dr; 110 uint32_t gpr_flags; 111 }; 112 113 // Private member variables. 114 mutable FPRType m_fpr_type; 115 FPR m_fpr; 116 IOVEC m_iovec; 117 YMM m_ymm_set; 118 RegInfo m_reg_info; 119 uint64_t m_gpr_x86_64[k_num_gpr_registers_x86_64]; 120 121 // Private member methods. 122 Error 123 WriteRegister(const uint32_t reg, const RegisterValue &value); 124 125 bool IsRegisterSetAvailable (uint32_t set_index) const; 126 127 lldb::ByteOrder 128 GetByteOrder() const; 129 130 bool 131 IsGPR(uint32_t reg_index) const; 132 133 FPRType 134 GetFPRType () const; 135 136 bool 137 IsFPR(uint32_t reg_index) const; 138 139 bool 140 WriteFPR(); 141 142 bool IsFPR(uint32_t reg_index, FPRType fpr_type) const; 143 144 bool 145 CopyXSTATEtoYMM (uint32_t reg_index, lldb::ByteOrder byte_order); 146 147 bool 148 CopyYMMtoXSTATE(uint32_t reg, lldb::ByteOrder byte_order); 149 150 bool 151 IsAVX (uint32_t reg_index) const; 152 153 bool 154 ReadFPR (); 155 156 Error 157 ReadRegisterRaw (uint32_t reg_index, RegisterValue ®_value); 158 159 bool 160 ReadGPR(); 161 162 bool 163 WriteGPR(); 164 }; 165 166 } // namespace process_linux 167 } // namespace lldb_private 168 169 #endif // #ifndef lldb_NativeRegisterContextLinux_x86_64_h 170 171