]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gdb/sparc-linux-nat.c
* sparc-linux-nat.c (fill_gregset): Replace read_register_gen
[thirdparty/binutils-gdb.git] / gdb / sparc-linux-nat.c
1 /* Native-dependent code for Linux/SPARC.
2 Copyright 2001 Free Software Foundation, Inc.
3
4 This file is part of GDB.
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. */
20
21 #include "defs.h"
22 #include "regcache.h"
23
24 #include <sys/procfs.h>
25
26 /* Prototypes for supply_gregset etc. */
27 #include "gregset.h"
28
29 void
30 supply_gregset (elf_gregset_t *gregsetp)
31 {
32 elf_greg_t *regp = (elf_greg_t *) gregsetp;
33 int i;
34
35 for (i = G0_REGNUM; i <= I7_REGNUM; i++)
36 supply_register (i, (char *) (regp + (i - G0_REGNUM)));
37
38 supply_register (PS_REGNUM, (char *) (regp + 32));
39
40 supply_register (PC_REGNUM, (char *) (regp + 33));
41 supply_register (NPC_REGNUM, (char *) (regp + 34));
42 supply_register (Y_REGNUM, (char *) (regp + 35));
43
44 supply_register (WIM_REGNUM, (char *) (regp + 36));
45 supply_register (TBR_REGNUM, (char *) (regp + 37));
46
47 /* Fill inaccessible registers with zero. */
48 supply_register (CPS_REGNUM, NULL);
49 }
50
51 void
52 fill_gregset (elf_gregset_t *gregsetp, int regno)
53 {
54 elf_greg_t *regp = (elf_greg_t *) gregsetp;
55 int i;
56
57 for (i = G0_REGNUM; i <= I7_REGNUM; i++)
58 if (regno == -1 || regno == i)
59 regcache_collect (i, regp + (i - G0_REGNUM));
60
61 if (regno == -1 || regno == PS_REGNUM)
62 regcache_collect (PS_REGNUM, regp + 32);
63
64 if (regno == -1 || regno == PC_REGNUM)
65 regcache_collect (PC_REGNUM, regp + 33);
66 if (regno == -1 || regno == NPC_REGNUM)
67 regcache_collect (NPC_REGNUM, regp + 34);
68 if (regno == -1 || regno == Y_REGNUM)
69 regcache_collect (Y_REGNUM, regp + 35);
70
71 if (regno == -1 || regno == WIM_REGNUM)
72 regcache_collect (WIM_REGNUM, regp + 36);
73 if (regno == -1 || regno == TBR_REGNUM)
74 regcache_collect (TBR_REGNUM, regp + 37);
75 }
76
77 void
78 supply_fpregset (elf_fpregset_t *fpregsetp)
79 {
80 int i;
81
82 for (i = FP0_REGNUM; i < FP0_REGNUM + 32; i++)
83 supply_register (i, (char *) &fpregsetp->pr_fr.pr_regs[i - FP0_REGNUM]);
84
85 supply_register (FPS_REGNUM, (char *) &fpregsetp->pr_fsr);
86 }
87
88 void
89 fill_fpregset (elf_fpregset_t *fpregsetp, int regno)
90 {
91 int i;
92
93 for (i = FP0_REGNUM; i < FP0_REGNUM + 32; i++)
94 if (regno == -1 || regno == i)
95 regcache_collect (i, &fpregsetp->pr_fr.pr_regs[i - FP0_REGNUM]);
96
97 if (regno == -1 || regno == FPS_REGNUM)
98 regcache_collect (FPS_REGNUM, &fpregsetp->pr_fsr);
99 }