Automatic date update in version.in
[binutils-gdb.git] / gdb / sh-netbsd-tdep.c
blobfec6a2e03d22df6e7287b9549be6dc641f0dc5a5
1 /* Target-dependent code for NetBSD/sh.
3 Copyright (C) 2002-2024 Free Software Foundation, Inc.
5 Contributed by Wasabi Systems, Inc.
7 This file is part of GDB.
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 3 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with this program. If not, see <http://www.gnu.org/licenses/>. */
22 #include "gdbcore.h"
23 #include "regset.h"
24 #include "value.h"
25 #include "osabi.h"
27 #include "sh-tdep.h"
28 #include "netbsd-tdep.h"
29 #include "solib-svr4.h"
30 #include "gdbarch.h"
32 /* Convert a register number into an offset into a ptrace
33 register structure. */
34 static const struct sh_corefile_regmap regmap[] =
36 {R0_REGNUM, 20 * 4},
37 {R0_REGNUM + 1, 19 * 4},
38 {R0_REGNUM + 2, 18 * 4},
39 {R0_REGNUM + 3, 17 * 4},
40 {R0_REGNUM + 4, 16 * 4},
41 {R0_REGNUM + 5, 15 * 4},
42 {R0_REGNUM + 6, 14 * 4},
43 {R0_REGNUM + 7, 13 * 4},
44 {R0_REGNUM + 8, 12 * 4},
45 {R0_REGNUM + 9, 11 * 4},
46 {R0_REGNUM + 10, 10 * 4},
47 {R0_REGNUM + 11, 9 * 4},
48 {R0_REGNUM + 12, 8 * 4},
49 {R0_REGNUM + 13, 7 * 4},
50 {R0_REGNUM + 14, 6 * 4},
51 {R0_REGNUM + 15, 5 * 4},
52 {PC_REGNUM, 0 * 4},
53 {SR_REGNUM, 1 * 4},
54 {PR_REGNUM, 2 * 4},
55 {MACH_REGNUM, 3 * 4},
56 {MACL_REGNUM, 4 * 4},
57 {-1 /* Terminator. */, 0}
61 static void
62 shnbsd_init_abi (struct gdbarch_info info,
63 struct gdbarch *gdbarch)
65 sh_gdbarch_tdep *tdep = gdbarch_tdep<sh_gdbarch_tdep> (gdbarch);
66 nbsd_init_abi (info, gdbarch);
68 tdep->core_gregmap = (struct sh_corefile_regmap *)regmap;
69 tdep->sizeof_gregset = 84;
71 set_solib_svr4_fetch_link_map_offsets
72 (gdbarch, svr4_ilp32_fetch_link_map_offsets);
75 void _initialize_shnbsd_tdep ();
76 void
77 _initialize_shnbsd_tdep ()
79 gdbarch_register_osabi (bfd_arch_sh, 0, GDB_OSABI_NETBSD,
80 shnbsd_init_abi);
81 gdbarch_register_osabi (bfd_arch_sh, 0, GDB_OSABI_OPENBSD,
82 shnbsd_init_abi);