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