linux-aarch64-tdesc.cc 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /* GNU/Linux/aarch64 specific target description, for the remote server
  2. for GDB.
  3. Copyright (C) 2017-2022 Free Software Foundation, Inc.
  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. #include "server.h"
  16. #include "linux-aarch64-tdesc.h"
  17. #include "tdesc.h"
  18. #include "arch/aarch64.h"
  19. #include "linux-aarch32-low.h"
  20. #include <inttypes.h>
  21. /* All possible aarch64 target descriptors. */
  22. struct target_desc *tdesc_aarch64_list[AARCH64_MAX_SVE_VQ + 1][2/*pauth*/][2 /* mte */];
  23. /* Create the aarch64 target description. */
  24. const target_desc *
  25. aarch64_linux_read_description (uint64_t vq, bool pauth_p, bool mte_p)
  26. {
  27. if (vq > AARCH64_MAX_SVE_VQ)
  28. error (_("VQ is %" PRIu64 ", maximum supported value is %d"), vq,
  29. AARCH64_MAX_SVE_VQ);
  30. struct target_desc *tdesc = tdesc_aarch64_list[vq][pauth_p][mte_p];
  31. if (tdesc == NULL)
  32. {
  33. tdesc = aarch64_create_target_description (vq, pauth_p, mte_p);
  34. static const char *expedite_regs_aarch64[] = { "x29", "sp", "pc", NULL };
  35. static const char *expedite_regs_aarch64_sve[] = { "x29", "sp", "pc",
  36. "vg", NULL };
  37. if (vq == 0)
  38. init_target_desc (tdesc, expedite_regs_aarch64);
  39. else
  40. init_target_desc (tdesc, expedite_regs_aarch64_sve);
  41. tdesc_aarch64_list[vq][pauth_p][mte_p] = tdesc;
  42. }
  43. return tdesc;
  44. }