1 /* 68k-dependent portions of the RPC protocol
2 used with a VxWorks target
4 Contributed by Wind River Systems.
6 This file is part of GDB.
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.
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.
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. */
26 #include "vx-share/regPacket.h"
36 #include "gdb_string.h"
39 #include <sys/types.h>
41 #include <sys/socket.h>
43 #ifdef _AIX /* IBM claims "void *malloc()" not char * */
44 #define malloc bogon_malloc
53 #include <sys/time.h> /* UTek's <rpc/rpc.h> doesn't #incl this */
55 #include "vx-share/ptrace.h"
56 #include "vx-share/xdr_ptrace.h"
57 #include "vx-share/xdr_ld.h"
58 #include "vx-share/xdr_rdb.h"
59 #include "vx-share/dbgRpcLib.h"
61 /* get rid of value.h if possible */
65 /* Flag set if target has fpu */
67 extern int target_has_fp
;
69 /* Generic register read/write routines in remote-vx.c. */
71 extern void net_read_registers ();
72 extern void net_write_registers ();
74 /* Read a register or registers from the VxWorks target.
75 REGNO is the register to read, or -1 for all; currently,
76 it is ignored. FIXME look at regno to improve efficiency. */
79 vx_read_register (int regno
)
81 char mc68k_greg_packet
[MC68K_GREG_PLEN
];
82 char mc68k_fpreg_packet
[MC68K_FPREG_PLEN
];
84 /* Get general-purpose registers. */
86 net_read_registers (mc68k_greg_packet
, MC68K_GREG_PLEN
, PTRACE_GETREGS
);
88 memcpy (deprecated_registers
,
89 &mc68k_greg_packet
[MC68K_R_D0
]
90 16 * MC68K_GREG_SIZE
);
91 memcpy (&deprecated_registers
[DEPRECATED_REGISTER_BYTE (PS_REGNUM
)],
92 &mc68k_greg_packet
[MC68K_R_SR
],
94 memcpy (&deprecated_registers
[DEPRECATED_REGISTER_BYTE (PC_REGNUM
)],
95 &mc68k_greg_packet
[MC68K_R_PC
],
98 /* Get floating-point registers, if the target system has them.
99 Otherwise, zero them. */
103 net_read_registers (mc68k_fpreg_packet
, MC68K_FPREG_PLEN
,
106 memcpy (&deprecated_registers
[DEPRECATED_REGISTER_BYTE (FP0_REGNUM
)],
107 &mc68k_fpreg_packet
[MC68K_R_FP0
],
108 MC68K_FPREG_SIZE
* 8);
109 memcpy (&deprecated_registers
[DEPRECATED_REGISTER_BYTE (FPC_REGNUM
)],
110 &mc68k_fpreg_packet
[MC68K_R_FPCR
],
111 MC68K_FPREG_PLEN
- (MC68K_FPREG_SIZE
* 8));
115 memset (&deprecated_registers
[DEPRECATED_REGISTER_BYTE (FP0_REGNUM
)],
116 0, MC68K_FPREG_SIZE
* 8);
117 memset (&deprecated_registers
[DEPRECATED_REGISTER_BYTE (FPC_REGNUM
)],
118 0, MC68K_FPREG_PLEN
- (MC68K_FPREG_SIZE
* 8));
121 /* Mark the register cache valid. */
123 deprecated_registers_fetched ();
126 /* Store a register or registers into the VxWorks target.
127 REGNO is the register to store, or -1 for all; currently,
128 it is ignored. FIXME look at regno to improve efficiency. */
131 vx_write_register (int regno
)
133 char mc68k_greg_packet
[MC68K_GREG_PLEN
];
134 char mc68k_fpreg_packet
[MC68K_FPREG_PLEN
];
136 /* Store general-purpose registers. */
138 memcpy (&mc68k_greg_packet
[MC68K_R_D0
], deprecated_registers
,
139 16 * MC68K_GREG_SIZE
);
140 memcpy (&mc68k_greg_packet
[MC68K_R_SR
],
141 &deprecated_registers
[DEPRECATED_REGISTER_BYTE (PS_REGNUM
)],
143 memcpy (&mc68k_greg_packet
[MC68K_R_PC
],
144 &deprecated_registers
[DEPRECATED_REGISTER_BYTE (PC_REGNUM
)],
147 net_write_registers (mc68k_greg_packet
, MC68K_GREG_PLEN
, PTRACE_SETREGS
);
149 /* Store floating point registers if the target has them. */
153 memcpy (&mc68k_fpreg_packet
[MC68K_R_FP0
],
154 &deprecated_registers
[DEPRECATED_REGISTER_BYTE (FP0_REGNUM
)],
155 MC68K_FPREG_SIZE
* 8);
156 memcpy (&mc68k_fpreg_packet
[MC68K_R_FPCR
],
157 &deprecated_registers
[DEPRECATED_REGISTER_BYTE (FPC_REGNUM
)],
158 MC68K_FPREG_PLEN
- (MC68K_FPREG_SIZE
* 8));
160 net_write_registers (mc68k_fpreg_packet
, MC68K_FPREG_PLEN
,
This page took 0.035932 seconds and 4 git commands to generate.