1 /* Copyright (C) 1995-2015 Free Software Foundation, Inc.
3 This file is part of GDB.
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 3 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>. */
20 #include "linux-low.h"
21 #include "linux-aarch32-low.h"
23 #include <sys/ptrace.h>
24 /* Don't include elf.h if linux/elf.h got included by gdb_proc_service.h.
25 On Bionic elf.h and linux/elf.h have conflicting definitions. */
30 /* Collect GP registers from REGCACHE to buffer BUF. */
33 arm_fill_gregset (struct regcache
*regcache
, void *buf
)
38 for (i
= ARM_A1_REGNUM
; i
<= ARM_PC_REGNUM
; i
++)
39 collect_register (regcache
, i
, ®s
[i
]);
41 collect_register (regcache
, ARM_PS_REGNUM
, ®s
[16]);
44 /* Supply GP registers contents, stored in BUF, to REGCACHE. */
47 arm_store_gregset (struct regcache
*regcache
, const void *buf
)
51 const uint32_t *regs
= buf
;
53 memset (zerobuf
, 0, 8);
54 for (i
= ARM_A1_REGNUM
; i
<= ARM_PC_REGNUM
; i
++)
55 supply_register (regcache
, i
, ®s
[i
]);
57 for (; i
< ARM_PS_REGNUM
; i
++)
58 supply_register (regcache
, i
, zerobuf
);
60 supply_register (regcache
, ARM_PS_REGNUM
, ®s
[16]);
63 /* Collect NUM number of VFP registers from REGCACHE to buffer BUF. */
66 arm_fill_vfpregset_num (struct regcache
*regcache
, void *buf
, int num
)
70 gdb_assert (num
== 16 || num
== 32);
72 base
= find_regno (regcache
->tdesc
, "d0");
73 for (i
= 0; i
< num
; i
++)
74 collect_register (regcache
, base
+ i
, (char *) buf
+ i
* 8);
76 collect_register_by_name (regcache
, "fpscr", (char *) buf
+ 32 * 8);
79 /* Supply NUM number of VFP registers contents, stored in BUF, to
83 arm_store_vfpregset_num (struct regcache
*regcache
, const void *buf
, int num
)
87 gdb_assert (num
== 16 || num
== 32);
89 base
= find_regno (regcache
->tdesc
, "d0");
90 for (i
= 0; i
< num
; i
++)
91 supply_register (regcache
, base
+ i
, (char *) buf
+ i
* 8);
93 supply_register_by_name (regcache
, "fpscr", (char *) buf
+ 32 * 8);
97 arm_fill_vfpregset (struct regcache
*regcache
, void *buf
)
99 arm_fill_vfpregset_num (regcache
, buf
, 32);
103 arm_store_vfpregset (struct regcache
*regcache
, const void *buf
)
105 arm_store_vfpregset_num (regcache
, buf
, 32);
108 /* Register sets with using PTRACE_GETREGSET. */
110 static struct regset_info aarch32_regsets
[] = {
111 { PTRACE_GETREGSET
, PTRACE_SETREGSET
, NT_PRSTATUS
, 18 * 4,
113 arm_fill_gregset
, arm_store_gregset
},
114 { PTRACE_GETREGSET
, PTRACE_SETREGSET
, NT_ARM_VFP
, 32 * 8 + 4,
116 arm_fill_vfpregset
, arm_store_vfpregset
},
117 { 0, 0, 0, -1, -1, NULL
, NULL
}
120 static struct regsets_info aarch32_regsets_info
=
122 aarch32_regsets
, /* regsets */
124 NULL
, /* disabled_regsets */
127 struct regs_info regs_info_aarch32
=
129 NULL
, /* regset_bitmap */
131 &aarch32_regsets_info
135 initialize_low_arch_aarch32 (void)
137 init_registers_arm_with_neon ();
139 initialize_regsets_info (&aarch32_regsets_info
);