GDB (xrefs)
Loading...
Searching...
No Matches
m68k-bsd-tdep.c
Go to the documentation of this file.
1/* Target-dependent code for Motorola 68000 BSD's.
2
3 Copyright (C) 2004-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 "arch-utils.h"
22#include "frame.h"
23#include "osabi.h"
24#include "regcache.h"
25#include "regset.h"
26#include "trad-frame.h"
27#include "tramp-frame.h"
28#include "gdbtypes.h"
29
30#include "m68k-tdep.h"
31#include "solib-svr4.h"
32
33/* Core file support. */
34
35/* Sizeof `struct reg' in <machine/reg.h>. */
36#define M68KBSD_SIZEOF_GREGS (18 * 4)
37
38/* Sizeof `struct fpreg' in <machine/reg.h. */
39#define M68KBSD_SIZEOF_FPREGS (((8 * 3) + 3) * 4)
40
41int
43{
44 int fp_len = gdbarch_register_type (gdbarch, regnum)->length ();
45
47 return 8 * fp_len + (regnum - M68K_FPC_REGNUM) * 4;
48
49 return (regnum - M68K_FP0_REGNUM) * fp_len;
50}
51
52/* Supply register REGNUM from the buffer specified by FPREGS and LEN
53 in the floating-point register set REGSET to register cache
54 REGCACHE. If REGNUM is -1, do this for all registers in REGSET. */
55
56static void
58 struct regcache *regcache,
59 int regnum, const void *fpregs, size_t len)
60{
61 struct gdbarch *gdbarch = regcache->arch ();
62 const gdb_byte *regs = (const gdb_byte *) fpregs;
63 int i;
64
65 gdb_assert (len >= M68KBSD_SIZEOF_FPREGS);
66
67 for (i = M68K_FP0_REGNUM; i <= M68K_PC_REGNUM; i++)
68 {
69 if (regnum == i || regnum == -1)
71 }
72}
73
74/* Supply register REGNUM from the buffer specified by GREGS and LEN
75 in the general-purpose register set REGSET to register cache
76 REGCACHE. If REGNUM is -1, do this for all registers in REGSET. */
77
78static void
80 struct regcache *regcache,
81 int regnum, const void *gregs, size_t len)
82{
83 const gdb_byte *regs = (const gdb_byte *) gregs;
84 int i;
85
86 gdb_assert (len >= M68KBSD_SIZEOF_GREGS);
87
88 for (i = M68K_D0_REGNUM; i <= M68K_PC_REGNUM; i++)
89 {
90 if (regnum == i || regnum == -1)
91 regcache->raw_supply (i, regs + i * 4);
92 }
93
95 {
99 }
100}
101
102/* Motorola 68000 register sets. */
103
104static const struct regset m68kbsd_gregset =
105{
106 NULL,
108 NULL,
110};
111
112static const struct regset m68kbsd_fpregset =
113{
114 NULL,
116};
117
118/* Iterate over core file register note sections. */
119
120static void
123 void *cb_data,
124 const struct regcache *regcache)
125{
127 NULL, cb_data);
129 NULL, cb_data);
130}
131
132
133static void
135{
136 m68k_gdbarch_tdep *tdep = gdbarch_tdep<m68k_gdbarch_tdep> (gdbarch);
137
138 tdep->jb_pc = 5;
139 tdep->jb_elt_size = 4;
140
142
145
146 /* NetBSD ELF uses the SVR4 ABI. */
148 tdep->struct_return = pcc_struct_return;
149
150 /* NetBSD ELF uses SVR4-style shared libraries. */
153}
154
156void
int regnum
@ pcc_struct_return
Definition arm-tdep.h:85
gdbarch * arch() const
Definition regcache.c:231
void raw_supply(int regnum, const void *buf) override
Definition regcache.c:1062
struct type * gdbarch_register_type(struct gdbarch *gdbarch, int reg_nr)
Definition gdbarch.c:2194
void set_gdbarch_decr_pc_after_break(struct gdbarch *gdbarch, CORE_ADDR decr_pc_after_break)
Definition gdbarch.c:2913
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
#define M68KBSD_SIZEOF_FPREGS
#define M68KBSD_SIZEOF_GREGS
void _initialize_m68kbsd_tdep()
static const struct regset m68kbsd_fpregset
static void m68kbsd_supply_gregset(const struct regset *regset, struct regcache *regcache, int regnum, const void *gregs, size_t len)
static const struct regset m68kbsd_gregset
static void m68kbsd_supply_fpregset(const struct regset *regset, struct regcache *regcache, int regnum, const void *fpregs, size_t len)
int m68kbsd_fpreg_offset(struct gdbarch *gdbarch, int regnum)
static void m68kbsd_init_abi(struct gdbarch_info info, struct gdbarch *gdbarch)
static void m68kbsd_iterate_over_regset_sections(struct gdbarch *gdbarch, iterate_over_regset_sections_cb *cb, void *cb_data, const struct regcache *regcache)
void m68k_svr4_init_abi(struct gdbarch_info info, struct gdbarch *gdbarch)
Definition m68k-tdep.c:1102
@ M68K_PC_REGNUM
Definition m68k-tdep.h:41
@ M68K_FP0_REGNUM
Definition m68k-tdep.h:42
@ M68K_D0_REGNUM
Definition m68k-tdep.h:31
@ M68K_FPC_REGNUM
Definition m68k-tdep.h:43
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_NETBSD
Definition osabi.h:34
#define REGSET_VARIABLE_SIZE
Definition regset.h:52
void set_solib_svr4_fetch_link_map_offsets(struct gdbarch *gdbarch, struct link_map_offsets *(*flmo)(void))
struct link_map_offsets * svr4_ilp32_fetch_link_map_offsets(void)
ULONGEST length() const
Definition gdbtypes.h:983