sh-netbsd-tdep.c 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. /* Target-dependent code for NetBSD/sh.
  2. Copyright (C) 2002-2022 Free Software Foundation, Inc.
  3. Contributed by Wasabi Systems, 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 "defs.h"
  16. #include "gdbcore.h"
  17. #include "regset.h"
  18. #include "value.h"
  19. #include "osabi.h"
  20. #include "sh-tdep.h"
  21. #include "netbsd-tdep.h"
  22. #include "solib-svr4.h"
  23. #include "gdbarch.h"
  24. /* Convert a register number into an offset into a ptrace
  25. register structure. */
  26. static const struct sh_corefile_regmap regmap[] =
  27. {
  28. {R0_REGNUM, 20 * 4},
  29. {R0_REGNUM + 1, 19 * 4},
  30. {R0_REGNUM + 2, 18 * 4},
  31. {R0_REGNUM + 3, 17 * 4},
  32. {R0_REGNUM + 4, 16 * 4},
  33. {R0_REGNUM + 5, 15 * 4},
  34. {R0_REGNUM + 6, 14 * 4},
  35. {R0_REGNUM + 7, 13 * 4},
  36. {R0_REGNUM + 8, 12 * 4},
  37. {R0_REGNUM + 9, 11 * 4},
  38. {R0_REGNUM + 10, 10 * 4},
  39. {R0_REGNUM + 11, 9 * 4},
  40. {R0_REGNUM + 12, 8 * 4},
  41. {R0_REGNUM + 13, 7 * 4},
  42. {R0_REGNUM + 14, 6 * 4},
  43. {R0_REGNUM + 15, 5 * 4},
  44. {PC_REGNUM, 0 * 4},
  45. {SR_REGNUM, 1 * 4},
  46. {PR_REGNUM, 2 * 4},
  47. {MACH_REGNUM, 3 * 4},
  48. {MACL_REGNUM, 4 * 4},
  49. {-1 /* Terminator. */, 0}
  50. };
  51. static void
  52. shnbsd_init_abi (struct gdbarch_info info,
  53. struct gdbarch *gdbarch)
  54. {
  55. sh_gdbarch_tdep *tdep = (sh_gdbarch_tdep *) gdbarch_tdep (gdbarch);
  56. nbsd_init_abi (info, gdbarch);
  57. tdep->core_gregmap = (struct sh_corefile_regmap *)regmap;
  58. tdep->sizeof_gregset = 84;
  59. set_solib_svr4_fetch_link_map_offsets
  60. (gdbarch, svr4_ilp32_fetch_link_map_offsets);
  61. }
  62. void _initialize_shnbsd_tdep ();
  63. void
  64. _initialize_shnbsd_tdep ()
  65. {
  66. gdbarch_register_osabi (bfd_arch_sh, 0, GDB_OSABI_NETBSD,
  67. shnbsd_init_abi);
  68. gdbarch_register_osabi (bfd_arch_sh, 0, GDB_OSABI_OPENBSD,
  69. shnbsd_init_abi);
  70. }