* ltconfig, ltmain.sh, libtool.m4, ltcf-c.sh, ltcf-cxx.sh,
[deliverable/binutils-gdb.git] / gdb / remote-vx960.c
CommitLineData
c906108c
SS
1/* i80960-dependent portions of the RPC protocol
2 used with a VxWorks target
3
c5aa993b 4 Contributed by Wind River Systems.
c906108c 5
c5aa993b 6 This file is part of GDB.
c906108c 7
c5aa993b
JM
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.
c906108c 12
c5aa993b
JM
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.
c906108c 17
c5aa993b
JM
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. */
c906108c
SS
22
23#include <stdio.h>
24#include "defs.h"
25
c5aa993b 26#include "vx-share/regPacket.h"
c906108c
SS
27#include "frame.h"
28#include "inferior.h"
c906108c
SS
29#include "target.h"
30#include "gdbcore.h"
31#include "command.h"
32#include "symtab.h"
33#include "symfile.h" /* for struct complaint */
4e052eda 34#include "regcache.h"
c906108c
SS
35
36#include "gdb_string.h"
37#include <errno.h>
c906108c
SS
38#include <fcntl.h>
39#include <sys/types.h>
40#include <sys/time.h>
41#include <sys/socket.h>
42
c5aa993b 43#ifdef _AIX /* IBM claims "void *malloc()" not char * */
c906108c
SS
44#define malloc bogon_malloc
45#endif
46
47#include <rpc/rpc.h>
48#include <sys/time.h> /* UTek's <rpc/rpc.h> doesn't #incl this */
49#include <netdb.h>
50#include "vx-share/ptrace.h"
51#include "vx-share/xdr_ptrace.h"
52#include "vx-share/xdr_ld.h"
53#include "vx-share/xdr_rdb.h"
54#include "vx-share/dbgRpcLib.h"
55
56/* get rid of value.h if possible */
57#include <value.h>
58#include <symtab.h>
59
60/* Flag set if target has fpu */
61
62extern int target_has_fp;
63
64/* 960 floating point format descriptor, from "i960-tdep.c." */
65
66extern struct ext_format ext_format_i960;
67
68/* Generic register read/write routines in remote-vx.c. */
69
70extern void net_read_registers ();
71extern void net_write_registers ();
72
73/* Read a register or registers from the VxWorks target.
74 REGNO is the register to read, or -1 for all; currently,
75 it is ignored. FIXME look at regno to improve efficiency. */
76
77void
fba45db2 78vx_read_register (int regno)
c906108c
SS
79{
80 char i960_greg_packet[I960_GREG_PLEN];
81 char i960_fpreg_packet[I960_FPREG_PLEN];
82
83 /* Get general-purpose registers. When copying values into
84 registers [], don't assume that a location in registers []
85 is properly aligned for the target data type. */
86
87 net_read_registers (i960_greg_packet, I960_GREG_PLEN, PTRACE_GETREGS);
88
89 bcopy (&i960_greg_packet[I960_R_R0],
90 &registers[REGISTER_BYTE (R0_REGNUM)], 16 * I960_GREG_SIZE);
91 bcopy (&i960_greg_packet[I960_R_G0],
92 &registers[REGISTER_BYTE (G0_REGNUM)], 16 * I960_GREG_SIZE);
93 bcopy (&i960_greg_packet[I960_R_PCW],
94 &registers[REGISTER_BYTE (PCW_REGNUM)], sizeof (int));
95 bcopy (&i960_greg_packet[I960_R_ACW],
96 &registers[REGISTER_BYTE (ACW_REGNUM)], sizeof (int));
97 bcopy (&i960_greg_packet[I960_R_TCW],
98 &registers[REGISTER_BYTE (TCW_REGNUM)], sizeof (int));
99
100 /* If the target has floating point registers, fetch them.
101 Otherwise, zero the floating point register values in
102 registers[] for good measure, even though we might not
103 need to. */
104
105 if (target_has_fp)
106 {
107 net_read_registers (i960_fpreg_packet, I960_FPREG_PLEN,
c5aa993b
JM
108 PTRACE_GETFPREGS);
109 bcopy (&i960_fpreg_packet[I960_R_FP0],
110 &registers[REGISTER_BYTE (FP0_REGNUM)],
111 REGISTER_RAW_SIZE (FP0_REGNUM) * 4);
c906108c
SS
112 }
113 else
114 bzero (&registers[REGISTER_BYTE (FP0_REGNUM)],
c5aa993b 115 REGISTER_RAW_SIZE (FP0_REGNUM) * 4);
c906108c
SS
116
117 /* Mark the register cache valid. */
118
119 registers_fetched ();
120}
121
122/* Store a register or registers into the VxWorks target.
123 REGNO is the register to store, or -1 for all; currently,
124 it is ignored. FIXME look at regno to improve efficiency. */
125
126void
fba45db2 127vx_write_register (int regno)
c906108c
SS
128{
129 char i960_greg_packet[I960_GREG_PLEN];
130 char i960_fpreg_packet[I960_FPREG_PLEN];
131
132 /* Store floating-point registers. When copying values from
133 registers [], don't assume that a location in registers []
134 is properly aligned for the target data type. */
135
136 bcopy (&registers[REGISTER_BYTE (R0_REGNUM)],
137 &i960_greg_packet[I960_R_R0], 16 * I960_GREG_SIZE);
138 bcopy (&registers[REGISTER_BYTE (G0_REGNUM)],
139 &i960_greg_packet[I960_R_G0], 16 * I960_GREG_SIZE);
140 bcopy (&registers[REGISTER_BYTE (PCW_REGNUM)],
141 &i960_greg_packet[I960_R_PCW], sizeof (int));
142 bcopy (&registers[REGISTER_BYTE (ACW_REGNUM)],
143 &i960_greg_packet[I960_R_ACW], sizeof (int));
144 bcopy (&registers[REGISTER_BYTE (TCW_REGNUM)],
145 &i960_greg_packet[I960_R_TCW], sizeof (int));
146
147 net_write_registers (i960_greg_packet, I960_GREG_PLEN, PTRACE_SETREGS);
148
149 /* Store floating point registers if the target has them. */
150
151 if (target_has_fp)
152 {
c5aa993b 153 bcopy (&registers[REGISTER_BYTE (FP0_REGNUM)],
c906108c
SS
154 &i960_fpreg_packet[I960_R_FP0],
155 REGISTER_RAW_SIZE (FP0_REGNUM) * 4);
156
157 net_write_registers (i960_fpreg_packet, I960_FPREG_PLEN,
c5aa993b 158 PTRACE_SETFPREGS);
c906108c
SS
159 }
160}
This page took 0.114192 seconds and 4 git commands to generate.