run copyright.sh for 2011.
[deliverable/binutils-gdb.git] / gdb / sh-linux-tdep.c
1 /* Target-dependent code for GNU/Linux Super-H.
2
3 Copyright (C) 2005, 2007, 2008, 2009, 2010, 2011
4 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 3 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, see <http://www.gnu.org/licenses/>. */
20
21 #include "defs.h"
22 #include "osabi.h"
23
24 #include "solib-svr4.h"
25 #include "symtab.h"
26
27 #include "glibc-tdep.h"
28 #include "sh-tdep.h"
29 #include "linux-tdep.h"
30
31 #define REGSx16(base) \
32 {(base), 0}, \
33 {(base) + 1, 4}, \
34 {(base) + 2, 8}, \
35 {(base) + 3, 12}, \
36 {(base) + 4, 16}, \
37 {(base) + 5, 20}, \
38 {(base) + 6, 24}, \
39 {(base) + 7, 28}, \
40 {(base) + 8, 32}, \
41 {(base) + 9, 36}, \
42 {(base) + 10, 40}, \
43 {(base) + 11, 44}, \
44 {(base) + 12, 48}, \
45 {(base) + 13, 52}, \
46 {(base) + 14, 56}, \
47 {(base) + 15, 60}
48
49 /* Describe the contents of the .reg section of the core file. */
50
51 static const struct sh_corefile_regmap gregs_table[] =
52 {
53 REGSx16 (R0_REGNUM),
54 {PC_REGNUM, 64},
55 {PR_REGNUM, 68},
56 {SR_REGNUM, 72},
57 {GBR_REGNUM, 76},
58 {MACH_REGNUM, 80},
59 {MACL_REGNUM, 84},
60 {-1 /* Terminator. */, 0}
61 };
62
63 /* Describe the contents of the .reg2 section of the core file. */
64
65 static const struct sh_corefile_regmap fpregs_table[] =
66 {
67 REGSx16 (FR0_REGNUM),
68 /* REGSx16 xfp_regs omitted. */
69 {FPSCR_REGNUM, 128},
70 {FPUL_REGNUM, 132},
71 {-1 /* Terminator. */, 0}
72 };
73
74 static void
75 sh_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
76 {
77 linux_init_abi (info, gdbarch);
78
79 /* GNU/Linux uses SVR4-style shared libraries. */
80 set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target);
81 set_solib_svr4_fetch_link_map_offsets
82 (gdbarch, svr4_ilp32_fetch_link_map_offsets);
83 set_gdbarch_skip_solib_resolver (gdbarch, glibc_skip_solib_resolver);
84
85 set_gdbarch_fetch_tls_load_module_address (gdbarch,
86 svr4_fetch_objfile_link_map);
87
88 /* Core files are supported for 32-bit SH only, at present. */
89 if (info.bfd_arch_info->mach != bfd_mach_sh5)
90 {
91 struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
92
93 tdep->core_gregmap = (struct sh_corefile_regmap *)gregs_table;
94 tdep->core_fpregmap = (struct sh_corefile_regmap *)fpregs_table;
95 }
96 }
97
98 /* Provide a prototype to silence -Wmissing-prototypes. */
99 extern void _initialize_sh_linux_tdep (void);
100
101 void
102 _initialize_sh_linux_tdep (void)
103 {
104 gdbarch_register_osabi (bfd_arch_sh, 0, GDB_OSABI_LINUX, sh_linux_init_abi);
105 }
This page took 0.063529 seconds and 5 git commands to generate.