xref: /freebsd-src/contrib/llvm-project/lldb/source/Plugins/Process/Utility/RegisterInfoPOSIX_riscv64.h (revision 06c3fb2749bda94cb5201f81ffdb8fa6c3161b2e)
1bdd1243dSDimitry Andric //===-- RegisterInfoPOSIX_riscv64.h -----------------------------*- C++ -*-===//
2bdd1243dSDimitry Andric //
3bdd1243dSDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4bdd1243dSDimitry Andric // See https://llvm.org/LICENSE.txt for license information.
5bdd1243dSDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6bdd1243dSDimitry Andric //
7bdd1243dSDimitry Andric //===----------------------------------------------------------------------===//
8bdd1243dSDimitry Andric 
9bdd1243dSDimitry Andric #ifndef LLDB_SOURCE_PLUGINS_PROCESS_UTILITY_REGISTERINFOPOSIX_RISCV64_H
10bdd1243dSDimitry Andric #define LLDB_SOURCE_PLUGINS_PROCESS_UTILITY_REGISTERINFOPOSIX_RISCV64_H
11bdd1243dSDimitry Andric 
12bdd1243dSDimitry Andric #include "RegisterInfoAndSetInterface.h"
13bdd1243dSDimitry Andric #include "lldb/Target/RegisterContext.h"
14bdd1243dSDimitry Andric #include "lldb/lldb-private.h"
15bdd1243dSDimitry Andric #include <map>
16bdd1243dSDimitry Andric 
17bdd1243dSDimitry Andric class RegisterInfoPOSIX_riscv64
18bdd1243dSDimitry Andric     : public lldb_private::RegisterInfoAndSetInterface {
19bdd1243dSDimitry Andric public:
20bdd1243dSDimitry Andric   static const lldb_private::RegisterInfo *
21bdd1243dSDimitry Andric   GetRegisterInfoPtr(const lldb_private::ArchSpec &target_arch);
22bdd1243dSDimitry Andric   static uint32_t
23bdd1243dSDimitry Andric   GetRegisterInfoCount(const lldb_private::ArchSpec &target_arch);
24bdd1243dSDimitry Andric 
25bdd1243dSDimitry Andric public:
26bdd1243dSDimitry Andric   enum { GPRegSet = 0, FPRegSet };
27bdd1243dSDimitry Andric 
28bdd1243dSDimitry Andric   struct GPR {
29bdd1243dSDimitry Andric     // note: gpr[0] is pc, not x0
30bdd1243dSDimitry Andric     uint64_t gpr[32];
31bdd1243dSDimitry Andric   };
32bdd1243dSDimitry Andric 
33bdd1243dSDimitry Andric   struct FPR {
34bdd1243dSDimitry Andric     uint64_t fpr[32];
35bdd1243dSDimitry Andric     uint32_t fcsr;
36bdd1243dSDimitry Andric   };
37bdd1243dSDimitry Andric 
38*06c3fb27SDimitry Andric   struct VPR {
39*06c3fb27SDimitry Andric     // The size should be VLEN*32 in bits, but we don't have VLEN here.
40*06c3fb27SDimitry Andric     void *vpr;
41*06c3fb27SDimitry Andric   };
42*06c3fb27SDimitry Andric 
43bdd1243dSDimitry Andric   RegisterInfoPOSIX_riscv64(const lldb_private::ArchSpec &target_arch,
44bdd1243dSDimitry Andric                             lldb_private::Flags flags);
45bdd1243dSDimitry Andric 
46bdd1243dSDimitry Andric   size_t GetGPRSize() const override;
47bdd1243dSDimitry Andric 
48bdd1243dSDimitry Andric   size_t GetFPRSize() const override;
49bdd1243dSDimitry Andric 
50bdd1243dSDimitry Andric   const lldb_private::RegisterInfo *GetRegisterInfo() const override;
51bdd1243dSDimitry Andric 
52bdd1243dSDimitry Andric   uint32_t GetRegisterCount() const override;
53bdd1243dSDimitry Andric 
54bdd1243dSDimitry Andric   const lldb_private::RegisterSet *
55bdd1243dSDimitry Andric   GetRegisterSet(size_t reg_set) const override;
56bdd1243dSDimitry Andric 
57bdd1243dSDimitry Andric   size_t GetRegisterSetCount() const override;
58bdd1243dSDimitry Andric 
59bdd1243dSDimitry Andric   size_t GetRegisterSetFromRegisterIndex(uint32_t reg_index) const override;
60bdd1243dSDimitry Andric 
61bdd1243dSDimitry Andric private:
62bdd1243dSDimitry Andric   const lldb_private::RegisterInfo *m_register_info_p;
63bdd1243dSDimitry Andric   uint32_t m_register_info_count;
64bdd1243dSDimitry Andric };
65bdd1243dSDimitry Andric 
66bdd1243dSDimitry Andric #endif
67