aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdb/.Sanitize1
-rw-r--r--gdb/config/m88k/.Sanitize13
-rw-r--r--gdb/config/m88k/cxux.mh10
-rw-r--r--gdb/config/m88k/cxux.mt4
-rw-r--r--gdb/config/m88k/nm-cxux.h32
-rw-r--r--gdb/config/m88k/tm-cxux.h56
-rw-r--r--gdb/config/m88k/tm-m88k.h11
-rw-r--r--gdb/config/m88k/xm-cxux.h73
-rw-r--r--gdb/configure.in16
-rw-r--r--gdb/cxux-nat.c500
10 files changed, 701 insertions, 15 deletions
diff --git a/gdb/.Sanitize b/gdb/.Sanitize
index 2dc75b3..48b791c 100644
--- a/gdb/.Sanitize
+++ b/gdb/.Sanitize
@@ -112,6 +112,7 @@ core.c
coredep.c
corelow.c
cp-valprint.c
+cxux-nat.c
dbxread.c
dcache.c
dcache.h
diff --git a/gdb/config/m88k/.Sanitize b/gdb/config/m88k/.Sanitize
index aa6e1b9..6e91bb9 100644
--- a/gdb/config/m88k/.Sanitize
+++ b/gdb/config/m88k/.Sanitize
@@ -1,4 +1,6 @@
-# Each directory to survive it's way into a release will need a file
+# .Sanitize for devo/gdb/config/m88k.
+
+# Each directory to survive its way into a release will need a file
# like this one called "./.Sanitize". All keyword lines must exist,
# and must exist in the order specified by this file. Each directory
# in the tree will be processed, top down, in the following order.
@@ -9,7 +11,7 @@
# The lines between the "Do-first:" line and the "Things-to-keep:"
# line are executed as a /bin/sh shell script before anything else is
-# done in this
+# done in this directory.
Do-first:
@@ -21,17 +23,22 @@ Do-first:
Things-to-keep:
+cxux.mh
+cxux.mt
delta88.mh
delta88.mt
delta88v4.mt
delta88v4.mh
m88k.mh
m88k.mt
-nm-m88k.h
+nm-cxux.h
nm-delta88v4.h
+nm-m88k.h
+tm-cxux.h
tm-delta88.h
tm-delta88v4.h
tm-m88k.h
+xm-cxux.h
xm-delta88.h
xm-delta88v4.h
xm-dgux.h
diff --git a/gdb/config/m88k/cxux.mh b/gdb/config/m88k/cxux.mh
new file mode 100644
index 0000000..b5dce18
--- /dev/null
+++ b/gdb/config/m88k/cxux.mh
@@ -0,0 +1,10 @@
+# Host: Motorola 88k running CX/UX
+
+XM_FILE= xm-cxux.h
+XDEPFILES=
+
+NAT_FILE= nm-cxux.h
+NATDEPFILES= infptrace.o inftarg.o fork-child.o cxux-nat.o corelow.o coredep.o
+
+MMALLOC=
+MMALLOC_DISABLE= -DNO_MMALLOC
diff --git a/gdb/config/m88k/cxux.mt b/gdb/config/m88k/cxux.mt
new file mode 100644
index 0000000..dfd1892
--- /dev/null
+++ b/gdb/config/m88k/cxux.mt
@@ -0,0 +1,4 @@
+# Target: Motorola 88k running Harris CX/UX
+
+TM_FILE= tm-cxux.h
+TDEPFILES= exec.o m88k-tdep.o m88k-pinsn.o remote-bug.o
diff --git a/gdb/config/m88k/nm-cxux.h b/gdb/config/m88k/nm-cxux.h
new file mode 100644
index 0000000..24e1426
--- /dev/null
+++ b/gdb/config/m88k/nm-cxux.h
@@ -0,0 +1,32 @@
+/* Native definitions for Motorola 88K running Harris CX/UX
+ Copyright 1993, 1994 Free Software Foundation, Inc.
+
+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. */
+
+/* Override the standard fetch/store definitions. */
+
+#define FETCH_INFERIOR_REGISTERS
+
+#define REGISTER_U_ADDR(addr, blockend, regno) \
+ (addr) = m88k_register_u_addr ((blockend),(regno));
+
+#define ATTACH_DETACH
+
+#define PTRACE_ATTACH 128
+#define PTRACE_DETACH 129
+
+
diff --git a/gdb/config/m88k/tm-cxux.h b/gdb/config/m88k/tm-cxux.h
new file mode 100644
index 0000000..c489408
--- /dev/null
+++ b/gdb/config/m88k/tm-cxux.h
@@ -0,0 +1,56 @@
+/* Target definitions for m88k running Harris CX/UX.
+ Copyright 1993, 1994 Free Software Foundation, Inc.
+
+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. */
+
+#define HARRIS_TARGET 1
+
+/* Type of X registers, as supplied by the OS */
+
+typedef struct {
+ long w1, w2, w3, w4;
+} X_REGISTER_RAW_TYPE;
+
+#define X_REGISTER_VIRTUAL_TYPE double
+
+#include "m88k/tm-m88k.h"
+
+#define ADD_SHARED_SYMBOL_FILES(args,have_tty) add_shared_symbol_files ()
+
+#define CONVERT_REGISTER_ADDRESS
+
+/* Always allocate space for both, but recognize that the m88100 has no
+ FP_REGS. */
+
+#define ARCH_NUM_REGS (target_is_m88110 ? (GP_REGS + FP_REGS) : (GP_REGS))
+
+/* Don't need this grotesquerie. */
+
+#undef SHIFT_INST_REGS
+
+/* Extended registers are treated as 16 bytes by Harris' OS's.
+ We treat them as 16 bytes here for consistency's sake. */
+
+#undef REGISTER_RAW_SIZE
+#define REGISTER_RAW_SIZE(N) ((N) < XFP_REGNUM ? 4 : 16)
+
+#undef REGISTER_BYTE
+#define REGISTER_BYTE(N) \
+ ((N) >= XFP_REGNUM \
+ ? (((GP_REGS) * REGISTER_RAW_SIZE(0)) + \
+ (((N) - XFP_REGNUM) * REGISTER_RAW_SIZE(XFP_REGNUM))) \
+ : ((N) * REGISTER_RAW_SIZE(0)))
diff --git a/gdb/config/m88k/tm-m88k.h b/gdb/config/m88k/tm-m88k.h
index 0228907..fbe26a5 100644
--- a/gdb/config/m88k/tm-m88k.h
+++ b/gdb/config/m88k/tm-m88k.h
@@ -258,6 +258,9 @@ extern CORE_ADDR skip_prologue ();
* cr06 is invalid */
+/* Note that the Harris Unix kernels emulate the m88100's behavior on
+ the m88110. */
+
#define SXIP_REGNUM 35 /* On m88100, Contains Shadow Execute
Instruction Pointer. */
#define SNIP_REGNUM 36 /* On m88100, Contains Shadow Next
@@ -615,8 +618,8 @@ extern void m88k_push_dummy_frame();
-- Kevin Buettner
*/
-#define TARGET_WRITE_PC(val) { \
- write_register(SXIP_REGNUM, (long) val); \
- write_register(SNIP_REGNUM, (long) val | 2); \
- write_register(SFIP_REGNUM, ((long) val | 2) + 4); \
+#define TARGET_WRITE_PC(val, pid) { \
+ write_register_pid(SXIP_REGNUM, (long) val, pid); \
+ write_register_pid(SNIP_REGNUM, (long) val | 2, pid); \
+ write_register_pid(SFIP_REGNUM, ((long) val | 2) + 4, pid); \
}
diff --git a/gdb/config/m88k/xm-cxux.h b/gdb/config/m88k/xm-cxux.h
new file mode 100644
index 0000000..8ef7446
--- /dev/null
+++ b/gdb/config/m88k/xm-cxux.h
@@ -0,0 +1,73 @@
+/* Host-machine dependent parameters for Motorola 88000, for GDB.
+ Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1993
+ Free Software Foundation, Inc.
+
+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 "m88k/xm-m88k.h"
+
+#define HOST_BYTE_ORDER BIG_ENDIAN
+
+#if !defined (USG)
+#define USG 1
+#endif
+
+/* Really native, but as long as only native files check this macro we
+ are OK. */
+#define NO_PTRACE_H
+
+#include <sys/param.h>
+
+#define x_foff _x_x._x_offset
+#define x_fname _x_name
+#define USER ptrace_user
+/*
+#define _BSD_WAIT_FLAVOR
+*/
+
+#define HAVE_TERMIO
+
+#ifndef USIZE
+#define USIZE 2048
+#ifndef UPAGES
+#define UPAGES USIZE
+#endif
+#endif
+#define NBPG NBPC
+
+/* Get rid of any system-imposed stack limit if possible. */
+
+#define SET_STACK_LIMIT_HUGE
+
+/* This is the amount to subtract from u.u_ar0
+ to get the offset in the core file of the register values. */
+
+/* Since registers r0 through r31 are stored directly in the struct ptrace_user,
+ (for m88k BCS)
+ the ptrace_user offsets are sufficient and KERNEL_U_ADDRESS can be 0 */
+
+#define KERNEL_U_ADDR 0
+
+/* The CX/UX C compiler doesn't permit complex expressions as array bounds. */
+#define STRICT_ANSI_BOUNDS
+
+/* Enable breakpoint hit count reporting */
+#define BP_HIT_COUNT
+
+#define CORE_REGISTER_ADDR(regno, reg_ptr) \
+ m88k_harris_core_register_addr(regno, reg_ptr)
+
diff --git a/gdb/configure.in b/gdb/configure.in
index 73f5ef9..b900709 100644
--- a/gdb/configure.in
+++ b/gdb/configure.in
@@ -75,20 +75,20 @@ m68030-sony-*) gdb_host=news1000 ;;
m68*-altos-*) gdb_host=altos ;;
m68*-apollo*-sysv*) gdb_host=apollo68v ;;
m68*-apollo*-bsd*) gdb_host=apollo68b ;;
-m68*-atari-sysv4*) gdb_host=m68kv4 ;;
m68*-att-*) gdb_host=3b1 ;;
m68*-bull*-sysv*) gdb_host=dpx2 ;;
-m68*-cbm-sysv4*) gdb_host=m68kv4 ;;
m68*-hp-bsd*) gdb_host=hp300bsd ;;
m68*-hp-hpux*) gdb_host=hp300hpux ;;
m68*-isi-*) gdb_host=isi ;;
m68*-*-lynxos*) gdb_host=m68klynx ;;
+m68*-*-sysv4*) gdb_host=m68kv4 ;;
m68*-motorola-*) gdb_host=delta68 ;;
m68*-sony-*) gdb_host=news ;;
m68*-sun-sunos3*) gdb_host=sun3os3 ;;
m68*-sun-sunos4*) gdb_host=sun3os4 ;;
m68*-sun-*) gdb_host=sun3os4 ;;
+m88*-harris-cxux*) gdb_host=cxux ;;
m88*-motorola-sysv4*) gdb_host=delta88v4 ;;
m88*-motorola-sysv*) gdb_host=delta88 ;;
m88*-*-mach3*) gdb_host=mach3 ;;
@@ -237,16 +237,14 @@ i960-*-vxworks*) gdb_target=vxworks960 ;;
m68000-*-sunos3*) gdb_target=sun2os3 ;;
m68000-*-sunos4*) gdb_target=sun2os4 ;;
-m68*-altos-*) gdb_target=altos ;;
m68*-apollo*-bsd*) gdb_target=apollo68b ;;
-m68*-atari-sysv4*) gdb_target=m68kv4 ;;
-m68*-att-*) gdb_target=3b1 ;;
m68*-bull-sysv*) gdb_target=dpx2 ;;
-m68*-cbm-sysv4*) gdb_target=m68kv4 ;;
-m68*-cisco*-*) gdb_target=cisco ;;
-m68*-ericsson-*) gdb_target=es1800 ;;
m68*-hp-bsd*) gdb_target=hp300bsd ;;
m68*-hp-hpux*) gdb_target=hp300hpux ;;
+m68*-altos-*) gdb_target=altos ;;
+m68*-att-*) gdb_target=3b1 ;;
+m68*-cisco*-*) gdb_target=cisco ;;
+m68*-ericsson-*) gdb_target=es1800 ;;
m68*-isi-*) gdb_target=isi ;;
m68*-motorola-*) gdb_target=delta68 ;;
m68*-netx-*) gdb_target=vxworks68 ;;
@@ -263,8 +261,10 @@ m68*-*-lynxos*) gdb_target=m68klynx
m68*-*-os68k*) gdb_target=os68k ;;
m68*-*-sunos3*) gdb_target=sun3os3 ;;
m68*-*-sunos4*) gdb_target=sun3os4 ;;
+m68*-*-sysv4*) gdb_target=m68kv4 ;;
m68*-*-vxworks*) gdb_target=vxworks68 ;;
+m88*-harris-cxux*) gdb_target=cxux ;;
m88*-motorola-sysv4*) gdb_target=delta88v4 ;;
m88*-*-mach3*) gdb_target=mach3 ;;
m88*-motorola-*) gdb_target=delta88 ;;
diff --git a/gdb/cxux-nat.c b/gdb/cxux-nat.c
new file mode 100644
index 0000000..52a4eb3
--- /dev/null
+++ b/gdb/cxux-nat.c
@@ -0,0 +1,500 @@
+/* Native support for Motorola 88k running Harris CX/UX.
+ Copyright 1988, 1990, 1991, 1992, 1993, 1994 Free Software Foundation, Inc.
+
+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 "defs.h"
+#include "frame.h"
+#include "inferior.h"
+
+#include <sys/types.h>
+#include <sys/param.h>
+#include <sys/dir.h>
+#include <signal.h>
+#include "gdbcore.h"
+#include <sys/user.h>
+
+#include "bfd.h"
+#include "symfile.h"
+#include "objfiles.h"
+#include "symtab.h"
+
+#ifndef USER /* added to support BCS ptrace_user */
+#define USER ptrace_user
+#endif
+#include <sys/ioctl.h>
+#include <fcntl.h>
+#include <sys/file.h>
+#include <sys/stat.h>
+
+#include "symtab.h"
+#include "setjmp.h"
+#include "value.h"
+
+#include <sys/ptrace.h>
+
+/* CX/UX provides them already, but as word offsets instead of char offsets */
+#define SXIP_OFFSET (PT_SXIP * 4)
+#define SNIP_OFFSET (PT_SNIP * 4)
+#define SFIP_OFFSET (PT_SFIP * 4)
+#define PSR_OFFSET (PT_PSR * sizeof(int))
+#define FPSR_OFFSET (PT_FPSR * sizeof(int))
+#define FPCR_OFFSET (PT_FPCR * sizeof(int))
+#else /* _CX_UX */
+/* define offsets to the pc instruction offsets in ptrace_user struct */
+#define SXIP_OFFSET ((char *)&u.pt_sigframe.dg_sigframe.sc_sxip - (char *)&u)
+#define SNIP_OFFSET ((char *)&u.pt_sigframe.dg_sigframe.sc_snip - (char *)&u)
+#define SFIP_OFFSET ((char *)&u.pt_sigframe.dg_sigframe.sc_sfip - (char *)&u)
+
+#define XREGADDR(r) (((char *)&u.pt_x0-(char *)&u) + \
+ ((r)-X0_REGNUM)*sizeof(X_REGISTER_RAW_TYPE))
+
+extern int have_symbol_file_p();
+
+extern jmp_buf stack_jmp;
+
+extern int errno;
+extern char registers[REGISTER_BYTES];
+
+void
+fetch_inferior_registers (regno)
+ int regno; /* Original value discarded */
+{
+ register unsigned int regaddr;
+ char buf[MAX_REGISTER_RAW_SIZE];
+ register int i;
+
+ struct USER u;
+ unsigned int offset;
+
+ offset = (char *) &u.pt_r0 - (char *) &u;
+ regaddr = offset; /* byte offset to r0;*/
+
+/* offset = ptrace (3, inferior_pid, (PTRACE_ARG3_TYPE) offset, 0) - KERNEL_U_ADDR; */
+ for (regno = 0; regno < PC_REGNUM; regno++)
+ {
+ /*regaddr = register_addr (regno, offset);*/
+ /* 88k enhancement */
+
+ for (i = 0; i < REGISTER_RAW_SIZE (regno); i += sizeof (int))
+ {
+ *(int *) &buf[i] = ptrace (3, inferior_pid,
+ (PTRACE_ARG3_TYPE) regaddr, 0);
+ regaddr += sizeof (int);
+ }
+ supply_register (regno, buf);
+ }
+ /* now load up registers 32-37; special pc registers */
+ *(int *) &buf[0] = ptrace (3, inferior_pid,
+ (PTRACE_ARG3_TYPE) PSR_OFFSET,0);
+ supply_register (PSR_REGNUM, buf);
+ *(int *) &buf[0] = ptrace (3, inferior_pid,
+ (PTRACE_ARG3_TYPE) FPSR_OFFSET,0);
+ supply_register (FPSR_REGNUM, buf);
+ *(int *) &buf[0] = ptrace (3, inferior_pid,
+ (PTRACE_ARG3_TYPE) FPCR_OFFSET,0);
+ supply_register (FPCR_REGNUM, buf);
+ *(int *) &buf[0] = ptrace (3,inferior_pid,
+ (PTRACE_ARG3_TYPE) SXIP_OFFSET ,0);
+ supply_register (SXIP_REGNUM, buf);
+ *(int *) &buf[0] = ptrace (3, inferior_pid,
+ (PTRACE_ARG3_TYPE) SNIP_OFFSET,0);
+ supply_register (SNIP_REGNUM, buf);
+ *(int *) &buf[0] = ptrace (3, inferior_pid,
+ (PTRACE_ARG3_TYPE) SFIP_OFFSET,0);
+ supply_register (SFIP_REGNUM, buf);
+
+ if (target_is_m88110)
+ {
+ for (regaddr = XREGADDR(X0_REGNUM), regno = X0_REGNUM;
+ regno < NUM_REGS;
+ regno++, regaddr += 16)
+ {
+ X_REGISTER_RAW_TYPE xval;
+
+ *(int *) &xval.w1 = ptrace (3, inferior_pid,
+ (PTRACE_ARG3_TYPE) regaddr, 0);
+ *(int *) &xval.w2 = ptrace (3, inferior_pid,
+ (PTRACE_ARG3_TYPE) (regaddr+4), 0);
+ *(int *) &xval.w3 = ptrace (3, inferior_pid,
+ (PTRACE_ARG3_TYPE) (regaddr+8), 0);
+ *(int *) &xval.w4 = ptrace (3, inferior_pid,
+ (PTRACE_ARG3_TYPE) (regaddr+12), 0);
+ supply_register(regno, (void *)&xval);
+ }
+ }
+}
+
+/* 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). */
+
+void
+store_inferior_registers (regno)
+ int regno;
+{
+ register unsigned int regaddr;
+ char buf[80];
+
+ struct USER u;
+
+ unsigned int offset = (char *) &u.pt_r0 - (char *) &u;
+
+ regaddr = offset;
+
+ /* Don't try to deal with EXIP_REGNUM or ENIP_REGNUM, because I think either
+ svr3 doesn't run on an 88110, or the kernel isolates the different (not
+ completely sure this is true, but seems to be. */
+ if (regno >= 0)
+ {
+ /* regaddr = register_addr (regno, offset); */
+ if (regno < PC_REGNUM)
+ {
+ regaddr = offset + regno * sizeof (int);
+ errno = 0;
+ ptrace (6, inferior_pid,
+ (PTRACE_ARG3_TYPE) regaddr, read_register (regno));
+ if (errno != 0)
+ {
+ sprintf (buf, "writing register number %d", regno);
+ perror_with_name (buf);
+ }
+ }
+ else if (regno == PSR_REGNUM)
+ ptrace (6, inferior_pid,
+ (PTRACE_ARG3_TYPE) PSR_OFFSET, read_register(regno));
+ else if (regno == FPSR_REGNUM)
+ ptrace (6, inferior_pid,
+ (PTRACE_ARG3_TYPE) FPSR_OFFSET, read_register(regno));
+ else if (regno == FPCR_REGNUM)
+ ptrace (6, inferior_pid,
+ (PTRACE_ARG3_TYPE) FPCR_OFFSET, read_register(regno));
+ else if (regno == SXIP_REGNUM)
+ ptrace (6, inferior_pid,
+ (PTRACE_ARG3_TYPE) SXIP_OFFSET, read_register(regno));
+ else if (regno == SNIP_REGNUM)
+ ptrace (6, inferior_pid,
+ (PTRACE_ARG3_TYPE) SNIP_OFFSET, read_register(regno));
+ else if (regno == SFIP_REGNUM)
+ ptrace (6, inferior_pid,
+ (PTRACE_ARG3_TYPE) SFIP_OFFSET, read_register(regno));
+ else if (target_is_m88110 && regno < NUM_REGS)
+ {
+ X_REGISTER_RAW_TYPE xval;
+
+ read_register_bytes(REGISTER_BYTE(regno), (char *)&xval,
+ sizeof(X_REGISTER_RAW_TYPE));
+ regaddr = XREGADDR(regno);
+ ptrace (6, inferior_pid, (PTRACE_ARG3_TYPE) regaddr, xval.w1);
+ ptrace (6, inferior_pid, (PTRACE_ARG3_TYPE) regaddr+4, xval.w2);
+ ptrace (6, inferior_pid, (PTRACE_ARG3_TYPE) regaddr+8, xval.w3);
+ ptrace (6, inferior_pid, (PTRACE_ARG3_TYPE) regaddr+12, xval.w4);
+ }
+ else
+ printf_unfiltered ("Bad register number for store_inferior routine\n");
+ }
+ else
+ {
+ for (regno = 0; regno < PC_REGNUM; regno++)
+ {
+ /* regaddr = register_addr (regno, offset); */
+ errno = 0;
+ regaddr = offset + regno * sizeof (int);
+ ptrace (6, inferior_pid,
+ (PTRACE_ARG3_TYPE) regaddr, read_register (regno));
+ if (errno != 0)
+ {
+ sprintf (buf, "writing register number %d", regno);
+ perror_with_name (buf);
+ }
+ }
+ ptrace (6, inferior_pid,
+ (PTRACE_ARG3_TYPE) PSR_OFFSET, read_register(regno));
+ ptrace (6, inferior_pid,
+ (PTRACE_ARG3_TYPE) FPSR_OFFSET,read_register(regno));
+ ptrace (6, inferior_pid,
+ (PTRACE_ARG3_TYPE) FPCR_OFFSET,read_register(regno));
+ ptrace (6,inferior_pid,
+ (PTRACE_ARG3_TYPE) SXIP_OFFSET,read_register(SXIP_REGNUM));
+ ptrace (6,inferior_pid,
+ (PTRACE_ARG3_TYPE) SNIP_OFFSET,read_register(SNIP_REGNUM));
+ ptrace (6,inferior_pid,
+ (PTRACE_ARG3_TYPE) SFIP_OFFSET,read_register(SFIP_REGNUM));
+ if (target_is_m88110)
+ {
+ for (regno = X0_REGNUM; regno < NUM_REGS; regno++)
+ {
+ X_REGISTER_RAW_TYPE xval;
+
+ read_register_bytes(REGISTER_BYTE(regno), (char *)&xval,
+ sizeof(X_REGISTER_RAW_TYPE));
+ regaddr = XREGADDR(regno);
+ ptrace (6, inferior_pid, (PTRACE_ARG3_TYPE) regaddr, xval.w1);
+ ptrace (6, inferior_pid, (PTRACE_ARG3_TYPE) (regaddr+4), xval.w2);
+ ptrace (6, inferior_pid, (PTRACE_ARG3_TYPE) (regaddr+8), xval.w3);
+ ptrace (6, inferior_pid, (PTRACE_ARG3_TYPE) (regaddr+12), xval.w4);
+ }
+ }
+ }
+}
+
+/* blockend is the address of the end of the user structure */
+
+m88k_register_u_addr (blockend, regnum)
+ int blockend, regnum;
+{
+ struct USER u;
+ int ustart = blockend - sizeof (struct USER);
+
+ if (regnum < PSR_REGNUM)
+ return (ustart + ((int) &u.pt_r0 - (int) &u) +
+ REGISTER_SIZE * regnum);
+ else if (regnum == PSR_REGNUM)
+ return (ustart + ((int) &u.pt_psr) - (int) &u);
+ else if (regnum == FPSR_REGNUM)
+ return (ustart + ((int) &u.pt_fpsr) - (int) &u);
+ else if (regnum == FPCR_REGNUM)
+ return (ustart + ((int) &u.pt_fpcr) - (int) &u);
+ else if (regnum == SXIP_REGNUM)
+ return (ustart + SXIP_OFFSET);
+ else if (regnum == SNIP_REGNUM)
+ return (ustart + SNIP_OFFSET);
+ else if (regnum == SFIP_REGNUM)
+ return (ustart + SFIP_OFFSET);
+ else if (target_is_m88110)
+ return (ustart + ((int) &u.pt_x0 - (int) &u) + /* Must be X register */
+ sizeof(u.pt_x0) * (regnum - X0_REGNUM));
+ else
+ return (blockend + REGISTER_SIZE * regnum);
+}
+
+#ifdef USE_PROC_FS
+
+#include <sys/procfs.h>
+
+/* Given a pointer to a general register set in /proc format (gregset_t *),
+ unpack the register contents and supply them as gdb's idea of the current
+ register values. */
+
+void
+supply_gregset (gregsetp)
+ gregset_t *gregsetp;
+{
+ register int regi;
+ register greg_t *regp = (greg_t *) gregsetp;
+
+ for (regi=0; regi <= SP_REGNUM; regi++)
+ supply_register (regi, (char *) (regp + regi));
+
+ supply_register (SXIP_REGNUM, (char *) (regp + R_XIP));
+ supply_register (SNIP_REGNUM, (char *) (regp + R_NIP));
+ supply_register (SFIP_REGNUM, (char *) (regp + R_FIP));
+ supply_register (PSR_REGNUM, (char *) (regp + R_PSR));
+ supply_register (FPSR_REGNUM, (char *) (regp + R_FPSR));
+ supply_register (FPCR_REGNUM, (char *) (regp + R_FPCR));
+}
+
+void
+fill_gregset (gregsetp, regno)
+ gregset_t *gregsetp;
+ int regno;
+{
+ int regi;
+ register greg_t *regp = (greg_t *) gregsetp;
+ extern char registers[];
+
+ for (regi = 0 ; regi <= R_R31 ; regi++)
+ if ((regno == -1) || (regno == regi))
+ *(regp + regi) = *(int *) &registers[REGISTER_BYTE(regi)];
+
+ if ((regno == -1) || (regno == SXIP_REGNUM))
+ *(regp + R_XIP) = *(int *) &registers[REGISTER_BYTE(SXIP_REGNUM)];
+ if ((regno == -1) || (regno == SNIP_REGNUM))
+ *(regp + R_NIP) = *(int *) &registers[REGISTER_BYTE(SNIP_REGNUM)];
+ if ((regno == -1) || (regno == SFIP_REGNUM))
+ *(regp + R_FIP) = *(int *) &registers[REGISTER_BYTE(SFIP_REGNUM)];
+ if ((regno == -1) || (regno == PSR_REGNUM))
+ *(regp + R_PSR) = *(int *) &registers[REGISTER_BYTE(PSR_REGNUM)];
+ if ((regno == -1) || (regno == FPSR_REGNUM))
+ *(regp + R_FPSR) = *(int *) &registers[REGISTER_BYTE(FPSR_REGNUM)];
+ if ((regno == -1) || (regno == FPCR_REGNUM))
+ *(regp + R_FPCR) = *(int *) &registers[REGISTER_BYTE(FPCR_REGNUM)];
+}
+
+#endif /* USE_PROC_FS */
+
+/* This support adds the equivalent of adb's % command. When
+ the `add-shared-symbol-files' command is given, this routine scans
+ the dynamic linker's link map and reads the minimal symbols
+ from each shared object file listed in the map. */
+
+struct link_map {
+ unsigned long l_addr; /* address at which object is mapped */
+ char *l_name; /* full name of loaded object */
+ void *l_ld; /* dynamic structure of object */
+ struct link_map *l_next; /* next link object */
+ struct link_map *l_prev; /* previous link object */
+};
+
+#define LINKS_MAP_POINTER "_ld_tail"
+#define LIBC_FILE "/usr/lib/libc.so.1"
+#define SHARED_OFFSET 0xf0001000
+
+#ifndef PATH_MAX
+#define PATH_MAX 1023 /* maximum size of path name on OS */
+#endif
+
+void
+add_shared_symbol_files ()
+{
+ void *desc;
+ struct link_map *ld_map, *lm, lms;
+ struct minimal_symbol *minsym;
+ struct objfile *objfile;
+ char *path_name;
+
+ if (! inferior_pid)
+ {
+ warning ("The program has not yet been started.");
+ return;
+ }
+
+ objfile = symbol_file_add (LIBC_FILE, 0, 0, 0, 0, 1);
+ minsym = lookup_minimal_symbol (LINKS_MAP_POINTER, objfile);
+
+ ld_map = (struct link_map *)
+ read_memory_integer (((int)SYMBOL_VALUE_ADDRESS(minsym) + SHARED_OFFSET), 4);
+ lm = ld_map;
+ while (lm)
+ {
+ int local_errno = 0;
+
+ read_memory ((CORE_ADDR)lm, (char*)&lms, sizeof (struct link_map));
+ if (lms.l_name)
+ {
+ if (target_read_string ((CORE_ADDR)lms.l_name, &path_name,
+ PATH_MAX, &local_errno))
+ {
+ symbol_file_add (path_name, 1, lms.l_addr, 0, 0, 0);
+ free(path_name);
+ }
+ }
+ /* traverse links in reverse order so that we get the
+ the symbols the user actually gets. */
+ lm = lms.l_prev;
+ }
+}
+
+int target_is_m88110;
+
+#if defined(_ES_MP)
+
+#include <sys/regset.h>
+
+unsigned int
+m88k_harris_core_register_addr (regno, reg_ptr)
+ int regno, reg_ptr;
+{
+ unsigned int word_offset;
+
+ switch (regno)
+ {
+ case PSR_REGNUM:
+ word_offset = R_EPSR;
+ break;
+ case FPSR_REGNUM:
+ word_offset = R_FPSR;
+ break;
+ case FPCR_REGNUM:
+ word_offset = R_FPCR;
+ break;
+ case SXIP_REGNUM:
+ word_offset = R_EXIP;
+ break;
+ case SNIP_REGNUM:
+ word_offset = R_ENIP;
+ break;
+ case SFIP_REGNUM:
+ word_offset = R_EFIP;
+ break;
+ default:
+ if (regno <= FP_REGNUM)
+ word_offset = regno;
+ else
+ word_offset = ((regno - X0_REGNUM) * 4);
+ }
+ return (word_offset * 4);
+}
+
+#endif /* _ES_MP */
+
+void
+_initialize_m88k_nat()
+{
+#ifdef _ES_MP
+ /* Enable 88110 support, as we don't support the 88100 under ES/MP. */
+
+ target_is_m88110 = 1;
+#elif defined(_CX_UX)
+ /* Determine whether we're running on an 88100 or an 88110. */
+ target_is_m88110 = (sinfo(SYSMACHINE,0) == SYS5800);
+#endif /* _CX_UX */
+}
+
+#ifdef _ES_MP
+/* Given a pointer to a general register set in /proc format (gregset_t *),
+ unpack the register contents and supply them as gdb's idea of the current
+ register values. */
+
+void
+supply_gregset (gregsetp)
+ gregset_t *gregsetp;
+{
+ register int regi;
+ register greg_t *regp = (greg_t *) gregsetp;
+
+ for (regi = 0 ; regi < R_R31 ; regi++)
+ {
+ supply_register (regi, (char *) (regp + regi));
+ }
+ supply_register (PSR_REGNUM, (char *) (regp + R_EPSR));
+ supply_register (FPSR_REGNUM, (char *) (regp + R_FPSR));
+ supply_register (FPCR_REGNUM, (char *) (regp + R_FPCR));
+ supply_register (SXIP_REGNUM, (char *) (regp + R_EXIP));
+ supply_register (SNIP_REGNUM, (char *) (regp + R_ENIP));
+ supply_register (SFIP_REGNUM, (char *) (regp + R_EFIP));
+}
+
+/* Given a pointer to a floating point register set in /proc format
+ (fpregset_t *), unpack the register contents and supply them as gdb's
+ idea of the current floating point register values. */
+
+void
+supply_fpregset (fpregsetp)
+ fpregset_t *fpregsetp;
+{
+ register int regi;
+ char *from;
+
+ for (regi = FP0_REGNUM ; regi <= FPLAST_REGNUM ; regi++)
+ {
+ from = (char *) &((*fpregsetp)[regi-FP0_REGNUM]);
+ supply_register (regi, from);
+ }
+}
+
+#endif /* _ES_MP */