1 //===-- NativeRegisterContextWindows_arm64.h --------------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #if defined(__aarch64__) || defined(_M_ARM64)
10 #ifndef liblldb_NativeRegisterContextWindows_arm64_h_
11 #define liblldb_NativeRegisterContextWindows_arm64_h_
12 
13 #include "Plugins/Process/Utility/lldb-arm64-register-enums.h"
14 
15 #include "NativeRegisterContextWindows.h"
16 
17 namespace lldb_private {
18 
19 class NativeThreadWindows;
20 
21 class NativeRegisterContextWindows_arm64 : public NativeRegisterContextWindows {
22 public:
23   NativeRegisterContextWindows_arm64(const ArchSpec &target_arch,
24                                      NativeThreadProtocol &native_thread);
25 
26   uint32_t GetRegisterSetCount() const override;
27 
28   const RegisterSet *GetRegisterSet(uint32_t set_index) const override;
29 
30   Status ReadRegister(const RegisterInfo *reg_info,
31                       RegisterValue &reg_value) override;
32 
33   Status WriteRegister(const RegisterInfo *reg_info,
34                        const RegisterValue &reg_value) override;
35 
36   Status ReadAllRegisterValues(lldb::DataBufferSP &data_sp) override;
37 
38   Status WriteAllRegisterValues(const lldb::DataBufferSP &data_sp) override;
39 
40   Status IsWatchpointHit(uint32_t wp_index, bool &is_hit) override;
41 
42   Status GetWatchpointHitIndex(uint32_t &wp_index,
43                                lldb::addr_t trap_addr) override;
44 
45   Status IsWatchpointVacant(uint32_t wp_index, bool &is_vacant) override;
46 
47   bool ClearHardwareWatchpoint(uint32_t wp_index) override;
48 
49   Status ClearAllHardwareWatchpoints() override;
50 
51   Status SetHardwareWatchpointWithIndex(lldb::addr_t addr, size_t size,
52                                         uint32_t watch_flags,
53                                         uint32_t wp_index);
54 
55   uint32_t SetHardwareWatchpoint(lldb::addr_t addr, size_t size,
56                                  uint32_t watch_flags) override;
57 
58   lldb::addr_t GetWatchpointAddress(uint32_t wp_index) override;
59 
60   uint32_t NumSupportedHardwareWatchpoints() override;
61 
62 protected:
63   Status GPRRead(const uint32_t reg, RegisterValue &reg_value);
64 
65   Status GPRWrite(const uint32_t reg, const RegisterValue &reg_value);
66 
67   Status FPRRead(const uint32_t reg, RegisterValue &reg_value);
68 
69   Status FPRWrite(const uint32_t reg, const RegisterValue &reg_value);
70 
71 private:
72   bool IsGPR(uint32_t reg_index) const;
73 
74   bool IsFPR(uint32_t reg_index) const;
75 };
76 
77 } // namespace lldb_private
78 
79 #endif // liblldb_NativeRegisterContextWindows_arm64_h_
80 #endif // defined(__aarch64__) || defined(_M_ARM64)
81