Based on patches from H.J. Lu <hjl@nynexst.com>:
[deliverable/binutils-gdb.git] / gdb / a68v-nat.c
CommitLineData
6e03b2b8 1/* Host-dependent code for Apollo-68ks for GDB, the GNU debugger.
5c9bbfe6
RP
2 Copyright 1986, 1987, 1989, 1991 Free Software Foundation, Inc.
3
4This file is part of GDB.
5
6This program is free software; you can redistribute it and/or modify
7it under the terms of the GNU General Public License as published by
8the Free Software Foundation; either version 2 of the License, or
9(at your option) any later version.
10
11This program is distributed in the hope that it will be useful,
12but WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14GNU General Public License for more details.
15
16You should have received a copy of the GNU General Public License
17along with this program; if not, write to the Free Software
18Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
19
20#include "defs.h"
21#include "inferior.h"
6e03b2b8
JK
22
23#ifndef _ISP__M68K
24#define _ISP__M68K 1
25#endif
26
27#include <ptrace.h>
5c9bbfe6
RP
28
29extern int errno;
30
5c9bbfe6 31void
6e03b2b8
JK
32fetch_inferior_registers (ignored)
33 int ignored;
5c9bbfe6 34{
6e03b2b8
JK
35 struct ptrace_$data_regs_m68k inferior_registers;
36 struct ptrace_$floating_regs_m68k inferior_fp_registers;
37 struct ptrace_$control_regs_m68k inferior_control_registers;
5c9bbfe6
RP
38 extern char registers[];
39
6e03b2b8
JK
40 ptrace_$init_control(&inferior_control_registers);
41 inferior_fp_registers.size = sizeof(inferior_fp_registers);
42
5c9bbfe6
RP
43 registers_fetched ();
44
45 ptrace (PTRACE_GETREGS, inferior_pid,
6e03b2b8
JK
46 (PTRACE_ARG3_TYPE) &inferior_registers,
47 ptrace_$data_set,
48 (PTRACE_ARG3_TYPE) &inferior_registers,
49 ptrace_$data_set);
50
51 ptrace (PTRACE_GETREGS, inferior_pid,
52 (PTRACE_ARG3_TYPE) &inferior_fp_registers,
53 ptrace_$floating_set_m68k,
54 (PTRACE_ARG3_TYPE) &inferior_fp_registers,
55 ptrace_$floating_set_m68k);
56
57 ptrace (PTRACE_GETREGS, inferior_pid,
58 (PTRACE_ARG3_TYPE) &inferior_control_registers,
59 ptrace_$control_set_m68k,
60 (PTRACE_ARG3_TYPE) &inferior_control_registers,
61 ptrace_$control_set_m68k);
62
63 bcopy (&inferior_registers, registers, 16 * 4);
64 bcopy (&inferior_fp_registers, &registers[REGISTER_BYTE (FP0_REGNUM)],
65 sizeof inferior_fp_registers.regs);
66 *(int *)&registers[REGISTER_BYTE (PS_REGNUM)] = inferior_control_registers.sr;
67 *(int *)&registers[REGISTER_BYTE (PC_REGNUM)] = inferior_control_registers.pc;
5c9bbfe6
RP
68}
69
70/* Store our register values back into the inferior.
71 If REGNO is -1, do this for all registers.
72 Otherwise, REGNO specifies which register (so we can save time). */
73
74void
75store_inferior_registers (regno)
76 int regno;
77{
6e03b2b8
JK
78 struct ptrace_$data_regs_m68k inferior_registers;
79 struct ptrace_$floating_regs_m68k inferior_fp_registers;
80 struct ptrace_$control_regs_m68k inferior_control_registers;
5c9bbfe6
RP
81 extern char registers[];
82
6e03b2b8
JK
83 ptrace_$init_control(&inferior_control_registers);
84 inferior_fp_registers.size = sizeof(inferior_fp_registers);
5c9bbfe6 85
6e03b2b8
JK
86 ptrace (PTRACE_GETREGS, inferior_pid,
87 (PTRACE_ARG3_TYPE) &inferior_fp_registers,
88 ptrace_$floating_set_m68k,
89 (PTRACE_ARG3_TYPE) &inferior_fp_registers,
90 ptrace_$floating_set_m68k);
5c9bbfe6 91
6e03b2b8
JK
92 ptrace (PTRACE_GETREGS, inferior_pid,
93 (PTRACE_ARG3_TYPE) &inferior_control_registers,
94 ptrace_$control_set_m68k,
95 (PTRACE_ARG3_TYPE) &inferior_control_registers,
96 ptrace_$control_set_m68k);
5c9bbfe6 97
6e03b2b8 98 bcopy (registers, &inferior_registers, sizeof(inferior_registers));
5c9bbfe6 99
6e03b2b8
JK
100 bcopy (&registers[REGISTER_BYTE (FP0_REGNUM)], inferior_fp_registers.regs,
101 sizeof inferior_fp_registers.regs);
5c9bbfe6 102
6e03b2b8
JK
103 inferior_control_registers.sr = *(int *)&registers[REGISTER_BYTE (PS_REGNUM)];
104 inferior_control_registers.pc = *(int *)&registers[REGISTER_BYTE (PC_REGNUM)];
5c9bbfe6 105
6e03b2b8
JK
106 ptrace (PTRACE_SETREGS, inferior_pid,
107 (PTRACE_ARG3_TYPE) &inferior_registers,
108 ptrace_$data_set_m68k,
109 (PTRACE_ARG3_TYPE) &inferior_registers,
110 ptrace_$data_set_m68k);
111
112 ptrace (PTRACE_SETREGS, inferior_pid,
113 (PTRACE_ARG3_TYPE) &inferior_fp_registers,
114 ptrace_$floating_set_m68k,
115 (PTRACE_ARG3_TYPE) &inferior_fp_registers,
116 ptrace_$floating_set_m68k);
117
118 ptrace (PTRACE_SETREGS, inferior_pid,
119 (PTRACE_ARG3_TYPE) &inferior_control_registers,
120 ptrace_$control_set_m68k,
121 (PTRACE_ARG3_TYPE) &inferior_control_registers,
122 ptrace_$control_set_m68k);
5c9bbfe6
RP
123}
124
6e03b2b8 125/* Apollos don't dump cores */
5c9bbfe6
RP
126void
127fetch_core_registers (core_reg_sect, core_reg_size, which)
128 char *core_reg_sect;
129 unsigned core_reg_size;
130 int which;
131{
132}
This page took 0.14831 seconds and 4 git commands to generate.