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_
13 #include "lldb/Core/Log.h"
14 #include "lldb-x86-register-enums.h"
15 #include "RegisterContextPOSIX.h"
16 #include "RegisterContext_x86.h"
20 class RegisterContextPOSIX_x86
21 : public lldb_private::RegisterContext
24 RegisterContextPOSIX_x86 (lldb_private::Thread &thread,
25 uint32_t concrete_frame_idx,
26 lldb_private::RegisterInfoInterface *register_info);
28 ~RegisterContextPOSIX_x86();
34 InvalidateAllRegisters();
43 GetRegisterSize(unsigned reg);
46 GetRegisterOffset(unsigned reg);
48 const lldb_private::RegisterInfo *
49 GetRegisterInfoAtIndex(size_t reg);
52 GetRegisterSetCount();
54 const lldb_private::RegisterSet *
55 GetRegisterSet(size_t set);
58 GetRegisterName(unsigned reg);
61 ConvertRegisterKindToRegisterNumber(lldb::RegisterKind kind, uint32_t num);
63 //---------------------------------------------------------------------------
64 // Note: prefer kernel definitions over user-land
65 //---------------------------------------------------------------------------
75 static uint32_t g_contained_eax[];
76 static uint32_t g_contained_ebx[];
77 static uint32_t g_contained_ecx[];
78 static uint32_t g_contained_edx[];
79 static uint32_t g_contained_edi[];
80 static uint32_t g_contained_esi[];
81 static uint32_t g_contained_ebp[];
82 static uint32_t g_contained_esp[];
84 static uint32_t g_invalidate_eax[];
85 static uint32_t g_invalidate_ebx[];
86 static uint32_t g_invalidate_ecx[];
87 static uint32_t g_invalidate_edx[];
88 static uint32_t g_invalidate_edi[];
89 static uint32_t g_invalidate_esi[];
90 static uint32_t g_invalidate_ebp[];
91 static uint32_t g_invalidate_esp[];
93 static uint32_t g_contained_rax[];
94 static uint32_t g_contained_rbx[];
95 static uint32_t g_contained_rcx[];
96 static uint32_t g_contained_rdx[];
97 static uint32_t g_contained_rdi[];
98 static uint32_t g_contained_rsi[];
99 static uint32_t g_contained_rbp[];
100 static uint32_t g_contained_rsp[];
101 static uint32_t g_contained_r8[];
102 static uint32_t g_contained_r9[];
103 static uint32_t g_contained_r10[];
104 static uint32_t g_contained_r11[];
105 static uint32_t g_contained_r12[];
106 static uint32_t g_contained_r13[];
107 static uint32_t g_contained_r14[];
108 static uint32_t g_contained_r15[];
110 static uint32_t g_invalidate_rax[];
111 static uint32_t g_invalidate_rbx[];
112 static uint32_t g_invalidate_rcx[];
113 static uint32_t g_invalidate_rdx[];
114 static uint32_t g_invalidate_rdi[];
115 static uint32_t g_invalidate_rsi[];
116 static uint32_t g_invalidate_rbp[];
117 static uint32_t g_invalidate_rsp[];
118 static uint32_t g_invalidate_r8[];
119 static uint32_t g_invalidate_r9[];
120 static uint32_t g_invalidate_r10[];
121 static uint32_t g_invalidate_r11[];
122 static uint32_t g_invalidate_r12[];
123 static uint32_t g_invalidate_r13[];
124 static uint32_t g_invalidate_r14[];
125 static uint32_t g_invalidate_r15[];
130 uint32_t num_registers;
131 uint32_t num_gpr_registers;
132 uint32_t num_fpr_registers;
133 uint32_t num_avx_registers;
152 uint64_t m_gpr_x86_64[lldb_private::k_num_gpr_registers_x86_64]; // 64-bit general purpose registers.
154 FPRType m_fpr_type; // determines the type of data stored by union FPR, if any.
155 FPR m_fpr; // floating-point registers including extended register sets.
156 IOVEC m_iovec; // wrapper for xsave.
157 YMM m_ymm_set; // copy of ymmh and xmm register halves.
158 std::unique_ptr<lldb_private::RegisterInfoInterface> m_register_info_ap; // Register Info Interface (FreeBSD or Linux)
160 // Determines if an extended register set is supported on the processor running the inferior process.
162 IsRegisterSetAvailable(size_t set_index);
164 virtual const lldb_private::RegisterInfo *
176 lldb::ByteOrder GetByteOrder();
178 bool CopyXSTATEtoYMM(uint32_t reg, lldb::ByteOrder byte_order);
179 bool CopyYMMtoXSTATE(uint32_t reg, lldb::ByteOrder byte_order);
180 bool IsFPR(unsigned reg, FPRType fpr_type);
181 FPRType GetFPRType();
183 virtual bool ReadGPR() = 0;
184 virtual bool ReadFPR() = 0;
185 virtual bool WriteGPR() = 0;
186 virtual bool WriteFPR() = 0;
189 #endif // #ifndef liblldb_RegisterContextPOSIX_x86_H_