sparc64-linux-nat.c 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  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 "regcache.h"
  16. #include <sys/procfs.h>
  17. #include "gregset.h"
  18. #include "sparc64-tdep.h"
  19. #include "sparc-tdep.h"
  20. #include "sparc-nat.h"
  21. #include "inferior.h"
  22. #include "target.h"
  23. #include "linux-nat.h"
  24. class sparc64_linux_nat_target final : public linux_nat_target
  25. {
  26. public:
  27. /* Add our register access methods. */
  28. void fetch_registers (struct regcache *regcache, int regnum) override
  29. { sparc_fetch_inferior_registers (this, regcache, regnum); }
  30. void store_registers (struct regcache *regcache, int regnum) override
  31. { sparc_store_inferior_registers (this, regcache, regnum); }
  32. /* Override linux_nat_target low methods. */
  33. /* ADI support */
  34. void low_forget_process (pid_t pid) override
  35. { sparc64_forget_process (pid); }
  36. };
  37. static sparc64_linux_nat_target the_sparc64_linux_nat_target;
  38. static const struct sparc_gregmap sparc64_linux_ptrace_gregmap =
  39. {
  40. 16 * 8, /* "tstate" */
  41. 17 * 8, /* %pc */
  42. 18 * 8, /* %npc */
  43. 19 * 8, /* %y */
  44. -1, /* %wim */
  45. -1, /* %tbr */
  46. 0 * 8, /* %g1 */
  47. -1, /* %l0 */
  48. 4 /* sizeof (%y) */
  49. };
  50. void
  51. supply_gregset (struct regcache *regcache, const prgregset_t *gregs)
  52. {
  53. sparc64_supply_gregset (sparc_gregmap, regcache, -1, gregs);
  54. }
  55. void
  56. supply_fpregset (struct regcache *regcache, const prfpregset_t *fpregs)
  57. {
  58. sparc64_supply_fpregset (&sparc64_bsd_fpregmap, regcache, -1, fpregs);
  59. }
  60. void
  61. fill_gregset (const struct regcache *regcache, prgregset_t *gregs, int regnum)
  62. {
  63. sparc64_collect_gregset (sparc_gregmap, regcache, regnum, gregs);
  64. }
  65. void
  66. fill_fpregset (const struct regcache *regcache,
  67. prfpregset_t *fpregs, int regnum)
  68. {
  69. sparc64_collect_fpregset (&sparc64_bsd_fpregmap, regcache, regnum, fpregs);
  70. }
  71. void _initialize_sparc64_linux_nat ();
  72. void
  73. _initialize_sparc64_linux_nat ()
  74. {
  75. sparc_fpregmap = &sparc64_bsd_fpregmap;
  76. /* Register the target. */
  77. linux_target = &the_sparc64_linux_nat_target;
  78. add_inf_child_target (&the_sparc64_linux_nat_target);
  79. sparc_gregmap = &sparc64_linux_ptrace_gregmap;
  80. }