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