1 //===-- NativeRegisterContextLinux_arm64.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 
11 #ifndef lldb_NativeRegisterContextLinux_arm64_h
12 #define lldb_NativeRegisterContextLinux_arm64_h
13 
14 #include "lldb/Host/common/NativeRegisterContextRegisterInfo.h"
15 #include "Plugins/Process/Utility/lldb-arm64-register-enums.h"
16 
17 namespace lldb_private {
18 namespace process_linux {
19 
20     class NativeProcessLinux;
21 
22     class NativeRegisterContextLinux_arm64 : public NativeRegisterContextRegisterInfo
23     {
24     public:
25         NativeRegisterContextLinux_arm64 (NativeThreadProtocol &native_thread,
26                                           uint32_t concrete_frame_idx,
27                                           RegisterInfoInterface *reg_info_interface_p);
28 
29         uint32_t
30         GetRegisterSetCount () const override;
31 
32         const RegisterSet *
33         GetRegisterSet (uint32_t set_index) const override;
34 
35         Error
36         ReadRegister (const RegisterInfo *reg_info, RegisterValue &reg_value) override;
37 
38         Error
39         WriteRegister (const RegisterInfo *reg_info, const RegisterValue &reg_value) override;
40 
41         Error
42         ReadAllRegisterValues (lldb::DataBufferSP &data_sp) override;
43 
44         Error
45         WriteAllRegisterValues (const lldb::DataBufferSP &data_sp) override;
46 
47     private:
48         struct RegInfo
49         {
50             uint32_t num_registers;
51             uint32_t num_gpr_registers;
52             uint32_t num_fpr_registers;
53 
54             uint32_t last_gpr;
55             uint32_t first_fpr;
56             uint32_t last_fpr;
57 
58             uint32_t first_fpr_v;
59             uint32_t last_fpr_v;
60 
61             uint32_t gpr_flags;
62         };
63 
64         // based on RegisterContextDarwin_arm64.h
65         struct VReg
66         {
67             uint8_t bytes[16];
68         };
69 
70         // based on RegisterContextDarwin_arm64.h
71         struct FPU
72         {
73             VReg        v[32];
74             uint32_t    fpsr;
75             uint32_t    fpcr;
76         };
77 
78         uint64_t m_gpr_arm64[k_num_gpr_registers_arm64]; // 64-bit general purpose registers.
79         RegInfo  m_reg_info;
80         FPU m_fpr; // floating-point registers including extended register sets.
81 
82         bool
83         IsGPR(unsigned reg) const;
84 
85         bool
86         ReadGPR ();
87 
88         bool
89         WriteGPR ();
90 
91         bool
92         IsFPR(unsigned reg) const;
93 
94         bool
95         ReadFPR ();
96 
97         bool
98         WriteFPR ();
99 
100         Error
101         ReadRegisterRaw (uint32_t reg_index, RegisterValue &reg_value);
102 
103         Error
104         WriteRegisterRaw (uint32_t reg_index, const RegisterValue &reg_value);
105 
106         lldb::ByteOrder
107         GetByteOrder() const;
108 
109         size_t
110         GetGPRSize() const;
111     };
112 
113 } // namespace process_linux
114 } // namespace lldb_private
115 
116 #endif // #ifndef lldb_NativeRegisterContextLinux_arm64_h
117 
118