OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [insight/] [gdb/] [a68v-nat.c] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 578 markom
/* Host-dependent code for Apollo-68ks for GDB, the GNU debugger.
2
   Copyright 1986, 1987, 1989, 1991, 1992, 1993, 1999, 2000, 2001
3
   Free Software Foundation, Inc.
4
 
5
   This file is part of GDB.
6
 
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.
11
 
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.
16
 
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.  */
21
 
22
#include "defs.h"
23
#include "inferior.h"
24
#include "regcache.h"
25
 
26
#ifndef _ISP__M68K
27
#define _ISP__M68K 1
28
#endif
29
 
30
#include <ptrace.h>
31
 
32
extern int errno;
33
 
34
void
35
fetch_inferior_registers (int ignored)
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;
40
 
41
  ptrace_$init_control (&inferior_control_registers);
42
  inferior_fp_registers.size = sizeof (inferior_fp_registers);
43
 
44
  registers_fetched ();
45
 
46
  ptrace (PTRACE_GETREGS, PIDGET (inferior_ptid),
47
          (PTRACE_ARG3_TYPE) & inferior_registers,
48
          ptrace_$data_set,
49
          (PTRACE_ARG3_TYPE) & inferior_registers,
50
          ptrace_$data_set);
51
 
52
  ptrace (PTRACE_GETREGS, PIDGET (inferior_ptid),
53
          (PTRACE_ARG3_TYPE) & inferior_fp_registers,
54
          ptrace_$floating_set_m68k,
55
          (PTRACE_ARG3_TYPE) & inferior_fp_registers,
56
          ptrace_$floating_set_m68k);
57
 
58
  ptrace (PTRACE_GETREGS, PIDGET (inferior_ptid),
59
          (PTRACE_ARG3_TYPE) & inferior_control_registers,
60
          ptrace_$control_set_m68k,
61
          (PTRACE_ARG3_TYPE) & inferior_control_registers,
62
          ptrace_$control_set_m68k);
63
 
64
  bcopy (&inferior_registers, registers, 16 * 4);
65
  bcopy (&inferior_fp_registers, &registers[REGISTER_BYTE (FP0_REGNUM)],
66
         sizeof inferior_fp_registers.regs);
67
  *(int *) &registers[REGISTER_BYTE (PS_REGNUM)] = inferior_control_registers.sr;
68
  *(int *) &registers[REGISTER_BYTE (PC_REGNUM)] = inferior_control_registers.pc;
69
}
70
 
71
/* Store our register values back into the inferior.
72
   If REGNO is -1, do this for all registers.
73
   Otherwise, REGNO specifies which register (so we can save time).  */
74
 
75
void
76
store_inferior_registers (int regno)
77
{
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;
81
 
82
  ptrace_$init_control (&inferior_control_registers);
83
  inferior_fp_registers.size = sizeof (inferior_fp_registers);
84
 
85
  ptrace (PTRACE_GETREGS, PIDGET (inferior_ptid),
86
          (PTRACE_ARG3_TYPE) & inferior_fp_registers,
87
          ptrace_$floating_set_m68k,
88
          (PTRACE_ARG3_TYPE) & inferior_fp_registers,
89
          ptrace_$floating_set_m68k);
90
 
91
  ptrace (PTRACE_GETREGS, PIDGET (inferior_ptid),
92
          (PTRACE_ARG3_TYPE) & inferior_control_registers,
93
          ptrace_$control_set_m68k,
94
          (PTRACE_ARG3_TYPE) & inferior_control_registers,
95
          ptrace_$control_set_m68k);
96
 
97
  bcopy (registers, &inferior_registers, sizeof (inferior_registers));
98
 
99
  bcopy (&registers[REGISTER_BYTE (FP0_REGNUM)], inferior_fp_registers.regs,
100
         sizeof inferior_fp_registers.regs);
101
 
102
  inferior_control_registers.sr = *(int *) &registers[REGISTER_BYTE (PS_REGNUM)];
103
  inferior_control_registers.pc = *(int *) &registers[REGISTER_BYTE (PC_REGNUM)];
104
 
105
  ptrace (PTRACE_SETREGS, PIDGET (inferior_ptid),
106
          (PTRACE_ARG3_TYPE) & inferior_registers,
107
          ptrace_$data_set_m68k,
108
          (PTRACE_ARG3_TYPE) & inferior_registers,
109
          ptrace_$data_set_m68k);
110
 
111
  ptrace (PTRACE_SETREGS, PIDGET (inferior_ptid),
112
          (PTRACE_ARG3_TYPE) & inferior_fp_registers,
113
          ptrace_$floating_set_m68k,
114
          (PTRACE_ARG3_TYPE) & inferior_fp_registers,
115
          ptrace_$floating_set_m68k);
116
 
117
  ptrace (PTRACE_SETREGS, PIDGET (inferior_ptid),
118
          (PTRACE_ARG3_TYPE) & inferior_control_registers,
119
          ptrace_$control_set_m68k,
120
          (PTRACE_ARG3_TYPE) & inferior_control_registers,
121
          ptrace_$control_set_m68k);
122
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.