1 //===-- RegisterInfoPOSIX_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 #ifndef LLDB_SOURCE_PLUGINS_PROCESS_UTILITY_REGISTERINFOPOSIX_ARM64_H
10 #define LLDB_SOURCE_PLUGINS_PROCESS_UTILITY_REGISTERINFOPOSIX_ARM64_H
11 
12 #include "RegisterInfoAndSetInterface.h"
13 #include "lldb/Target/RegisterContext.h"
14 #include "lldb/lldb-private.h"
15 
16 class RegisterInfoPOSIX_arm64
17     : public lldb_private::RegisterInfoAndSetInterface {
18 public:
19   enum { GPRegSet = 0, FPRegSet };
20 
21   // based on RegisterContextDarwin_arm64.h
22   struct GPR {
23     uint64_t x[29]; // x0-x28
24     uint64_t fp;    // x29
25     uint64_t lr;    // x30
26     uint64_t sp;    // x31
27     uint64_t pc;    // pc
28     uint32_t cpsr;  // cpsr
29   };
30 
31   // based on RegisterContextDarwin_arm64.h
32   struct VReg {
33     uint8_t bytes[16];
34   };
35 
36   // based on RegisterContextDarwin_arm64.h
37   struct FPU {
38     VReg v[32];
39     uint32_t fpsr;
40     uint32_t fpcr;
41   };
42 
43   // based on RegisterContextDarwin_arm64.h
44   struct EXC {
45     uint64_t far;       // Virtual Fault Address
46     uint32_t esr;       // Exception syndrome
47     uint32_t exception; // number of arm exception token
48   };
49 
50   // based on RegisterContextDarwin_arm64.h
51   struct DBG {
52     uint64_t bvr[16];
53     uint64_t bcr[16];
54     uint64_t wvr[16];
55     uint64_t wcr[16];
56     uint64_t mdscr_el1;
57   };
58 
59   RegisterInfoPOSIX_arm64(const lldb_private::ArchSpec &target_arch);
60 
61   size_t GetGPRSize() const override;
62 
63   size_t GetFPRSize() const override;
64 
65   const lldb_private::RegisterInfo *GetRegisterInfo() const override;
66 
67   uint32_t GetRegisterCount() const override;
68 
69   const lldb_private::RegisterSet *
70   GetRegisterSet(size_t reg_set) const override;
71 
72   size_t GetRegisterSetCount() const override;
73 
74   size_t GetRegisterSetFromRegisterIndex(uint32_t reg_index) const override;
75 
76 private:
77   uint32_t num_registers;
78   uint32_t num_gpr_registers;
79   uint32_t num_fpr_registers;
80 
81   uint32_t last_gpr;
82   uint32_t first_fpr;
83   uint32_t last_fpr;
84 
85   const lldb_private::RegisterInfo *m_register_info_p;
86   uint32_t m_register_info_count;
87 };
88 
89 #endif
90