Commit | Line | Data |
---|---|---|
66e810cd | 1 | /* Target-specific functions for ARM running under NetBSD. |
4be87837 | 2 | Copyright 2002, 2003 Free Software Foundation, Inc. |
66e810cd RE |
3 | |
4 | This file is part of GDB. | |
5 | ||
6 | This program is free software; you can redistribute it and/or modify | |
7 | it under the terms of the GNU General Public License as published by | |
8 | the Free Software Foundation; either version 2 of the License, or | |
9 | (at your option) any later version. | |
10 | ||
11 | This program is distributed in the hope that it will be useful, | |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | GNU General Public License for more details. | |
15 | ||
16 | You should have received a copy of the GNU General Public License | |
17 | along with this program; if not, write to the Free Software | |
18 | Foundation, Inc., 59 Temple Place - Suite 330, | |
19 | Boston, MA 02111-1307, USA. */ | |
20 | ||
21 | #include "defs.h" | |
4be87837 | 22 | #include "osabi.h" |
66e810cd RE |
23 | |
24 | #include "arm-tdep.h" | |
9eeef8ef JT |
25 | #include "nbsd-tdep.h" |
26 | #include "solib-svr4.h" | |
66e810cd | 27 | |
9df628e0 | 28 | /* Description of the longjmp buffer. */ |
625602f2 | 29 | #define ARM_NBSD_JB_PC 24 |
7a5ea0d4 | 30 | #define ARM_NBSD_JB_ELEMENT_SIZE INT_REGISTER_SIZE |
9df628e0 | 31 | |
66e810cd RE |
32 | /* For compatibility with previous implemenations of GDB on arm/NetBSD, |
33 | override the default little-endian breakpoint. */ | |
34 | static const char arm_nbsd_arm_le_breakpoint[] = {0x11, 0x00, 0x00, 0xe6}; | |
35 | ||
41d39a95 RE |
36 | static int |
37 | arm_netbsd_aout_in_solib_call_trampoline (CORE_ADDR pc, char *name) | |
38 | { | |
39 | if (strcmp (name, "_PROCEDURE_LINKAGE_TABLE_") == 0) | |
40 | return 1; | |
41 | ||
42 | return 0; | |
43 | } | |
44 | ||
66e810cd RE |
45 | static void |
46 | arm_netbsd_init_abi_common (struct gdbarch_info info, | |
47 | struct gdbarch *gdbarch) | |
48 | { | |
49 | struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); | |
50 | ||
51 | tdep->lowest_pc = 0x8000; | |
52 | tdep->arm_breakpoint = arm_nbsd_arm_le_breakpoint; | |
53 | tdep->arm_breakpoint_size = sizeof (arm_nbsd_arm_le_breakpoint); | |
9df628e0 | 54 | |
625602f2 RE |
55 | tdep->jb_pc = ARM_NBSD_JB_PC; |
56 | tdep->jb_elt_size = ARM_NBSD_JB_ELEMENT_SIZE; | |
66e810cd RE |
57 | } |
58 | ||
59 | static void | |
60 | arm_netbsd_aout_init_abi (struct gdbarch_info info, | |
61 | struct gdbarch *gdbarch) | |
62 | { | |
08216dd7 RE |
63 | struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); |
64 | ||
66e810cd | 65 | arm_netbsd_init_abi_common (info, gdbarch); |
41d39a95 RE |
66 | |
67 | set_gdbarch_in_solib_call_trampoline | |
68 | (gdbarch, arm_netbsd_aout_in_solib_call_trampoline); | |
17c0759e | 69 | tdep->fp_model = ARM_FLOAT_SOFT_FPA; |
66e810cd RE |
70 | } |
71 | ||
72 | static void | |
73 | arm_netbsd_elf_init_abi (struct gdbarch_info info, | |
74 | struct gdbarch *gdbarch) | |
75 | { | |
08216dd7 RE |
76 | struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); |
77 | ||
66e810cd | 78 | arm_netbsd_init_abi_common (info, gdbarch); |
08216dd7 | 79 | |
9eeef8ef JT |
80 | set_solib_svr4_fetch_link_map_offsets (gdbarch, |
81 | nbsd_ilp32_solib_svr4_fetch_link_map_offsets); | |
82 | ||
08216dd7 | 83 | tdep->fp_model = ARM_FLOAT_SOFT_VFP; |
66e810cd RE |
84 | } |
85 | ||
70f80edf JT |
86 | static enum gdb_osabi |
87 | arm_netbsd_aout_osabi_sniffer (bfd *abfd) | |
88 | { | |
89 | if (strcmp (bfd_get_target (abfd), "a.out-arm-netbsd") == 0) | |
90 | return GDB_OSABI_NETBSD_AOUT; | |
91 | ||
92 | return GDB_OSABI_UNKNOWN; | |
93 | } | |
94 | ||
66e810cd RE |
95 | void |
96 | _initialize_arm_netbsd_tdep (void) | |
97 | { | |
70f80edf JT |
98 | gdbarch_register_osabi_sniffer (bfd_arch_arm, bfd_target_aout_flavour, |
99 | arm_netbsd_aout_osabi_sniffer); | |
100 | ||
05816f70 | 101 | gdbarch_register_osabi (bfd_arch_arm, 0, GDB_OSABI_NETBSD_AOUT, |
70f80edf | 102 | arm_netbsd_aout_init_abi); |
05816f70 | 103 | gdbarch_register_osabi (bfd_arch_arm, 0, GDB_OSABI_NETBSD_ELF, |
70f80edf | 104 | arm_netbsd_elf_init_abi); |
66e810cd | 105 | } |