This commit was generated by cvs2svn to track changes on a CVS vendor
[deliverable/binutils-gdb.git] / gdb / a68v-nat.c
CommitLineData
c906108c
SS
1/* Host-dependent code for Apollo-68ks for GDB, the GNU debugger.
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
19
20#include "defs.h"
21#include "inferior.h"
22
23#ifndef _ISP__M68K
24#define _ISP__M68K 1
25#endif
26
27#include <ptrace.h>
28
29extern int errno;
30
31void
32fetch_inferior_registers (ignored)
33 int ignored;
34{
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;
c906108c
SS
38
39 ptrace_$init_control(&inferior_control_registers);
40 inferior_fp_registers.size = sizeof(inferior_fp_registers);
41
42 registers_fetched ();
43
44 ptrace (PTRACE_GETREGS, inferior_pid,
45 (PTRACE_ARG3_TYPE) &inferior_registers,
46 ptrace_$data_set,
47 (PTRACE_ARG3_TYPE) &inferior_registers,
48 ptrace_$data_set);
49
50 ptrace (PTRACE_GETREGS, inferior_pid,
51 (PTRACE_ARG3_TYPE) &inferior_fp_registers,
52 ptrace_$floating_set_m68k,
53 (PTRACE_ARG3_TYPE) &inferior_fp_registers,
54 ptrace_$floating_set_m68k);
55
56 ptrace (PTRACE_GETREGS, inferior_pid,
57 (PTRACE_ARG3_TYPE) &inferior_control_registers,
58 ptrace_$control_set_m68k,
59 (PTRACE_ARG3_TYPE) &inferior_control_registers,
60 ptrace_$control_set_m68k);
61
62 bcopy (&inferior_registers, registers, 16 * 4);
63 bcopy (&inferior_fp_registers, &registers[REGISTER_BYTE (FP0_REGNUM)],
64 sizeof inferior_fp_registers.regs);
65 *(int *)&registers[REGISTER_BYTE (PS_REGNUM)] = inferior_control_registers.sr;
66 *(int *)&registers[REGISTER_BYTE (PC_REGNUM)] = inferior_control_registers.pc;
67}
68
69/* Store our register values back into the inferior.
70 If REGNO is -1, do this for all registers.
71 Otherwise, REGNO specifies which register (so we can save time). */
72
73void
74store_inferior_registers (regno)
75 int regno;
76{
77 struct ptrace_$data_regs_m68k inferior_registers;
78 struct ptrace_$floating_regs_m68k inferior_fp_registers;
79 struct ptrace_$control_regs_m68k inferior_control_registers;
c906108c
SS
80
81 ptrace_$init_control(&inferior_control_registers);
82 inferior_fp_registers.size = sizeof(inferior_fp_registers);
83
84 ptrace (PTRACE_GETREGS, inferior_pid,
85 (PTRACE_ARG3_TYPE) &inferior_fp_registers,
86 ptrace_$floating_set_m68k,
87 (PTRACE_ARG3_TYPE) &inferior_fp_registers,
88 ptrace_$floating_set_m68k);
89
90 ptrace (PTRACE_GETREGS, inferior_pid,
91 (PTRACE_ARG3_TYPE) &inferior_control_registers,
92 ptrace_$control_set_m68k,
93 (PTRACE_ARG3_TYPE) &inferior_control_registers,
94 ptrace_$control_set_m68k);
95
96 bcopy (registers, &inferior_registers, sizeof(inferior_registers));
97
98 bcopy (&registers[REGISTER_BYTE (FP0_REGNUM)], inferior_fp_registers.regs,
99 sizeof inferior_fp_registers.regs);
100
101 inferior_control_registers.sr = *(int *)&registers[REGISTER_BYTE (PS_REGNUM)];
102 inferior_control_registers.pc = *(int *)&registers[REGISTER_BYTE (PC_REGNUM)];
103
104 ptrace (PTRACE_SETREGS, inferior_pid,
105 (PTRACE_ARG3_TYPE) &inferior_registers,
106 ptrace_$data_set_m68k,
107 (PTRACE_ARG3_TYPE) &inferior_registers,
108 ptrace_$data_set_m68k);
109
110 ptrace (PTRACE_SETREGS, inferior_pid,
111 (PTRACE_ARG3_TYPE) &inferior_fp_registers,
112 ptrace_$floating_set_m68k,
113 (PTRACE_ARG3_TYPE) &inferior_fp_registers,
114 ptrace_$floating_set_m68k);
115
116 ptrace (PTRACE_SETREGS, inferior_pid,
117 (PTRACE_ARG3_TYPE) &inferior_control_registers,
118 ptrace_$control_set_m68k,
119 (PTRACE_ARG3_TYPE) &inferior_control_registers,
120 ptrace_$control_set_m68k);
121}
This page took 0.053662 seconds and 4 git commands to generate.