]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - source/Plugins/Process/Linux/NativeRegisterContextLinux_mips64.h
Vendor import of lldb release_39 branch r287912:
[FreeBSD/FreeBSD.git] / source / Plugins / Process / Linux / NativeRegisterContextLinux_mips64.h
1 //===-- NativeRegisterContextLinux_mips64.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 #if defined (__mips__)
11
12 #ifndef lldb_NativeRegisterContextLinux_mips64_h
13 #define lldb_NativeRegisterContextLinux_mips64_h
14
15 #include "Plugins/Process/Linux/NativeRegisterContextLinux.h"
16 #include "Plugins/Process/Utility/RegisterContext_mips.h"
17 #include "Plugins/Process/Utility/lldb-mips-linux-register-enums.h"
18
19 #define MAX_NUM_WP 8
20
21 namespace lldb_private {
22 namespace process_linux {
23
24     class NativeProcessLinux;
25
26     class NativeRegisterContextLinux_mips64 : public NativeRegisterContextLinux
27     {
28     public:
29         NativeRegisterContextLinux_mips64 (const ArchSpec& target_arch,
30                                            NativeThreadProtocol &native_thread, 
31                                            uint32_t concrete_frame_idx);
32
33         uint32_t
34         GetRegisterSetCount () const override;
35
36         lldb::addr_t
37         GetPCfromBreakpointLocation (lldb::addr_t fail_value = LLDB_INVALID_ADDRESS) override;
38
39         lldb::addr_t
40         GetWatchpointHitAddress (uint32_t wp_index) override;
41
42         const RegisterSet *
43         GetRegisterSet (uint32_t set_index) const override;
44
45         Error
46         ReadRegister (const RegisterInfo *reg_info, RegisterValue &reg_value) override;
47
48         Error
49         WriteRegister (const RegisterInfo *reg_info, const RegisterValue &reg_value) override;
50
51         Error
52         ReadAllRegisterValues (lldb::DataBufferSP &data_sp) override;
53
54         Error
55         WriteAllRegisterValues (const lldb::DataBufferSP &data_sp) override;
56
57         Error
58         ReadCP1();
59
60         Error
61         WriteCP1();
62
63         Error
64         IsWatchpointHit (uint32_t wp_index, bool &is_hit) override;
65
66         uint8_t *ReturnFPOffset(uint8_t reg_index, uint32_t byte_offset);
67
68
69         Error
70         GetWatchpointHitIndex(uint32_t &wp_index, lldb::addr_t trap_addr) override;
71
72         Error
73         IsWatchpointVacant (uint32_t wp_index, bool &is_vacant) override;
74
75         bool
76         ClearHardwareWatchpoint (uint32_t wp_index) override;
77
78         Error
79         ClearAllHardwareWatchpoints () override;
80
81         Error
82         SetHardwareWatchpointWithIndex (lldb::addr_t addr, size_t size,
83                 uint32_t watch_flags, uint32_t wp_index);
84
85         uint32_t
86         SetHardwareWatchpoint (lldb::addr_t addr, size_t size,
87                 uint32_t watch_flags) override;
88
89         lldb::addr_t
90         GetWatchpointAddress (uint32_t wp_index) override;
91
92         uint32_t
93         NumSupportedHardwareWatchpoints () override;
94
95         static bool
96         IsMSAAvailable();
97
98     protected:
99
100         Error
101         Read_SR_Config(uint32_t offset, const char *reg_name, uint32_t size,
102                        RegisterValue &value);
103
104         Error
105         ReadRegisterRaw(uint32_t reg_index, RegisterValue &value) override;
106
107         Error
108         DoReadWatchPointRegisterValue(lldb::tid_t tid, void* watch_readback);
109
110         Error
111         WriteRegisterRaw(uint32_t reg_index,
112                          const RegisterValue &value) override;
113
114         Error
115         DoWriteWatchPointRegisterValue(lldb::tid_t tid, void* watch_readback);
116
117         bool
118         IsFR0();
119
120         bool
121         IsFRE();
122
123         bool
124         IsFPR(uint32_t reg_index) const;
125
126         bool
127         IsMSA(uint32_t reg_index) const;
128
129         void*
130         GetGPRBuffer() override { return &m_gpr; }
131
132         void*
133         GetFPRBuffer() override { return &m_fpr; }
134
135         size_t
136         GetFPRSize() override { return sizeof(FPR_linux_mips); }
137
138     private:
139         // Info about register ranges.
140         struct RegInfo
141         {
142             uint32_t num_registers;
143             uint32_t num_gpr_registers;
144             uint32_t num_fpr_registers;
145
146             uint32_t last_gpr;
147             uint32_t first_fpr;
148             uint32_t last_fpr;
149             uint32_t first_msa;
150             uint32_t last_msa;
151         };
152
153         RegInfo m_reg_info;
154
155         GPR_linux_mips m_gpr;
156
157         FPR_linux_mips m_fpr;
158
159         MSA_linux_mips m_msa;
160
161         lldb::addr_t hw_addr_map[MAX_NUM_WP];
162
163         IOVEC_mips m_iovec;
164     };
165
166 } // namespace process_linux
167 } // namespace lldb_private
168
169 #endif // #ifndef lldb_NativeRegisterContextLinux_mips64_h
170
171 #endif // defined (__mips__)