1 //===-- NativeRegisterContextFreeBSD_mips64.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(__mips64__)
10 
11 #ifndef lldb_NativeRegisterContextFreeBSD_mips64_h
12 #define lldb_NativeRegisterContextFreeBSD_mips64_h
13 
14 // clang-format off
15 #include <sys/types.h>
16 #include <machine/reg.h>
17 // clang-format on
18 
19 #include "Plugins/Process/FreeBSD/NativeRegisterContextFreeBSD.h"
20 #include "Plugins/Process/Utility/RegisterContextFreeBSD_mips64.h"
21 
22 #include <array>
23 
24 namespace lldb_private {
25 namespace process_freebsd {
26 
27 class NativeProcessFreeBSD;
28 
29 class NativeRegisterContextFreeBSD_mips64
30     : public NativeRegisterContextFreeBSD {
31 public:
32   NativeRegisterContextFreeBSD_mips64(const ArchSpec &target_arch,
33                                       NativeThreadProtocol &native_thread);
34 
35   uint32_t GetRegisterSetCount() const override;
36 
37   uint32_t GetUserRegisterCount() const override;
38 
39   const RegisterSet *GetRegisterSet(uint32_t set_index) const override;
40 
41   Status ReadRegister(const RegisterInfo *reg_info,
42                       RegisterValue &reg_value) override;
43 
44   Status WriteRegister(const RegisterInfo *reg_info,
45                        const RegisterValue &reg_value) override;
46 
47   Status ReadAllRegisterValues(lldb::WritableDataBufferSP &data_sp) override;
48 
49   Status WriteAllRegisterValues(const lldb::DataBufferSP &data_sp) override;
50 
51   llvm::Error
52   CopyHardwareWatchpointsFrom(NativeRegisterContextFreeBSD &source) override;
53 
54 private:
55   enum RegSetKind {
56     GPRegSet,
57     FPRegSet,
58   };
59   std::array<uint8_t, sizeof(reg) + sizeof(fpreg)> m_reg_data;
60 
61   llvm::Optional<RegSetKind> GetSetForNativeRegNum(uint32_t reg_num) const;
62 
63   Status ReadRegisterSet(RegSetKind set);
64   Status WriteRegisterSet(RegSetKind set);
65 
66   RegisterContextFreeBSD_mips64 &GetRegisterInfo() const;
67 };
68 
69 } // namespace process_freebsd
70 } // namespace lldb_private
71 
72 #endif // #ifndef lldb_NativeRegisterContextFreeBSD_mips64_h
73 
74 #endif // defined (__mips64__)
75