Commit | Line | Data |
---|---|---|
424f3115 | 1 | /* Target-dependent code for NetBSD/arm. |
527ca6bb | 2 | |
28e7fd62 | 3 | Copyright (C) 2002-2013 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 | |
a9762ec7 | 9 | the Free Software Foundation; either version 3 of the License, or |
66e810cd RE |
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 | |
a9762ec7 | 18 | along with this program. If not, see <http://www.gnu.org/licenses/>. */ |
66e810cd RE |
19 | |
20 | #include "defs.h" | |
4be87837 | 21 | #include "osabi.h" |
66e810cd | 22 | |
527ca6bb MK |
23 | #include "gdb_string.h" |
24 | ||
66e810cd | 25 | #include "arm-tdep.h" |
9eeef8ef | 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. */ | |
948f8e3d PA |
34 | static const gdb_byte arm_nbsd_arm_le_breakpoint[] = {0x11, 0x00, 0x00, 0xe6}; |
35 | static const gdb_byte arm_nbsd_arm_be_breakpoint[] = {0xe6, 0x00, 0x00, 0x11}; | |
36 | static const gdb_byte arm_nbsd_thumb_le_breakpoint[] = {0xfe, 0xde}; | |
37 | static const gdb_byte arm_nbsd_thumb_be_breakpoint[] = {0xde, 0xfe}; | |
66e810cd RE |
38 | |
39 | static void | |
40 | arm_netbsd_init_abi_common (struct gdbarch_info info, | |
41 | struct gdbarch *gdbarch) | |
42 | { | |
43 | struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); | |
44 | ||
45 | tdep->lowest_pc = 0x8000; | |
2afeb6b8 RE |
46 | switch (info.byte_order) |
47 | { | |
48 | case BFD_ENDIAN_LITTLE: | |
49 | tdep->arm_breakpoint = arm_nbsd_arm_le_breakpoint; | |
50 | tdep->thumb_breakpoint = arm_nbsd_thumb_le_breakpoint; | |
51 | tdep->arm_breakpoint_size = sizeof (arm_nbsd_arm_le_breakpoint); | |
52 | tdep->thumb_breakpoint_size = sizeof (arm_nbsd_thumb_le_breakpoint); | |
53 | break; | |
54 | ||
55 | case BFD_ENDIAN_BIG: | |
56 | tdep->arm_breakpoint = arm_nbsd_arm_be_breakpoint; | |
57 | tdep->thumb_breakpoint = arm_nbsd_thumb_be_breakpoint; | |
58 | tdep->arm_breakpoint_size = sizeof (arm_nbsd_arm_be_breakpoint); | |
59 | tdep->thumb_breakpoint_size = sizeof (arm_nbsd_thumb_be_breakpoint); | |
60 | break; | |
61 | ||
62 | default: | |
63 | internal_error (__FILE__, __LINE__, | |
edefbb7c | 64 | _("arm_gdbarch_init: bad byte order for float format")); |
2afeb6b8 | 65 | } |
9df628e0 | 66 | |
625602f2 RE |
67 | tdep->jb_pc = ARM_NBSD_JB_PC; |
68 | tdep->jb_elt_size = ARM_NBSD_JB_ELEMENT_SIZE; | |
190dce09 UW |
69 | |
70 | /* Single stepping. */ | |
71 | set_gdbarch_software_single_step (gdbarch, arm_software_single_step); | |
66e810cd RE |
72 | } |
73 | ||
74 | static void | |
75 | arm_netbsd_aout_init_abi (struct gdbarch_info info, | |
76 | struct gdbarch *gdbarch) | |
77 | { | |
08216dd7 RE |
78 | struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); |
79 | ||
66e810cd | 80 | arm_netbsd_init_abi_common (info, gdbarch); |
28e97307 DJ |
81 | if (tdep->fp_model == ARM_FLOAT_AUTO) |
82 | tdep->fp_model = ARM_FLOAT_SOFT_FPA; | |
66e810cd RE |
83 | } |
84 | ||
85 | static void | |
424f3115 | 86 | arm_netbsd_elf_init_abi (struct gdbarch_info info, |
66e810cd RE |
87 | struct gdbarch *gdbarch) |
88 | { | |
08216dd7 RE |
89 | struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); |
90 | ||
66e810cd | 91 | arm_netbsd_init_abi_common (info, gdbarch); |
28e97307 DJ |
92 | if (tdep->fp_model == ARM_FLOAT_AUTO) |
93 | tdep->fp_model = ARM_FLOAT_SOFT_VFP; | |
a4ab4a25 MK |
94 | |
95 | /* NetBSD ELF uses SVR4-style shared libraries. */ | |
96 | set_solib_svr4_fetch_link_map_offsets | |
424f3115 | 97 | (gdbarch, svr4_ilp32_fetch_link_map_offsets); |
66e810cd RE |
98 | } |
99 | ||
70f80edf JT |
100 | static enum gdb_osabi |
101 | arm_netbsd_aout_osabi_sniffer (bfd *abfd) | |
102 | { | |
103 | if (strcmp (bfd_get_target (abfd), "a.out-arm-netbsd") == 0) | |
104 | return GDB_OSABI_NETBSD_AOUT; | |
105 | ||
106 | return GDB_OSABI_UNKNOWN; | |
107 | } | |
108 | ||
63807e1d PA |
109 | /* Provide a prototype to silence -Wmissing-prototypes. */ |
110 | extern initialize_file_ftype _initialize_arm_netbsd_tdep; | |
111 | ||
66e810cd RE |
112 | void |
113 | _initialize_arm_netbsd_tdep (void) | |
114 | { | |
70f80edf JT |
115 | gdbarch_register_osabi_sniffer (bfd_arch_arm, bfd_target_aout_flavour, |
116 | arm_netbsd_aout_osabi_sniffer); | |
117 | ||
05816f70 | 118 | gdbarch_register_osabi (bfd_arch_arm, 0, GDB_OSABI_NETBSD_AOUT, |
70f80edf | 119 | arm_netbsd_aout_init_abi); |
05816f70 | 120 | gdbarch_register_osabi (bfd_arch_arm, 0, GDB_OSABI_NETBSD_ELF, |
70f80edf | 121 | arm_netbsd_elf_init_abi); |
66e810cd | 122 | } |