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 "RegisterContext_x86.h"
18 #include "RegisterInfoInterface.h"
19 #include "lldb-x86-register-enums.h"
20 #include "lldb/Target/RegisterContext.h"
21 #include "lldb/Utility/Log.h"
25 class RegisterContextPOSIX_x86 : public lldb_private::RegisterContext {
27 RegisterContextPOSIX_x86(lldb_private::Thread &thread,
28 uint32_t concrete_frame_idx,
29 lldb_private::RegisterInfoInterface *register_info);
31 ~RegisterContextPOSIX_x86() override;
35 void InvalidateAllRegisters() override;
37 size_t GetRegisterCount() override;
39 virtual size_t GetGPRSize();
41 virtual size_t GetFXSAVEOffset();
43 virtual unsigned GetRegisterSize(unsigned reg);
45 virtual unsigned GetRegisterOffset(unsigned reg);
47 const lldb_private::RegisterInfo *GetRegisterInfoAtIndex(size_t reg) override;
49 size_t GetRegisterSetCount() override;
51 const lldb_private::RegisterSet *GetRegisterSet(size_t set) override;
53 const char *GetRegisterName(unsigned reg);
55 uint32_t ConvertRegisterKindToRegisterNumber(lldb::RegisterKind kind,
56 uint32_t num) override;
58 //---------------------------------------------------------------------------
59 // Note: prefer kernel definitions over user-land
60 //---------------------------------------------------------------------------
69 static uint32_t g_contained_eax[];
70 static uint32_t g_contained_ebx[];
71 static uint32_t g_contained_ecx[];
72 static uint32_t g_contained_edx[];
73 static uint32_t g_contained_edi[];
74 static uint32_t g_contained_esi[];
75 static uint32_t g_contained_ebp[];
76 static uint32_t g_contained_esp[];
78 static uint32_t g_invalidate_eax[];
79 static uint32_t g_invalidate_ebx[];
80 static uint32_t g_invalidate_ecx[];
81 static uint32_t g_invalidate_edx[];
82 static uint32_t g_invalidate_edi[];
83 static uint32_t g_invalidate_esi[];
84 static uint32_t g_invalidate_ebp[];
85 static uint32_t g_invalidate_esp[];
87 static uint32_t g_contained_rax[];
88 static uint32_t g_contained_rbx[];
89 static uint32_t g_contained_rcx[];
90 static uint32_t g_contained_rdx[];
91 static uint32_t g_contained_rdi[];
92 static uint32_t g_contained_rsi[];
93 static uint32_t g_contained_rbp[];
94 static uint32_t g_contained_rsp[];
95 static uint32_t g_contained_r8[];
96 static uint32_t g_contained_r9[];
97 static uint32_t g_contained_r10[];
98 static uint32_t g_contained_r11[];
99 static uint32_t g_contained_r12[];
100 static uint32_t g_contained_r13[];
101 static uint32_t g_contained_r14[];
102 static uint32_t g_contained_r15[];
104 static uint32_t g_invalidate_rax[];
105 static uint32_t g_invalidate_rbx[];
106 static uint32_t g_invalidate_rcx[];
107 static uint32_t g_invalidate_rdx[];
108 static uint32_t g_invalidate_rdi[];
109 static uint32_t g_invalidate_rsi[];
110 static uint32_t g_invalidate_rbp[];
111 static uint32_t g_invalidate_rsp[];
112 static uint32_t g_invalidate_r8[];
113 static uint32_t g_invalidate_r9[];
114 static uint32_t g_invalidate_r10[];
115 static uint32_t g_invalidate_r11[];
116 static uint32_t g_invalidate_r12[];
117 static uint32_t g_invalidate_r13[];
118 static uint32_t g_invalidate_r14[];
119 static uint32_t g_invalidate_r15[];
123 uint32_t num_registers;
124 uint32_t num_gpr_registers;
125 uint32_t num_fpr_registers;
126 uint32_t num_avx_registers;
145 uint64_t m_gpr_x86_64[lldb_private::k_num_gpr_registers_x86_64]; // 64-bit
151 m_fpr_type; // determines the type of data stored by union FPR, if any.
152 lldb_private::FPR m_fpr; // floating-point registers including extended
154 lldb_private::YMM m_ymm_set; // copy of ymmh and xmm register halves.
155 std::unique_ptr<lldb_private::RegisterInfoInterface>
156 m_register_info_ap; // Register Info Interface (FreeBSD or Linux)
158 // Determines if an extended register set is supported on the processor
159 // running the inferior process.
160 virtual bool IsRegisterSetAvailable(size_t set_index);
162 virtual const lldb_private::RegisterInfo *GetRegisterInfo();
164 bool IsGPR(unsigned reg);
166 bool IsFPR(unsigned reg);
168 bool IsAVX(unsigned reg);
170 lldb::ByteOrder GetByteOrder();
172 bool CopyXSTATEtoYMM(uint32_t reg, lldb::ByteOrder byte_order);
173 bool CopyYMMtoXSTATE(uint32_t reg, lldb::ByteOrder byte_order);
174 bool IsFPR(unsigned reg, FPRType fpr_type);
175 FPRType GetFPRType();
177 virtual bool ReadGPR() = 0;
178 virtual bool ReadFPR() = 0;
179 virtual bool WriteGPR() = 0;
180 virtual bool WriteFPR() = 0;
183 #endif // liblldb_RegisterContextPOSIX_x86_h_