1 /* Target-dependent code for the MIPS architecture, for GDB, the GNU Debugger.
2 Copyright 1988, 1989, 1990, 1991, 1992 Free Software Foundation, Inc.
3 Contributed by Alessandro Forin(af@cs.cmu.edu) at CMU
4 and by Per Bothner(bothner@cs.wisc.edu) at U.Wisconsin.
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 2 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, write to the Free Software
20 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
25 * Implemented for Irix 4.x by Garrett A. Wollman
29 #include <sys/procfs.h>
31 typedef unsigned int greg_t
; /* why isn't this defined? */
34 * See the comment in m68k-tdep.c regarding the utility of these functions.
38 supply_gregset (gregsetp
)
42 register greg_t
*regp
= (greg_t
*)(gregsetp
->gp_regs
);
44 /* FIXME: somewhere, there should be a #define for the meaning
45 of this magic number 32; we should use that. */
46 for(regi
= 0; regi
< 32; regi
++)
47 supply_register (regi
, (char *)(regp
+ regi
));
49 supply_register (PC_REGNUM
, (char *)&(gregsetp
->gp_pc
));
50 supply_register (HI_REGNUM
, (char *)&(gregsetp
->gp_mdhi
));
51 supply_register (LO_REGNUM
, (char *)&(gregsetp
->gp_mdlo
));
52 supply_register (PS_REGNUM
, (char *)&(gregsetp
->gp_cause
));
56 fill_gregset (gregsetp
, regno
)
61 register greg_t
*regp
= (greg_t
*)(gregsetp
->gp_regs
);
62 extern char registers
[];
64 /* same FIXME as above wrt 32*/
65 for (regi
= 0; regi
< 32; regi
++)
66 if ((regno
== -1) || (regno
== regi
))
67 *(regp
+ regi
) = *(greg_t
*) ®isters
[REGISTER_BYTE (regi
)];
69 if ((regno
== -1) || (regno
== PC_REGNUM
))
70 gregsetp
->gp_pc
= *(greg_t
*) ®isters
[REGISTER_BYTE (PC_REGNUM
)];
72 if ((regno
== -1) || (regno
== PS_REGNUM
))
73 gregsetp
->gp_cause
= *(greg_t
*) ®isters
[REGISTER_BYTE (PS_REGNUM
)];
75 if ((regno
== -1) || (regno
== HI_REGNUM
))
76 gregsetp
->gp_mdhi
= *(greg_t
*) ®isters
[REGISTER_BYTE (HI_REGNUM
)];
78 if ((regno
== -1) || (regno
== LO_REGNUM
))
79 gregsetp
->gp_mdlo
= *(greg_t
*) ®isters
[REGISTER_BYTE (LO_REGNUM
)];
83 * Now we do the same thing for floating-point registers.
84 * We don't bother to condition on FP0_REGNUM since any
85 * reasonable MIPS configuration has an R3010 in it.
87 * Again, see the comments in m68k-tdep.c.
91 supply_fpregset (fpregsetp
)
92 fpregset_t
*fpregsetp
;
96 for (regi
= 0; regi
< 32; regi
++)
97 supply_register (FP0_REGNUM
+ regi
,
98 (char *)&fpregsetp
->fp_r
.fp_regs
[regi
]);
100 supply_register (FCRCS_REGNUM
, (char *)&fpregsetp
->fp_csr
);
102 /* FIXME: how can we supply FCRIR_REGNUM? SGI doesn't tell us. */
106 fill_fpregset (fpregsetp
, regno
)
107 fpregset_t
*fpregsetp
;
112 extern char registers
[];
114 for (regi
= FP0_REGNUM
; regi
< FP0_REGNUM
+ 32; regi
++)
116 if ((regno
== -1) || (regno
== regi
))
118 from
= (char *) ®isters
[REGISTER_BYTE (regi
)];
119 to
= (char *) &(fpregsetp
->fp_r
.fp_regs
[regi
]);
120 bcopy(from
, to
, REGISTER_RAW_SIZE (regi
));
124 if ((regno
== -1) || (regno
== FCRCS_REGNUM
))
125 fpregsetp
->fp_csr
= *(unsigned *) ®isters
[REGISTER_BYTE(FCRCS_REGNUM
)];
This page took 0.03108 seconds and 4 git commands to generate.