amd64-tdep.h 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. /* Target-dependent definitions for AMD64.
  2. Copyright (C) 2001-2022 Free Software Foundation, Inc.
  3. Contributed by Jiri Smid, SuSE Labs.
  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 AMD64_TDEP_H
  16. #define AMD64_TDEP_H
  17. struct gdbarch;
  18. struct frame_info;
  19. struct regcache;
  20. #include "i386-tdep.h"
  21. #include "infrun.h"
  22. /* Register numbers of various important registers. */
  23. enum amd64_regnum
  24. {
  25. AMD64_RAX_REGNUM, /* %rax */
  26. AMD64_RBX_REGNUM, /* %rbx */
  27. AMD64_RCX_REGNUM, /* %rcx */
  28. AMD64_RDX_REGNUM, /* %rdx */
  29. AMD64_RSI_REGNUM, /* %rsi */
  30. AMD64_RDI_REGNUM, /* %rdi */
  31. AMD64_RBP_REGNUM, /* %rbp */
  32. AMD64_RSP_REGNUM, /* %rsp */
  33. AMD64_R8_REGNUM, /* %r8 */
  34. AMD64_R9_REGNUM, /* %r9 */
  35. AMD64_R10_REGNUM, /* %r10 */
  36. AMD64_R11_REGNUM, /* %r11 */
  37. AMD64_R12_REGNUM, /* %r12 */
  38. AMD64_R13_REGNUM, /* %r13 */
  39. AMD64_R14_REGNUM, /* %r14 */
  40. AMD64_R15_REGNUM, /* %r15 */
  41. AMD64_RIP_REGNUM, /* %rip */
  42. AMD64_EFLAGS_REGNUM, /* %eflags */
  43. AMD64_CS_REGNUM, /* %cs */
  44. AMD64_SS_REGNUM, /* %ss */
  45. AMD64_DS_REGNUM, /* %ds */
  46. AMD64_ES_REGNUM, /* %es */
  47. AMD64_FS_REGNUM, /* %fs */
  48. AMD64_GS_REGNUM, /* %gs */
  49. AMD64_ST0_REGNUM = 24, /* %st0 */
  50. AMD64_ST1_REGNUM, /* %st1 */
  51. AMD64_FCTRL_REGNUM = AMD64_ST0_REGNUM + 8,
  52. AMD64_FSTAT_REGNUM = AMD64_ST0_REGNUM + 9,
  53. AMD64_FTAG_REGNUM = AMD64_ST0_REGNUM + 10,
  54. AMD64_XMM0_REGNUM = 40, /* %xmm0 */
  55. AMD64_XMM1_REGNUM, /* %xmm1 */
  56. AMD64_MXCSR_REGNUM = AMD64_XMM0_REGNUM + 16,
  57. AMD64_YMM0H_REGNUM, /* %ymm0h */
  58. AMD64_YMM15H_REGNUM = AMD64_YMM0H_REGNUM + 15,
  59. AMD64_BND0R_REGNUM = AMD64_YMM15H_REGNUM + 1,
  60. AMD64_BND3R_REGNUM = AMD64_BND0R_REGNUM + 3,
  61. AMD64_BNDCFGU_REGNUM,
  62. AMD64_BNDSTATUS_REGNUM,
  63. AMD64_XMM16_REGNUM,
  64. AMD64_XMM31_REGNUM = AMD64_XMM16_REGNUM + 15,
  65. AMD64_YMM16H_REGNUM,
  66. AMD64_YMM31H_REGNUM = AMD64_YMM16H_REGNUM + 15,
  67. AMD64_K0_REGNUM,
  68. AMD64_K7_REGNUM = AMD64_K0_REGNUM + 7,
  69. AMD64_ZMM0H_REGNUM,
  70. AMD64_ZMM31H_REGNUM = AMD64_ZMM0H_REGNUM + 31,
  71. AMD64_PKRU_REGNUM,
  72. AMD64_FSBASE_REGNUM,
  73. AMD64_GSBASE_REGNUM
  74. };
  75. /* Number of general purpose registers. */
  76. #define AMD64_NUM_GREGS 24
  77. #define AMD64_NUM_REGS (AMD64_GSBASE_REGNUM + 1)
  78. extern displaced_step_copy_insn_closure_up amd64_displaced_step_copy_insn
  79. (struct gdbarch *gdbarch, CORE_ADDR from, CORE_ADDR to,
  80. struct regcache *regs);
  81. extern void amd64_displaced_step_fixup
  82. (struct gdbarch *gdbarch, displaced_step_copy_insn_closure *closure,
  83. CORE_ADDR from, CORE_ADDR to, struct regcache *regs);
  84. /* Initialize the ABI for amd64. Uses DEFAULT_TDESC as fallback
  85. tdesc, if INFO does not specify one. */
  86. extern void amd64_init_abi (struct gdbarch_info info,
  87. struct gdbarch *gdbarch,
  88. const target_desc *default_tdesc);
  89. /* Initialize the ABI for x32. Uses DEFAULT_TDESC as fallback tdesc,
  90. if INFO does not specify one. */
  91. extern void amd64_x32_init_abi (struct gdbarch_info info,
  92. struct gdbarch *gdbarch,
  93. const target_desc *default_tdesc);
  94. extern const struct target_desc *amd64_target_description (uint64_t xcr0,
  95. bool segments);
  96. /* Fill register REGNUM in REGCACHE with the appropriate
  97. floating-point or SSE register value from *FXSAVE. If REGNUM is
  98. -1, do this for all registers. This function masks off any of the
  99. reserved bits in *FXSAVE. */
  100. extern void amd64_supply_fxsave (struct regcache *regcache, int regnum,
  101. const void *fxsave);
  102. /* Similar to amd64_supply_fxsave, but use XSAVE extended state. */
  103. extern void amd64_supply_xsave (struct regcache *regcache, int regnum,
  104. const void *xsave);
  105. /* Fill register REGNUM (if it is a floating-point or SSE register) in
  106. *FXSAVE with the value from REGCACHE. If REGNUM is -1, do this for
  107. all registers. This function doesn't touch any of the reserved
  108. bits in *FXSAVE. */
  109. extern void amd64_collect_fxsave (const struct regcache *regcache, int regnum,
  110. void *fxsave);
  111. /* Similar to amd64_collect_fxsave, but use XSAVE extended state. */
  112. extern void amd64_collect_xsave (const struct regcache *regcache,
  113. int regnum, void *xsave, int gcore);
  114. /* Floating-point register set. */
  115. extern const struct regset amd64_fpregset;
  116. /* Variables exported from amd64-linux-tdep.c. */
  117. extern int amd64_linux_gregset_reg_offset[];
  118. /* Variables exported from amd64-netbsd-tdep.c. */
  119. extern int amd64nbsd_r_reg_offset[];
  120. /* Variables exported from amd64-obsd-tdep.c. */
  121. extern int amd64obsd_r_reg_offset[];
  122. #endif /* amd64-tdep.h */