* Makefile.in (TARGET_FLAGS_TO_PASS): Pass down LD_FOR_TARGET and
authorStu Grossman <grossman@cygnus>
Thu, 18 Aug 1994 06:32:55 +0000 (06:32 +0000)
committerStu Grossman <grossman@cygnus>
Thu, 18 Aug 1994 06:32:55 +0000 (06:32 +0000)
NLMCONV_FOR_TARGET.  (SUBDIRS):  Add nlm target.
* configure.in (powerpc-*-netware*):  Automatically configure nlm
subdir.
* nlm/Makefile.in:  Add {CC NLMCONV LD}_FOR_TARGET.  Remove alpha
specific stuff.  Make things more configurable.
* nlm/configure.in:  Add powerpc-*-netware* target.  Use
gdbserve.mt/cpu.c/cpu.h for target stuff.  Get rid of tm/xm/nm.h
files.
* nlm/gdbserve.c:  Move Alpha specific stuff into other files.
Remove lots of architecture-specific stuff.
* nlm/gdbserve.def:  Add new imports.
* nlm/ppc.c, nlm/ppc.h:  New files that contain PowerPC specific code.
* nlm/prelude.c:  Don't include libhooks.h, get rid of call to
register library.
* nlm/prelude.o:  What was this doing here?

15 files changed:
gdb/ChangeLog
gdb/Makefile.in
gdb/configure.in
gdb/nlm/Makefile.in
gdb/nlm/aio.h [new file with mode: 0644]
gdb/nlm/alpha.c [new file with mode: 0644]
gdb/nlm/alpha.h [new file with mode: 0644]
gdb/nlm/configure.in
gdb/nlm/fake_aio.c [new file with mode: 0644]
gdb/nlm/gdbserve.c
gdb/nlm/gdbserve.def
gdb/nlm/ppc.c [new file with mode: 0644]
gdb/nlm/ppc.h [new file with mode: 0644]
gdb/nlm/prelude.c
gdb/nlm/prelude.o [deleted file]

index c0a88e189285d52d6b5b7c6819e0c5b888d93e96..8849c02c10dcf8ddbf219b38a4217e60a0e7b07f 100644 (file)
@@ -1,3 +1,22 @@
+Wed Aug 17 23:08:53 1994  Stu Grossman  (grossman@cygnus.com)
+
+       * Makefile.in (TARGET_FLAGS_TO_PASS):  Pass down LD_FOR_TARGET and
+       NLMCONV_FOR_TARGET.  (SUBDIRS):  Add nlm target.
+       * configure.in (powerpc-*-netware*):  Automatically configure nlm
+       subdir.
+       * nlm/Makefile.in:  Add {CC NLMCONV LD}_FOR_TARGET.  Remove alpha
+       specific stuff.  Make things more configurable.
+       * nlm/configure.in:  Add powerpc-*-netware* target.  Use
+       gdbserve.mt/cpu.c/cpu.h for target stuff.  Get rid of tm/xm/nm.h
+       files.
+       * nlm/gdbserve.c:  Move Alpha specific stuff into other files.
+       Remove lots of architecture-specific stuff.
+       * nlm/gdbserve.def:  Add new imports.
+       * nlm/ppc.c, nlm/ppc.h:  New files that contain PowerPC specific code.
+       * nlm/prelude.c:  Don't include libhooks.h, get rid of call to
+       register library.
+       * nlm/prelude.o:  What was this doing here?
+
 Wed Aug 17 23:17:33 1994  Rob Savoye  (rob@darkstar.cygnus.com)
 
        * remote-pa.c: New file for HPPA embedded support. Currently it's
index d01dd07c7e78e33baae24d814431990741dffb36..cb54b34d2ddc14c20609fb2df9f16cea406012bb 100644 (file)
@@ -307,6 +307,7 @@ TARGET_FLAGS_TO_PASS = \
        "prefix=$(prefix)" \
        "exec_prefix=$(exec_prefix)" \
        "against=$(against)" \
+       "BISON=$(BISON)" \
        'CC=$$(CC_FOR_TARGET)' \
        "CC_FOR_TARGET=$(CC_FOR_TARGET)" \
        "CFLAGS=$(CFLAGS)" \
@@ -317,13 +318,14 @@ TARGET_FLAGS_TO_PASS = \
        'CXX=$$(CXX_FOR_TARGET)' \
        "CXX_FOR_TARGET=$(CXX_FOR_TARGET)" \
        "CXXFLAGS=$(CXXFLAGS)" \
-       "MAKEINFO=$(MAKEINFO)" \
        "INSTALL=$(INSTALL)" \
        "INSTALL_PROGRAM=$(INSTALL_PROGRAM)" \
        "INSTALL_DATA=$(INSTALL_DATA)" \
+       "LD_FOR_TARGET=$(LD_FOR_TARGET)" \
+       "MAKEINFO=$(MAKEINFO)" \
+       "NLMCONV_FOR_TARGET=$(NLMCONV_FOR_TARGET)" \
        "RUNTEST=$(RUNTEST)" \
-       "RUNTESTFLAGS=$(RUNTESTFLAGS)" \
-       "BISON=$(BISON)"
+       "RUNTESTFLAGS=$(RUNTESTFLAGS)"
 
 # All source files that go into linking GDB.
 # Links made at configuration time should not be specified here, since
@@ -462,7 +464,7 @@ NTSOBS = standalone.o
 
 NTSSTART = kdb-start.o
 
-SUBDIRS = doc testsuite
+SUBDIRS = doc testsuite nlm
 
 # For now, shortcut the "configure GDB for fewer languages" stuff.
 YYFILES = c-exp.tab.c m2-exp.tab.c ch-exp.tab.c
@@ -584,6 +586,9 @@ nlmstub.nlm: nlmstub.o $(srcdir)/nlmstub.def
 
 nlmstub: nlmstub.nlm
 
+nlm:   force
+       rootme=`pwd`; export rootme; $(MAKE) $(TARGET_FLAGS_TO_PASS) DO=all DODIRS=nlm subdir_do
+
 # libproc is not listed here because all-libproc is a dependency of all-gui,
 # not all-gdb, and thus might be built after us.
 LIBGDBDEPS=$(COMMON_OBS) $(LIBGDB_OBS) $(TSOBS) $(ADD_DEPS) $(CDEPS) init.o
index c8e77752d4cac9277981a29a87fc7632123d11cb..e51d2a2a9456a5d0bbc1b8708317d8b5590a6ecb 100644 (file)
@@ -300,7 +300,8 @@ ns32k-utek-sysv*)   gdb_target=merlin ;;
 ns32k-utek-*)          gdb_target=umax ;;
 
 pn-*-*)                        gdb_target=pn ;;
-powerpc-*-netware*)    gdb_target=ppc-nw ;;
+powerpc-*-netware*)    gdb_target=ppc-nw
+                       configdirs="${configdirs} nlm" ;;
 
 pyramid-*-*)           gdb_target=pyramid ;;
 
index 36388da25f853a0fce1a7962c6f8e78f100d42cd..517fc0f101fafbbc30ba338dbd9b13c473089088 100644 (file)
@@ -47,6 +47,46 @@ INSTALL_DATA = $(INSTALL)
 INSTALL_XFORM = $(INSTALL) -t='$(program_transform_name)'
 INSTALL_XFORM1 = $(INSTALL_XFORM) -b=.1
 
+CC_FOR_TARGET = ` \
+  if [ -f ../../gcc/xgcc ] ; then \
+    if [ -f ../../newlib/Makefile ] ; then \
+      echo ../../gcc/xgcc -B../../gcc/ -idirafter ../newlib/targ-include -idirafter $${rootsrc}/../newlib/libc/include -nostdinc -L../../../newlib -B../../../newlib/; \
+    else \
+      echo ../../gcc/xgcc -B../../gcc/; \
+    fi; \
+  else \
+    if [ "$(host_canonical)" = "$(target_canonical)" ] ; then \
+      echo $(CC); \
+    else \
+      t='$(program_transform_name)'; echo gcc | sed -e '' $$t; \
+    fi; \
+  fi`
+
+NLMCONV_FOR_TARGET = ` \
+  if [ -f ../../binutils/nlmconv ] ; then \
+    echo ../../binutils/nlmconv; \
+  else \
+    if [ "$(host_canonical)" = "$(target_canonical)" ] ; then \
+      echo $(NLMCONV); \
+    else \
+      t='$(program_transform_name)'; echo nlmconv | sed -e '' $$t; \
+    fi; \
+  fi`
+
+NWSOURCE = /gaunt/grossman/unsupported/Novell
+NWINCLUDES = -I/gaunt/grossman/PPC-NETWARE/ndk/include
+
+LD_FOR_TARGET = ` \
+  if [ -f ../../ld/ld.new ] ; then \
+    echo ../../ld/ld.new; \
+  else \
+    if [ "$(host_canonical)" = "$(target_canonical)" ] ; then \
+      echo $(LD); \
+    else \
+      t='$(program_transform_name)'; echo ld | sed -e '' $$t; \
+    fi; \
+  fi`
+
 AR = ar
 AR_FLAGS = qv
 RANLIB = ranlib
@@ -130,7 +170,7 @@ GLOBAL_CFLAGS = ${MT_CFLAGS} ${MH_CFLAGS}
 # when running make.  I.E.  "make CFLAGS=-Wmissing-prototypes".
 CFLAGS = -g
 # INTERNAL_CFLAGS is the aggregate of all other *CFLAGS macros.
-INTERNAL_CFLAGS = ${CFLAGS} ${GLOBAL_CFLAGS} ${PROFILE_CFLAGS} ${MMALLOC_CFLAGS} ${INCLUDE_CFLAGS} ${USER_CFLAGS}
+INTERNAL_CFLAGS = ${CFLAGS} ${GLOBAL_CFLAGS} ${PROFILE_CFLAGS} ${MMALLOC_CFLAGS} ${INCLUDE_CFLAGS} ${USER_CFLAGS} ${NWINCLUDES}
 LDFLAGS = $(CFLAGS)
 
 # Perhaps should come from parent Makefile
@@ -146,22 +186,17 @@ LINTFLAGS= -I${BFD_DIR}
 
 # All source files that go into linking GDB remote server.
 
-SFILES = $(srcdir)/alpha-patch.c $(srcdir)/alpha-uart.c $(srcdir)/gdbserve.c \
-        $(srcdir)/alpha-io.S
-
 DEPFILES = $(GDBSERVE_DEPFILES)
 
-SOURCES = $(SFILES) $(ALLDEPFILES)
+SOURCES = $(ALLDEPFILES)
 TAGFILES = $(SOURCES) ${HFILES} ${ALLPARAM} ${POSSLIBS} 
 
-OBS = gdbserve.o alpha-patch.o alpha-uart.o alpha-io.o $(srcdir)/prelude.o
-
 # Prevent Sun make from putting in the machine type.  Setting
 # TARGET_ARCH to nothing works for SunOS 3, 4.0, but not for 4.1.
 .c.o:
-       ${CC} -c ${INTERNAL_CFLAGS} $<
+       ${CC_FOR_TARGET} -c ${INTERNAL_CFLAGS} $<
 
-all: GDBSERVE.NLM
+all: gdbserve.nlm
 
 # Traditionally "install" depends on "all".  But it may be useful
 # not to; for example, if the user has made some trivial change to a 
@@ -183,29 +218,11 @@ info dvi:
 install-info:
 clean-info:
 
-NWAXPDEV=/gaunt/grossman/ALPHA-NLM/cygnus_940215/nwaxpdev
-
-.EXPORT: NWAXPDEV
-
-CC=${NWAXPDEV}/bin/cc -32addr -non_shared -no_excpt -g -DALPHA=1 -std -I -I${NWAXPDEV}/usr/include -I${NWAXPDEV}/clib/include
-LD=${NWAXPDEV}/bin/ld -32addr -no_excpt -non_shared -d -r -L -T 0 -g -b
-AS=${NWAXPDEV}/bin/as -I. -32addr
-NLMCONV=${NWAXPDEV}/bin/alphanlm
-
-GDBSERVE.NLM:  gdbserve $(srcdir)/gdbserve.def
-       ${NLMCONV} $(srcdir)/gdbserve.def
-
-gdbserve: $(OBS)
-       ${LD} $(LDFLAGS) -o gdbserve ${OBS} ${LIBS} ${NWAXPDEV}/usr/lib/nwlibc.a
-
-gdbserve.o: $(srcdir)/gdbserve.c $(srcdir)/alpha-patch.h
-
-alpha-patches.o: $(srcdir)/alpha-patches.c $(srcdir)/alpha-patches.h
-
-alpha-io.o: $(srcdir)/alpha-io.S
-       ${AS} -o alpha-io.o $(srcdir)/alpha-io.S
+gdbserve.nlm:  gdbserve.O $(srcdir)/gdbserve.def
+       ${NLMCONV_FOR_TARGET} -T $(srcdir)/gdbserve.def
 
-alpha-uart.o:  $(srcdir)/alpha-uart.c
+gdbserve.O: prelude.o gdbserve.o $(TDEPFILES)
+       ${LD_FOR_TARGET} $(LDFLAGS) -r -o gdbserve.O prelude.o gdbserve.o ${TDEPFILES}
 
 config.status:
        @echo "You must configure gdbserver.  Look at the README file for details."
@@ -229,7 +246,7 @@ tags: TAGS
 clean:
        rm -f *.o ${ADD_FILES} *~
        rm -f init.c version.c
-       rm -f gdbserver core make.log
+       rm -f gdbserve.O gdbserve.nlm core make.log
 
 distclean: clean c-exp.tab.c m2-exp.tab.c ch-exp.tab.c TAGS
        rm -f tm.h xm.h config.status
diff --git a/gdb/nlm/aio.h b/gdb/nlm/aio.h
new file mode 100644 (file)
index 0000000..37bc28f
--- /dev/null
@@ -0,0 +1,636 @@
+
+/*----------------------------------------------------------------------------*
+ *                                                                           *
+ *     NetWare 386 Developer's Asynchronous I/O (AIO) Runtime library        *
+ *                                                                           *
+ *     This include file defines the constants and prototypes required       *
+ *     to use the AIO application interface.                                 *
+ *                                                                           *
+ *     (c) Copyright.  1991 Novell, Inc.   All rights reserved.              *
+ *                                                                           *
+ *----------------------------------------------------------------------------*/
+
+typedef unsigned long DWORD;
+
+
+/*----------------------------------------------------------------------------*
+ *                                                                           *
+ *    Predefined hardware types for use with the AIOAcquirePort function.     *
+ *                                                                           *
+ *----------------------------------------------------------------------------*/
+
+#define AIO_COMX_TYPE            (1)
+#define AIO_ARTIC_TYPE           (2)
+#define AIO_WNIM_TYPE            (3)
+
+
+/*----------------------------------------------------------------------------*
+ *                                                                           *
+ *    Function completion code status values.                                *
+ *                                                                           *
+ *    Note that all error statuses are negative values.                              *
+ *                                                                           *
+ *----------------------------------------------------------------------------*/
+
+#define AIO_SUCCESS              (0)
+#define AIO_BAD_HANDLE           (-1)
+#define AIO_FAILURE              (-2)
+#define AIO_FUNC_NOT_SUPPORTED   (-3)
+#define AIO_INVALID_PARAMETER    (-5)
+#define AIO_PORT_NOT_AVAILABLE   (-6)
+#define AIO_QUALIFIED_SUCCESS    (-7)
+#define AIO_NO_MORE_PORTS        (-8)
+#define AIO_TYPE_NUMBER_INVALID          (-10)
+#define AIO_BOARD_NUMBER_INVALID  (-11)
+#define AIO_PORT_NUMBER_INVALID          (-12)
+#define AIO_RESOURCE_TAG_INVALID  (-13)
+#define AIO_DATA_PRESENT         (-14)
+#define AIO_BAD_REQUEST_TYPE     (-15)
+#define AIO_PORT_GONE            (-20)
+#define AIO_RTAG_INVALID         (-21)
+
+
+/* This is only for non-CLIB application */
+
+#define ASYNCIOSignature  0x4E595341   /* 'NYSA' */
+
+/*----------------------------------------------------------------------------*
+ *                                                                           *
+ *    Definitions for use with the AIOSetExternalControl function.           *
+ *                                                                           *
+ *----------------------------------------------------------------------------*/
+
+#define AIO_EXTERNAL_CONTROL     (1)  
+#define AIO_EXTCTRL_DTR                    (1)
+#define AIO_EXTCTRL_RTS                    (2)
+
+
+#define AIO_BREAK_CONTROL        (2)
+#define AIO_SET_BREAK_OFF          (0)
+#define AIO_SET_BREAK_ON           (1)
+
+
+#define AIO_FLOW_CONTROL         (3)
+#define AIO_SOFTWARE_FLOW_CONTROL_OFF  (0)
+#define AIO_SOFTWARE_FLOW_CONTROL_ON   (1)
+#define AIO_HARDWARE_FLOW_CONTROL_OFF  (0)
+#define AIO_HARDWARE_FLOW_CONTROL_ON   (2)
+
+
+#define AIO_FLOW_CONTROL_CHARACTERS (4)         
+
+#define AIO_SET_DEADMAN_TIMER    (5)  
+
+/*----------------------------------------------------------------------------*
+ *                                                                           *
+ *    Definitions for use with the AIOGetExternalStatus function.            *
+ *                                                                           *
+ *----------------------------------------------------------------------------*/
+
+#define AIO_EXTSTA_RI        (0x00000001)
+#define AIO_EXTSTA_DCD       (0x00000008)
+#define AIO_EXTSTA_DSR       (0x00000010)
+#define AIO_EXTSTA_CTS       (0x00000020)
+#define AIO_EXTSTA_BREAK      (0x00000080)
+
+
+/*----------------------------------------------------------------------------*
+ *                                                                           *
+ *    Definitions for use with the AIOFlushBuffers function.                 *
+ *                                                                           *
+ *----------------------------------------------------------------------------*/
+
+#define AIO_FLUSH_WRITE_BUFFER   (0x0001)
+#define AIO_FLUSH_READ_BUFFER    (0x0002)
+
+
+/*----------------------------------------------------------------------------*
+ *                                                                           *
+ *    Definitions for use with the AIOReadStatus function.                   *
+ *                                                                           *
+ *----------------------------------------------------------------------------*/
+
+#define AIO_RECEIVE_ACTIVE   (0)
+#define AIO_RECEIVE_FULL     (1)
+
+/*----------------------------------------------------------------------------*
+ *                                                                           *
+ *    Definitions for use with the AIOWriteStatus function.                  *
+ *                                                                           *
+ *----------------------------------------------------------------------------*/
+
+#define AIO_TRANSMIT_IDLE     (0)
+#define AIO_TRANSMIT_ACTIVE   (1)
+#define AIO_TRANSMIT_XOFFED   (2)
+
+/*----------------------------------------------------------------------------*
+ *                                                                           *
+ *    Definitions for use with the AIOAcquirePort function.                  *
+ *                                                                           *
+ *----------------------------------------------------------------------------*/
+
+#define AIO_HARDWARE_TYPE_WILDCARD  (-1)
+#define AIO_BOARD_NUMBER_WILDCARD   (-1)
+#define AIO_PORT_NUMBER_WILDCARD    (-1)
+
+/*----------------------------------------------------------------------------*
+ *                                                                           *
+ *    Definitions for use with the AIOConfigurePort function.                *
+ *                                                                           *
+ *----------------------------------------------------------------------------*/
+
+/* BitRate */
+                         
+#define AIO_BAUD_50      (0)
+#define AIO_BAUD_75      (1)
+#define AIO_BAUD_110     (2)
+#define AIO_BAUD_134p5   (3)
+#define AIO_BAUD_150     (4)
+#define AIO_BAUD_300     (5)
+#define AIO_BAUD_600     (6)
+#define AIO_BAUD_1200    (7)
+#define AIO_BAUD_1800    (8)
+#define AIO_BAUD_2000    (9)
+#define AIO_BAUD_2400    (10)
+#define AIO_BAUD_3600    (11)
+#define AIO_BAUD_4800    (12)
+#define AIO_BAUD_7200    (13)
+#define AIO_BAUD_9600    (14)
+#define AIO_BAUD_19200   (15)
+#define AIO_BAUD_38400   (16)
+#define AIO_BAUD_57600   (17)
+#define AIO_BAUD_115200          (18)
+                         
+/* DataBits */
+
+#define AIO_DATA_BITS_5          (0)
+#define AIO_DATA_BITS_6          (1)
+#define AIO_DATA_BITS_7          (2)
+#define AIO_DATA_BITS_8          (3)
+
+/* StopBits */
+                            
+#define AIO_STOP_BITS_1          (0)
+#define AIO_STOP_BITS_1p5 (1)
+#define AIO_STOP_BITS_2          (2)
+                           
+/* Parity */
+
+#define AIO_PARITY_NONE          (0)
+#define AIO_PARITY_ODD   (1)
+#define AIO_PARITY_EVEN          (2)
+#define AIO_PARITY_MARK          (3)
+#define AIO_PARITY_SPACE  (4)
+
+/* FlowControl */
+                                     
+#define AIO_SOFTWARE_FLOWCONTROL_OFF  (0)
+#define AIO_SOFTWARE_FLOWCONTROL_ON   (1)
+#define AIO_HARDWARE_FLOWCONTROL_OFF  (0)
+#define AIO_HARDWARE_FLOWCONTROL_ON   (2)
+
+#define AIO_DROPOUT_VALUE   (0xFF)
+
+/*----------------------------------------------------------------------------*
+ *                                                                           *
+ *    Definitions for use with AIOPORTCAPABILITIES structure.                *
+ *                                                                           *
+ *----------------------------------------------------------------------------*/
+                             
+typedef struct
+  {                          
+  WORD   returnLength;       /*  byte length of capabilities data */
+  BYTE   majorVersion;
+  BYTE   minorVersion;
+  LONG   notSupportedMask;
+  BYTE   minBitRate;         /*  minimum bit rate index supported */
+  BYTE   maxBitRate;         /*  maximum bit rate index supported */
+  BYTE   minDataBits;        /*  minimum data bits per char index supported */
+  BYTE   maxDataBits;        /*  maximum data bits per char index supported */
+  BYTE   minStopBits;        /*  minimum stop bits per char index supported */
+  BYTE   maxStopBits;        /*  maximum stop bits per char index supported */
+  BYTE   minParityMode;      /*  minimum parity mode index supported */
+  BYTE   maxParityMode;      /*  maximum parity mode index supported */
+  BYTE   minFlowCtrlMode;    /*  minimum flow control mode index supported */
+  BYTE   maxFlowCtrlMode;    /*  maximum flow control mode index supported */
+  LONG   miscCapabilities;   /*  miscellaneous capability flags */
+  LONG   minReadBufferSize;  /*  minimum length of receive buffer */
+  LONG   maxReadBufferSize;  /*  maximum length of receive buffer */
+  LONG   minWriteBufferSize; /*  minimum length of transmit buffer */
+  LONG   maxWriteBufferSize; /*  maximum length of transmit buffer */
+  WORD   minDeadmanTime;     /*  minimum deadman time (seconds) */
+  WORD   maxDeadmanTime;     /*  maximum deadman time (seconds) */
+  } AIOPORTCAPABILITIES;
+
+#define AIO_PORT_NS_MINBITRATE          (0x80000000)
+#define AIO_PORT_NS_MAXBITRATE          (0x40000000)
+#define AIO_PORT_NS_MINDATABITS                 (0x20000000)
+#define AIO_PORT_NS_MAXDATABITS                 (0x10000000)
+#define AIO_PORT_NS_MINSTOPBITS                 (0x08000000)
+#define AIO_PORT_NS_MAXSTOPBITS                 (0x04000000)
+#define AIO_PORT_NS_MINPARITYMODE       (0x02000000)
+#define AIO_PORT_NS_MAXPARITYMODE       (0x01000000)
+#define AIO_PORT_NS_MINFLOWCTRLMODE     (0x00800000)
+#define AIO_PORT_NS_MAXFLOWCTRLMODE     (0x00400000)
+#define AIO_PORT_NS_MISCCAPABILITIES    (0x00200000)
+#define AIO_PORT_NS_MINREADBUFFERSIZE   (0x00100000)
+#define AIO_PORT_NS_MAXREADBUFFERSIZE   (0x00080000)
+#define AIO_PORT_NS_MINWRITEBUFFERSIZE  (0x00040000)
+#define AIO_PORT_NS_MAXWRITEBUFFERSIZE  (0x00020000)
+#define AIO_PORT_NS_MINDEADMANTIME      (0x00010000)
+#define AIO_PORT_NS_MAXDEADMANTIME      (0x00008000) 
+
+#define AIO_PORT_CAPS_NOT_SUPPORTED (0x00007FFF)
+#define AIO_PORT_CAPS_MAJOR_VERSION  (1)
+#define AIO_PORT_CAPS_MINOR_VERSION  (0)
+
+#define AIO_CAP_OUTPUT_BREAK   (0x00000002)
+#define AIO_CAP_FLOWCTRLCHARS  (0x00000004)
+#define AIO_CAP_PROGRAMMABLE   (0x00000008)
+#define AIO_CAP_INPUT          (0x00000010)
+#define AIO_CAP_OUTPUT         (0x00000020)
+
+
+typedef struct 
+  {
+  WORD   returnLength;       /*  byte length of driver capabilities structure */
+  BYTE   byteData[2];
+  } AIODVRCAPABILITIES;
+
+#define AIO_NO_STRUCT_DATA_RETURNED   (2)
+
+/*----------------------------------------------------------------------------*
+ *                                                                           *
+ *    Definitions for use with the AIOGetPortsRollCall function.             *
+ *                                                                           *
+ *----------------------------------------------------------------------------*/
+
+typedef struct
+  {
+  WORD   returnLength;       /*  byte length of port info data */
+  BYTE   majorVersion;
+  BYTE   minorVersion;
+  LONG   notSupportedMask;
+  int    hardwareType;       /*  value used with AIOAcquirePort   */  
+  int    boardNumber;        /*    "                              */
+  int    portNumber;         /*    "                              */
+  WORD   availability;       /*  availability of port for acquire */
+  LONG   externalStatus;     /*  current external status value for port */
+  LONG   chgdExternalStatus; /*  changed external status value for port  */
+  } AIOPORTINFO;
+
+#define AIO_INFO_NS_HARDWARETYPE        (0x80000000)
+#define AIO_INFO_NS_BOARDNUMBER                 (0x40000000)
+#define AIO_INFO_NS_PORTNUMBER          (0x20000000)
+#define AIO_INFO_NS_AVAILABILITY        (0x10000000)
+#define AIO_INFO_NS_EXTERNALSTATUS      (0x08000000)
+#define AIO_INFO_NS_CHGDEXTERNALSTATUS  (0x04000000)
+
+#define AIO_PORT_INFO_NOT_SUPPORTED (0x03FFFFFF)
+#define AIO_PORT_INFO_MAJOR_VERSION   (1)
+#define AIO_PORT_INFO_MINOR_VERSION   (0)
+
+#define AIO_AVAILABLE_FOR_ACQUIRE   (0)
+#define AIO_ALREADY_ACQUIRED       (1)
+#define AIO_UNAVAILABLE                    (0xFF)
+
+#define AIO_INITIAL      (0)
+#define AIO_SUCCESSOR    (1)    
+
+
+/*----------------------------------------------------------------------------*
+ *                                                                           *
+ *    Definitions for use with the AIOGetPortConfiguration function.         *
+ *                                                                           *
+ *----------------------------------------------------------------------------*/
+
+typedef struct
+  {
+  WORD   returnLength;       /*  byte length of port configuration data */
+  BYTE   majorVersion;
+  BYTE   minorVersion;
+  LONG   notSupportedMask;
+  int    hardwareType;       /*  value used with AIOAcquirePort     */
+  int    boardNumber;        /*    "  */
+  int    portNumber;         /*    " */
+  BYTE   bitRate;            /*  Bits per second index */
+  BYTE   dataBits;           /*  Bits per character index */
+  BYTE   stopBits;           /*  Stop bits per char index */
+  BYTE   parityMode;         /*  Generated parity index */
+  BYTE   flowCtrlMode;       /*  Flow control mode */
+  BYTE   breakMode;          /*  Break control mode */
+  LONG   readSize;           /*  Receive buffer size */
+  LONG   writeSize;          /*  Transmit buffer size */
+  BYTE   transmitXon;   
+  BYTE   transmitXoff;  
+  BYTE   receiveXon;    
+  BYTE   receiveXoff;
+  WORD   externalControl;    /*  set with AIO_EXTERNAL_CONTROL */
+
+  } AIOPORTCONFIG;
+
+#define AIO_CONFIG_NS_HARDWARETYPE        (0x80000000)
+#define AIO_CONFIG_NS_BOARDNUMBER         (0x40000000)
+#define AIO_CONFIG_NS_PORTNUMBER          (0x20000000)
+#define AIO_CONFIG_NS_BITRATE             (0x10000000)
+#define AIO_CONFIG_NS_DATABITS            (0x08000000)
+#define AIO_CONFIG_NS_STOPBITS            (0x04000000)
+#define AIO_CONFIG_NS_PARITYMODE          (0x02000000)
+#define AIO_CONFIG_NS_FLOWCTRLMODE        (0x01000000)
+#define AIO_CONFIG_NS_BREAKMODE                   (0x00800000)
+#define AIO_CONFIG_NS_READSIZE            (0x00400000)
+#define AIO_CONFIG_NS_WRITESIZE                   (0x00200000)
+#define AIO_CONFIG_NS_TRANSMITXON         (0x00100000)
+#define AIO_CONFIG_NS_TRANSMITXOFF        (0x00080000)
+#define AIO_CONFIG_NS_RECEIVEXON          (0x00040000)
+#define AIO_CONFIG_NS_RECEIVEXOFF         (0x00020000)
+#define AIO_CONFIG_NS_EXTERNALCONTROL     (0x00010000)
+
+#define AIO_PORT_CONFIG_NOT_SUPPORTED (0x0007FFFF)
+#define AIO_PORT_CONFIG_MAJOR_VERSION  (1)
+#define AIO_PORT_CONFIG_MINOR_VERSION  (0)
+
+#define AIO_EXTCTRL_DTR_ENABLE         (1)
+#define AIO_EXTCTRL_DTR_DISABLE                (0)
+#define AIO_EXTCTRL_RTS_ENABLE         (2)
+#define AIO_EXTCTRL_RTS_DISABLE                (0)
+
+#define AIO_BREAK_MODE_OFF          (0)
+#define AIO_BREAK_MODE_ON           (1)
+
+typedef struct 
+  {
+  WORD   returnLength;       /*  byte length of driver config structure */
+  BYTE   byteData[2];
+  } AIODVRCONFIG;
+
+/*----------------------------------------------------------------------------*
+ *                                                                           *
+ *    Definitions for use with the AIOGetStatistics function.                *
+ *                                                                           *
+ *----------------------------------------------------------------------------*/
+
+typedef struct 
+  {
+  WORD   returnLength;       /*  byte length of port statistics structure */
+  BYTE   majorVersion;
+  BYTE   minorVersion;
+  LONG   notSupportedMask;
+  LONG   receiveBytes;       /*  total number of bytes received on port */
+  LONG   transmitBytes;      /*  total number of bytes transmitted from port */
+  LONG   parityErrors;       /*  number of receive parity errors  */
+  LONG   framingErrors;      /*  number of receive framing errors */
+  LONG   overrunSoftware;    /*  number of software overruns (occurrences) */
+  LONG   overrunHardware;    /*  number of hardware overruns (occurrences) */
+  } AIOPORTSTATISTICS;
+
+#define AIO_STATS_NS_RECEIVEBYTES        (0x80000000)
+#define AIO_STATS_NS_TRANSMITBYTES       (0x40000000)
+#define AIO_STATS_NS_PARITYERRORS        (0x20000000)
+#define AIO_STATS_NS_FRAMINGERRORS       (0x10000000)
+#define AIO_STATS_NS_OVERRUNSOFTWARE     (0x08000000)
+#define AIO_STATS_NS_OVERRUNHARDWARE     (0x04000000)
+
+#define AIO_PORT_STATS_NOT_SUPPORTED  (0x03FFFFFF)
+#define AIO_PORT_STATS_MAJOR_VERSION  (1)
+#define AIO_PORT_STATS_MINOR_VERSION  (0)
+
+typedef struct 
+  {
+  WORD   returnLength;       /*  byte length of driver statistics structure */
+  BYTE   byteData[2];
+  } AIODVRSTATISTICS;
+
+/*----------------------------------------------------------------------------*
+ *                                                                           *
+ *    Definitions for use with AIOGetDriverList function.                    *
+ *                                                                           *
+ *----------------------------------------------------------------------------*/
+
+typedef struct
+  {
+  int    hardwareType;
+  int    ports;
+  char   name[128];
+  } AIODRIVERLISTENTRY;
+
+typedef struct
+  {
+  WORD               returnLength;
+  AIODRIVERLISTENTRY  driver[1];
+  } AIODRIVERLIST;
+
+#define AIO_DRIVER_LIST_GET_FIRST   (-1)
+
+
+/*----------------------------------------------------------------------------*
+ *                                                                           *
+ *    Definitions for use with AIOGetBoardList function.                     *
+ *                                                                           *
+ *----------------------------------------------------------------------------*/
+
+typedef struct
+  {
+  int    boardNumber;
+  int    ports;
+  char   name[128];
+  } AIOBOARDLISTENTRY;
+
+typedef struct
+  {
+  WORD              returnLength;
+  AIOBOARDLISTENTRY  board[1];
+  } AIOBOARDLIST;
+
+#define AIO_BOARD_LIST_GET_FIRST    (-1)
+
+/*----------------------------------------------------------------------------*
+ *                                                                           *
+ *    Definitions for use with AIOSetControlData function.                   *
+ *                                                                           *
+ *----------------------------------------------------------------------------*/
+
+typedef struct 
+  {
+  WORD   returnLength;       /*  byte length of control data structure */
+  BYTE   byteData[2];
+  } AIOCONTROLDATA;
+
+/*----------------------------------------------------------------------------*
+ *                                                                           *
+ *    Definitions for use with AIOGetFirstPortInfo and AIOGetNextPortInfo     *
+ *                                                                           *
+ *----------------------------------------------------------------------------*/
+
+typedef struct
+  {
+  int    typeMask;
+  int    boardMask;
+  int    portMask;
+  int    reserved[6];
+  } AIOPORTSEARCH;
+
+       /* reserved index values */
+
+#define SEARCH_TYPE_INDEX     0
+#define SEARCH_BOARD_INDEX    1
+#define SEARCH_PORT_INDEX     2
+
+
+/*----------------------------------------------------------------------------*
+ *                                                                           *
+ *    Definition of AIO functions.                                           *
+ *                                                                           *
+ *----------------------------------------------------------------------------*/
+
+extern int  AIOAcquirePort           ( int   *hardwareType,
+                                       int   *boardNumber,
+                                       int   *portNumber,
+                                       int   *portHandle
+                                     );
+
+extern int  AIOAcquirePortWithRTag   ( int   *hardwareType,
+                                       int   *boardNumber,       
+                                       int   *portNumber,        
+                                       int   *portHandle,        
+                                       LONG   RTag
+                                     );
+
+extern int  AIOConfigurePort         ( int   portHandle,
+                                       BYTE  bitRate,
+                                       BYTE  dataBits,
+                                       BYTE  stopBits,
+                                       BYTE  parityMode,
+                                       BYTE  flowCtrlMode
+                                     );
+       
+extern int  AIOFlushBuffers          ( int   portHandle,
+                                       WORD  flushFlag
+                                     );
+       
+extern int AIOGetBoardList( int                    hardwareType,
+                           int             boardIndex,
+                           AIOBOARDLIST   *pBoardList );
+
+extern int  AIOGetDriverList         ( int   lastHardwareType,
+                                       AIODRIVERLIST *pDriverList
+                                     );
+       
+extern int  AIOGetExternalStatus     ( int   portHandle,
+                                       LONG  *extStatus,
+                                       LONG  *chgdExtStatus
+                                     );
+
+extern int   AIOGetFirstPortInfo      ( int                hardwareType,
+                                       int                 boardNumber,    
+                                       int                 portNumber,    
+                                       AIOPORTSEARCH       *portSearchP,    
+                                       AIOPORTINFO         *portInfoP,    
+                                       AIOPORTCAPABILITIES *capabilitiesP,   
+                                       AIODVRCAPABILITIES  *dvrCapabilitiesP,
+                                       char                *NLMModuleNameP );
+
+extern int   AIOGetNextPortInfo              ( AIOPORTSEARCH       *portSearchP,       
+                                       AIOPORTINFO         *portInfoP,       
+                                       AIOPORTCAPABILITIES *capabilitiesP,   
+                                       AIODVRCAPABILITIES  *dvrCapabilitiesP,
+                                       char                *NLMModuleNameP );
+       
+extern int  AIOGetPortCapability     ( int                 portHandle,
+                                       AIOPORTCAPABILITIES *pCapabilities,
+                                       AIODVRCAPABILITIES  *pDvrCapabilities
+                                     );
+
+extern int  AIOGetPortConfiguration  ( int                 portHandle,
+                                       AIOPORTCONFIG       *pPortConfig,
+                                       AIODVRCONFIG        *pDvrConfig
+                                     );
+
+extern int  AIOGetPortStatus         ( int   portHandle,
+                                       LONG  *writeCount,
+                                       WORD  *writeState,
+                                       LONG  *readCount,
+                                       WORD  *readState,
+                                       LONG  *extStatus,
+                                       LONG  *chgdExtStatus
+                                     );
+       
+extern int  AIOGetReadBufferSize     ( int   portHandle,
+                                       LONG  *readSize
+                                     );
+       
+extern int  AIOGetPortStatistics     ( int   portHandle,
+                                       AIOPORTSTATISTICS   *pPortStatistics,
+                                       AIODVRSTATISTICS    *pDvrStatistics
+                                     );
+
+extern int   AIOGetFirstPortStatistics( int                hardwareType,
+                                       int                 boardNumber,    
+                                       int                 portNumber,    
+                                       AIOPORTSEARCH       *portSearchP,    
+                                       AIOPORTSTATISTICS   *pPortStatistics,
+                                       AIODVRSTATISTICS    *pDvrStatistics
+                                     );
+
+extern int   AIOGetNextPortStatistics ( AIOPORTSEARCH      *portSearchP,       
+                                       AIOPORTSTATISTICS   *pPortStatistics,
+                                       AIODVRSTATISTICS    *pDvrStatistics
+                                     );
+
+extern int  AIOGetWriteBufferSize    ( int   portHandle,
+                                       LONG  *writeSize
+                                     );
+       
+extern int  AIOReadData              ( int   portHandle,
+                                       char  *buffer,
+                                       LONG  length,
+                                       LONG  *numberBytesRead
+                                     );
+       
+extern int  AIOReadStatus            ( int   portHandle, 
+                                       LONG  *count,
+                                       WORD  *state
+                                     );
+       
+extern int  AIOReleasePort           ( int   portHandle );
+       
+extern int  AIOSetControlData        ( int   portHandle,
+                                       int   requestType,
+                                       AIOCONTROLDATA *requestStructValue
+                                     );
+
+extern int  AIOSetExternalControl    ( int   portHandle,
+                                       int   requestType,
+                                       int   requestValue
+                                     );
+       
+extern int  AIOSetFlowControl        ( int   portHandle,
+                                       int   flowCtrlMode
+                                     );
+       
+extern int  AIOSetFlowControlCharacters( int   portHandle,
+                                       BYTE  transmitXon,
+                                       BYTE  transmitXoff,
+                                       BYTE  receiveXon,
+                                       BYTE  receiveXoff
+                                     );
+       
+extern int  AIOSetReadBufferSize     ( int    portHandle,
+                                       LONG   bufferSize
+                                     );
+      
+extern int  AIOSetWriteBufferSize    ( int    portHandle,
+                                       LONG   bufferSize
+                                     );
+
+extern int  AIOWriteData             ( int   portHandle,
+                                       char  *buffer,
+                                       LONG  length,
+                                       LONG  *numberBytesWritten
+                                     );
+       
+extern int  AIOWriteStatus           ( int   portHandle,
+                                       LONG  *count,
+                                       WORD  *state
+                                     );
diff --git a/gdb/nlm/alpha.c b/gdb/nlm/alpha.c
new file mode 100644 (file)
index 0000000..62547cb
--- /dev/null
@@ -0,0 +1,152 @@
+#include "alpha.h"
+
+/* Get the registers out of the frame information.  */
+
+void
+frame_to_registers (frame, regs)
+     struct StackFrame *frame;
+     char *regs;
+{
+  mem2hex (&frame->ExceptionPC, &regs[PC_REGNUM * 8 * 2], 8 * 1, 0);
+
+  mem2hex (&frame->ExceptionRegs[SF_IREG_OFFSET], &regs[V0_REGNUM * 8 * 2], 8 * 64, 0);
+}
+
+/* Put the registers back into the frame information.  */
+
+void
+registers_to_frame (regs, frame)
+     char *regs;
+     struct StackFrame *frame;
+{
+  hex2mem (&regs[PC_REGNUM * 8 * 2], &frame->ExceptionPC, 8 * 1, 0);
+
+  hex2mem (&regs[V0_REGNUM * 8 * 2], &frame->ExceptionRegs[SF_IREG_OFFSET], 8 * 64, 0);
+}
+
+union inst
+{
+  LONG l;
+
+  struct
+    {
+      union
+       {
+         struct
+           {
+             unsigned hint : 16;
+             unsigned rb : 5;
+             unsigned ra : 5;
+             unsigned opcode : 6;
+           } jump;
+         struct
+           {
+             signed disp : 21;
+             unsigned ra : 5;
+             unsigned opcode : 6;
+           } branch;
+       } variant;
+    } inst;
+};
+
+static LONG saved_inst;
+static LONG *saved_inst_pc = 0;
+static LONG saved_target_inst;
+static LONG *saved_target_inst_pc = 0;
+
+void
+set_step_traps (frame)
+     struct StackFrame *frame;
+{
+  union inst inst;
+  LONG *target;
+  int opcode;
+  int ra, rb;
+  LONG *pc = (LONG *)frame->ExceptionPC;
+
+  inst.l = *pc++;
+
+  opcode = inst.inst.variant.branch.opcode;
+
+  if ((opcode & 0x30) == 0x30) /* A branch of some sort */
+    target = inst.inst.variant.branch.disp + pc;
+  else if (opcode == 0x1a)     /* jmp, ret, etc... */
+    target = (LONG *)(frame->ExceptionRegs[SF_IREG_OFFSET
+                                          + inst.inst.variant.jump.rb].lo
+                     & ~3);
+  else
+    target = pc;
+
+  saved_inst = *pc;
+  *pc = 0x80;                  /* call_pal bpt */
+  saved_inst_pc = pc;
+
+  if (target != pc)
+    {
+      saved_target_inst = *target;
+      *target = 0x80;          /* call_pal bpt */
+      saved_target_inst_pc = target;
+    }
+}
+
+/* Remove step breakpoints.  Returns non-zero if pc was at a step breakpoint,
+   zero otherwise.  This routine works even if there were no step breakpoints
+   set.  */
+
+int
+clear_step_traps (frame)
+     struct StackFrame *frame;
+{
+  int retcode;
+  LONG *pc = (LONG *)frame->ExceptionPC;
+
+  if (saved_inst_pc == pc || saved_target_inst_pc == pc)
+    retcode = 1;
+  else
+    retcode = 0;
+
+  if (saved_inst_pc)
+    {
+      *saved_inst_pc = saved_inst;
+      saved_inst_pc = 0;
+    }
+
+  if (saved_target_inst_pc)
+    {
+      *saved_target_inst_pc = saved_target_inst;
+      saved_target_inst_pc = 0;
+    }
+
+  return retcode;
+}
+
+void
+do_status (ptr, frame)
+     char *ptr;
+     struct StackFrame *frame;
+{
+  int sigval;
+
+  sigval = computeSignal (frame->ExceptionNumber);
+
+  sprintf (ptr, "T%02x", sigval);
+  ptr += 3;
+
+  sprintf (ptr, "%02x:", PC_REGNUM);
+  ptr = mem2hex (&frame->ExceptionPC, ptr + 3, 8, 0);
+  *ptr++ = ';';
+
+  sprintf (ptr, "%02x:", SP_REGNUM);
+  ptr = mem2hex (&frame->ExceptionRegs[SF_IREG_OFFSET + SP_REGNUM], ptr + 3, 8, 0);
+  *ptr++ = ';';
+
+  sprintf (ptr, "%02x:", RA_REGNUM);
+  ptr = mem2hex (&frame->ExceptionRegs[SF_IREG_OFFSET + RA_REGNUM], ptr + 3, 8, 0);
+  *ptr++ = ';';
+
+  sprintf (ptr, "%02x:", FP_REGNUM);
+  ptr = mem2hex (&frame->ExceptionRegs[SF_IREG_OFFSET + FP_REGNUM], ptr + 3, 8, 0);
+  *ptr++ = ';';
+
+  *ptr = '\000';
+}
diff --git a/gdb/nlm/alpha.h b/gdb/nlm/alpha.h
new file mode 100644 (file)
index 0000000..8fc7ab1
--- /dev/null
@@ -0,0 +1,19 @@
+#include "alpha-patch.h"
+
+/* Register values.  All of these values *MUST* agree with tm.h */
+#define RA_REGNUM 26           /* Contains return address value */
+#define SP_REGNUM 30           /* Contains address of top of stack */
+#define PC_REGNUM 64           /* Contains program counter */
+#define FP_REGNUM 65           /* Virtual frame pointer */
+#define V0_REGNUM 0            /* Function integer return value */
+#define NUM_REGS 66            /* Number of machine registers */
+#define REGISTER_BYTES (NUM_REGS * 8) /* Total size of registers array */
+
+#define ExceptionPC ExceptionRegs[SF_REG_PC].lo
+#define DECR_PC_AFTER_BREAK 0  /* NT's Palcode gets this right! */
+#define BREAKPOINT {0x80, 0, 0, 0} /* call_pal bpt */
+unsigned char breakpoint_insn;
+#define BREAKPOINT_SIZE 4
+
+/*#define flush_i_cache() asm("call_pal 0x86")*/
+
index 5f4ca6c52cc0db2713aa758591195aa5c6ba8c9a..2e0ff17ad3a2bba9847c71ee5ac7b45f1fbdfc10 100644 (file)
@@ -106,14 +106,6 @@ vax-*-ultrix*)             gdb_host=vaxult ;;
 
 esac
 
-if [ ! -f ${srcdir}/../config/${gdb_host_cpu}/${gdb_host}.mh ]; then
-       echo '***' "GDB remote does not support host ${host}" 1>&2
-       exit 1
-fi
-
-#  We really shouldn't depend on there being a space after XM_FILE= ...
-hostfile=`awk '$1 == "XM_FILE=" { print $2 }' <${srcdir}/../config/${gdb_host_cpu}/${gdb_host}.mh`
-
 # per-target:
 
 # Map target cpu into the config cpu subdirectory name.
@@ -230,6 +222,7 @@ ns32k-utek-sysv)    gdb_target=merlin ;;
 ns32k-utek-*)          gdb_target=umax ;;
 
 pn-*-*)                        gdb_target=pn ;;
+powerpc-*-netware*)    gdb_target=ppc-nw ;;
 
 pyramid-*-*)           gdb_target=pyramid ;;
 
@@ -251,25 +244,20 @@ vax-*-*)          gdb_target=vax ;;
 z8k-*-sim)             gdb_target=z8ksim ;;
 esac
 
-if [ ! -f ${srcdir}/../config/${gdb_target_cpu}/${gdb_target}.mt ]; then
-       echo '***' "GDB remote does not support target ${target}" 1>&2
+if [ ! -f ${srcdir}/../config/${gdb_target_cpu}/gdbserve.mt ]; then
+       echo '***' "GDBSERVE does not support target ${target}" 1>&2
        exit 1
 fi
 
 if [ -z "${removing}" ] ; then
-       cat ${srcdir}/../config/${gdb_host_cpu}/${gdb_host}.mh ${srcdir}/../config/${gdb_target_cpu}/${gdb_target}.mt | awk '$1 == "#msg" {
+       cat ${srcdir}/../config/${gdb_host_cpu}/${gdb_host}.mh ${srcdir}/../config/${gdb_target_cpu}/gdbserve.mt | awk '$1 == "#msg" {
                print substr($0,6)}'
 fi
 
-#  We really shouldn't depend on there being a space after TM_FILE= ...
-targetfile=`awk '$1 == "TM_FILE=" { print $2 }' <${srcdir}/../config/${gdb_target_cpu}/${gdb_target}.mt`
+#  We really shouldn't depend on there being a space after CPU_FILE= ...
+cpufile=`awk '$1 == "CPU_FILE=" { print $2 }' <${srcdir}/../config/${gdb_target_cpu}/gdbserve.mt`
 
-if [ "${target}" = "${host}" ] ; then
-       nativefile=`awk '$1 == "NAT_FILE=" { print $2 }' <${srcdir}/../config/${gdb_host_cpu}/${gdb_host}.mh`
-fi
-
-host_makefile_frag=../config/${gdb_host_cpu}/${gdb_host}.mh
-target_makefile_frag=../config/${gdb_target_cpu}/${gdb_target}.mt
+target_makefile_frag=../config/${gdb_target_cpu}/gdbserve.mt
 
 # If hostfile (XM_FILE) and/or targetfile (TM_FILE) and/or nativefile
 # (NAT_FILE) is not set in the ?config/* file, we don't make the
@@ -279,47 +267,8 @@ target_makefile_frag=../config/${gdb_target_cpu}/${gdb_target}.mt
 
 files=
 links=
-rm -f xm.h
-if [ "${hostfile}" != "" ]; then
-       if [ -f ${srcdir}/../config/${hostfile} ]; then
-               files="${files} ../config/${hostfile}"
-       else
-               files="${files} ../config/${gdb_host_cpu}/${hostfile}"
-       fi
-       links="${links} xm.h"
-fi
-rm -f tm.h
-if [ "${targetfile}" != "" ]; then
-       if [ -f ${srcdir}/../config/${targetfile} ]; then
-               files="${files} ../config/${targetfile}"
-       else
-               files="${files} ../config/${gdb_target_cpu}/${targetfile}"
-       fi
-       links="${links} tm.h"
-fi
-rm -f nm.h
-if [ "${nativefile}" != "" ]; then
-       if [ -f ${srcdir}/../config/${nativefile} ]; then
-               files="${files} ../config/${nativefile}"
-       else
-               files="${files} ../config/${gdb_host_cpu}/${nativefile}"
-       fi
-       links="${links} nm.h"
-# temporary scaffolding until all hosts have the host/target/native
-# split in place.
-else
-       files="${files} ../config/nm-trash.h"
-       links="${links} nm.h"
-fi
-
-if [ ${target_cpu} = "sparclite" ]; then
-       configdirs="${configdirs} sparclite"
-fi
-
-# post-target:
-
-if [ "${nativefile}" = "" ] ; then
-       sed -e '/^NATDEPFILES= /s//# NATDEPFILES= /' \
-               < Makefile > Makefile.tem
-       mv -f Makefile.tem Makefile
+rm -f cpu.c
+if [ "${cpufile}" != "" ]; then
+       files="${files} ${cpufile}.c ${cpufile}.h"
+       links="${links} cpu.c cpu.h"
 fi
diff --git a/gdb/nlm/fake_aio.c b/gdb/nlm/fake_aio.c
new file mode 100644 (file)
index 0000000..91cc7d5
--- /dev/null
@@ -0,0 +1,76 @@
+#include <nwtypes.h>
+#include <errno.h>
+#include <stdio.h>
+#include <aio.h>
+
+#define CONST const
+
+/* This file provides stubs and equivalent interfaces for all functions that
+   the debugger stub needs, but aren't yet implemented. */
+
+int
+AIOReadData (int portHandle, char  *buffer, LONG length, LONG *numberBytesRead)
+{
+  return AIO_SUCCESS;
+}
+
+int
+AIOWriteData (int portHandle, char *buffer, LONG length,
+             LONG *numberBytesWritten)
+       
+{
+  return AIO_SUCCESS;
+}
+
+int
+AIOAcquirePort (int *hardwareType, int *boardNumber, int *portNumber,
+               int *portHandle)
+{
+  return AIO_SUCCESS;
+}
+
+int
+AIOConfigurePort (int portHandle, BYTE bitRate,        BYTE dataBits, BYTE stopBits,
+                 BYTE parityMode, BYTE flowCtrlMode)
+{
+  return AIO_SUCCESS;
+}
+
+int
+AIOGetPortConfiguration (int portHandle, AIOPORTCONFIG *pPortConfig,
+                            AIODVRCONFIG *pDvrConfig)
+{
+  fprintf (stderr, "AIOGetPortConfiguration stubbed out\n");
+  exit (1);
+}
+
+int
+AIOReleasePort (int portHandle)
+{
+  return AIO_SUCCESS;
+}
+       
+int
+AIOSetExternalControl (int portHandle, int requestType, int requestValue)
+{
+  return AIO_SUCCESS;
+}
+
+int
+AIOGetExternalStatus (int portHandle, LONG *extStatus, LONG *chgdExtStatus)
+{
+  fprintf (stderr, "AIOGetExternalStatus stubbed out\n");
+  exit (1);
+}
+
+void
+StopBell ()
+{
+}
+
+int
+Breakpoint (int __arg)
+{
+  fprintf (stderr, "Breakpoint() stubbed out\n");
+  exit (1);
+}
index e3494cc9dd5fd17703d943d744d53b7f88a5a8ff..31a0c6e8524788bb1cb36f66532f0160c4372f1d 100644 (file)
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
-/*#include <ctype.h>*/
 #include <time.h>
-/*#include <aio.h>*/
 #include <nwconio.h>
 #include <nwadv.h>
 #include <nwdbgapi.h>
-/*#include <process.h>*/
 #include <errno.h>
 #include <nwthread.h>
-#include "alpha-patch.h"
+#include <aio.h>
+#include "cpu.h"
 
 /****************************************************/
 /* This information is from Novell.  It is not in any of the standard
@@ -142,28 +140,12 @@ static int remote_debug = 1;
 
 static const char hexchars[] = "0123456789abcdef";
 
-/* Register values.  All of these values *MUST* agree with tm.h */
-#define RA_REGNUM 26           /* Contains return address value */
-#define SP_REGNUM 30           /* Contains address of top of stack */
-#define PC_REGNUM 64           /* Contains program counter */
-#define FP_REGNUM 65           /* Virtual frame pointer */
-#define V0_REGNUM 0            /* Function integer return value */
-#define NUM_REGS 66            /* Number of machine registers */
-#define REGISTER_BYTES (NUM_REGS * 8) /* Total size of registers array */
-
-#define ExceptionPC ExceptionRegs[SF_REG_PC].lo
-#define DECR_PC_AFTER_BREAK 0  /* NT's Palcode gets this right! */
-#define BREAKPOINT {0x80, 0, 0, 0} /* call_pal bpt */
-
 unsigned char breakpoint_insn[] = BREAKPOINT;
-#define BREAKPOINT_SIZE (sizeof breakpoint_insn)
-
-/*#define flush_i_cache() asm("call_pal 0x86")*/
 
-static char *mem2hex (void *mem, char *buf, int count, int may_fault);
-static char *hex2mem (char *buf, void *mem, int count, int may_fault);
-static void set_step_traps (struct StackFrame *);
-static void clear_step_traps (struct StackFrame *);
+char *mem2hex (void *mem, char *buf, int count, int may_fault);
+char *hex2mem (char *buf, void *mem, int count, int may_fault);
+extern void set_step_traps (struct StackFrame *);
+extern void clear_step_traps (struct StackFrame *);
 
 #if 0
 __main() {};
@@ -214,30 +196,6 @@ putDebugChar (c)
   return 1;
 }
 
-/* Get the registers out of the frame information.  */
-
-static void
-frame_to_registers (frame, regs)
-     struct StackFrame *frame;
-     char *regs;
-{
-  mem2hex (&frame->ExceptionPC, &regs[PC_REGNUM * 8 * 2], 8 * 1, 0);
-
-  mem2hex (&frame->ExceptionRegs[SF_IREG_OFFSET], &regs[V0_REGNUM * 8 * 2], 8 * 64, 0);
-}
-
-/* Put the registers back into the frame information.  */
-
-static void
-registers_to_frame (regs, frame)
-     char *regs;
-     struct StackFrame *frame;
-{
-  hex2mem (&regs[PC_REGNUM * 8 * 2], &frame->ExceptionPC, 8 * 1, 0);
-
-  hex2mem (&regs[V0_REGNUM * 8 * 2], &frame->ExceptionRegs[SF_IREG_OFFSET], 8 * 64, 0);
-}
-
 /* Turn a hex character into a number.  */
 
 static int
@@ -404,8 +362,9 @@ static int mem_may_fault;
 
 /* Indicate to caller of mem2hex or hex2mem that there has been an
    error.  */
-static volatile int mem_err = 0;
+volatile int mem_err = 0;
 
+#ifndef ALTERNATE_MEM_FUNCS
 /* These are separate functions so that they are so short and sweet
    that the compiler won't save any registers (if there is a fault
    to mem_fault, they won't get restored, so there better not be any
@@ -425,27 +384,14 @@ set_char (addr, val)
 {
   *addr = val;
 }
-
-/* This bit of assembly language just returns from a function.  If a
-   memory error occurs within get_char or set_char, the debugger
-   handler points EIP at these instructions to get out.  */
-
-extern void just_return ();
-#if 0
-asm (".globl just_return");
-asm (".globl _just_return");
-asm ("just_return:");
-asm ("_just_return:");
-asm ("leave");
-asm ("ret");
-#endif
+#endif /* ALTERNATE_MEM_FUNCS */
 
 /* convert the memory pointed to by mem into hex, placing result in buf */
 /* return a pointer to the last char put in buf (null) */
 /* If MAY_FAULT is non-zero, then we should set mem_err in response to
    a fault; if zero treat a fault like any other fault in the stub.  */
 
-static char *
+char *
 mem2hex (mem, buf, count, may_fault)
      void *mem;
      char *buf;
@@ -473,7 +419,7 @@ mem2hex (mem, buf, count, may_fault)
 /* convert the hex array pointed to by buf into binary to be placed in mem */
 /* return a pointer to the character AFTER the last byte written */
 
-static char *
+char *
 hex2mem (buf, mem, count, may_fault)
      char *buf;
      void *mem;
@@ -500,7 +446,7 @@ hex2mem (buf, mem, count, may_fault)
 /* This function takes the 386 exception vector and attempts to
    translate this number into a unix compatible signal value.  */
 
-static int
+int
 computeSignal (exceptionVector)
      int exceptionVector;
 {
@@ -559,133 +505,6 @@ hexToInt(ptr, intValue)
   return (numChars);
 }
 
-union inst
-{
-  LONG l;
-
-  struct
-    {
-      union
-       {
-         struct
-           {
-             unsigned hint : 16;
-             unsigned rb : 5;
-             unsigned ra : 5;
-             unsigned opcode : 6;
-           } jump;
-         struct
-           {
-             signed disp : 21;
-             unsigned ra : 5;
-             unsigned opcode : 6;
-           } branch;
-       } variant;
-    } inst;
-};
-
-static LONG saved_inst;
-static LONG *saved_inst_pc = 0;
-static LONG saved_target_inst;
-static LONG *saved_target_inst_pc = 0;
-
-static void
-set_step_traps (frame)
-     struct StackFrame *frame;
-{
-  union inst inst;
-  LONG *target;
-  int opcode;
-  int ra, rb;
-  LONG *pc = (LONG *)frame->ExceptionPC;
-
-  inst.l = *pc++;
-
-  opcode = inst.inst.variant.branch.opcode;
-
-  if ((opcode & 0x30) == 0x30) /* A branch of some sort */
-    target = inst.inst.variant.branch.disp + pc;
-  else if (opcode == 0x1a)     /* jmp, ret, etc... */
-    target = (LONG *)(frame->ExceptionRegs[SF_IREG_OFFSET
-                                          + inst.inst.variant.jump.rb].lo
-                     & ~3);
-  else
-    target = pc;
-
-  saved_inst = *pc;
-  *pc = 0x80;                  /* call_pal bpt */
-  saved_inst_pc = pc;
-
-  if (target != pc)
-    {
-      saved_target_inst = *target;
-      *target = 0x80;          /* call_pal bpt */
-      saved_target_inst_pc = target;
-    }
-}
-
-/* Remove step breakpoints.  Returns non-zero if pc was at a step breakpoint,
-   zero otherwise.  This routine works even if there were no step breakpoints
-   set.  */
-
-static int
-clear_step_traps (frame)
-     struct StackFrame *frame;
-{
-  int retcode;
-  LONG *pc = (LONG *)frame->ExceptionPC;
-
-  if (saved_inst_pc == pc || saved_target_inst_pc == pc)
-    retcode = 1;
-  else
-    retcode = 0;
-
-  if (saved_inst_pc)
-    {
-      *saved_inst_pc = saved_inst;
-      saved_inst_pc = 0;
-    }
-
-  if (saved_target_inst_pc)
-    {
-      *saved_target_inst_pc = saved_target_inst;
-      saved_target_inst_pc = 0;
-    }
-
-  return retcode;
-}
-
-static void
-do_status (ptr, frame)
-     char *ptr;
-     struct StackFrame *frame;
-{
-  int sigval;
-
-  sigval = computeSignal (frame->ExceptionNumber);
-
-  sprintf (ptr, "T%02x", sigval);
-  ptr += 3;
-
-  sprintf (ptr, "%02x:", PC_REGNUM);
-  ptr = mem2hex (&frame->ExceptionPC, ptr + 3, 8, 0);
-  *ptr++ = ';';
-
-  sprintf (ptr, "%02x:", SP_REGNUM);
-  ptr = mem2hex (&frame->ExceptionRegs[SF_IREG_OFFSET + SP_REGNUM], ptr + 3, 8, 0);
-  *ptr++ = ';';
-
-  sprintf (ptr, "%02x:", RA_REGNUM);
-  ptr = mem2hex (&frame->ExceptionRegs[SF_IREG_OFFSET + RA_REGNUM], ptr + 3, 8, 0);
-  *ptr++ = ';';
-
-  sprintf (ptr, "%02x:", FP_REGNUM);
-  ptr = mem2hex (&frame->ExceptionRegs[SF_IREG_OFFSET + FP_REGNUM], ptr + 3, 8, 0);
-  *ptr++ = ';';
-
-  *ptr = '\000';
-}
-
 /* This function does all command processing for interfacing to gdb.
    It is called whenever an exception occurs in the module being
    debugged.  */
index 7377fb4f8391019eacbcbdb664163b062e04d85d..a4e7f9de84eb185351dc78b624c1689e6d8eab4f 100644 (file)
@@ -2,8 +2,8 @@ description "GDB debugger stub"
 version 1,2,0
 #debug
 screenname "System Console"
-input gdbserve
-output GDBSERVE.NLM
+input gdbserve.O
+output gdbserve.nlm
 start _Prelude
 exit _Stop
 import
@@ -14,10 +14,12 @@ import
        GetThreadID
        KillMe
        LoadModule
+       ReadByteAltDebugger
        RegisterDebuggerRTag
        ResumeThread
        SuspendThread
        UnRegisterDebugger
+       WriteByteAltDebugger
        _GetCLibNLMLibHandle
        _NWRegisterNLMLibraryUser
        _SetupArgv
@@ -29,9 +31,11 @@ import
        exit
        fprintf
        getcmd
+       memcmp
        memcpy
        memset
        sprintf
        strcmp
        strcpy
        strlen
+       strnicmp
diff --git a/gdb/nlm/ppc.c b/gdb/nlm/ppc.c
new file mode 100644 (file)
index 0000000..a683d69
--- /dev/null
@@ -0,0 +1,414 @@
+#include <nwdfs.h>
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <time.h>
+#include <nwconio.h>
+#include <nwadv.h>
+#include <nwdbgapi.h>
+#include <errno.h>
+#include <nwthread.h>
+#include "ppc.h"
+
+extern char *mem2hex (void *mem, char *buf, int count, int may_fault);
+extern char *hex2mem (char *buf, void *mem, int count, int may_fault);
+extern int computeSignal (int exceptionVector);
+
+void
+flush_i_cache (void)
+{
+}
+
+/* Get the registers out of the frame information.  */
+
+void
+frame_to_registers (frame, regs)
+     struct StackFrame *frame;
+     char *regs;
+{
+  mem2hex (&frame->ExceptionState.CsavedRegs, &regs[GP0_REGNUM * 4 * 2], 4 * 32, 0);
+
+  mem2hex (&frame->ExceptionState.CSavedFPRegs, &regs[FP0_REGNUM * 4 * 2], 4 * 32, 0);
+
+  mem2hex (&frame->ExceptionPC, &regs[PC_REGNUM * 4 * 2], 4 * 1, 0);
+
+  mem2hex (&frame->ExceptionState.u.SpecialRegistersEnumerated.CsavedSRR1, &regs[CR_REGNUM * 4 * 2], 4 * 1, 0);
+  mem2hex (&frame->ExceptionState.u.SpecialRegistersEnumerated.CsavedLR, &regs[LR_REGNUM * 4 * 2], 4 * 1, 0);
+  mem2hex (&frame->ExceptionState.u.SpecialRegistersEnumerated.CsavedCTR, &regs[CTR_REGNUM * 4 * 2], 4 * 1, 0);
+  mem2hex (&frame->ExceptionState.u.SpecialRegistersEnumerated.CsavedXER, &regs[XER_REGNUM * 4 * 2], 4 * 1, 0);
+  mem2hex (&frame->ExceptionState.u.SpecialRegistersEnumerated.CsavedMQ, &regs[MQ_REGNUM * 4 * 2], 4 * 1, 0);
+}
+
+/* Put the registers back into the frame information.  */
+
+void
+registers_to_frame (regs, frame)
+     char *regs;
+     struct StackFrame *frame;
+{
+  hex2mem (&regs[GP0_REGNUM * 4 * 2], &frame->ExceptionState.CsavedRegs, 4 * 32, 0);
+
+  hex2mem (&regs[FP0_REGNUM * 4 * 2], &frame->ExceptionState.CSavedFPRegs, 4 * 32, 0);
+
+  hex2mem (&regs[PC_REGNUM * 4 * 2], &frame->ExceptionPC, 4 * 1, 0);
+
+  hex2mem (&regs[CR_REGNUM * 4 * 2], &frame->ExceptionState.u.SpecialRegistersEnumerated.CsavedSRR1, 4 * 1, 0);
+  hex2mem (&regs[LR_REGNUM * 4 * 2], &frame->ExceptionState.u.SpecialRegistersEnumerated.CsavedLR, 4 * 1, 0);
+  hex2mem (&regs[CTR_REGNUM * 4 * 2], &frame->ExceptionState.u.SpecialRegistersEnumerated.CsavedCTR, 4 * 1, 0);
+  hex2mem (&regs[XER_REGNUM * 4 * 2], &frame->ExceptionState.u.SpecialRegistersEnumerated.CsavedXER, 4 * 1, 0);
+  hex2mem (&regs[MQ_REGNUM * 4 * 2], &frame->ExceptionState.u.SpecialRegistersEnumerated.CsavedMQ, 4 * 1, 0);
+}
+
+extern int ReadByteAltDebugger (char* addr, char *theByte);
+
+extern int WriteByteAltDebugger (char* addr, char theByte);
+
+extern volatile int mem_err;
+
+int
+get_char (addr)
+     char *addr;
+{
+  char c;
+
+  if (!ReadByteAltDebugger (addr, &c))
+    mem_err = 1;
+
+  return c;
+}
+
+void
+set_char (addr, val)
+     char *addr;
+     int val;
+{
+  if (!WriteByteAltDebugger (addr, val))
+    mem_err = 1;
+}
+
+int
+mem_write (dst, src, len)
+     char *dst, *src;
+     int len;
+{
+  while (len-- && !mem_err)
+    set_char (dst++, *src++);
+
+  return mem_err;
+}
+
+union inst
+{
+  LONG l;
+
+  struct
+    {
+      union
+       {
+         struct                /* Unconditional branch */
+           {
+             unsigned opcode : 6; /* 18 */
+             signed li : 24;
+             unsigned aa : 1;
+             unsigned lk : 1;
+           } b;
+         struct                /* Conditional branch */
+           {
+             unsigned opcode : 6; /* 16 */
+             unsigned bo : 5;
+             unsigned bi : 5;
+             signed bd : 14;
+             unsigned aa : 1;
+             unsigned lk : 1;
+           } bc;
+         struct                /* Conditional branch to ctr or lr reg */
+           {
+             unsigned opcode : 6; /* 19 */
+             unsigned bo : 5;
+             unsigned bi : 5;
+             unsigned type : 15; /* 528 = ctr, 16 = lr */
+             unsigned lk : 1;
+           } bclr;
+       } variant;
+    } inst;
+};
+
+static LONG saved_inst;
+static char *saved_inst_pc = 0;
+static LONG saved_target_inst;
+static char *saved_target_inst_pc = 0;
+
+void
+set_step_traps (frame)
+     struct StackFrame *frame;
+{
+  union inst inst;
+  char *target;
+  int opcode;
+  int ra, rb;
+  char *pc = (char *)frame->ExceptionPC;
+
+  inst.l = *(LONG *)pc;
+
+  opcode = inst.inst.variant.b.opcode;
+
+  switch (opcode)
+    {
+    case 18:                   /* Unconditional branch */
+      target = (char *)(inst.inst.variant.b.li << 2);
+
+      if (!inst.inst.variant.b.aa) /* Relative? */
+       target += (long)pc;
+
+      break;
+    case 16:                   /* Conditional branch */
+      target = (char *)(inst.inst.variant.bc.bd << 2);
+
+      if (!inst.inst.variant.bc.aa) /* Relative? */
+       target += (long)pc;
+
+      break;
+    case 19:                   /* Cond. branch via ctr or lr reg */
+      switch (inst.inst.variant.bclr.type)
+       {
+       case 528:               /* ctr */
+         target = (char *)frame->ExceptionState.u.SpecialRegistersEnumerated.CsavedCTR;
+         break;
+       case 16:                /* lr */
+         target = (char *)frame->ExceptionState.u.SpecialRegistersEnumerated.CsavedLR;
+         break;
+       default:
+         target = pc;
+       }
+      break;
+    default:
+      target = pc;
+    }
+
+  saved_inst = *(LONG *)pc;
+  mem_write (pc, breakpoint_insn, BREAKPOINT_SIZE);
+  saved_inst_pc = pc;
+
+  if (target != pc)
+    {
+      saved_target_inst = *(LONG *)target;
+      mem_write (target, breakpoint_insn, BREAKPOINT_SIZE);
+      saved_target_inst_pc = target;
+    }
+}
+
+/* Remove step breakpoints.  Returns non-zero if pc was at a step breakpoint,
+   zero otherwise.  This routine works even if there were no step breakpoints
+   set.  */
+
+int
+clear_step_traps (frame)
+     struct StackFrame *frame;
+{
+  int retcode;
+  char *pc = (char *)frame->ExceptionPC;
+
+  if (saved_inst_pc == pc || saved_target_inst_pc == pc)
+    retcode = 1;
+  else
+    retcode = 0;
+
+  if (saved_inst_pc)
+    {
+      mem_write (saved_inst_pc, saved_inst, BREAKPOINT_SIZE);
+      saved_inst_pc = 0;
+    }
+
+  if (saved_target_inst_pc)
+    {
+      mem_write (saved_target_inst_pc, saved_target_inst, BREAKPOINT_SIZE);
+      saved_target_inst_pc = 0;
+    }
+
+  return retcode;
+}
+
+void
+do_status (ptr, frame)
+     char *ptr;
+     struct StackFrame *frame;
+{
+  int sigval;
+
+  sigval = computeSignal (frame->ExceptionNumber);
+
+  sprintf (ptr, "T%02x", sigval);
+  ptr += 3;
+
+  sprintf (ptr, "%02x:", PC_REGNUM);
+  ptr = mem2hex (&frame->ExceptionPC, ptr + 3, 4, 0);
+  *ptr++ = ';';
+
+  sprintf (ptr, "%02x:", SP_REGNUM);
+  ptr = mem2hex (&frame->ExceptionState.CsavedRegs[SP_REGNUM], ptr + 3, 4, 0);
+  *ptr++ = ';';
+
+  sprintf (ptr, "%02x:", LR_REGNUM);
+  ptr = mem2hex (&frame->ExceptionState.CsavedRegs[LR_REGNUM], ptr + 3, 4, 0);
+  *ptr++ = ';';
+
+  *ptr = '\000';
+}
+
+/*
+ * strtol : convert a string to long.
+ *
+ * Andy Wilson, 2-Oct-89.
+ */
+
+/* FIXME: It'd be nice to configure around these, but the include files are too
+   painful.  These macros should at least be more portable than hardwired hex
+   constants. */
+
+#define        ULONG_MAX       ((unsigned long)(~0L))          /* 0xFFFFFFFF */
+#define        LONG_MAX        ((long)(ULONG_MAX >> 1))        /* 0x7FFFFFFF */
+#define        LONG_MIN        ((long)(~LONG_MAX))             /* 0x80000000 */
+
+extern int errno;
+
+unsigned long strtoul(const char *s, char **ptr, int base);
+
+long
+strtol(s, ptr, base)
+     const char *s; char **ptr; int base;
+{
+  int minus=0;
+  unsigned long tmp;
+  const char *start=s;
+  char *eptr;
+
+  if (s==NULL)
+    {
+      errno = ERANGE;
+      if (!ptr)
+       *ptr = (char *)start;
+      return 0L;
+    }
+  while (isspace(*s))
+       s++;
+  if (*s == '-') {
+       s++;
+       minus = 1;
+      }
+  else if (*s == '+')
+    s++;
+
+  /*
+   * let strtoul do the hard work.
+   */
+  tmp = strtoul(s, &eptr, base);
+  if (ptr != NULL)
+    *ptr = (char *)((eptr==s) ? (char *)start : eptr);
+  if (tmp > (minus ? - (unsigned long) LONG_MIN : (unsigned long) LONG_MAX))
+    {
+      errno = ERANGE;
+      return (minus ? LONG_MIN : LONG_MAX);
+    }
+  return (minus ? (long) -tmp : (long) tmp);
+}
+
+/*
+ * strtol : convert a string to long.
+ *
+ * Andy Wilson, 2-Oct-89.
+ */
+
+#ifndef ULONG_MAX
+#define        ULONG_MAX       ((unsigned long)(~0L))          /* 0xFFFFFFFF */
+#endif
+
+extern int errno;
+
+unsigned long
+strtoul(s, ptr, base)
+     const char *s; char **ptr; int base;
+{
+  unsigned long total = 0;
+  unsigned digit;
+  const char *start=s;
+  int did_conversion=0;
+  int overflow = 0;
+  int negate = 0;
+  unsigned long maxdiv, maxrem;
+
+  if (s==NULL)
+    {
+      errno = ERANGE;
+      if (!ptr)
+       *ptr = (char *)start;
+      return 0L;
+    }
+
+  while (isspace(*s))
+    s++;
+  if (*s == '+')
+    s++;
+  else if (*s == '-')
+    s++, negate = 1;
+  if (base==0 || base==16) /*  the 'base==16' is for handling 0x */
+    {
+      int tmp;
+
+      /*
+       * try to infer base from the string
+       */
+      if (*s != '0')
+        tmp = 10;      /* doesn't start with 0 - assume decimal */
+      else if (s[1] == 'X' || s[1] == 'x')
+       tmp = 16, s += 2; /* starts with 0x or 0X - hence hex */
+      else
+       tmp = 8;        /* starts with 0 - hence octal */
+      if (base==0)
+       base = (int)tmp;
+    }
+
+  maxdiv = ULONG_MAX / base;
+  maxrem = ULONG_MAX % base;
+
+  while ((digit = *s) != '\0')
+    {
+      if (digit >= '0' && digit < ('0'+base))
+       digit -= '0';
+      else
+       if (base > 10)
+         {
+           if (digit >= 'a' && digit < ('a'+(base-10)))
+             digit = digit - 'a' + 10;
+           else if (digit >= 'A' && digit < ('A'+(base-10)))
+             digit = digit - 'A' + 10;
+           else
+             break;
+         }
+       else
+         break;
+      did_conversion = 1;
+      if (total > maxdiv
+         || (total == maxdiv && digit > maxrem))
+       overflow = 1;
+      total = (total * base) + digit;
+      s++;
+    }
+  if (overflow)
+    {
+      errno = ERANGE;
+      if (ptr != NULL)
+       *ptr = (char *)s;
+      return (ULONG_MAX);
+    }
+  if (ptr != NULL)
+    *ptr = (char *) ((did_conversion) ? (char *)s : (char *)start);
+  return negate ? -total : total;
+}
+
+void _exit (int foo) __attribute__ ((noreturn));
+
+void
+exit (int foo)
+{
+  _exit (foo);
+}
diff --git a/gdb/nlm/ppc.h b/gdb/nlm/ppc.h
new file mode 100644 (file)
index 0000000..849531b
--- /dev/null
@@ -0,0 +1,163 @@
+typedef long Long;
+
+/* The following enum is used to access the special registers in 
+   the saved machine state.  */
+
+typedef enum
+{
+  kDc_SavedPC =        0,              /* really SRR0 */
+  kDc_SavedMSR = 1,            /* really SRR1 */
+  kDc_SavedCR =        2,
+  kDc_SavedLR =        3,
+  kDc_SavedDSISR = 4,
+  kDc_SavedDAR = 5,
+  kDc_SavedXER = 6,
+  kDc_SavedCTR = 7,
+  kDc_SavedSDR1 = 8,
+  kDc_SavedRTCU = 9,
+  kDc_SavedRTCL = 10,
+  kDc_SavedDEC = 11,
+  kDc_SavedSR00 = 12,          /* The Segement Registers are consecutive */
+  kDc_SavedSR01 = 13,          /* kDc_SavedSR00 + n is supported */
+  kDc_SavedSR02 = 14,
+  kDc_SavedSR03 = 15,
+  kDc_SavedSR04 = 16,
+  kDc_SavedSR05 = 17,
+  kDc_SavedSR06 = 18,
+  kDc_SavedSR07 = 19,
+  kDc_SavedSR08 = 20,
+  kDc_SavedSR09 = 21,
+  kDc_SavedSR10 = 22,
+  kDc_SavedSR11 = 23,
+  kDc_SavedSR12 = 24,
+  kDc_SavedSR13 = 25,
+  kDc_SavedSR14 = 26,
+  kDc_SavedSR15 = 27,
+  kDc_SavedFPSCR = 29,
+  kDc_SavedMQ = 30,
+  kDc_SavedBAT0U = 31,
+  kDc_SavedBAT0L = 32,
+  kDc_SavedBAT1U = 33,
+  kDc_SavedBAT1L = 34,
+  kDc_SavedBAT2U = 35,
+  kDc_SavedBAT2L = 36,
+  kDc_SavedBAT3U = 37,
+  kDc_SavedBAT3L = 38,
+
+  kNumberSpecialRegisters = 39
+} Dc_SavedRegisterName;
+
+/* Access to floating points is not very easy.  This allows the number to be
+   accessed both as a floating number and as a pair of Longs.  */
+
+typedef union
+{
+  double asfloat;              /* access the variable as a floating number */
+  struct
+    {
+      Long high;
+      Long low;
+    }
+  asLONG;                      /* access the variable as two Longs */
+} FloatingPoints;
+
+/* The following is the standard record for Saving a machine state */
+
+struct SavedMachineState
+{
+  FloatingPoints CSavedFPRegs[32]; /* The floating point registers [0->31] */
+                               /* ***32bit assumption*** */
+  Long CsavedRegs[32];         /* space to save the General Registers */
+                               /* These are saved 0->31 */
+  Long CexReason;
+  Long SavedDomainID;
+  union
+    {                          /* must be 8-byte aligned, so doubleFPSCR is 8-byte aligned */
+      struct
+       {
+         Long CsavedSRR0;      /* Index 0 - The saved PC */
+         Long CsavedSRR1;      /* 1 saved MSR */
+         Long CsavedCR;        /* 2 */
+         Long CsavedLR;        /* 3 */
+         Long CsavedDSISR;     /* 4 */
+         Long CsavedDAR;       /* 5 */
+
+         Long CsavedXER;       /* 6 */
+         Long CsavedCTR;       /* 7 */
+         Long CsavedSDR1;      /* 8 */
+         Long CsavedRTCU;      /* 9 */
+         Long CsavedRTCL;      /* 10 */
+         Long CsavedDEC;       /* 11 */
+         Long CsavedSR0;       /* 12 */
+         Long CsavedSR1;       /* 13 */
+         Long CsavedSR2;       /* 14 */
+         Long CsavedSR3;       /* 15 */
+         Long CsavedSR4;       /* 16 */
+         Long CsavedSR5;       /* 17 */
+         Long CsavedSR6;       /* 18 */
+         Long CsavedSR7;       /* 19 */
+         Long CsavedSR8;       /* 20 */
+         Long CsavedSR9;       /* 21 */
+         Long CsavedSR10;      /* 22 */
+         Long CsavedSR11;      /* 23 */
+         Long CsavedSR12;      /* 24 */
+         Long CsavedSR13;      /* 25 */
+         Long CsavedSR14;      /* 26 */
+         Long CsavedSR15;      /* 27 */
+                               /* CdoubleFPSCR must be double word aligned */
+         Long CdoubleFPSCR;    /* 28 this is the upper part of the store and has
+                                     no meaning */
+         Long CsavedFPSCR;     /* 29 */
+         Long CsavedMQ;        /* 30 */
+         Long CsavedBAT0U;     /* 31 */
+         Long CsavedBAT0L;     /* 32 */
+         Long CsavedBAT1U;     /* 33 */
+         Long CsavedBAT1L;     /* 34 */
+         Long CsavedBAT2U;     /* 35 */
+         Long CsavedBAT2L;     /* 36 */
+         Long CsavedBAT3U;     /* 37 */
+         Long CsavedBAT3L;     /* 38 */
+       }
+      SpecialRegistersEnumerated;
+
+      Long SpecialRegistersIndexed[kNumberSpecialRegisters];
+    } u;
+
+  Long Padding[3];             /* Needed for quad-word alignment */
+};
+
+struct StackFrame
+{
+  LONG *ExceptionDomainID;
+  /*ProcessorStructure*/ int *ExceptionProcessorID;
+  BYTE *ExceptionDescription;
+  LONG ExceptionFlags;
+  LONG ExceptionErrorCode;
+  LONG ExceptionNumber;
+  struct SavedMachineState ExceptionState;
+};
+
+/* Register values.  All of these values *MUST* agree with tm.h */
+#define        GP0_REGNUM 0            /* GPR register 0 */
+#define SP_REGNUM 1            /* Contains address of top of stack */
+#define FP0_REGNUM 32          /* FPR (Floating point) register 0 */
+#define PC_REGNUM 64           /* Contains program counter */
+#define PS_REGNUM 65           /* Processor (or machine) status (%msr) */
+#define        CR_REGNUM 66            /* Condition register */
+#define        LR_REGNUM 67            /* Link register */
+#define        CTR_REGNUM 68           /* Count register */
+#define        XER_REGNUM 69           /* Fixed point exception registers */
+#define        MQ_REGNUM 70            /* Multiply/quotient register */
+#define NUM_REGS 71            /* Number of machine registers */
+#define REGISTER_BYTES (420)   /* Total size of registers array */
+
+#define ExceptionPC ExceptionState.u.SpecialRegistersEnumerated.CsavedSRR0
+#define DECR_PC_AFTER_BREAK 0  /* PPCs get this right! */
+#define BREAKPOINT {0x7d, 0x82, 0x10, 0x08}
+extern unsigned char breakpoint_insn[];
+#define BREAKPOINT_SIZE 4
+
+#define ALTERNATE_MEM_FUNCS    /* We need our own get_char/set_char */
+
+extern int get_char (char *addr);
+extern void set_char (char *addr, int val);
index c2e68579a71b457919e75ee3d0c0d553bf3b6b55..e3207c26093a977d3482b20f25849aba9eda812f 100644 (file)
 ==============================================================================
 */
 #include <nwpre.h>
-#include "libhooks.h"
+/*#include "libhooks.h"*/
+#include <stddef.h>
+
+extern int main (int, char **);
 
 static int     NLMID;
 
@@ -55,8 +58,5 @@ int _Prelude
                &NLMID,
                                        _cstart_);
 
-       if (!rc)
-               rc = _NWRegisterNLMLibraryUser(NLMID, _GetCLibNLMLibHandle());
-
        return rc;
 }
diff --git a/gdb/nlm/prelude.o b/gdb/nlm/prelude.o
deleted file mode 100644 (file)
index c9f5f42..0000000
Binary files a/gdb/nlm/prelude.o and /dev/null differ