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         Error
34         ReadRegister (const RegisterInfo *reg_info, RegisterValue &reg_value) override;
35 
36         Error
37         WriteRegister (const RegisterInfo *reg_info, const RegisterValue &reg_value) override;
38 
39         Error
40         ReadAllRegisterValues (lldb::DataBufferSP &data_sp) override;
41 
42         Error
43         WriteAllRegisterValues (const lldb::DataBufferSP &data_sp) override;
44 
45     private:
46         struct RegInfo
47         {
48             uint32_t num_registers;
49             uint32_t num_gpr_registers;
50             uint32_t num_fpr_registers;
51 
52             uint32_t last_gpr;
53             uint32_t first_fpr;
54             uint32_t last_fpr;
55 
56             uint32_t first_fpr_v;
57             uint32_t last_fpr_v;
58 
59             uint32_t gpr_flags;
60         };
61 
62         struct QReg
63         {
64             uint8_t bytes[16];
65         };
66 
67         struct FPU
68         {
69             union {
70                 uint32_t s[32];
71                 uint64_t d[32];
72                 QReg     q[16];  // the 128-bit NEON registers
73                 } floats;
74             uint32_t fpscr;
75         };
76 
77         uint32_t m_gpr_arm[k_num_gpr_registers_arm];
78         RegInfo  m_reg_info;
79         FPU m_fpr;
80 
81         bool
82         IsGPR(unsigned reg) const;
83 
84         bool
85         ReadGPR ();
86 
87         bool
88         WriteGPR ();
89 
90         bool
91         IsFPR(unsigned reg) const;
92 
93         bool
94         ReadFPR ();
95 
96         bool
97         WriteFPR ();
98 
99         Error
100         ReadRegisterRaw (uint32_t reg_index, RegisterValue &reg_value);
101 
102         Error
103         WriteRegisterRaw (uint32_t reg_index, const RegisterValue &reg_value);
104 
105         lldb::ByteOrder
106         GetByteOrder() const;
107 
108         size_t
109         GetGPRSize() const;
110     };
111 
112 } // namespace process_linux
113 } // namespace lldb_private
114 
115 #endif // #ifndef lldb_NativeRegisterContextLinux_arm_h
116 
117