]>
Commit | Line | Data |
---|---|---|
a4b6fc86 AC |
1 | /* Native-dependent code for GNU/Linux SPARC. |
2 | ||
3 | Copyright 2001, 2002 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" | |
24 | ||
25 | #include <sys/procfs.h> | |
26 | ||
27 | /* Prototypes for supply_gregset etc. */ | |
28 | #include "gregset.h" | |
29 | ||
30 | void | |
31 | supply_gregset (elf_gregset_t *gregsetp) | |
32 | { | |
33 | elf_greg_t *regp = (elf_greg_t *) gregsetp; | |
34 | int i; | |
35 | ||
36 | for (i = G0_REGNUM; i <= I7_REGNUM; i++) | |
37 | supply_register (i, (char *) (regp + (i - G0_REGNUM))); | |
38 | ||
39 | supply_register (PS_REGNUM, (char *) (regp + 32)); | |
40 | ||
41 | supply_register (PC_REGNUM, (char *) (regp + 33)); | |
42 | supply_register (NPC_REGNUM, (char *) (regp + 34)); | |
43 | supply_register (Y_REGNUM, (char *) (regp + 35)); | |
44 | ||
45 | supply_register (WIM_REGNUM, (char *) (regp + 36)); | |
46 | supply_register (TBR_REGNUM, (char *) (regp + 37)); | |
47 | ||
48 | /* Fill inaccessible registers with zero. */ | |
49 | supply_register (CPS_REGNUM, NULL); | |
50 | } | |
51 | ||
52 | void | |
53 | fill_gregset (elf_gregset_t *gregsetp, int regno) | |
54 | { | |
55 | elf_greg_t *regp = (elf_greg_t *) gregsetp; | |
56 | int i; | |
57 | ||
58 | for (i = G0_REGNUM; i <= I7_REGNUM; i++) | |
59 | if (regno == -1 || regno == i) | |
b0677c2e | 60 | regcache_collect (i, regp + (i - G0_REGNUM)); |
d2b57b94 DJ |
61 | |
62 | if (regno == -1 || regno == PS_REGNUM) | |
b0677c2e | 63 | regcache_collect (PS_REGNUM, regp + 32); |
d2b57b94 DJ |
64 | |
65 | if (regno == -1 || regno == PC_REGNUM) | |
b0677c2e | 66 | regcache_collect (PC_REGNUM, regp + 33); |
d2b57b94 | 67 | if (regno == -1 || regno == NPC_REGNUM) |
b0677c2e | 68 | regcache_collect (NPC_REGNUM, regp + 34); |
d2b57b94 | 69 | if (regno == -1 || regno == Y_REGNUM) |
b0677c2e | 70 | regcache_collect (Y_REGNUM, regp + 35); |
d2b57b94 DJ |
71 | |
72 | if (regno == -1 || regno == WIM_REGNUM) | |
b0677c2e | 73 | regcache_collect (WIM_REGNUM, regp + 36); |
d2b57b94 | 74 | if (regno == -1 || regno == TBR_REGNUM) |
b0677c2e | 75 | regcache_collect (TBR_REGNUM, regp + 37); |
d2b57b94 DJ |
76 | } |
77 | ||
78 | void | |
79 | supply_fpregset (elf_fpregset_t *fpregsetp) | |
80 | { | |
81 | int i; | |
82 | ||
83 | for (i = FP0_REGNUM; i < FP0_REGNUM + 32; i++) | |
84 | supply_register (i, (char *) &fpregsetp->pr_fr.pr_regs[i - FP0_REGNUM]); | |
85 | ||
86 | supply_register (FPS_REGNUM, (char *) &fpregsetp->pr_fsr); | |
87 | } | |
88 | ||
89 | void | |
90 | fill_fpregset (elf_fpregset_t *fpregsetp, int regno) | |
91 | { | |
92 | int i; | |
93 | ||
94 | for (i = FP0_REGNUM; i < FP0_REGNUM + 32; i++) | |
95 | if (regno == -1 || regno == i) | |
b0677c2e | 96 | regcache_collect (i, &fpregsetp->pr_fr.pr_regs[i - FP0_REGNUM]); |
d2b57b94 DJ |
97 | |
98 | if (regno == -1 || regno == FPS_REGNUM) | |
b0677c2e | 99 | regcache_collect (FPS_REGNUM, &fpregsetp->pr_fsr); |
d2b57b94 | 100 | } |