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