| 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 | |
| 39 | static int |
| 40 | arm_netbsd_aout_in_solib_call_trampoline (CORE_ADDR pc, char *name) |
| 41 | { |
| 42 | if (strcmp (name, "_PROCEDURE_LINKAGE_TABLE_") == 0) |
| 43 | return 1; |
| 44 | |
| 45 | return 0; |
| 46 | } |
| 47 | |
| 48 | static void |
| 49 | arm_netbsd_init_abi_common (struct gdbarch_info info, |
| 50 | struct gdbarch *gdbarch) |
| 51 | { |
| 52 | struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); |
| 53 | |
| 54 | tdep->lowest_pc = 0x8000; |
| 55 | tdep->arm_breakpoint = arm_nbsd_arm_le_breakpoint; |
| 56 | tdep->arm_breakpoint_size = sizeof (arm_nbsd_arm_le_breakpoint); |
| 57 | |
| 58 | tdep->jb_pc = ARM_NBSD_JB_PC; |
| 59 | tdep->jb_elt_size = ARM_NBSD_JB_ELEMENT_SIZE; |
| 60 | } |
| 61 | |
| 62 | static void |
| 63 | arm_netbsd_aout_init_abi (struct gdbarch_info info, |
| 64 | struct gdbarch *gdbarch) |
| 65 | { |
| 66 | struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); |
| 67 | |
| 68 | arm_netbsd_init_abi_common (info, gdbarch); |
| 69 | |
| 70 | set_gdbarch_in_solib_call_trampoline |
| 71 | (gdbarch, arm_netbsd_aout_in_solib_call_trampoline); |
| 72 | tdep->fp_model = ARM_FLOAT_SOFT_FPA; |
| 73 | } |
| 74 | |
| 75 | static void |
| 76 | arm_netbsd_elf_init_abi (struct gdbarch_info info, |
| 77 | struct gdbarch *gdbarch) |
| 78 | { |
| 79 | struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); |
| 80 | |
| 81 | arm_netbsd_init_abi_common (info, gdbarch); |
| 82 | |
| 83 | set_solib_svr4_fetch_link_map_offsets (gdbarch, |
| 84 | nbsd_ilp32_solib_svr4_fetch_link_map_offsets); |
| 85 | |
| 86 | tdep->fp_model = ARM_FLOAT_SOFT_VFP; |
| 87 | } |
| 88 | |
| 89 | static enum gdb_osabi |
| 90 | arm_netbsd_aout_osabi_sniffer (bfd *abfd) |
| 91 | { |
| 92 | if (strcmp (bfd_get_target (abfd), "a.out-arm-netbsd") == 0) |
| 93 | return GDB_OSABI_NETBSD_AOUT; |
| 94 | |
| 95 | return GDB_OSABI_UNKNOWN; |
| 96 | } |
| 97 | |
| 98 | void |
| 99 | _initialize_arm_netbsd_tdep (void) |
| 100 | { |
| 101 | gdbarch_register_osabi_sniffer (bfd_arch_arm, bfd_target_aout_flavour, |
| 102 | arm_netbsd_aout_osabi_sniffer); |
| 103 | |
| 104 | gdbarch_register_osabi (bfd_arch_arm, 0, GDB_OSABI_NETBSD_AOUT, |
| 105 | arm_netbsd_aout_init_abi); |
| 106 | gdbarch_register_osabi (bfd_arch_arm, 0, GDB_OSABI_NETBSD_ELF, |
| 107 | arm_netbsd_elf_init_abi); |
| 108 | } |