sim: run: support concise env var settings
[binutils-gdb.git] / gdb / aarch64-fbsd-nat.c
1 /* Native-dependent code for FreeBSD/aarch64.
2
3 Copyright (C) 2017-2021 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 "regcache.h"
22 #include "target.h"
23
24 #include <sys/types.h>
25 #include <sys/ptrace.h>
26 #include <machine/reg.h>
27
28 #include "fbsd-nat.h"
29 #include "aarch64-fbsd-tdep.h"
30 #include "inf-ptrace.h"
31
32 struct aarch64_fbsd_nat_target final : public fbsd_nat_target
33 {
34 void fetch_registers (struct regcache *, int) override;
35 void store_registers (struct regcache *, int) override;
36 };
37
38 static aarch64_fbsd_nat_target the_aarch64_fbsd_nat_target;
39
40 /* Fetch register REGNUM from the inferior. If REGNUM is -1, do this
41 for all registers. */
42
43 void
44 aarch64_fbsd_nat_target::fetch_registers (struct regcache *regcache,
45 int regnum)
46 {
47 fetch_register_set<struct reg> (regcache, regnum, PT_GETREGS,
48 &aarch64_fbsd_gregset);
49 fetch_register_set<struct fpreg> (regcache, regnum, PT_GETFPREGS,
50 &aarch64_fbsd_fpregset);
51 }
52
53 /* Store register REGNUM back into the inferior. If REGNUM is -1, do
54 this for all registers. */
55
56 void
57 aarch64_fbsd_nat_target::store_registers (struct regcache *regcache,
58 int regnum)
59 {
60 store_register_set<struct reg> (regcache, regnum, PT_GETREGS, PT_SETREGS,
61 &aarch64_fbsd_gregset);
62 store_register_set<struct fpreg> (regcache, regnum, PT_GETFPREGS,
63 PT_SETFPREGS, &aarch64_fbsd_fpregset);
64 }
65
66 void _initialize_aarch64_fbsd_nat ();
67 void
68 _initialize_aarch64_fbsd_nat ()
69 {
70 add_inf_child_target (&the_aarch64_fbsd_nat_target);
71 }