Include arch/arm-linux.h in aarch32-linux-nat.c
[deliverable/binutils-gdb.git] / gdb / aarch32-linux-nat.c
1 /* Copyright (C) 1999-2016 Free Software Foundation, Inc.
2
3 This file is part of GDB.
4
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.
9
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.
14
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/>. */
17
18 #include "defs.h"
19
20 #include "regcache.h"
21 #include "arm-tdep.h"
22 #include "arm-linux-tdep.h"
23 #include "arch/arm-linux.h"
24
25 #include "aarch32-linux-nat.h"
26
27 /* Supply GP registers contents, stored in REGS, to REGCACHE. ARM_APCS_32
28 is true if the 32-bit mode is in use, otherwise, it is false. */
29
30 void
31 aarch32_gp_regcache_supply (struct regcache *regcache, uint32_t *regs,
32 int arm_apcs_32)
33 {
34 int regno;
35
36 for (regno = ARM_A1_REGNUM; regno < ARM_PC_REGNUM; regno++)
37 regcache_raw_supply (regcache, regno, &regs[regno]);
38
39 if (arm_apcs_32)
40 regcache_raw_supply (regcache, ARM_PS_REGNUM, &regs[ARM_CPSR_GREGNUM]);
41 else
42 regcache_raw_supply (regcache, ARM_PS_REGNUM, &regs[ARM_PC_REGNUM]);
43
44 regs[ARM_PC_REGNUM] = gdbarch_addr_bits_remove
45 (get_regcache_arch (regcache), regs[ARM_PC_REGNUM]);
46 regcache_raw_supply (regcache, ARM_PC_REGNUM, &regs[ARM_PC_REGNUM]);
47 }
48
49 /* Collect GP registers from REGCACHE to buffer REGS. ARM_APCS_32 is
50 true if the 32-bit mode is in use, otherwise, it is false. */
51
52 void
53 aarch32_gp_regcache_collect (const struct regcache *regcache, uint32_t *regs,
54 int arm_apcs_32)
55 {
56 int regno;
57
58 for (regno = ARM_A1_REGNUM; regno <= ARM_PC_REGNUM; regno++)
59 {
60 if (REG_VALID == regcache_register_status (regcache, regno))
61 regcache_raw_collect (regcache, regno, &regs[regno]);
62 }
63
64 if (arm_apcs_32
65 && REG_VALID == regcache_register_status (regcache, ARM_PS_REGNUM))
66 regcache_raw_collect (regcache, ARM_PS_REGNUM,
67 &regs[ARM_CPSR_GREGNUM]);
68 }
69
70 /* Supply VFP registers contents, stored in REGS, to REGCACHE.
71 VFP_REGISTER_COUNT is the number of VFP registers. */
72
73 void
74 aarch32_vfp_regcache_supply (struct regcache *regcache, gdb_byte *regs,
75 const int vfp_register_count)
76 {
77 int regno;
78
79 for (regno = 0; regno < vfp_register_count; regno++)
80 regcache_raw_supply (regcache, regno + ARM_D0_REGNUM,
81 regs + regno * 8);
82
83 regcache_raw_supply (regcache, ARM_FPSCR_REGNUM,
84 regs + 32 * 8);
85 }
86
87 /* Collect VFP registers from REGCACHE to buffer REGS.
88 VFP_REGISTER_COUNT is the number VFP registers. */
89
90 void
91 aarch32_vfp_regcache_collect (const struct regcache *regcache, gdb_byte *regs,
92 const int vfp_register_count)
93 {
94 int regno;
95
96 for (regno = 0; regno < vfp_register_count; regno++)
97 regcache_raw_collect (regcache, regno + ARM_D0_REGNUM, regs + regno * 8);
98
99 regcache_raw_collect (regcache, ARM_FPSCR_REGNUM, regs + 32 * 8);
100 }
This page took 0.032569 seconds and 5 git commands to generate.