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