1/* Manage register sets.
2
3   Copyright (C) 2003, 2004, 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#ifndef REGSET_H
22#define REGSET_H 1
23
24struct gdbarch;
25struct regcache;
26
27/* Data structure for the supported register notes in a core file.  */
28struct core_regset_section
29{
30  const char *sect_name;
31  int size;
32  const char *human_name;
33};
34
35/* Data structure describing a register set.  */
36
37typedef void (supply_regset_ftype) (const struct regset *, struct regcache *,
38                                    int, const void *, size_t);
39typedef void (collect_regset_ftype) (const struct regset *,
40                                     const struct regcache *,
41                                     int, void *, size_t);
42
43struct regset
44{
45  /* Data pointer for private use by the methods below, presumably
46     providing some sort of description of the register set.  */
47  const void *descr;
48
49  /* Function supplying values in a register set to a register cache.  */
50  supply_regset_ftype *supply_regset;
51
52  /* Function collecting values in a register set from a register cache.  */
53  collect_regset_ftype *collect_regset;
54
55  /* Architecture associated with the register set.  */
56  struct gdbarch *arch;
57};
58
59/* Allocate a fresh 'struct regset' whose supply_regset function is
60   SUPPLY_REGSET, and whose collect_regset function is COLLECT_REGSET.
61   If the regset has no collect_regset function, pass NULL for
62   COLLECT_REGSET.
63
64   The object returned is allocated on ARCH's obstack.  */
65
66extern struct regset *regset_alloc (struct gdbarch *arch,
67                                    supply_regset_ftype *supply_regset,
68                                    collect_regset_ftype *collect_regset);
69
70#endif /* regset.h */
71