1 //===-- RegisterContextPOSIX_x86.h ------------------------------*- 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 //===----------------------------------------------------------------------===//
10 #ifndef liblldb_RegisterContextPOSIX_x86_h_
11 #define liblldb_RegisterContextPOSIX_x86_h_
15 // Other libraries and framework includes
17 #include "lldb/Core/Log.h"
18 #include "lldb/Target/RegisterContext.h"
19 #include "RegisterInfoInterface.h"
20 #include "RegisterContext_x86.h"
21 #include "lldb-x86-register-enums.h"
25 class RegisterContextPOSIX_x86
26 : public lldb_private::RegisterContext
29 RegisterContextPOSIX_x86 (lldb_private::Thread &thread,
30 uint32_t concrete_frame_idx,
31 lldb_private::RegisterInfoInterface *register_info);
33 ~RegisterContextPOSIX_x86() override;
39 InvalidateAllRegisters() override;
42 GetRegisterCount() override;
48 GetRegisterSize(unsigned reg);
51 GetRegisterOffset(unsigned reg);
53 const lldb_private::RegisterInfo *
54 GetRegisterInfoAtIndex(size_t reg) override;
57 GetRegisterSetCount() override;
59 const lldb_private::RegisterSet *
60 GetRegisterSet(size_t set) override;
63 GetRegisterName(unsigned reg);
66 ConvertRegisterKindToRegisterNumber(lldb::RegisterKind kind, uint32_t num) override;
68 //---------------------------------------------------------------------------
69 // Note: prefer kernel definitions over user-land
70 //---------------------------------------------------------------------------
80 static uint32_t g_contained_eax[];
81 static uint32_t g_contained_ebx[];
82 static uint32_t g_contained_ecx[];
83 static uint32_t g_contained_edx[];
84 static uint32_t g_contained_edi[];
85 static uint32_t g_contained_esi[];
86 static uint32_t g_contained_ebp[];
87 static uint32_t g_contained_esp[];
89 static uint32_t g_invalidate_eax[];
90 static uint32_t g_invalidate_ebx[];
91 static uint32_t g_invalidate_ecx[];
92 static uint32_t g_invalidate_edx[];
93 static uint32_t g_invalidate_edi[];
94 static uint32_t g_invalidate_esi[];
95 static uint32_t g_invalidate_ebp[];
96 static uint32_t g_invalidate_esp[];
98 static uint32_t g_contained_rax[];
99 static uint32_t g_contained_rbx[];
100 static uint32_t g_contained_rcx[];
101 static uint32_t g_contained_rdx[];
102 static uint32_t g_contained_rdi[];
103 static uint32_t g_contained_rsi[];
104 static uint32_t g_contained_rbp[];
105 static uint32_t g_contained_rsp[];
106 static uint32_t g_contained_r8[];
107 static uint32_t g_contained_r9[];
108 static uint32_t g_contained_r10[];
109 static uint32_t g_contained_r11[];
110 static uint32_t g_contained_r12[];
111 static uint32_t g_contained_r13[];
112 static uint32_t g_contained_r14[];
113 static uint32_t g_contained_r15[];
115 static uint32_t g_invalidate_rax[];
116 static uint32_t g_invalidate_rbx[];
117 static uint32_t g_invalidate_rcx[];
118 static uint32_t g_invalidate_rdx[];
119 static uint32_t g_invalidate_rdi[];
120 static uint32_t g_invalidate_rsi[];
121 static uint32_t g_invalidate_rbp[];
122 static uint32_t g_invalidate_rsp[];
123 static uint32_t g_invalidate_r8[];
124 static uint32_t g_invalidate_r9[];
125 static uint32_t g_invalidate_r10[];
126 static uint32_t g_invalidate_r11[];
127 static uint32_t g_invalidate_r12[];
128 static uint32_t g_invalidate_r13[];
129 static uint32_t g_invalidate_r14[];
130 static uint32_t g_invalidate_r15[];
135 uint32_t num_registers;
136 uint32_t num_gpr_registers;
137 uint32_t num_fpr_registers;
138 uint32_t num_avx_registers;
157 uint64_t m_gpr_x86_64[lldb_private::k_num_gpr_registers_x86_64]; // 64-bit general purpose registers.
159 FPRType m_fpr_type; // determines the type of data stored by union FPR, if any.
160 FPR m_fpr; // floating-point registers including extended register sets.
161 IOVEC m_iovec; // wrapper for xsave.
162 YMM m_ymm_set; // copy of ymmh and xmm register halves.
163 std::unique_ptr<lldb_private::RegisterInfoInterface> m_register_info_ap; // Register Info Interface (FreeBSD or Linux)
165 // Determines if an extended register set is supported on the processor running the inferior process.
167 IsRegisterSetAvailable(size_t set_index);
169 virtual const lldb_private::RegisterInfo *
181 lldb::ByteOrder GetByteOrder();
183 bool CopyXSTATEtoYMM(uint32_t reg, lldb::ByteOrder byte_order);
184 bool CopyYMMtoXSTATE(uint32_t reg, lldb::ByteOrder byte_order);
185 bool IsFPR(unsigned reg, FPRType fpr_type);
186 FPRType GetFPRType();
188 virtual bool ReadGPR() = 0;
189 virtual bool ReadFPR() = 0;
190 virtual bool WriteGPR() = 0;
191 virtual bool WriteFPR() = 0;
194 #endif // liblldb_RegisterContextPOSIX_x86_h_