| 1 | /* Target-dependent code for Windows CE running on ARM processors, |
| 2 | for GDB. |
| 3 | |
| 4 | Copyright (C) 2007 Free Software Foundation, Inc. |
| 5 | |
| 6 | This file is part of GDB. |
| 7 | |
| 8 | This program is free software; you can redistribute it and/or modify |
| 9 | it under the terms of the GNU General Public License as published by |
| 10 | the Free Software Foundation; either version 2 of the License, or |
| 11 | (at your option) any later version. |
| 12 | |
| 13 | This program is distributed in the hope that it will be useful, |
| 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 | GNU General Public License for more details. |
| 17 | |
| 18 | You should have received a copy of the GNU General Public License |
| 19 | along with this program; if not, write to the Free Software |
| 20 | Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 21 | Boston, MA 02110-1301, USA. */ |
| 22 | |
| 23 | #include "defs.h" |
| 24 | #include "osabi.h" |
| 25 | #include "solib-svr4.h" |
| 26 | #include "target.h" |
| 27 | |
| 28 | #include "gdb_string.h" |
| 29 | |
| 30 | #include "arm-tdep.h" |
| 31 | |
| 32 | static const char arm_wince_le_breakpoint[] = { 0x10, 0x00, 0x00, 0xe6 }; |
| 33 | static const char arm_wince_thumb_le_breakpoint[] = { 0xfe, 0xdf }; |
| 34 | |
| 35 | /* Description of the longjmp buffer. */ |
| 36 | #define ARM_WINCE_JB_ELEMENT_SIZE INT_REGISTER_SIZE |
| 37 | #define ARM_WINCE_JB_PC 21 |
| 38 | |
| 39 | static void |
| 40 | arm_wince_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) |
| 41 | { |
| 42 | struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); |
| 43 | |
| 44 | tdep->arm_breakpoint = arm_wince_le_breakpoint; |
| 45 | tdep->arm_breakpoint_size = sizeof (arm_wince_le_breakpoint); |
| 46 | tdep->thumb_breakpoint = arm_wince_thumb_le_breakpoint; |
| 47 | tdep->thumb_breakpoint_size = sizeof (arm_wince_thumb_le_breakpoint); |
| 48 | tdep->struct_return = pcc_struct_return; |
| 49 | |
| 50 | tdep->fp_model = ARM_FLOAT_SOFT_VFP; |
| 51 | |
| 52 | tdep->jb_pc = ARM_WINCE_JB_PC; |
| 53 | tdep->jb_elt_size = ARM_WINCE_JB_ELEMENT_SIZE; |
| 54 | |
| 55 | /* On ARM WinCE char defaults to signed. */ |
| 56 | set_gdbarch_char_signed (gdbarch, 1); |
| 57 | |
| 58 | set_solib_svr4_fetch_link_map_offsets |
| 59 | (gdbarch, svr4_ilp32_fetch_link_map_offsets); |
| 60 | |
| 61 | /* Shared library handling. */ |
| 62 | set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target); |
| 63 | |
| 64 | /* Single stepping. */ |
| 65 | set_gdbarch_software_single_step (gdbarch, arm_software_single_step); |
| 66 | } |
| 67 | |
| 68 | static enum gdb_osabi |
| 69 | arm_wince_osabi_sniffer (bfd *abfd) |
| 70 | { |
| 71 | const char *target_name = bfd_get_target (abfd); |
| 72 | |
| 73 | if (strcmp (target_name, "pei-arm-wince-little") == 0) |
| 74 | return GDB_OSABI_WINCE; |
| 75 | |
| 76 | return GDB_OSABI_UNKNOWN; |
| 77 | } |
| 78 | |
| 79 | /* Provide a prototype to silence -Wmissing-prototypes. */ |
| 80 | void _initialize_arm_wince_tdep (void); |
| 81 | |
| 82 | void |
| 83 | _initialize_arm_wince_tdep (void) |
| 84 | { |
| 85 | gdbarch_register_osabi_sniffer (bfd_arch_arm, bfd_target_coff_flavour, |
| 86 | arm_wince_osabi_sniffer); |
| 87 | |
| 88 | gdbarch_register_osabi (bfd_arch_arm, 0, GDB_OSABI_WINCE, |
| 89 | arm_wince_init_abi); |
| 90 | } |