sparc64-nat.c 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. /* Native-dependent code for GNU/Linux UltraSPARC.
  2. Copyright (C) 2003-2022 Free Software Foundation, Inc.
  3. This file is part of GDB.
  4. This program is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 3 of the License, or
  7. (at your option) any later version.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with this program. If not, see <http://www.gnu.org/licenses/>. */
  14. #include "defs.h"
  15. #include "gdbarch.h"
  16. #include "sparc64-tdep.h"
  17. #include "sparc-nat.h"
  18. /* Determine whether `gregset_t' contains register REGNUM. */
  19. static int
  20. sparc64_gregset_supplies_p (struct gdbarch *gdbarch, int regnum)
  21. {
  22. if (gdbarch_ptr_bit (gdbarch) == 32)
  23. return sparc32_gregset_supplies_p (gdbarch, regnum);
  24. /* Integer registers. */
  25. if ((regnum >= SPARC_G1_REGNUM && regnum <= SPARC_G7_REGNUM)
  26. || (regnum >= SPARC_O0_REGNUM && regnum <= SPARC_O7_REGNUM)
  27. || (regnum >= SPARC_L0_REGNUM && regnum <= SPARC_L7_REGNUM)
  28. || (regnum >= SPARC_I0_REGNUM && regnum <= SPARC_I7_REGNUM))
  29. return 1;
  30. /* Control registers. */
  31. if (regnum == SPARC64_PC_REGNUM
  32. || regnum == SPARC64_NPC_REGNUM
  33. || regnum == SPARC64_STATE_REGNUM
  34. || regnum == SPARC64_Y_REGNUM
  35. || regnum == SPARC64_FPRS_REGNUM)
  36. return 1;
  37. return 0;
  38. }
  39. /* Determine whether `fpregset_t' contains register REGNUM. */
  40. static int
  41. sparc64_fpregset_supplies_p (struct gdbarch *gdbarch, int regnum)
  42. {
  43. if (gdbarch_ptr_bit (gdbarch) == 32)
  44. return sparc32_fpregset_supplies_p (gdbarch, regnum);
  45. /* Floating-point registers. */
  46. if ((regnum >= SPARC_F0_REGNUM && regnum <= SPARC_F31_REGNUM)
  47. || (regnum >= SPARC64_F32_REGNUM && regnum <= SPARC64_F62_REGNUM))
  48. return 1;
  49. /* Control registers. */
  50. if (regnum == SPARC64_FSR_REGNUM)
  51. return 1;
  52. return 0;
  53. }
  54. void _initialize_sparc64_nat ();
  55. void
  56. _initialize_sparc64_nat ()
  57. {
  58. sparc_supply_gregset = sparc64_supply_gregset;
  59. sparc_collect_gregset = sparc64_collect_gregset;
  60. sparc_supply_fpregset = sparc64_supply_fpregset;
  61. sparc_collect_fpregset = sparc64_collect_fpregset;
  62. sparc_gregset_supplies_p = sparc64_gregset_supplies_p;
  63. sparc_fpregset_supplies_p = sparc64_fpregset_supplies_p;
  64. }