1 /* Copyright (C) 1999-2016 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/>. */
22 #include "arm-linux-tdep.h"
24 #include "aarch32-linux-nat.h"
26 /* Supply GP registers contents, stored in REGS, to REGCACHE. ARM_APCS_32
27 is true if the 32-bit mode is in use, otherwise, it is false. */
30 aarch32_gp_regcache_supply (struct regcache *regcache, uint32_t *regs,
35 for (regno = ARM_A1_REGNUM; regno < ARM_PC_REGNUM; regno++)
36 regcache_raw_supply (regcache, regno, ®s[regno]);
39 regcache_raw_supply (regcache, ARM_PS_REGNUM, ®s[ARM_CPSR_GREGNUM]);
41 regcache_raw_supply (regcache, ARM_PS_REGNUM, ®s[ARM_PC_REGNUM]);
43 regs[ARM_PC_REGNUM] = gdbarch_addr_bits_remove
44 (get_regcache_arch (regcache), regs[ARM_PC_REGNUM]);
45 regcache_raw_supply (regcache, ARM_PC_REGNUM, ®s[ARM_PC_REGNUM]);
48 /* Collect GP registers from REGCACHE to buffer REGS. ARM_APCS_32 is
49 true if the 32-bit mode is in use, otherwise, it is false. */
52 aarch32_gp_regcache_collect (const struct regcache *regcache, uint32_t *regs,
57 for (regno = ARM_A1_REGNUM; regno <= ARM_PC_REGNUM; regno++)
59 if (REG_VALID == regcache_register_status (regcache, regno))
60 regcache_raw_collect (regcache, regno, ®s[regno]);
64 && REG_VALID == regcache_register_status (regcache, ARM_PS_REGNUM))
65 regcache_raw_collect (regcache, ARM_PS_REGNUM,
66 ®s[ARM_CPSR_GREGNUM]);
69 /* Supply VFP registers contents, stored in REGS, to REGCACHE.
70 VFP_REGISTER_COUNT is the number of VFP registers. */
73 aarch32_vfp_regcache_supply (struct regcache *regcache, gdb_byte *regs,
74 const int vfp_register_count)
78 for (regno = 0; regno < vfp_register_count; regno++)
79 regcache_raw_supply (regcache, regno + ARM_D0_REGNUM,
82 regcache_raw_supply (regcache, ARM_FPSCR_REGNUM,
86 /* Collect VFP registers from REGCACHE to buffer REGS.
87 VFP_REGISTER_COUNT is the number VFP registers. */
90 aarch32_vfp_regcache_collect (const struct regcache *regcache, gdb_byte *regs,
91 const int vfp_register_count)
95 for (regno = 0; regno < vfp_register_count; regno++)
96 regcache_raw_collect (regcache, regno + ARM_D0_REGNUM, regs + regno * 8);
98 regcache_raw_collect (regcache, ARM_FPSCR_REGNUM, regs + 32 * 8);