1 //===-- NativeRegisterContextLinux_ppc64le.h ---------------------*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
10 // This implementation is related to the OpenPOWER ABI for Power Architecture
11 // 64-bit ELF V2 ABI
12 
13 #if defined(__powerpc64__)
14 
15 #ifndef lldb_NativeRegisterContextLinux_ppc64le_h
16 #define lldb_NativeRegisterContextLinux_ppc64le_h
17 
18 #include "Plugins/Process/Linux/NativeRegisterContextLinux.h"
19 #include "Plugins/Process/Utility/lldb-ppc64le-register-enums.h"
20 
21 #define DECLARE_REGISTER_INFOS_PPC64LE_STRUCT
22 #include "RegisterInfos_ppc64le.h"
23 #undef DECLARE_REGISTER_INFOS_PPC64LE_STRUCT
24 
25 namespace lldb_private {
26 namespace process_linux {
27 
28 class NativeProcessLinux;
29 
30 class NativeRegisterContextLinux_ppc64le : public NativeRegisterContextLinux {
31 public:
32   NativeRegisterContextLinux_ppc64le(const ArchSpec &target_arch,
33                                    NativeThreadProtocol &native_thread,
34                                    uint32_t concrete_frame_idx);
35 
36   uint32_t GetRegisterSetCount() const override;
37 
38   uint32_t GetUserRegisterCount() const override;
39 
40   const RegisterSet *GetRegisterSet(uint32_t set_index) const override;
41 
42   Status ReadRegister(const RegisterInfo *reg_info,
43                       RegisterValue &reg_value) override;
44 
45   Status WriteRegister(const RegisterInfo *reg_info,
46                        const RegisterValue &reg_value) override;
47 
48   Status ReadAllRegisterValues(lldb::DataBufferSP &data_sp) override;
49 
50   Status WriteAllRegisterValues(const lldb::DataBufferSP &data_sp) override;
51 
52 protected:
53   Status DoReadGPR(void *buf, size_t buf_size) override;
54 
55   Status DoWriteGPR(void *buf, size_t buf_size) override;
56 
57   void *GetGPRBuffer() override { return &m_gpr_ppc64le; }
58 
59 private:
60   GPR m_gpr_ppc64le; // 64-bit general purpose registers.
61 
62   bool IsGPR(unsigned reg) const;
63 };
64 
65 } // namespace process_linux
66 } // namespace lldb_private
67 
68 #endif // #ifndef lldb_NativeRegisterContextLinux_ppc64le_h
69 
70 #endif // defined(__powerpc64__)
71