]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gdb/armnbsd-tdep.c
Copyright updates for 2007.
[thirdparty/binutils-gdb.git] / gdb / armnbsd-tdep.c
1 /* Target-dependent code for NetBSD/arm.
2
3 Copyright (C) 2002, 2003, 2004, 2006, 2007 Free Software Foundation, Inc.
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., 51 Franklin Street, Fifth Floor,
20 Boston, MA 02110-1301, USA. */
21
22 #include "defs.h"
23 #include "osabi.h"
24
25 #include "gdb_string.h"
26
27 #include "arm-tdep.h"
28 #include "solib-svr4.h"
29
30 /* Description of the longjmp buffer. */
31 #define ARM_NBSD_JB_PC 24
32 #define ARM_NBSD_JB_ELEMENT_SIZE INT_REGISTER_SIZE
33
34 /* For compatibility with previous implemenations of GDB on arm/NetBSD,
35 override the default little-endian breakpoint. */
36 static const char arm_nbsd_arm_le_breakpoint[] = {0x11, 0x00, 0x00, 0xe6};
37 static const char arm_nbsd_arm_be_breakpoint[] = {0xe6, 0x00, 0x00, 0x11};
38 static const char arm_nbsd_thumb_le_breakpoint[] = {0xfe, 0xde};
39 static const char arm_nbsd_thumb_be_breakpoint[] = {0xde, 0xfe};
40
41 static void
42 arm_netbsd_init_abi_common (struct gdbarch_info info,
43 struct gdbarch *gdbarch)
44 {
45 struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
46
47 tdep->lowest_pc = 0x8000;
48 switch (info.byte_order)
49 {
50 case BFD_ENDIAN_LITTLE:
51 tdep->arm_breakpoint = arm_nbsd_arm_le_breakpoint;
52 tdep->thumb_breakpoint = arm_nbsd_thumb_le_breakpoint;
53 tdep->arm_breakpoint_size = sizeof (arm_nbsd_arm_le_breakpoint);
54 tdep->thumb_breakpoint_size = sizeof (arm_nbsd_thumb_le_breakpoint);
55 break;
56
57 case BFD_ENDIAN_BIG:
58 tdep->arm_breakpoint = arm_nbsd_arm_be_breakpoint;
59 tdep->thumb_breakpoint = arm_nbsd_thumb_be_breakpoint;
60 tdep->arm_breakpoint_size = sizeof (arm_nbsd_arm_be_breakpoint);
61 tdep->thumb_breakpoint_size = sizeof (arm_nbsd_thumb_be_breakpoint);
62 break;
63
64 default:
65 internal_error (__FILE__, __LINE__,
66 _("arm_gdbarch_init: bad byte order for float format"));
67 }
68
69 tdep->jb_pc = ARM_NBSD_JB_PC;
70 tdep->jb_elt_size = ARM_NBSD_JB_ELEMENT_SIZE;
71 }
72
73 static void
74 arm_netbsd_aout_init_abi (struct gdbarch_info info,
75 struct gdbarch *gdbarch)
76 {
77 struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
78
79 arm_netbsd_init_abi_common (info, gdbarch);
80 if (tdep->fp_model == ARM_FLOAT_AUTO)
81 tdep->fp_model = ARM_FLOAT_SOFT_FPA;
82 }
83
84 static void
85 arm_netbsd_elf_init_abi (struct gdbarch_info info,
86 struct gdbarch *gdbarch)
87 {
88 struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
89
90 arm_netbsd_init_abi_common (info, gdbarch);
91 if (tdep->fp_model == ARM_FLOAT_AUTO)
92 tdep->fp_model = ARM_FLOAT_SOFT_VFP;
93
94 /* NetBSD ELF uses SVR4-style shared libraries. */
95 set_solib_svr4_fetch_link_map_offsets
96 (gdbarch, svr4_ilp32_fetch_link_map_offsets);
97 }
98
99 static enum gdb_osabi
100 arm_netbsd_aout_osabi_sniffer (bfd *abfd)
101 {
102 if (strcmp (bfd_get_target (abfd), "a.out-arm-netbsd") == 0)
103 return GDB_OSABI_NETBSD_AOUT;
104
105 return GDB_OSABI_UNKNOWN;
106 }
107
108 void
109 _initialize_arm_netbsd_tdep (void)
110 {
111 gdbarch_register_osabi_sniffer (bfd_arch_arm, bfd_target_aout_flavour,
112 arm_netbsd_aout_osabi_sniffer);
113
114 gdbarch_register_osabi (bfd_arch_arm, 0, GDB_OSABI_NETBSD_AOUT,
115 arm_netbsd_aout_init_abi);
116 gdbarch_register_osabi (bfd_arch_arm, 0, GDB_OSABI_NETBSD_ELF,
117 arm_netbsd_elf_init_abi);
118 }