]> CyberLeo.Net >> Repos - FreeBSD/releng/10.0.git/blob - contrib/gdb/gdb/armnbsd-tdep.c
- Copy stable/10 (r259064) to releng/10.0 as part of the
[FreeBSD/releng/10.0.git] / contrib / gdb / gdb / armnbsd-tdep.c
1 /* Target-specific functions for ARM running under NetBSD.
2    Copyright 2002, 2003 Free Software Foundation, Inc.
3
4    This file is part of GDB.
5
6    This program is free software; you can redistribute it and/or modify
7    it under the terms of the GNU General Public License as published by
8    the Free Software Foundation; either version 2 of the License, or
9    (at your option) any later version.
10
11    This program is distributed in the hope that it will be useful,
12    but WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14    GNU General Public License for more details.
15
16    You should have received a copy of the GNU General Public License
17    along with this program; if not, write to the Free Software
18    Foundation, Inc., 59 Temple Place - Suite 330,
19    Boston, MA 02111-1307, USA.  */
20
21 #include "defs.h"
22 #include "osabi.h"
23
24 #include "arm-tdep.h"
25 #include "nbsd-tdep.h"
26 #include "solib-svr4.h"
27
28 /* Description of the longjmp buffer.  */
29 #define ARM_NBSD_JB_PC 24
30 #define ARM_NBSD_JB_ELEMENT_SIZE INT_REGISTER_SIZE
31
32 /* For compatibility with previous implemenations of GDB on arm/NetBSD,
33    override the default little-endian breakpoint.  */
34 static const char arm_nbsd_arm_le_breakpoint[] = {0x11, 0x00, 0x00, 0xe6};
35
36 static int
37 arm_netbsd_aout_in_solib_call_trampoline (CORE_ADDR pc, char *name)
38 {
39   if (strcmp (name, "_PROCEDURE_LINKAGE_TABLE_") == 0)
40     return 1;
41
42   return 0;
43 }
44
45 static void
46 arm_netbsd_init_abi_common (struct gdbarch_info info,
47                             struct gdbarch *gdbarch)
48 {
49   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
50
51   tdep->lowest_pc = 0x8000;
52   tdep->arm_breakpoint = arm_nbsd_arm_le_breakpoint;
53   tdep->arm_breakpoint_size = sizeof (arm_nbsd_arm_le_breakpoint);
54
55   tdep->jb_pc = ARM_NBSD_JB_PC;
56   tdep->jb_elt_size = ARM_NBSD_JB_ELEMENT_SIZE;
57 }
58   
59 static void
60 arm_netbsd_aout_init_abi (struct gdbarch_info info, 
61                           struct gdbarch *gdbarch)
62 {
63   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
64
65   arm_netbsd_init_abi_common (info, gdbarch);
66
67   set_gdbarch_in_solib_call_trampoline
68     (gdbarch, arm_netbsd_aout_in_solib_call_trampoline);
69   tdep->fp_model = ARM_FLOAT_SOFT_FPA;
70 }
71
72 static void
73 arm_netbsd_elf_init_abi (struct gdbarch_info info, 
74                          struct gdbarch *gdbarch)
75 {
76   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
77
78   arm_netbsd_init_abi_common (info, gdbarch);
79
80   set_solib_svr4_fetch_link_map_offsets (gdbarch,
81                                 nbsd_ilp32_solib_svr4_fetch_link_map_offsets);
82
83   tdep->fp_model = ARM_FLOAT_SOFT_VFP;
84 }
85
86 static enum gdb_osabi
87 arm_netbsd_aout_osabi_sniffer (bfd *abfd)
88 {
89   if (strcmp (bfd_get_target (abfd), "a.out-arm-netbsd") == 0)
90     return GDB_OSABI_NETBSD_AOUT;
91
92   return GDB_OSABI_UNKNOWN;
93 }
94
95 void
96 _initialize_arm_netbsd_tdep (void)
97 {
98   gdbarch_register_osabi_sniffer (bfd_arch_arm, bfd_target_aout_flavour,
99                                   arm_netbsd_aout_osabi_sniffer);
100
101   gdbarch_register_osabi (bfd_arch_arm, 0, GDB_OSABI_NETBSD_AOUT,
102                           arm_netbsd_aout_init_abi);
103   gdbarch_register_osabi (bfd_arch_arm, 0, GDB_OSABI_NETBSD_ELF,
104                           arm_netbsd_elf_init_abi);
105 }