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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [gdb-5.0/] [gdb/] [remote-vx68.c] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 104 markom
/* 68k-dependent portions of the RPC protocol
2
   used with a VxWorks target
3
 
4
   Contributed by Wind River Systems.
5
 
6
   This file is part of GDB.
7
 
8
   This program is free software; you can redistribute it and/or modify
9
   it under the terms of the GNU General Public License as published by
10
   the Free Software Foundation; either version 2 of the License, or
11
   (at your option) any later version.
12
 
13
   This program is distributed in the hope that it will be useful,
14
   but WITHOUT ANY WARRANTY; without even the implied warranty of
15
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
   GNU General Public License for more details.
17
 
18
   You should have received a copy of the GNU General Public License
19
   along with this program; if not, write to the Free Software
20
   Foundation, Inc., 59 Temple Place - Suite 330,
21
   Boston, MA 02111-1307, USA.  */
22
 
23
#include <stdio.h>
24
#include "defs.h"
25
 
26
#include "vx-share/regPacket.h"
27
#include "frame.h"
28
#include "inferior.h"
29
#include "gdb_wait.h"
30
#include "target.h"
31
#include "gdbcore.h"
32
#include "command.h"
33
#include "symtab.h"
34
#include "symfile.h"            /* for struct complaint */
35
 
36
#include "gdb_string.h"
37
#include <errno.h>
38
#include <signal.h>
39
#include <fcntl.h>
40
#include <sys/types.h>
41
#include <sys/time.h>
42
#include <sys/socket.h>
43
 
44
#ifdef _AIX                     /* IBM claims "void *malloc()" not char * */
45
#define malloc bogon_malloc
46
#endif
47
 
48
#include <rpc/rpc.h>
49
 
50
#ifdef _AIX
51
#undef malloc
52
#endif
53
 
54
#include <sys/time.h>           /* UTek's <rpc/rpc.h> doesn't #incl this */
55
#include <netdb.h>
56
#include "vx-share/ptrace.h"
57
#include "vx-share/xdr_ptrace.h"
58
#include "vx-share/xdr_ld.h"
59
#include "vx-share/xdr_rdb.h"
60
#include "vx-share/dbgRpcLib.h"
61
 
62
/* get rid of value.h if possible */
63
#include <value.h>
64
#include <symtab.h>
65
 
66
/* Flag set if target has fpu */
67
 
68
extern int target_has_fp;
69
 
70
/* Generic register read/write routines in remote-vx.c.  */
71
 
72
extern void net_read_registers ();
73
extern void net_write_registers ();
74
 
75
/* Read a register or registers from the VxWorks target.
76
   REGNO is the register to read, or -1 for all; currently,
77
   it is ignored.  FIXME look at regno to improve efficiency.  */
78
 
79
void
80
vx_read_register (regno)
81
     int regno;
82
{
83
  char mc68k_greg_packet[MC68K_GREG_PLEN];
84
  char mc68k_fpreg_packet[MC68K_FPREG_PLEN];
85
 
86
  /* Get general-purpose registers.  */
87
 
88
  net_read_registers (mc68k_greg_packet, MC68K_GREG_PLEN, PTRACE_GETREGS);
89
 
90
  bcopy (&mc68k_greg_packet[MC68K_R_D0], registers, 16 * MC68K_GREG_SIZE);
91
  bcopy (&mc68k_greg_packet[MC68K_R_SR], &registers[REGISTER_BYTE (PS_REGNUM)],
92
         MC68K_GREG_SIZE);
93
  bcopy (&mc68k_greg_packet[MC68K_R_PC], &registers[REGISTER_BYTE (PC_REGNUM)],
94
         MC68K_GREG_SIZE);
95
 
96
  /* Get floating-point registers, if the target system has them.
97
     Otherwise, zero them.  */
98
 
99
  if (target_has_fp)
100
    {
101
      net_read_registers (mc68k_fpreg_packet, MC68K_FPREG_PLEN,
102
                          PTRACE_GETFPREGS);
103
 
104
      bcopy (&mc68k_fpreg_packet[MC68K_R_FP0],
105
             &registers[REGISTER_BYTE (FP0_REGNUM)],
106
             MC68K_FPREG_SIZE * 8);
107
      bcopy (&mc68k_fpreg_packet[MC68K_R_FPCR],
108
             &registers[REGISTER_BYTE (FPC_REGNUM)],
109
             MC68K_FPREG_PLEN - (MC68K_FPREG_SIZE * 8));
110
    }
111
  else
112
    {
113
      bzero (&registers[REGISTER_BYTE (FP0_REGNUM)],
114
             MC68K_FPREG_SIZE * 8);
115
      bzero (&registers[REGISTER_BYTE (FPC_REGNUM)],
116
             MC68K_FPREG_PLEN - (MC68K_FPREG_SIZE * 8));
117
    }
118
 
119
  /* Mark the register cache valid.  */
120
 
121
  registers_fetched ();
122
}
123
 
124
/* Store a register or registers into the VxWorks target.
125
   REGNO is the register to store, or -1 for all; currently,
126
   it is ignored.  FIXME look at regno to improve efficiency.  */
127
 
128
void
129
vx_write_register (regno)
130
     int regno;
131
{
132
  char mc68k_greg_packet[MC68K_GREG_PLEN];
133
  char mc68k_fpreg_packet[MC68K_FPREG_PLEN];
134
 
135
  /* Store general-purpose registers.  */
136
 
137
  bcopy (registers, &mc68k_greg_packet[MC68K_R_D0], 16 * MC68K_GREG_SIZE);
138
  bcopy (&registers[REGISTER_BYTE (PS_REGNUM)],
139
         &mc68k_greg_packet[MC68K_R_SR], MC68K_GREG_SIZE);
140
  bcopy (&registers[REGISTER_BYTE (PC_REGNUM)],
141
         &mc68k_greg_packet[MC68K_R_PC], MC68K_GREG_SIZE);
142
 
143
  net_write_registers (mc68k_greg_packet, MC68K_GREG_PLEN, PTRACE_SETREGS);
144
 
145
  /* Store floating point registers if the target has them.  */
146
 
147
  if (target_has_fp)
148
    {
149
      bcopy (&registers[REGISTER_BYTE (FP0_REGNUM)],
150
             &mc68k_fpreg_packet[MC68K_R_FP0],
151
             MC68K_FPREG_SIZE * 8);
152
      bcopy (&registers[REGISTER_BYTE (FPC_REGNUM)],
153
             &mc68k_fpreg_packet[MC68K_R_FPCR],
154
             MC68K_FPREG_PLEN - (MC68K_FPREG_SIZE * 8));
155
 
156
      net_write_registers (mc68k_fpreg_packet, MC68K_FPREG_PLEN,
157
                           PTRACE_SETFPREGS);
158
    }
159
}

powered by: WebSVN 2.1.0

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