* config/arm/embed.mt (DEPRECATED_TM_FILE): Set to tm-arm.h.
[deliverable/binutils-gdb.git] / gdb / armnbsd-tdep.c
CommitLineData
424f3115 1/* Target-dependent code for NetBSD/arm.
527ca6bb 2
6aba47ca 3 Copyright (C) 2002, 2003, 2004, 2006, 2007 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
197e01b6
EZ
19 Foundation, Inc., 51 Franklin Street, Fifth Floor,
20 Boston, MA 02110-1301, USA. */
66e810cd
RE
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 28#include "solib-svr4.h"
66e810cd 29
9df628e0 30/* Description of the longjmp buffer. */
625602f2 31#define ARM_NBSD_JB_PC 24
7a5ea0d4 32#define ARM_NBSD_JB_ELEMENT_SIZE INT_REGISTER_SIZE
9df628e0 33
66e810cd
RE
34/* For compatibility with previous implemenations of GDB on arm/NetBSD,
35 override the default little-endian breakpoint. */
36static const char arm_nbsd_arm_le_breakpoint[] = {0x11, 0x00, 0x00, 0xe6};
2afeb6b8
RE
37static const char arm_nbsd_arm_be_breakpoint[] = {0xe6, 0x00, 0x00, 0x11};
38static const char arm_nbsd_thumb_le_breakpoint[] = {0xfe, 0xde};
39static const char arm_nbsd_thumb_be_breakpoint[] = {0xde, 0xfe};
66e810cd
RE
40
41static void
42arm_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;
2afeb6b8
RE
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__,
edefbb7c 66 _("arm_gdbarch_init: bad byte order for float format"));
2afeb6b8 67 }
9df628e0 68
625602f2
RE
69 tdep->jb_pc = ARM_NBSD_JB_PC;
70 tdep->jb_elt_size = ARM_NBSD_JB_ELEMENT_SIZE;
190dce09
UW
71
72 /* Single stepping. */
73 set_gdbarch_software_single_step (gdbarch, arm_software_single_step);
66e810cd
RE
74}
75
76static void
77arm_netbsd_aout_init_abi (struct gdbarch_info info,
78 struct gdbarch *gdbarch)
79{
08216dd7
RE
80 struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
81
66e810cd 82 arm_netbsd_init_abi_common (info, gdbarch);
28e97307
DJ
83 if (tdep->fp_model == ARM_FLOAT_AUTO)
84 tdep->fp_model = ARM_FLOAT_SOFT_FPA;
66e810cd
RE
85}
86
87static void
424f3115 88arm_netbsd_elf_init_abi (struct gdbarch_info info,
66e810cd
RE
89 struct gdbarch *gdbarch)
90{
08216dd7
RE
91 struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
92
66e810cd 93 arm_netbsd_init_abi_common (info, gdbarch);
28e97307
DJ
94 if (tdep->fp_model == ARM_FLOAT_AUTO)
95 tdep->fp_model = ARM_FLOAT_SOFT_VFP;
a4ab4a25
MK
96
97 /* NetBSD ELF uses SVR4-style shared libraries. */
98 set_solib_svr4_fetch_link_map_offsets
424f3115 99 (gdbarch, svr4_ilp32_fetch_link_map_offsets);
66e810cd
RE
100}
101
70f80edf
JT
102static enum gdb_osabi
103arm_netbsd_aout_osabi_sniffer (bfd *abfd)
104{
105 if (strcmp (bfd_get_target (abfd), "a.out-arm-netbsd") == 0)
106 return GDB_OSABI_NETBSD_AOUT;
107
108 return GDB_OSABI_UNKNOWN;
109}
110
66e810cd
RE
111void
112_initialize_arm_netbsd_tdep (void)
113{
70f80edf
JT
114 gdbarch_register_osabi_sniffer (bfd_arch_arm, bfd_target_aout_flavour,
115 arm_netbsd_aout_osabi_sniffer);
116
05816f70 117 gdbarch_register_osabi (bfd_arch_arm, 0, GDB_OSABI_NETBSD_AOUT,
70f80edf 118 arm_netbsd_aout_init_abi);
05816f70 119 gdbarch_register_osabi (bfd_arch_arm, 0, GDB_OSABI_NETBSD_ELF,
70f80edf 120 arm_netbsd_elf_init_abi);
66e810cd 121}
This page took 0.415533 seconds and 4 git commands to generate.