Mips native support. Decstation and iris4 have been tested.
[deliverable/binutils-gdb.git] / gdb / irix4-nat.c
CommitLineData
a70dc898
RP
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.
5
6This file is part of GDB.
7
8This program is free software; you can redistribute it and/or modify
9it under the terms of the GNU General Public License as published by
10the Free Software Foundation; either version 2 of the License, or
11(at your option) any later version.
12
13This program is distributed in the hope that it will be useful,
14but WITHOUT ANY WARRANTY; without even the implied warranty of
15MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16GNU General Public License for more details.
17
18You should have received a copy of the GNU General Public License
19along with this program; if not, write to the Free Software
20Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
21
22#include "defs.h"
23
24/*
25 * Implemented for Irix 4.x by Garrett A. Wollman
26 */
27
28#include <sys/time.h>
29#include <sys/procfs.h>
30
31typedef unsigned int greg_t; /* why isn't this defined? */
32
33/*
34 * See the comment in m68k-tdep.c regarding the utility of these functions.
35 */
36
37void
38supply_gregset (gregsetp)
39 gregset_t *gregsetp;
40{
41 register int regi;
42 register greg_t *regp = (greg_t *)(gregsetp->gp_regs);
43
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));
48
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));
53}
54
55void
56fill_gregset (gregsetp, regno)
57 gregset_t *gregsetp;
58 int regno;
59{
60 int regi;
61 register greg_t *regp = (greg_t *)(gregsetp->gp_regs);
62 extern char registers[];
63
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 *) &registers[REGISTER_BYTE (regi)];
68
69 if ((regno == -1) || (regno == PC_REGNUM))
70 gregsetp->gp_pc = *(greg_t *) &registers[REGISTER_BYTE (PC_REGNUM)];
71
72 if ((regno == -1) || (regno == PS_REGNUM))
73 gregsetp->gp_cause = *(greg_t *) &registers[REGISTER_BYTE (PS_REGNUM)];
74
75 if ((regno == -1) || (regno == HI_REGNUM))
76 gregsetp->gp_mdhi = *(greg_t *) &registers[REGISTER_BYTE (HI_REGNUM)];
77
78 if ((regno == -1) || (regno == LO_REGNUM))
79 gregsetp->gp_mdlo = *(greg_t *) &registers[REGISTER_BYTE (LO_REGNUM)];
80}
81
82/*
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.
86 *
87 * Again, see the comments in m68k-tdep.c.
88 */
89
90void
91supply_fpregset (fpregsetp)
92 fpregset_t *fpregsetp;
93{
94 register int regi;
95
96 for (regi = 0; regi < 32; regi++)
97 supply_register (FP0_REGNUM + regi,
98 (char *)&fpregsetp->fp_r.fp_regs[regi]);
99
100 supply_register (FCRCS_REGNUM, (char *)&fpregsetp->fp_csr);
101
102 /* FIXME: how can we supply FCRIR_REGNUM? SGI doesn't tell us. */
103}
104
105void
106fill_fpregset (fpregsetp, regno)
107 fpregset_t *fpregsetp;
108 int regno;
109{
110 int regi;
111 char *from, *to;
112 extern char registers[];
113
114 for (regi = FP0_REGNUM; regi < FP0_REGNUM + 32; regi++)
115 {
116 if ((regno == -1) || (regno == regi))
117 {
118 from = (char *) &registers[REGISTER_BYTE (regi)];
119 to = (char *) &(fpregsetp->fp_r.fp_regs[regi]);
120 bcopy(from, to, REGISTER_RAW_SIZE (regi));
121 }
122 }
123
124 if ((regno == -1) || (regno == FCRCS_REGNUM))
125 fpregsetp->fp_csr = *(unsigned *) &registers[REGISTER_BYTE(FCRCS_REGNUM)];
126}
This page took 0.026609 seconds and 4 git commands to generate.