1 /* Native-dependent code for Linux/SPARC.
2 Copyright 2001 Free Software Foundation, Inc.
4 This file is part of GDB.
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.
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.
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. */
24 #include <sys/procfs.h>
26 /* Prototypes for supply_gregset etc. */
30 supply_gregset (elf_gregset_t *gregsetp)
32 elf_greg_t *regp = (elf_greg_t *) gregsetp;
35 for (i = G0_REGNUM; i <= I7_REGNUM; i++)
36 supply_register (i, (char *) (regp + (i - G0_REGNUM)));
38 supply_register (PS_REGNUM, (char *) (regp + 32));
40 supply_register (PC_REGNUM, (char *) (regp + 33));
41 supply_register (NPC_REGNUM, (char *) (regp + 34));
42 supply_register (Y_REGNUM, (char *) (regp + 35));
44 supply_register (WIM_REGNUM, (char *) (regp + 36));
45 supply_register (TBR_REGNUM, (char *) (regp + 37));
47 /* Fill inaccessible registers with zero. */
48 supply_register (CPS_REGNUM, NULL);
52 fill_gregset (elf_gregset_t *gregsetp, int regno)
54 elf_greg_t *regp = (elf_greg_t *) gregsetp;
57 for (i = G0_REGNUM; i <= I7_REGNUM; i++)
58 if (regno == -1 || regno == i)
59 read_register_gen (i, (char *) (regp + (i - G0_REGNUM)));
61 if (regno == -1 || regno == PS_REGNUM)
62 read_register_gen (PS_REGNUM, (char *) (regp + 32));
64 if (regno == -1 || regno == PC_REGNUM)
65 read_register_gen (PC_REGNUM, (char *) (regp + 33));
66 if (regno == -1 || regno == NPC_REGNUM)
67 read_register_gen (NPC_REGNUM, (char *) (regp + 34));
68 if (regno == -1 || regno == Y_REGNUM)
69 read_register_gen (Y_REGNUM, (char *) (regp + 35));
71 if (regno == -1 || regno == WIM_REGNUM)
72 read_register_gen (WIM_REGNUM, (char *) (regp + 36));
73 if (regno == -1 || regno == TBR_REGNUM)
74 read_register_gen (TBR_REGNUM, (char *) (regp + 37));
78 supply_fpregset (elf_fpregset_t *fpregsetp)
82 for (i = FP0_REGNUM; i < FP0_REGNUM + 32; i++)
83 supply_register (i, (char *) &fpregsetp->pr_fr.pr_regs[i - FP0_REGNUM]);
85 supply_register (FPS_REGNUM, (char *) &fpregsetp->pr_fsr);
89 fill_fpregset (elf_fpregset_t *fpregsetp, int regno)
93 for (i = FP0_REGNUM; i < FP0_REGNUM + 32; i++)
94 if (regno == -1 || regno == i)
95 read_register_gen (i, (char *) &fpregsetp->pr_fr.pr_regs[i - FP0_REGNUM]);
97 if (regno == -1 || regno == FPS_REGNUM)
98 read_register_gen (FPS_REGNUM, (char *) &fpregsetp->pr_fsr);