aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKung Hsu <kung@cygnus>1995-01-16 23:56:41 +0000
committerKung Hsu <kung@cygnus>1995-01-16 23:56:41 +0000
commit83d9bb1416873498a6eb2da72e01fcdcb51b6370 (patch)
tree6741f5f16ce34bfa8b63d3fb7657bee48b266b1f
parentfcad29ce262809eee13a964bbf3ffcd32740432c (diff)
downloadfsf-binutils-gdb-83d9bb1416873498a6eb2da72e01fcdcb51b6370.zip
fsf-binutils-gdb-83d9bb1416873498a6eb2da72e01fcdcb51b6370.tar.gz
fsf-binutils-gdb-83d9bb1416873498a6eb2da72e01fcdcb51b6370.tar.bz2
* Makefile.in: add new files remote-vx29k.c, config/a29k/tm-vx29k.h,
and config/a29k/vx29k.mt. * configure.in: add new configuration a29k-*-vxworks. * remote-vx29k.c: new file merged from WRS. * remote-vx.c: merge changes from WRS.
-rw-r--r--gdb/ChangeLog10
-rw-r--r--gdb/Makefile.in10
-rw-r--r--gdb/configure.in2
-rw-r--r--gdb/remote-vx.c290
-rw-r--r--gdb/remote-vx29k.c169
5 files changed, 360 insertions, 121 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index c94f4d0..a0e80c2 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,13 @@
+Mon Jan 16 15:43:29 1995 Kung Hsu <kung@mexican.cygnus.com>
+
+ * Makefile.in: add new files remote-vx29k.c, config/a29k/tm-vx29k.h,
+ and config/a29k/vx29k.mt.
+ * configure.in: add new configuration a29k-*-vxworks.
+ * remote-vx29k.c: new file merged from WRS.
+ * remote-vx.c: merge changes from WRS.
+ * config/a29k/vx29k.mt: new file for new configuration.
+ * config/a29k/tm-vx29k.h: new header file for newconfiguration.
+
Sun Jan 15 14:36:19 1995 Steve Chamberlain <sac@splat>
* breakpoint.h (disable_breakpoint, enable_breakpoint):
diff --git a/gdb/Makefile.in b/gdb/Makefile.in
index 764783b..6ee9449 100644
--- a/gdb/Makefile.in
+++ b/gdb/Makefile.in
@@ -898,7 +898,8 @@ ALLDEPFILES = 29k-share/udi/udip2soc.c 29k-share/udi/udr.c \
remote-hms.c remote-mips.c \
remote-mm.c remote-mon.c remote-nindy.c remote-os9k.c remote-sim.c \
remote-st.c remote-utils.c dcache.c \
- remote-udi.c remote-vx.c remote-z8k.c rs6000-nat.c rs6000-pinsn.c \
+ remote-udi.c remote-vx.c remote-vx29k.c remote-z8k.c \
+ rs6000-nat.c rs6000-pinsn.c \
rs6000-tdep.c ser-go32.c ser-tcp.c sh-tdep.c solib.c sparc-nat.c \
sparc-pinsn.c sparc-tdep.c sparcl-tdep.c sun3-nat.c sun386-nat.c \
symm-tdep.c symm-nat.c \
@@ -907,7 +908,7 @@ ALLDEPFILES = 29k-share/udi/udip2soc.c 29k-share/udi/udr.c \
vx-share/xdr_ld.c vx-share/xdr_ptrace.c vx-share/xdr_rdb.c \
xcoffread.c xcoffsolib.c z8k-tdep.c
-ALLCONFIG = config/a29k/a29k-kern.mt config/a29k/a29k-udi.mt \
+ALLCONFIG = config/a29k/a29k-kern.mt config/a29k/a29k-udi.mt config/a29k/vx29k.mt\
config/a29k/a29k.mt config/a29k/ultra3.mh config/a29k/ultra3.mt \
config/alpha/alpha-osf1.mh config/alpha/alpha-osf2.mh \
config/alpha/alpha-osf1.mt config/alpha/alpha-nw.mt \
@@ -1351,6 +1352,11 @@ remote-vx.o: remote-vx.c $(wait_h) complaints.h $(defs_h) $(gdbcmd_h) \
vx-share/ptrace.h vx-share/xdr_ld.h vx-share/xdr_ptrace.h \
vx-share/xdr_rdb.h gdb-stabs.h objfiles.h symfile.h $(bfd_h)
+remote-vx29k.o: remote-vx29k.c $(wait_h) complaints.h $(defs_h) $(gdbcmd_h) \
+ $(gdbcore_h) $(inferior_h) target.h vx-share/dbgRpcLib.h \
+ vx-share/ptrace.h vx-share/xdr_ld.h vx-share/xdr_ptrace.h \
+ vx-share/xdr_rdb.h
+
remote-z8k.o: remote-z8k.c $(wait_h) $(srcdir)/../sim/z8k/sim.h \
$(defs_h) $(gdbcore_h) $(inferior_h) target.h terminal.h
diff --git a/gdb/configure.in b/gdb/configure.in
index 9afcd56..9c1e235 100644
--- a/gdb/configure.in
+++ b/gdb/configure.in
@@ -187,11 +187,13 @@ a29k-*-kern*) gdb_target=a29k-kern ;;
a29k-*-none*) gdb_target=a29k ;;
a29k-*-sym1*) gdb_target=ultra3 ;;
a29k-*-udi*) gdb_target=a29k-udi ;;
+a29k-*-vxworks*) gdb_target=vx29k ;;
alpha-*-osf*) gdb_target=alpha-osf1 ;;
alpha-*-netware*) gdb_target=alpha-nw
configdirs="${configdirs} nlm" ;;
+arc-*-*) gdb_target=arc ;;
arm-*-*) gdb_target=arm ;;
c1-*-*) gdb_target=convex ;;
diff --git a/gdb/remote-vx.c b/gdb/remote-vx.c
index 2de3bc5..7c2da88 100644
--- a/gdb/remote-vx.c
+++ b/gdb/remote-vx.c
@@ -56,9 +56,16 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include <symtab.h>
+/* Maximum number of bytes to transfer in a single
+ PTRACE_{READ,WRITE}DATA request. */
+#define VX_MEMXFER_MAX 4096
+
+extern void vx_read_register ();
+extern void vx_write_register ();
extern void symbol_file_command ();
extern int stop_soon_quietly; /* for wait_for_inferior */
+static int net_step ();
static int net_ptrace_clnt_call (); /* Forward decl */
static enum clnt_stat net_clnt_call (); /* Forward decl */
extern struct target_ops vx_ops, vx_run_ops; /* Forward declaration */
@@ -72,7 +79,7 @@ static char *vx_running; /* Called function */
/* Nonzero means target that is being debugged remotely has a floating
point processor. */
-static int target_has_fp;
+int target_has_fp;
/* Default error message when the network is forking up. */
@@ -340,7 +347,13 @@ net_wait (pEvent)
status = net_clnt_call (PROCESS_WAIT, xdr_int, &pid, xdr_RDB_EVENT,
pEvent);
- return (status == RPC_SUCCESS)? pEvent->status: -1;
+ /* return (status == RPC_SUCCESS)? pEvent->status: -1; */
+ if (status == RPC_SUCCESS)
+ return ((pEvent->status) ? 1 : 0);
+ else if (status == RPC_TIMEDOUT)
+ return (1);
+ else
+ return (-1);
}
/* Suspend the remote task.
@@ -369,137 +382,100 @@ net_quit ()
/* Read a register or registers from the remote system. */
static void
-vx_read_register (regno)
- int regno;
+net_read_registers (reg_buf, len, procnum)
+ char *reg_buf;
+ int len;
+ u_long procnum;
{
int status;
Rptrace ptrace_in;
Ptrace_return ptrace_out;
- C_bytes in_data;
C_bytes out_data;
- extern char registers[];
+ char message[100];
- memset ((char *) &ptrace_in, '\0', sizeof (ptrace_in));
- memset ((char *) &ptrace_out, '\0', sizeof (ptrace_out));
+ bzero ((char *) &ptrace_in, sizeof (ptrace_in));
+ bzero ((char *) &ptrace_out, sizeof (ptrace_out));
+
+ /* Initialize RPC input argument structure. */
- /* FIXME, eventually only get the ones we need. */
- registers_fetched ();
-
ptrace_in.pid = inferior_pid;
+ ptrace_in.info.ttype = NOINFO;
+
+ /* Initialize RPC return value structure. */
+
+ out_data.bytes = reg_buf;
+ out_data.len = len;
ptrace_out.info.more_data = (caddr_t) &out_data;
- out_data.len = VX_NUM_REGS * REGISTER_RAW_SIZE (0);
- out_data.bytes = (caddr_t) registers;
-
- status = net_ptrace_clnt_call (PTRACE_GETREGS, &ptrace_in, &ptrace_out);
+
+ /* Call RPC; take an error exit if appropriate. */
+
+ status = net_ptrace_clnt_call (procnum, &ptrace_in, &ptrace_out);
if (status)
error (rpcerr);
if (ptrace_out.status == -1)
{
- errno = ptrace_out.errno;
- perror_with_name ("net_ptrace_clnt_call(PTRACE_GETREGS)");
- }
-
-#ifdef VX_SIZE_FPREGS
- /* If the target has floating point registers, fetch them.
- Otherwise, zero the floating point register values in
- registers[] for good measure, even though we might not
- need to. */
-
- if (target_has_fp)
- {
- ptrace_in.pid = inferior_pid;
- ptrace_out.info.more_data = (caddr_t) &out_data;
- out_data.len = VX_SIZE_FPREGS;
- out_data.bytes = (caddr_t) &registers[REGISTER_BYTE (FP0_REGNUM)];
-
- status = net_ptrace_clnt_call (PTRACE_GETFPREGS, &ptrace_in, &ptrace_out);
- if (status)
- error (rpcerr);
- if (ptrace_out.status == -1)
- {
- errno = ptrace_out.errno;
- perror_with_name ("net_ptrace_clnt_call(PTRACE_GETFPREGS)");
- }
- }
- else
- {
- memset (&registers[REGISTER_BYTE (FP0_REGNUM)], '\0', VX_SIZE_FPREGS);
+ errno = ptrace_out.errno_val;
+ sprintf (message, "reading %s registers", (procnum == PTRACE_GETREGS)
+ ? "general-purpose"
+ : "floating-point");
+ perror_with_name (message);
}
-#endif /* VX_SIZE_FPREGS */
-}
-
-/* Prepare to store registers. Since we will store all of them,
- read out their current values now. */
-
-static void
-vx_prepare_to_store ()
-{
- /* Fetch all registers, if any of them are not yet fetched. */
- read_register_bytes (0, NULL, REGISTER_BYTES);
}
+/* Write register values to a VxWorks target. REG_BUF points to a buffer
+ containing the raw register values, LEN is the length of REG_BUF in
+ bytes, and PROCNUM is the RPC procedure number (PTRACE_SETREGS or
+ PTRACE_SETFPREGS). An error exit is taken if the RPC call fails or
+ if an error status is returned by the remote debug server. This is
+ a utility routine used by vx_write_register (). */
-/* Store our register values back into the inferior.
- If REGNO is -1, do this for all registers.
- Otherwise, REGNO specifies which register (so we can save time). */
-/* FIXME, look at REGNO to save time here */
-
-static void
-vx_write_register (regno)
- int regno;
+void
+net_write_registers (reg_buf, len, procnum)
+ char *reg_buf;
+ int len;
+ u_long procnum;
{
- C_bytes in_data;
- C_bytes out_data;
- extern char registers[];
int status;
Rptrace ptrace_in;
Ptrace_return ptrace_out;
+ C_bytes in_data;
+ char message[100];
- memset ((char *) &ptrace_in, '\0', sizeof (ptrace_in));
- memset ((char *) &ptrace_out, '\0', sizeof (ptrace_out));
+ bzero ((char *) &ptrace_in, sizeof (ptrace_in));
+ bzero ((char *) &ptrace_out, sizeof (ptrace_out));
+
+ /* Initialize RPC input argument structure. */
+
+ in_data.bytes = reg_buf;
+ in_data.len = len;
ptrace_in.pid = inferior_pid;
- ptrace_in.info.ttype = DATA;
+ ptrace_in.info.ttype = DATA;
ptrace_in.info.more_data = (caddr_t) &in_data;
- in_data.bytes = registers;
-
- in_data.len = VX_NUM_REGS * REGISTER_SIZE;
+ /* Call RPC; take an error exit if appropriate. */
- /* XXX change second param to be a proc number */
- status = net_ptrace_clnt_call (PTRACE_SETREGS, &ptrace_in, &ptrace_out);
+ status = net_ptrace_clnt_call (procnum, &ptrace_in, &ptrace_out);
if (status)
error (rpcerr);
if (ptrace_out.status == -1)
{
- errno = ptrace_out.errno;
- perror_with_name ("net_ptrace_clnt_call(PTRACE_SETREGS)");
+ errno = ptrace_out.errno_val;
+ sprintf (message, "writing %s registers", (procnum == PTRACE_SETREGS)
+ ? "general-purpose"
+ : "floating-point");
+ perror_with_name (message);
}
+}
-#ifdef VX_SIZE_FPREGS
- /* Store floating point registers if the target has them. */
-
- if (target_has_fp)
- {
- ptrace_in.pid = inferior_pid;
- ptrace_in.info.ttype = DATA;
- ptrace_in.info.more_data = (caddr_t) &in_data;
-
-
- in_data.bytes = &registers[REGISTER_BYTE (FP0_REGNUM)];
- in_data.len = VX_SIZE_FPREGS;
+/* Prepare to store registers. Since we will store all of them,
+ read out their current values now. */
- status = net_ptrace_clnt_call (PTRACE_SETFPREGS, &ptrace_in,
- &ptrace_out);
- if (status)
- error (rpcerr);
- if (ptrace_out.status == -1)
- {
- errno = ptrace_out.errno;
- perror_with_name ("net_ptrace_clnt_call(PTRACE_SETFPREGS)");
- }
- }
-#endif /* VX_SIZE_FPREGS */
+static void
+vx_prepare_to_store ()
+{
+ /* Fetch all registers, if any of them are not yet fetched. */
+ read_register_bytes (0, NULL, REGISTER_BYTES);
}
/* Copy LEN bytes to or from remote inferior's memory starting at MEMADDR
@@ -522,6 +498,7 @@ vx_xfer_memory (memaddr, myaddr, len, write, target)
Rptrace ptrace_in;
Ptrace_return ptrace_out;
C_bytes data;
+ enum ptracereq request;
memset ((char *) &ptrace_in, '\0', sizeof (ptrace_in));
memset ((char *) &ptrace_out, '\0', sizeof (ptrace_out));
@@ -537,28 +514,55 @@ vx_xfer_memory (memaddr, myaddr, len, write, target)
data.bytes = (caddr_t) myaddr; /* Where from */
data.len = len; /* How many bytes (again, for XDR) */
-
- /* XXX change second param to be a proc number */
- status = net_ptrace_clnt_call (PTRACE_WRITEDATA, &ptrace_in,
- &ptrace_out);
+ request = PTRACE_WRITEDATA;
}
else
{
ptrace_out.info.more_data = (caddr_t) &data;
- data.bytes = myaddr; /* Where to */
- data.len = len; /* How many (again, for XDR) */
-
- /* XXX change second param to be a proc number */
- status = net_ptrace_clnt_call (PTRACE_READDATA, &ptrace_in, &ptrace_out);
+ request = PTRACE_READDATA;
}
+ /* Loop until the entire request has been satisfied, transferring
+ at most VX_MEMXFER_MAX bytes per iteration. Break from the loop
+ if an error status is returned by the remote debug server. */
- if (status)
- error (rpcerr);
- if (ptrace_out.status == -1)
+ nleft = len;
+ status = 0;
+
+ while (nleft > 0 && status == 0)
{
- return 0; /* No bytes moved */
+ nxfer = min (nleft, VX_MEMXFER_MAX);
+
+ ptrace_in.addr = (int) memaddr;
+ ptrace_in.data = nxfer;
+ data.bytes = (caddr_t) myaddr;
+ data.len = nxfer;
+
+ /* Request a block from the remote debug server; if RPC fails,
+ report an error and return to debugger command level. */
+
+ if (net_ptrace_clnt_call (request, &ptrace_in, &ptrace_out))
+ error (rpcerr);
+
+ status = ptrace_out.status;
+ if (status == 0)
+ {
+ memaddr += nxfer;
+ myaddr += nxfer;
+ nleft -= nxfer;
+ }
+ else
+ {
+ /* A target-side error has ocurred. Set errno to the error
+ code chosen by the target so that a later perror () will
+ say something meaningful. */
+
+ errno = ptrace_out.errno_val;
+ }
}
- return len; /* Moved *all* the bytes */
+
+ /* Return the number of bytes transferred. */
+
+ return (len - nleft);
}
static void
@@ -589,6 +593,7 @@ vx_resume (pid, step, siggnal)
int status;
Rptrace ptrace_in;
Ptrace_return ptrace_out;
+ CORE_ADDR cont_addr;
if (pid == -1)
pid = inferior_pid;
@@ -596,15 +601,29 @@ vx_resume (pid, step, siggnal)
if (siggnal != 0 && siggnal != stop_signal)
error ("Cannot send signals to VxWorks processes");
+ /* Set CONT_ADDR to the address at which we are continuing,
+ or to 1 if we are continuing from where the program stopped.
+ This conforms to traditional ptrace () usage, but at the same
+ time has special meaning for the VxWorks remote debug server.
+ If the address is not 1, the server knows that the target
+ program is jumping to a new address, which requires special
+ handling if there is a breakpoint at the new address. */
+
+ cont_addr = read_register (PC_REGNUM);
+ if (cont_addr == stop_pc)
+ cont_addr = 1;
+
memset ((char *) &ptrace_in, '\0', sizeof (ptrace_in));
memset ((char *) &ptrace_out, '\0', sizeof (ptrace_out));
ptrace_in.pid = pid;
- ptrace_in.addr = 1; /* Target side insists on this, or it panics. */
+ ptrace_in.addr = cont_addr; /* Target side insists on this, or it panics. */
+
+ if (step)
+ status = net_step();
+ else
+ status = net_ptrace_clnt_call (PTRACE_CONT, &ptrace_in, &ptrace_out);
- /* XXX change second param to be a proc number */
- status = net_ptrace_clnt_call (step? PTRACE_SINGLESTEP: PTRACE_CONT,
- &ptrace_in, &ptrace_out);
if (status)
error (rpcerr);
if (ptrace_out.status == -1)
@@ -719,6 +738,18 @@ vx_load_command (arg_string, from_tty)
dont_repeat ();
+ /* Refuse to load the module if a debugged task is running. Doing so
+ can have a number of unpleasant consequences to the running task. */
+
+ if (inferior_pid != 0 && target_has_execution)
+ {
+ if (query ("You may not load a module while the target task is running.\n\
+Kill the target task? "))
+ target_kill ();
+ else
+ error ("Load cancelled.");
+ }
+
QUIT;
immediate_quit++;
if (net_load (arg_string, &text_addr, &data_addr, &bss_addr) == -1)
@@ -732,7 +763,6 @@ vx_load_command (arg_string, from_tty)
reinit_frame_cache ();
}
-#ifdef FIXME /* Not ready for prime time */
/* Single step the target program at the source or machine level.
Takes an error exit if rpc fails.
Returns -1 if remote single-step operation fails, else 0. */
@@ -765,7 +795,6 @@ net_step ()
else
error (rpcerr);
}
-#endif
/* Emulate ptrace using RPC calls to the VxWorks target system.
Returns nonzero (-1) if RPC status to VxWorks is bad, 0 otherwise. */
@@ -1228,6 +1257,29 @@ vx_attach (args, from_tty)
in order for other parts of GDB to work correctly. */
inferior_pid = pid;
vx_running = 0;
+#if defined (START_INFERIOR_HOOK)
+ START_INFERIOR_HOOK ();
+#endif
+
+ mark_breakpoints_out ();
+
+ /* Set up the "saved terminal modes" of the inferior
+ based on what modes we are starting it with. */
+
+ target_terminal_init ();
+
+ /* Install inferior's terminal modes. */
+
+ target_terminal_inferior ();
+
+ /* We will get a task spawn event immediately. */
+
+ init_wait_for_inferior ();
+ clear_proceed_status ();
+ stop_soon_quietly = 1;
+ wait_for_inferior ();
+ stop_soon_quietly = 0;
+ normal_stop ();
}
diff --git a/gdb/remote-vx29k.c b/gdb/remote-vx29k.c
new file mode 100644
index 0000000..519d930
--- /dev/null
+++ b/gdb/remote-vx29k.c
@@ -0,0 +1,169 @@
+/* Am29k-dependent portions of the RPC protocol
+ used with a VxWorks target
+
+Contributed by Wind River Systems.
+
+This file is part of GDB.
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
+
+#include <stdio.h>
+#include "defs.h"
+
+#include "vx-share/regPacket.h"
+#include "frame.h"
+#include "inferior.h"
+#include "wait.h"
+#include "target.h"
+#include "gdbcore.h"
+#include "command.h"
+#include "symtab.h"
+#include "symfile.h" /* for struct complaint */
+
+#include <string.h>
+#include <errno.h>
+#include <signal.h>
+#include <fcntl.h>
+#include <sys/types.h>
+#include <sys/time.h>
+#include <sys/socket.h>
+
+#ifdef _AIX /* IBM claims "void *malloc()" not char * */
+#define malloc bogon_malloc
+#endif
+
+#include <rpc/rpc.h>
+#include <sys/time.h> /* UTek's <rpc/rpc.h> doesn't #incl this */
+#include <netdb.h>
+#include "vx-share/ptrace.h"
+#include "vx-share/xdr_ptrace.h"
+#include "vx-share/xdr_ld.h"
+#include "vx-share/xdr_rdb.h"
+#include "vx-share/dbgRpcLib.h"
+
+/* get rid of value.h if possible */
+#include <value.h>
+#include <symtab.h>
+
+/* Flag set if target has fpu */
+
+extern int target_has_fp;
+
+/* Generic register read/write routines in remote-vx.c. */
+
+extern void net_read_registers ();
+extern void net_write_registers ();
+
+/* Read a register or registers from the VxWorks target.
+ REGNO is the register to read, or -1 for all; currently,
+ it is ignored. FIXME look at regno to improve efficiency. */
+
+void
+vx_read_register (regno)
+ int regno;
+{
+ char am29k_greg_packet[AM29K_GREG_PLEN];
+ char am29k_fpreg_packet[AM29K_FPREG_PLEN];
+
+ /* Get general-purpose registers. When copying values into
+ registers [], don't assume that a location in registers []
+ is properly aligned for the target data type. */
+
+ net_read_registers (am29k_greg_packet, AM29K_GREG_PLEN, PTRACE_GETREGS);
+
+ /* Now copy the register values into registers[].
+ Note that this code depends on the ordering of the REGNUMs
+ as defined in "tm-29k.h". */
+
+ bcopy (&am29k_greg_packet[AM29K_R_GR96],
+ &registers[REGISTER_BYTE (GR96_REGNUM)], 160 * AM29K_GREG_SIZE);
+ bcopy (&am29k_greg_packet[AM29K_R_VAB],
+ &registers[REGISTER_BYTE (VAB_REGNUM)], 15 * AM29K_GREG_SIZE);
+ registers[REGISTER_BYTE (INTE_REGNUM)] = am29k_greg_packet[AM29K_R_INTE];
+ bcopy (&am29k_greg_packet[AM29K_R_RSP],
+ &registers[REGISTER_BYTE (GR1_REGNUM)], 5 * AM29K_GREG_SIZE);
+
+ /* PAD For now, don't care about exop register */
+
+ bzero (&registers[REGISTER_BYTE (EXO_REGNUM)], 1 * AM29K_GREG_SIZE);
+
+ /* If the target has floating point registers, fetch them.
+ Otherwise, zero the floating point register values in
+ registers[] for good measure, even though we might not
+ need to. */
+
+ if (target_has_fp)
+ {
+ net_read_registers (am29k_fpreg_packet, AM29K_FPREG_PLEN,
+ PTRACE_GETFPREGS);
+ registers[REGISTER_BYTE (FPE_REGNUM)] = am29k_fpreg_packet[AM29K_R_FPE];
+ registers[REGISTER_BYTE (FPS_REGNUM)] = am29k_fpreg_packet[AM29K_R_FPS];
+
+ /* PAD For now, don't care about registers (?) AI0 to q */
+
+ bzero (&registers[REGISTER_BYTE (161)], 21 * AM29K_FPREG_SIZE);
+ }
+ else
+ {
+ bzero (&registers[REGISTER_BYTE (FPE_REGNUM)], 1 * AM29K_FPREG_SIZE);
+ bzero (&registers[REGISTER_BYTE (FPS_REGNUM)], 1 * AM29K_FPREG_SIZE);
+
+ /* PAD For now, don't care about registers (?) AI0 to q */
+
+ bzero (&registers[REGISTER_BYTE (161)], 21 * AM29K_FPREG_SIZE);
+ }
+
+ /* Mark the register cache valid. */
+
+ registers_fetched ();
+}
+
+/* Store a register or registers into the VxWorks target.
+ REGNO is the register to store, or -1 for all; currently,
+ it is ignored. FIXME look at regno to improve efficiency. */
+
+void
+vx_write_register (regno)
+ int regno;
+{
+ char am29k_greg_packet[AM29K_GREG_PLEN];
+ char am29k_fpreg_packet[AM29K_FPREG_PLEN];
+
+ /* Store general purpose registers. When copying values from
+ registers [], don't assume that a location in registers []
+ is properly aligned for the target data type. */
+
+ bcopy (&registers[REGISTER_BYTE (GR96_REGNUM)],
+ &am29k_greg_packet[AM29K_R_GR96], 160 * AM29K_GREG_SIZE);
+ bcopy (&registers[REGISTER_BYTE (VAB_REGNUM)],
+ &am29k_greg_packet[AM29K_R_VAB], 15 * AM29K_GREG_SIZE);
+ am29k_greg_packet[AM29K_R_INTE] = registers[REGISTER_BYTE (INTE_REGNUM)];
+ bcopy (&registers[REGISTER_BYTE (GR1_REGNUM)],
+ &am29k_greg_packet[AM29K_R_RSP], 5 * AM29K_GREG_SIZE);
+
+ net_write_registers (am29k_greg_packet, AM29K_GREG_PLEN, PTRACE_SETREGS);
+
+ /* Store floating point registers if the target has them. */
+
+ if (target_has_fp)
+ {
+ am29k_fpreg_packet[AM29K_R_FPE] = registers[REGISTER_BYTE (FPE_REGNUM)];
+ am29k_fpreg_packet[AM29K_R_FPS] = registers[REGISTER_BYTE (FPS_REGNUM)];
+
+ net_write_registers (am29k_fpreg_packet, AM29K_FPREG_PLEN,
+ PTRACE_SETFPREGS);
+ }
+}
+