1 /* Host-dependent code for Apollo-68ksfor GDB, the GNU debugger.
2 Copyright 1986, 1987, 1989, 1991 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., 675 Mass Ave, Cambridge, MA 02139, USA. */
27 #if defined (GDB_TARGET_IS_SUN3)
28 /* All of this stuff is only relevant if both host and target are sun3. */
30 fetch_inferior_registers ()
32 struct regs inferior_registers
;
34 struct fp_status inferior_fp_registers
;
36 extern char registers
[];
40 ptrace (PTRACE_GETREGS
, inferior_pid
, &inferior_registers
);
42 ptrace (PTRACE_GETFPREGS
, inferior_pid
, &inferior_fp_registers
);
45 bcopy (&inferior_registers
, registers
, 16 * 4);
47 bcopy (&inferior_fp_registers
, ®isters
[REGISTER_BYTE (FP0_REGNUM
)],
48 sizeof inferior_fp_registers
.fps_regs
);
50 *(int *)®isters
[REGISTER_BYTE (PS_REGNUM
)] = inferior_registers
.r_ps
;
51 *(int *)®isters
[REGISTER_BYTE (PC_REGNUM
)] = inferior_registers
.r_pc
;
53 bcopy (&inferior_fp_registers
.fps_control
,
54 ®isters
[REGISTER_BYTE (FPC_REGNUM
)],
55 sizeof inferior_fp_registers
- sizeof inferior_fp_registers
.fps_regs
);
59 /* Store our register values back into the inferior.
60 If REGNO is -1, do this for all registers.
61 Otherwise, REGNO specifies which register (so we can save time). */
63 store_inferior_registers (regno
)
66 struct regs inferior_registers
;
68 struct fp_status inferior_fp_registers
;
70 extern char registers
[];
72 bcopy (registers
, &inferior_registers
, 16 * 4);
74 bcopy (®isters
[REGISTER_BYTE (FP0_REGNUM
)], &inferior_fp_registers
,
75 sizeof inferior_fp_registers
.fps_regs
);
77 inferior_registers
.r_ps
= *(int *)®isters
[REGISTER_BYTE (PS_REGNUM
)];
78 inferior_registers
.r_pc
= *(int *)®isters
[REGISTER_BYTE (PC_REGNUM
)];
81 bcopy (®isters
[REGISTER_BYTE (FPC_REGNUM
)],
82 &inferior_fp_registers
.fps_control
,
83 sizeof inferior_fp_registers
- sizeof inferior_fp_registers
.fps_regs
);
86 ptrace (PTRACE_SETREGS
, inferior_pid
, &inferior_registers
);
88 ptrace (PTRACE_SETFPREGS
, inferior_pid
, &inferior_fp_registers
);
92 /* Machine-dependent code for pulling registers out of a Sun-3 core file. */
95 fetch_core_registers (core_reg_sect
, core_reg_size
, which
)
97 unsigned core_reg_size
;
100 extern char registers
[];
101 struct regs
*regs
= (struct regs
*) core_reg_sect
;
104 if (core_reg_size
< sizeof (struct regs
))
105 error ("Can't find registers in core file");
107 bcopy ((char *)regs
, registers
, 16 * 4);
108 supply_register (PS_REGNUM
, ®s
->r_ps
);
109 supply_register (PC_REGNUM
, ®s
->r_pc
);
111 } else if (which
== 2) {
113 #define fpustruct ((struct fpu *) core_reg_sect)
115 if (core_reg_size
>= sizeof (struct fpu
))
118 bcopy (fpustruct
->f_fpstatus
.fps_regs
,
119 ®isters
[REGISTER_BYTE (FP0_REGNUM
)],
120 sizeof fpustruct
->f_fpstatus
.fps_regs
);
121 bcopy (&fpustruct
->f_fpstatus
.fps_control
,
122 ®isters
[REGISTER_BYTE (FPC_REGNUM
)],
123 sizeof fpustruct
->f_fpstatus
-
124 sizeof fpustruct
->f_fpstatus
.fps_regs
);
128 fprintf (stderr
, "Couldn't read float regs from core file\n");
131 #else /* Not sun3 target. */
132 /* These functions shouldn't be called when we're cross-debugging. */
135 fetch_inferior_registers ()
140 store_inferior_registers (regno
)
147 fetch_core_registers (core_reg_sect
, core_reg_size
, which
)
149 unsigned core_reg_size
;
153 #endif /* Not sun3 target. */