aarch64-tdep.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. /* Common target dependent code for GDB on AArch64 systems.
  2. Copyright (C) 2009-2022 Free Software Foundation, Inc.
  3. Contributed by ARM Ltd.
  4. This file is part of GDB.
  5. This program is free software; you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation; either version 3 of the License, or
  8. (at your option) any later version.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with this program. If not, see <http://www.gnu.org/licenses/>. */
  15. #ifndef AARCH64_TDEP_H
  16. #define AARCH64_TDEP_H
  17. #include "arch/aarch64.h"
  18. #include "displaced-stepping.h"
  19. #include "infrun.h"
  20. #include "gdbarch.h"
  21. /* Forward declarations. */
  22. struct gdbarch;
  23. struct regset;
  24. /* AArch64 Dwarf register numbering. */
  25. #define AARCH64_DWARF_X0 0
  26. #define AARCH64_DWARF_SP 31
  27. #define AARCH64_DWARF_PAUTH_RA_STATE 34
  28. #define AARCH64_DWARF_PAUTH_DMASK 35
  29. #define AARCH64_DWARF_PAUTH_CMASK 36
  30. #define AARCH64_DWARF_V0 64
  31. #define AARCH64_DWARF_SVE_VG 46
  32. #define AARCH64_DWARF_SVE_FFR 47
  33. #define AARCH64_DWARF_SVE_P0 48
  34. #define AARCH64_DWARF_SVE_Z0 96
  35. /* Size of integer registers. */
  36. #define X_REGISTER_SIZE 8
  37. #define B_REGISTER_SIZE 1
  38. #define H_REGISTER_SIZE 2
  39. #define S_REGISTER_SIZE 4
  40. #define D_REGISTER_SIZE 8
  41. #define Q_REGISTER_SIZE 16
  42. /* Total number of general (X) registers. */
  43. #define AARCH64_X_REGISTER_COUNT 32
  44. /* Total number of D registers. */
  45. #define AARCH64_D_REGISTER_COUNT 32
  46. /* The maximum number of modified instructions generated for one
  47. single-stepped instruction. */
  48. #define AARCH64_DISPLACED_MODIFIED_INSNS 1
  49. /* Target-dependent structure in gdbarch. */
  50. struct aarch64_gdbarch_tdep : gdbarch_tdep
  51. {
  52. /* Lowest address at which instructions will appear. */
  53. CORE_ADDR lowest_pc = 0;
  54. /* Offset to PC value in jump buffer. If this is negative, longjmp
  55. support will be disabled. */
  56. int jb_pc = 0;
  57. /* And the size of each entry in the buf. */
  58. size_t jb_elt_size = 0;
  59. /* Types for AdvSISD registers. */
  60. struct type *vnq_type = nullptr;
  61. struct type *vnd_type = nullptr;
  62. struct type *vns_type = nullptr;
  63. struct type *vnh_type = nullptr;
  64. struct type *vnb_type = nullptr;
  65. struct type *vnv_type = nullptr;
  66. /* syscall record. */
  67. int (*aarch64_syscall_record) (struct regcache *regcache,
  68. unsigned long svc_number) = nullptr;
  69. /* The VQ value for SVE targets, or zero if SVE is not supported. */
  70. uint64_t vq = 0;
  71. /* Returns true if the target supports SVE. */
  72. bool has_sve () const
  73. {
  74. return vq != 0;
  75. }
  76. int pauth_reg_base = 0;
  77. int pauth_ra_state_regnum = 0;
  78. /* Returns true if the target supports pauth. */
  79. bool has_pauth () const
  80. {
  81. return pauth_reg_base != -1;
  82. }
  83. /* First MTE register. This is -1 if no MTE registers are available. */
  84. int mte_reg_base = 0;
  85. /* Returns true if the target supports MTE. */
  86. bool has_mte () const
  87. {
  88. return mte_reg_base != -1;
  89. }
  90. };
  91. const target_desc *aarch64_read_description (uint64_t vq, bool pauth_p,
  92. bool mte_p);
  93. extern int aarch64_process_record (struct gdbarch *gdbarch,
  94. struct regcache *regcache, CORE_ADDR addr);
  95. displaced_step_copy_insn_closure_up
  96. aarch64_displaced_step_copy_insn (struct gdbarch *gdbarch,
  97. CORE_ADDR from, CORE_ADDR to,
  98. struct regcache *regs);
  99. void aarch64_displaced_step_fixup (struct gdbarch *gdbarch,
  100. displaced_step_copy_insn_closure *dsc,
  101. CORE_ADDR from, CORE_ADDR to,
  102. struct regcache *regs);
  103. bool aarch64_displaced_step_hw_singlestep (struct gdbarch *gdbarch);
  104. #endif /* aarch64-tdep.h */