1 //===-- RegisterContextPOSIX_x86.h ------------------------------*- C++ -*-===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 #ifndef LLDB_SOURCE_PLUGINS_PROCESS_UTILITY_REGISTERCONTEXTPOSIX_X86_H
10 #define LLDB_SOURCE_PLUGINS_PROCESS_UTILITY_REGISTERCONTEXTPOSIX_X86_H
12 #include "RegisterContext_x86.h"
13 #include "RegisterInfoInterface.h"
14 #include "RegisterInfos_x86_64_with_base_shared.h"
15 #include "lldb-x86-register-enums.h"
16 #include "lldb/Target/RegisterContext.h"
17 #include "lldb/Utility/Log.h"
19 class RegisterContextPOSIX_x86
: public lldb_private::RegisterContext
{
21 RegisterContextPOSIX_x86(lldb_private::Thread
&thread
,
22 uint32_t concrete_frame_idx
,
23 lldb_private::RegisterInfoInterface
*register_info
);
25 ~RegisterContextPOSIX_x86() override
;
29 void InvalidateAllRegisters() override
;
31 size_t GetRegisterCount() override
;
33 virtual size_t GetGPRSize();
35 virtual size_t GetFXSAVEOffset();
37 virtual unsigned GetRegisterSize(unsigned reg
);
39 virtual unsigned GetRegisterOffset(unsigned reg
);
41 const lldb_private::RegisterInfo
*GetRegisterInfoAtIndex(size_t reg
) override
;
43 size_t GetRegisterSetCount() override
;
45 const lldb_private::RegisterSet
*GetRegisterSet(size_t set
) override
;
47 const char *GetRegisterName(unsigned reg
);
49 // Note: prefer kernel definitions over user-land
58 static uint32_t g_contained_eax
[];
59 static uint32_t g_contained_ebx
[];
60 static uint32_t g_contained_ecx
[];
61 static uint32_t g_contained_edx
[];
62 static uint32_t g_contained_edi
[];
63 static uint32_t g_contained_esi
[];
64 static uint32_t g_contained_ebp
[];
65 static uint32_t g_contained_esp
[];
67 static uint32_t g_invalidate_eax
[];
68 static uint32_t g_invalidate_ebx
[];
69 static uint32_t g_invalidate_ecx
[];
70 static uint32_t g_invalidate_edx
[];
71 static uint32_t g_invalidate_edi
[];
72 static uint32_t g_invalidate_esi
[];
73 static uint32_t g_invalidate_ebp
[];
74 static uint32_t g_invalidate_esp
[];
76 static uint32_t g_contained_rax
[];
77 static uint32_t g_contained_rbx
[];
78 static uint32_t g_contained_rcx
[];
79 static uint32_t g_contained_rdx
[];
80 static uint32_t g_contained_rdi
[];
81 static uint32_t g_contained_rsi
[];
82 static uint32_t g_contained_rbp
[];
83 static uint32_t g_contained_rsp
[];
84 static uint32_t g_contained_r8
[];
85 static uint32_t g_contained_r9
[];
86 static uint32_t g_contained_r10
[];
87 static uint32_t g_contained_r11
[];
88 static uint32_t g_contained_r12
[];
89 static uint32_t g_contained_r13
[];
90 static uint32_t g_contained_r14
[];
91 static uint32_t g_contained_r15
[];
93 static uint32_t g_invalidate_rax
[];
94 static uint32_t g_invalidate_rbx
[];
95 static uint32_t g_invalidate_rcx
[];
96 static uint32_t g_invalidate_rdx
[];
97 static uint32_t g_invalidate_rdi
[];
98 static uint32_t g_invalidate_rsi
[];
99 static uint32_t g_invalidate_rbp
[];
100 static uint32_t g_invalidate_rsp
[];
101 static uint32_t g_invalidate_r8
[];
102 static uint32_t g_invalidate_r9
[];
103 static uint32_t g_invalidate_r10
[];
104 static uint32_t g_invalidate_r11
[];
105 static uint32_t g_invalidate_r12
[];
106 static uint32_t g_invalidate_r13
[];
107 static uint32_t g_invalidate_r14
[];
108 static uint32_t g_invalidate_r15
[];
110 static uint32_t g_contained_fip
[];
111 static uint32_t g_contained_fdp
[];
113 static uint32_t g_invalidate_fip
[];
114 static uint32_t g_invalidate_fdp
[];
116 static uint32_t g_contained_st0_32
[];
117 static uint32_t g_contained_st1_32
[];
118 static uint32_t g_contained_st2_32
[];
119 static uint32_t g_contained_st3_32
[];
120 static uint32_t g_contained_st4_32
[];
121 static uint32_t g_contained_st5_32
[];
122 static uint32_t g_contained_st6_32
[];
123 static uint32_t g_contained_st7_32
[];
125 static uint32_t g_invalidate_st0_32
[];
126 static uint32_t g_invalidate_st1_32
[];
127 static uint32_t g_invalidate_st2_32
[];
128 static uint32_t g_invalidate_st3_32
[];
129 static uint32_t g_invalidate_st4_32
[];
130 static uint32_t g_invalidate_st5_32
[];
131 static uint32_t g_invalidate_st6_32
[];
132 static uint32_t g_invalidate_st7_32
[];
134 static uint32_t g_contained_st0_64
[];
135 static uint32_t g_contained_st1_64
[];
136 static uint32_t g_contained_st2_64
[];
137 static uint32_t g_contained_st3_64
[];
138 static uint32_t g_contained_st4_64
[];
139 static uint32_t g_contained_st5_64
[];
140 static uint32_t g_contained_st6_64
[];
141 static uint32_t g_contained_st7_64
[];
143 static uint32_t g_invalidate_st0_64
[];
144 static uint32_t g_invalidate_st1_64
[];
145 static uint32_t g_invalidate_st2_64
[];
146 static uint32_t g_invalidate_st3_64
[];
147 static uint32_t g_invalidate_st4_64
[];
148 static uint32_t g_invalidate_st5_64
[];
149 static uint32_t g_invalidate_st6_64
[];
150 static uint32_t g_invalidate_st7_64
[];
154 m_fpr_type
; // determines the type of data stored by union FPR, if any.
155 lldb_private::FPR m_fpr
; // floating-point registers including extended
157 lldb_private::YMM m_ymm_set
; // copy of ymmh and xmm register halves.
158 std::unique_ptr
<lldb_private::RegisterInfoInterface
>
159 m_register_info_up
; // Register Info Interface (FreeBSD or Linux)
161 // Determines if an extended register set is supported on the processor
162 // running the inferior process.
163 virtual bool IsRegisterSetAvailable(size_t set_index
);
165 virtual const lldb_private::RegisterInfo
*GetRegisterInfo();
167 bool IsGPR(unsigned reg
);
169 bool IsFPR(unsigned reg
);
171 bool IsAVX(unsigned reg
);
173 bool CopyXSTATEtoYMM(uint32_t reg
, lldb::ByteOrder byte_order
);
174 bool CopyYMMtoXSTATE(uint32_t reg
, lldb::ByteOrder byte_order
);
175 bool IsFPR(unsigned reg
, FPRType fpr_type
);
176 FPRType
GetFPRType();
178 virtual bool ReadGPR() = 0;
179 virtual bool ReadFPR() = 0;
180 virtual bool WriteGPR() = 0;
181 virtual bool WriteFPR() = 0;
182 virtual lldb_private::RegInfo
&GetRegInfo();
185 #endif // LLDB_SOURCE_PLUGINS_PROCESS_UTILITY_REGISTERCONTEXTPOSIX_X86_H