GDB (xrefs)
Loading...
Searching...
No Matches
tilegx-linux-tdep.c
Go to the documentation of this file.
1/* Target-dependent code for GNU/Linux on Tilera TILE-Gx processors.
2
3 Copyright (C) 2012-2023 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 3 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, see <http://www.gnu.org/licenses/>. */
19
20#include "defs.h"
21#include "osabi.h"
22#include "linux-tdep.h"
23#include "glibc-tdep.h"
24#include "solib-svr4.h"
25#include "symtab.h"
26#include "regcache.h"
27#include "regset.h"
28#include "tramp-frame.h"
29#include "trad-frame.h"
30#include "tilegx-tdep.h"
31#include "gdbarch.h"
32
33/* Signal trampoline support. */
34
35static void
37 frame_info_ptr this_frame,
38 struct trad_frame_cache *this_cache,
39 CORE_ADDR func)
40{
41 CORE_ADDR sp = get_frame_register_unsigned (this_frame, 54);
42
43 /* Base address of register save area. */
44 CORE_ADDR base = sp
45 + 16 /* Skip ABI_SAVE_AREA. */
46 + 128 /* Skip SIGINFO. */
47 + 40; /* Skip UCONTEXT. */
48
49 /* Address of saved LR register (R56) which holds previous PC. */
50 CORE_ADDR prev_pc = base + 56 * 8;
51
52 int i;
53
54 for (i = 0; i < 56; i++)
55 trad_frame_set_reg_addr (this_cache, i, base + i * 8);
56
57 trad_frame_set_reg_value (this_cache, 64,
58 get_frame_memory_unsigned (this_frame, prev_pc, 8));
59
60 /* Save a frame ID. */
61 trad_frame_set_id (this_cache, frame_id_build (base, func));
62}
63
65{
67 8,
68 {
69 { 0x00045fe551483000ULL, ULONGEST_MAX }, /* { moveli r10, 139 } */
70 { 0x286b180051485000ULL, ULONGEST_MAX }, /* { swint1 } */
71 { TRAMP_SENTINEL_INSN, ULONGEST_MAX }
72 },
74};
75
76/* Register map; must match struct pt_regs in "ptrace.h". */
77
79 {
81 { 1, TILEGX_PC_REGNUM, 8 },
82 { 1, TILEGX_FAULTNUM_REGNUM, 8 },
83 { 0 }
84 };
85
86#define TILEGX_LINUX_SIZEOF_GREGSET (64 * 8)
87
88/* TILE-Gx Linux kernel register set. */
89
95
96
97static void
100 void *cb_data,
101 const struct regcache *regcache)
102{
104 &tilegx_linux_regset, NULL, cb_data);
105}
106
107/* OS specific initialization of gdbarch. */
108
109static void
137
139void
141{
142 gdbarch_register_osabi (bfd_arch_tilegx, bfd_mach_tilegx, GDB_OSABI_LINUX,
144}
ULONGEST get_frame_register_unsigned(frame_info_ptr frame, int regnum)
Definition frame.c:1399
struct frame_id frame_id_build(CORE_ADDR stack_addr, CORE_ADDR code_addr)
Definition frame.c:736
ULONGEST get_frame_memory_unsigned(frame_info_ptr this_frame, CORE_ADDR addr, int len)
Definition frame.c:3007
@ SIGTRAMP_FRAME
Definition frame.h:198
int gdbarch_addr_bit(struct gdbarch *gdbarch)
Definition gdbarch.c:1739
void set_gdbarch_skip_trampoline_code(struct gdbarch *gdbarch, gdbarch_skip_trampoline_code_ftype *skip_trampoline_code)
void set_gdbarch_fetch_tls_load_module_address(struct gdbarch *gdbarch, gdbarch_fetch_tls_load_module_address_ftype *fetch_tls_load_module_address)
void set_gdbarch_skip_solib_resolver(struct gdbarch *gdbarch, gdbarch_skip_solib_resolver_ftype *skip_solib_resolver)
void set_gdbarch_iterate_over_regset_sections(struct gdbarch *gdbarch, gdbarch_iterate_over_regset_sections_ftype *iterate_over_regset_sections)
void iterate_over_regset_sections_cb(const char *sect_name, int supply_size, int collect_size, const struct regset *regset, const char *human_name, void *cb_data)
Definition gdbarch.h:104
CORE_ADDR glibc_skip_solib_resolver(struct gdbarch *gdbarch, CORE_ADDR pc)
Definition glibc-tdep.c:38
link_map_offsets * linux_lp64_fetch_link_map_offsets()
link_map_offsets * linux_ilp32_fetch_link_map_offsets()
void linux_init_abi(struct gdbarch_info info, struct gdbarch *gdbarch, int num_disp_step_buffers)
CORE_ADDR find_solib_trampoline_target(frame_info_ptr frame, CORE_ADDR pc)
Definition minsyms.c:1554
void gdbarch_register_osabi(enum bfd_architecture arch, unsigned long machine, enum gdb_osabi osabi, void(*init_osabi)(struct gdbarch_info, struct gdbarch *))
Definition osabi.c:146
@ GDB_OSABI_LINUX
Definition osabi.h:32
void regcache_collect_regset(const struct regset *regset, const struct regcache *regcache, int regnum, void *buf, size_t size)
Definition regcache.c:1273
void regcache_supply_regset(const struct regset *regset, struct regcache *regcache, int regnum, const void *buf, size_t size)
Definition regcache.c:1251
void(* func)(remote_target *remote, char *)
void set_solib_svr4_fetch_link_map_offsets(struct gdbarch *gdbarch, struct link_map_offsets *(*flmo)(void))
CORE_ADDR svr4_fetch_objfile_link_map(struct objfile *objfile)
Definition regcache.h:111
#define TILEGX_LINUX_SIZEOF_GREGSET
void _initialize_tilegx_linux_tdep()
static const struct tramp_frame tilegx_linux_rt_sigframe
static void tilegx_linux_sigframe_init(const struct tramp_frame *self, frame_info_ptr this_frame, struct trad_frame_cache *this_cache, CORE_ADDR func)
static const struct regcache_map_entry tilegx_linux_regmap[]
static const struct regset tilegx_linux_regset
static void tilegx_linux_init_abi(struct gdbarch_info info, struct gdbarch *gdbarch)
static void tilegx_iterate_over_regset_sections(struct gdbarch *gdbarch, iterate_over_regset_sections_cb *cb, void *cb_data, const struct regcache *regcache)
@ TILEGX_NUM_EASY_REGS
Definition tilegx-tdep.h:92
@ TILEGX_FAULTNUM_REGNUM
@ TILEGX_FIRST_EASY_REGNUM
Definition tilegx-tdep.h:34
@ TILEGX_PC_REGNUM
void trad_frame_set_reg_addr(struct trad_frame_cache *this_trad_cache, int regnum, CORE_ADDR addr)
Definition trad-frame.c:110
void trad_frame_set_id(struct trad_frame_cache *this_trad_cache, struct frame_id this_id)
Definition trad-frame.c:220
void trad_frame_set_reg_value(struct trad_frame_cache *this_trad_cache, int regnum, LONGEST val)
Definition trad-frame.c:94
void tramp_frame_prepend_unwinder(struct gdbarch *gdbarch, const struct tramp_frame *tramp_frame)
#define TRAMP_SENTINEL_INSN
Definition tramp-frame.h:44