2005-11-09 Randolph Chung <tausq@debian.org>
[deliverable/binutils-gdb.git] / gdb / armnbsd-tdep.c
1 /* Target-specific functions for ARM running under NetBSD.
2
3 Copyright 2002, 2003, 2004 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., 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA. */
21
22 #include "defs.h"
23 #include "osabi.h"
24
25 #include "gdb_string.h"
26
27 #include "arm-tdep.h"
28 #include "nbsd-tdep.h"
29 #include "solib-svr4.h"
30
31 /* Description of the longjmp buffer. */
32 #define ARM_NBSD_JB_PC 24
33 #define ARM_NBSD_JB_ELEMENT_SIZE INT_REGISTER_SIZE
34
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};
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};
41
42 static void
43 arm_netbsd_init_abi_common (struct gdbarch_info info,
44 struct gdbarch *gdbarch)
45 {
46 struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
47
48 tdep->lowest_pc = 0x8000;
49 switch (info.byte_order)
50 {
51 case BFD_ENDIAN_LITTLE:
52 tdep->arm_breakpoint = arm_nbsd_arm_le_breakpoint;
53 tdep->thumb_breakpoint = arm_nbsd_thumb_le_breakpoint;
54 tdep->arm_breakpoint_size = sizeof (arm_nbsd_arm_le_breakpoint);
55 tdep->thumb_breakpoint_size = sizeof (arm_nbsd_thumb_le_breakpoint);
56 break;
57
58 case BFD_ENDIAN_BIG:
59 tdep->arm_breakpoint = arm_nbsd_arm_be_breakpoint;
60 tdep->thumb_breakpoint = arm_nbsd_thumb_be_breakpoint;
61 tdep->arm_breakpoint_size = sizeof (arm_nbsd_arm_be_breakpoint);
62 tdep->thumb_breakpoint_size = sizeof (arm_nbsd_thumb_be_breakpoint);
63 break;
64
65 default:
66 internal_error (__FILE__, __LINE__,
67 _("arm_gdbarch_init: bad byte order for float format"));
68 }
69
70 tdep->jb_pc = ARM_NBSD_JB_PC;
71 tdep->jb_elt_size = ARM_NBSD_JB_ELEMENT_SIZE;
72 }
73
74 static void
75 arm_netbsd_aout_init_abi (struct gdbarch_info info,
76 struct gdbarch *gdbarch)
77 {
78 struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
79
80 arm_netbsd_init_abi_common (info, gdbarch);
81 if (tdep->fp_model == ARM_FLOAT_AUTO)
82 tdep->fp_model = ARM_FLOAT_SOFT_FPA;
83 }
84
85 static void
86 arm_netbsd_elf_init_abi (struct gdbarch_info info,
87 struct gdbarch *gdbarch)
88 {
89 struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
90
91 arm_netbsd_init_abi_common (info, gdbarch);
92
93 set_solib_svr4_fetch_link_map_offsets (gdbarch,
94 nbsd_ilp32_solib_svr4_fetch_link_map_offsets);
95
96 if (tdep->fp_model == ARM_FLOAT_AUTO)
97 tdep->fp_model = ARM_FLOAT_SOFT_VFP;
98 }
99
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
109 void
110 _initialize_arm_netbsd_tdep (void)
111 {
112 gdbarch_register_osabi_sniffer (bfd_arch_arm, bfd_target_aout_flavour,
113 arm_netbsd_aout_osabi_sniffer);
114
115 gdbarch_register_osabi (bfd_arch_arm, 0, GDB_OSABI_NETBSD_AOUT,
116 arm_netbsd_aout_init_abi);
117 gdbarch_register_osabi (bfd_arch_arm, 0, GDB_OSABI_NETBSD_ELF,
118 arm_netbsd_elf_init_abi);
119 }
This page took 0.045755 seconds and 4 git commands to generate.