* gdb.asm/asm-source.exp: Add alpha-*-netbsd* to the list of
[deliverable/binutils-gdb.git] / gdb / armobsd-tdep.c
CommitLineData
a58dc200
MK
1/* Target-dependent code for OpenBSD/arm.
2
3 Copyright (C) 2006 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., 51 Franklin Street, Fifth Floor,
20 Boston, MA 02110-1301, USA. */
21
22#include "defs.h"
23#include "osabi.h"
e3ac4a1e
MK
24#include "trad-frame.h"
25#include "tramp-frame.h"
a58dc200 26
aa88762a 27#include "obsd-tdep.h"
a58dc200
MK
28#include "arm-tdep.h"
29#include "solib-svr4.h"
30
e3ac4a1e
MK
31/* Signal trampolines. */
32
33static void
34armobsd_sigframe_init (const struct tramp_frame *self,
35 struct frame_info *next_frame,
36 struct trad_frame_cache *cache,
37 CORE_ADDR func)
38{
39 CORE_ADDR sp, sigcontext_addr, addr;
40 int regnum;
41
42 /* We find the appropriate instance of `struct sigcontext' at a
43 fixed offset in the signal frame. */
44 sp = frame_unwind_register_signed (next_frame, ARM_SP_REGNUM);
45 sigcontext_addr = sp + 16;
46
47 /* PC. */
48 trad_frame_set_reg_addr (cache, ARM_PC_REGNUM, sigcontext_addr + 76);
49
50 /* GPRs. */
51 for (regnum = ARM_A1_REGNUM, addr = sigcontext_addr + 12;
52 regnum <= ARM_LR_REGNUM; regnum++, addr += 4)
53 trad_frame_set_reg_addr (cache, regnum, addr);
54
55 trad_frame_set_id (cache, frame_id_build (sp, func));
56}
57
58static const struct tramp_frame armobsd_sigframe =
59{
60 SIGTRAMP_FRAME,
61 4,
62 {
63 { 0xe28d0010, -1 }, /* add r0, sp, #16 */
64 { 0xef000067, -1 }, /* swi SYS_sigreturn */
65 { 0xef000001, -1 }, /* swi SYS_exit */
66 { 0xeafffffc, -1 }, /* b . - 8 */
67 { TRAMP_SENTINEL_INSN, -1 }
68 },
69 armobsd_sigframe_init
70};
71\f
72
a58dc200
MK
73static void
74armobsd_init_abi (struct gdbarch_info info,
75 struct gdbarch *gdbarch)
76{
77 struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
78
79 if (tdep->fp_model == ARM_FLOAT_AUTO)
80 tdep->fp_model = ARM_FLOAT_SOFT_VFP;
81
e3ac4a1e
MK
82 tramp_frame_prepend_unwinder (gdbarch, &armobsd_sigframe);
83
a58dc200
MK
84 /* OpenBSD/arm uses SVR4-style shared libraries. */
85 set_solib_svr4_fetch_link_map_offsets
86 (gdbarch, svr4_ilp32_fetch_link_map_offsets);
aa88762a 87 set_gdbarch_skip_solib_resolver (gdbarch, obsd_skip_solib_resolver);
a58dc200
MK
88
89 tdep->jb_pc = 24;
90 tdep->jb_elt_size = 4;
91}
92
93void
94_initialize_armobsd_tdep (void)
95{
96 gdbarch_register_osabi (bfd_arch_arm, 0, GDB_OSABI_OPENBSD_ELF,
97 armobsd_init_abi);
98}
This page took 0.027005 seconds and 4 git commands to generate.