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