1 //===-- RegisterContextFreeBSD_powerpc.cpp --------------------------------===//
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 #include "RegisterContextFreeBSD_powerpc.h"
10 #include "RegisterContextPOSIX_powerpc.h"
13 using namespace lldb_private
;
16 // http://svnweb.freebsd.org/base/head/sys/powerpc/include/reg.h
17 typedef struct _GPR64
{
57 typedef struct _GPR32
{
133 typedef struct _VMX
{
171 // Include RegisterInfos_powerpc to declare our g_register_infos_powerpc
173 #define DECLARE_REGISTER_INFOS_POWERPC_STRUCT
174 #include "RegisterInfos_powerpc.h"
175 #undef DECLARE_REGISTER_INFOS_POWERPC_STRUCT
177 RegisterContextFreeBSD_powerpc::RegisterContextFreeBSD_powerpc(
178 const ArchSpec
&target_arch
)
179 : RegisterInfoInterface(target_arch
) {}
181 RegisterContextFreeBSD_powerpc::~RegisterContextFreeBSD_powerpc() = default;
183 size_t RegisterContextFreeBSD_powerpc::GetGPRSize() const {
184 // This is an 'abstract' base, so no GPR struct.
188 const RegisterInfo
*RegisterContextFreeBSD_powerpc::GetRegisterInfo() const {
189 llvm_unreachable("Abstract class!");
193 uint32_t RegisterContextFreeBSD_powerpc::GetRegisterCount() const { return 0; }
195 RegisterContextFreeBSD_powerpc32::RegisterContextFreeBSD_powerpc32(
196 const ArchSpec
&target_arch
)
197 : RegisterContextFreeBSD_powerpc(target_arch
) {}
199 RegisterContextFreeBSD_powerpc32::~RegisterContextFreeBSD_powerpc32() = default;
201 size_t RegisterContextFreeBSD_powerpc32::GetGPRSize() const {
202 return sizeof(GPR32
);
205 const RegisterInfo
*RegisterContextFreeBSD_powerpc32::GetRegisterInfo() const {
206 return g_register_infos_powerpc32
;
209 uint32_t RegisterContextFreeBSD_powerpc32::GetRegisterCount() const {
210 return static_cast<uint32_t>(sizeof(g_register_infos_powerpc32
) /
211 sizeof(g_register_infos_powerpc32
[0]));
214 RegisterContextFreeBSD_powerpc64::RegisterContextFreeBSD_powerpc64(
215 const ArchSpec
&target_arch
)
216 : RegisterContextFreeBSD_powerpc(target_arch
) {}
218 RegisterContextFreeBSD_powerpc64::~RegisterContextFreeBSD_powerpc64() = default;
220 size_t RegisterContextFreeBSD_powerpc64::GetGPRSize() const {
221 return sizeof(GPR64
);
224 const RegisterInfo
*RegisterContextFreeBSD_powerpc64::GetRegisterInfo() const {
225 if (GetTargetArchitecture().GetMachine() == llvm::Triple::ppc
)
226 return g_register_infos_powerpc64_32
;
227 return g_register_infos_powerpc64
;
230 uint32_t RegisterContextFreeBSD_powerpc64::GetRegisterCount() const {
231 return static_cast<uint32_t>(sizeof(g_register_infos_powerpc64
) /
232 sizeof(g_register_infos_powerpc64
[0]));