1 /* Target-dependent code for ARM BSD's.
3 Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011
4 Free Software Foundation, Inc.
6 This file is part of GDB.
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.
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.
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/>. */
26 #include "gdb_assert.h"
27 #include "gdb_string.h"
31 /* Core file support. */
33 /* Sizeof `struct reg' in <machine/reg.h>. */
34 #define ARMBSD_SIZEOF_GREGS (17 * 4)
36 /* Sizeof `struct fpreg' in <machine/reg.h. */
37 #define ARMBSD_SIZEOF_FPREGS ((1 + (8 * 3)) * 4)
40 armbsd_fpreg_offset (int regnum
)
42 if (regnum
== ARM_FPS_REGNUM
)
45 return 4 + (regnum
- ARM_F0_REGNUM
) * 12;
48 /* Supply register REGNUM from the buffer specified by FPREGS and LEN
49 in the floating-point register set REGSET to register cache
50 REGCACHE. If REGNUM is -1, do this for all registers in REGSET. */
53 armbsd_supply_fpregset (const struct regset
*regset
,
54 struct regcache
*regcache
,
55 int regnum
, const void *fpregs
, size_t len
)
57 const gdb_byte
*regs
= fpregs
;
60 gdb_assert (len
>= ARMBSD_SIZEOF_FPREGS
);
62 for (i
= ARM_F0_REGNUM
; i
<= ARM_FPS_REGNUM
; i
++)
64 if (regnum
== i
|| regnum
== -1)
65 regcache_raw_supply (regcache
, i
, regs
+ armbsd_fpreg_offset (i
));
69 /* Supply register REGNUM from the buffer specified by GREGS and LEN
70 in the general-purpose register set REGSET to register cache
71 REGCACHE. If REGNUM is -1, do this for all registers in REGSET. */
74 armbsd_supply_gregset (const struct regset
*regset
,
75 struct regcache
*regcache
,
76 int regnum
, const void *gregs
, size_t len
)
78 const gdb_byte
*regs
= gregs
;
81 gdb_assert (len
>= ARMBSD_SIZEOF_GREGS
);
83 for (i
= ARM_A1_REGNUM
; i
<= ARM_PC_REGNUM
; i
++)
85 if (regnum
== i
|| regnum
== -1)
86 regcache_raw_supply (regcache
, i
, regs
+ i
* 4);
89 if (regnum
== ARM_PS_REGNUM
|| regnum
== -1)
90 regcache_raw_supply (regcache
, i
, regs
+ 16 * 4);
92 if (len
>= ARMBSD_SIZEOF_GREGS
+ ARMBSD_SIZEOF_FPREGS
)
94 regs
+= ARMBSD_SIZEOF_GREGS
;
95 len
-= ARMBSD_SIZEOF_GREGS
;
96 armbsd_supply_fpregset (regset
, regcache
, regnum
, regs
, len
);
100 /* ARM register sets. */
102 static struct regset armbsd_gregset
=
105 armbsd_supply_gregset
108 static struct regset armbsd_fpregset
=
111 armbsd_supply_fpregset
114 /* Return the appropriate register set for the core section identified
115 by SECT_NAME and SECT_SIZE. */
117 const struct regset
*
118 armbsd_regset_from_core_section (struct gdbarch
*gdbarch
,
119 const char *sect_name
, size_t sect_size
)
121 if (strcmp (sect_name
, ".reg") == 0 && sect_size
>= ARMBSD_SIZEOF_GREGS
)
122 return &armbsd_gregset
;
124 if (strcmp (sect_name
, ".reg2") == 0 && sect_size
>= ARMBSD_SIZEOF_FPREGS
)
125 return &armbsd_fpregset
;
This page took 0.036927 seconds and 4 git commands to generate.