1 /* Native support for the SGI Iris running IRIX version 4, for GDB.
2 Copyright 1988, 1989, 1990, 1991, 1992, 1993 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.
5 Implemented for Irix 4.x by Garrett A. Wollman.
7 This file is part of GDB.
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
27 #include <sys/procfs.h>
28 #include <setjmp.h> /* For JB_XXX. */
30 /* Size of elements in jmpbuf */
32 #define JB_ELEMENT_SIZE 4
34 typedef unsigned int greg_t
; /* why isn't this defined? */
37 * See the comment in m68k-tdep.c regarding the utility of these functions.
41 supply_gregset (gregsetp
)
45 register greg_t
*regp
= (greg_t
*)(gregsetp
->gp_regs
);
47 /* FIXME: somewhere, there should be a #define for the meaning
48 of this magic number 32; we should use that. */
49 for(regi
= 0; regi
< 32; regi
++)
50 supply_register (regi
, (char *)(regp
+ regi
));
52 supply_register (PC_REGNUM
, (char *)&(gregsetp
->gp_pc
));
53 supply_register (HI_REGNUM
, (char *)&(gregsetp
->gp_mdhi
));
54 supply_register (LO_REGNUM
, (char *)&(gregsetp
->gp_mdlo
));
55 supply_register (PS_REGNUM
, (char *)&(gregsetp
->gp_cause
));
59 fill_gregset (gregsetp
, regno
)
64 register greg_t
*regp
= (greg_t
*)(gregsetp
->gp_regs
);
66 /* same FIXME as above wrt 32*/
67 for (regi
= 0; regi
< 32; regi
++)
68 if ((regno
== -1) || (regno
== regi
))
69 *(regp
+ regi
) = *(greg_t
*) ®isters
[REGISTER_BYTE (regi
)];
71 if ((regno
== -1) || (regno
== PC_REGNUM
))
72 gregsetp
->gp_pc
= *(greg_t
*) ®isters
[REGISTER_BYTE (PC_REGNUM
)];
74 if ((regno
== -1) || (regno
== PS_REGNUM
))
75 gregsetp
->gp_cause
= *(greg_t
*) ®isters
[REGISTER_BYTE (PS_REGNUM
)];
77 if ((regno
== -1) || (regno
== HI_REGNUM
))
78 gregsetp
->gp_mdhi
= *(greg_t
*) ®isters
[REGISTER_BYTE (HI_REGNUM
)];
80 if ((regno
== -1) || (regno
== LO_REGNUM
))
81 gregsetp
->gp_mdlo
= *(greg_t
*) ®isters
[REGISTER_BYTE (LO_REGNUM
)];
85 * Now we do the same thing for floating-point registers.
86 * We don't bother to condition on FP0_REGNUM since any
87 * reasonable MIPS configuration has an R3010 in it.
89 * Again, see the comments in m68k-tdep.c.
93 supply_fpregset (fpregsetp
)
94 fpregset_t
*fpregsetp
;
98 for (regi
= 0; regi
< 32; regi
++)
99 supply_register (FP0_REGNUM
+ regi
,
100 (char *)&fpregsetp
->fp_r
.fp_regs
[regi
]);
102 supply_register (FCRCS_REGNUM
, (char *)&fpregsetp
->fp_csr
);
104 /* FIXME: how can we supply FCRIR_REGNUM? SGI doesn't tell us. */
108 fill_fpregset (fpregsetp
, regno
)
109 fpregset_t
*fpregsetp
;
115 for (regi
= FP0_REGNUM
; regi
< FP0_REGNUM
+ 32; regi
++)
117 if ((regno
== -1) || (regno
== regi
))
119 from
= (char *) ®isters
[REGISTER_BYTE (regi
)];
120 to
= (char *) &(fpregsetp
->fp_r
.fp_regs
[regi
- FP0_REGNUM
]);
121 bcopy(from
, to
, REGISTER_RAW_SIZE (regi
));
125 if ((regno
== -1) || (regno
== FCRCS_REGNUM
))
126 fpregsetp
->fp_csr
= *(unsigned *) ®isters
[REGISTER_BYTE(FCRCS_REGNUM
)];
130 /* Figure out where the longjmp will land.
131 We expect the first arg to be a pointer to the jmp_buf structure from which
132 we extract the pc (JB_PC) that we will land at. The pc is copied into PC.
133 This routine returns true on success. */
136 get_longjmp_target(pc
)
141 jb_addr
= read_register(A0_REGNUM
);
143 if (target_read_memory(jb_addr
+ JB_PC
* JB_ELEMENT_SIZE
, pc
,
147 SWAP_TARGET_AND_HOST(pc
, sizeof(CORE_ADDR
));
153 fetch_core_registers (core_reg_sect
, core_reg_size
, which
, reg_addr
)
155 unsigned core_reg_size
;
156 int which
; /* Unused */
157 unsigned int reg_addr
; /* Unused */
159 if (core_reg_size
!= REGISTER_BYTES
)
161 warning ("wrong size gregset struct in core file");
165 memcpy ((char *)registers
, core_reg_sect
, core_reg_size
);
This page took 0.032532 seconds and 4 git commands to generate.