1 //===-- RegisterContextPOSIX_powerpc.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_POWERPC_H
10 #define LLDB_SOURCE_PLUGINS_PROCESS_UTILITY_REGISTERCONTEXTPOSIX_POWERPC_H
12 #include "RegisterContext_powerpc.h"
13 #include "RegisterInfoInterface.h"
14 #include "lldb/Target/RegisterContext.h"
15 #include "lldb/Utility/Log.h"
17 // Internal codes for all powerpc registers.
20 gpr_r0_powerpc
= k_first_gpr_powerpc
,
57 k_last_gpr_powerpc
= gpr_pc_powerpc
,
60 fpr_f0_powerpc
= k_first_fpr
,
93 k_last_fpr
= fpr_fpscr_powerpc
,
96 vmx_v0_powerpc
= k_first_vmx
,
130 k_last_vmx
= vmx_vscr_powerpc
,
132 k_num_registers_powerpc
,
133 k_num_gpr_registers_powerpc
= k_last_gpr_powerpc
- k_first_gpr_powerpc
+ 1,
134 k_num_fpr_registers_powerpc
= k_last_fpr
- k_first_fpr
+ 1,
135 k_num_vmx_registers_powerpc
= k_last_vmx
- k_first_vmx
+ 1,
138 class RegisterContextPOSIX_powerpc
: public lldb_private::RegisterContext
{
140 RegisterContextPOSIX_powerpc(
141 lldb_private::Thread
&thread
, uint32_t concrete_frame_idx
,
142 lldb_private::RegisterInfoInterface
*register_info
);
144 ~RegisterContextPOSIX_powerpc() override
;
148 void InvalidateAllRegisters() override
;
150 size_t GetRegisterCount() override
;
152 virtual size_t GetGPRSize();
154 virtual unsigned GetRegisterSize(unsigned reg
);
156 virtual unsigned GetRegisterOffset(unsigned reg
);
158 const lldb_private::RegisterInfo
*GetRegisterInfoAtIndex(size_t reg
) override
;
160 size_t GetRegisterSetCount() override
;
162 const lldb_private::RegisterSet
*GetRegisterSet(size_t set
) override
;
164 const char *GetRegisterName(unsigned reg
);
168 m_gpr_powerpc
[k_num_gpr_registers_powerpc
]; // general purpose registers.
170 m_fpr_powerpc
[k_num_fpr_registers_powerpc
]; // floating point registers.
171 uint32_t m_vmx_powerpc
[k_num_vmx_registers_powerpc
][4];
172 std::unique_ptr
<lldb_private::RegisterInfoInterface
>
173 m_register_info_up
; // Register Info Interface (FreeBSD or Linux)
175 // Determines if an extended register set is supported on the processor
176 // running the inferior process.
177 virtual bool IsRegisterSetAvailable(size_t set_index
);
179 virtual const lldb_private::RegisterInfo
*GetRegisterInfo();
181 bool IsGPR(unsigned reg
);
183 bool IsFPR(unsigned reg
);
185 bool IsVMX(unsigned reg
);
187 virtual bool ReadGPR() = 0;
188 virtual bool ReadFPR() = 0;
189 virtual bool ReadVMX() = 0;
190 virtual bool WriteGPR() = 0;
191 virtual bool WriteFPR() = 0;
192 virtual bool WriteVMX() = 0;
195 #endif // LLDB_SOURCE_PLUGINS_PROCESS_UTILITY_REGISTERCONTEXTPOSIX_POWERPC_H