⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gdb-4.18-bdm-m68k.patch

📁 WaitForSingleObject 摩托罗拉的68k源程序
💻 PATCH
📖 第 1 页 / 共 3 页
字号:
diff -urN gdb-4.18/gdb/Makefile.in gdb-4.18-new/gdb/Makefile.in--- gdb-4.18/gdb/Makefile.in	Wed Apr  7 15:00:43 1999+++ gdb-4.18-new/gdb/Makefile.in	Thu Aug 19 14:18:02 1999@@ -949,5 +949,5 @@ 	vax-tdep.c \-	vx-share/xdr_ld.c vx-share/xdr_ptrace.c vx-share/xdr_rdb.c \+	vx-share/xdr_ld.c vx-share/xdr_ptrace.c vx-share/xdr_rdb.c remote-m68k-bdm.c\ 	win32-nat.c \ udip2soc.o: $(srcdir)/29k-share/udi/udip2soc.c $(udiheaders) 	$(CC) -c $(INTERNAL_CFLAGS) $(srcdir)/29k-share/udi/udip2soc.c@@ -1392,6 +1392,9 @@  remote-mm.o: remote-mm.c $(bfd_h) $(wait_h) $(defs_h) $(inferior_h) \ 	minimon.h target.h terminal.h gdb_string.h++remote-m68k-bdm.o: remote-m68k-bdm.c $(bfd_h) $(wait_h) $(defs_h) $(inferior_h) \+	$(gdbcore_h) target.h  remote-nindy.o: remote-nindy.c $(floatformat_h) $(wait_h) $(command_h) \ 	$(defs_h) $(gdbcore_h) $(inferior_h) \diff -urN gdb-4.18/gdb/config/m68k/bdm.mt gdb-4.18-new/gdb/config/m68k/bdm.mt--- gdb-4.18/gdb/config/m68k/bdm.mt	Wed Dec 31 18:00:00 1969+++ gdb-4.18-new/gdb/config/m68k/bdm.mt	Wed Dec  8 04:25:12 1999@@ -0,0 +1,5 @@+# Target: m68k bdm interface for the CPU32 and Coldfire processors.+#+TM_CLIBS= -lBDM+TDEPFILES= m68k-tdep.o remote-m68k-bdm.o+TM_FILE= tm-bdm.hdiff -urN gdb-4.18/gdb/config/m68k/tm-bdm.h gdb-4.18-new/gdb/config/m68k/tm-bdm.h--- gdb-4.18/gdb/config/m68k/tm-bdm.h	Wed Dec 31 18:00:00 1969+++ gdb-4.18-new/gdb/config/m68k/tm-bdm.h	Thu Aug 19 14:18:02 1999@@ -0,0 +1,87 @@+/*+ * Target machine description for Coldfire BDM (Moto 5200)+ * Copyright (C) 1995  W. Eric Norum+ * Copyright (C) 1998  Chris Johns (ccj@acm.org)+ *+ * Based on:+ *  1. `A Background Debug Mode Driver Package for Motorola's+ *     16- and 32-Bit Microcontrollers', Scott Howard, Motorola+ *     Canada, 1993.+ *  2. `Linux device driver for public domain BDM Interface',+ *     M. Schraut, Technische Universitaet Muenchen, Lehrstuhl+ *     fuer Prozessrechner, 1995.+ *  3. BDM support for gdb by W. Eric Norum+ *     Saskatchewan Accelerator Laboratory+ *     University of Saskatchewan+ *     107 North Road+ *     Saskatoon, Saskatchewan, CANADA+ *     S7N 5C6+ * + * 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.+ */++/*+ * Coldfire does it for us if we use PCC to get the PC+ */+#define	DECR_PC_AFTER_BREAK	0++/*+ * We have to control this directly as the CPU32 and Coldfire have different+ * breakpoint opcodes.+ */+#define BREAKPOINT_FROM_PC m68k_bdm_breakpoint_from_pc++/*+ * Include the generic stuff+ */+#include "m68k/tm-m68k.h"++/*+ * Override some of the generic definitions+ */++/*+ * we need 40 registers for the CPU32 and Coldfire:+ *   8 data registers+ *   8 address registers+ *   2 other registers (PC, PS)+ *  22 special registers (actual set depends on architecture)+ *   0 floating point registers+ */+#undef NUM_REGS+#undef REGISTER_BYTES+#define NUM_REGS    40+#define REGISTER_BYTES (16*4 + 2*4 + 22*4)++#undef REGISTER_NAMES+#define REGISTER_NAME(i) bdm_register_name(i)+extern const char *bdm_register_name(int i);++#undef FP0_REGNUM+#undef FPC_REGNUM+#undef FPS_REGNUM+#undef FPI_REGNUM+#define FP0_REGNUM 40                   /* Floating point register 0 */+#define FPC_REGNUM FP0_REGNUM + 8       /* 68881 control register */+#define FPS_REGNUM FPC_REGNUM + 1       /* 68881 status register */+#define FPI_REGNUM FPS_REGNUM + 1       /* 68881 iaddr register */++/*+ * The other definitions and macros don't need to be changed:+ *    a) The Coldfire has no floating point registers+ *    b) The REGISTER_BYTES_OK macro isn't used+ */diff -urN gdb-4.18/gdb/configure.tgt gdb-4.18-new/gdb/configure.tgt--- gdb-4.18/gdb/configure.tgt	Wed Apr  7 15:00:17 1999+++ gdb-4.18-new/gdb/configure.tgt	Thu Aug 19 14:18:02 1999@@ -149,6 +149,7 @@ m68*-*bug-*)            gdb_target=monitor ;; m68*-monitor-*)         gdb_target=monitor ;; m68*-est-*)		gdb_target=monitor ;;+m68*-bdm-*)		gdb_target=bdm ;; m68*-*-aout*)		gdb_target=monitor ;; m68*-*-coff*)		gdb_target=monitor ;; m68*-*-elf*)		gdb_target=monitor ;;diff -urN gdb-4.18/gdb/doc/all-cfg.texi gdb-4.18-new/gdb/doc/all-cfg.texi--- gdb-4.18/gdb/doc/all-cfg.texi	Fri Feb  5 19:26:05 1999+++ gdb-4.18-new/gdb/doc/all-cfg.texi	Thu Aug 19 14:18:02 1999@@ -39,6 +39,9 @@ @c Intel 960 target: @set I960 @c+@c Motorola BDM target:+@set BDM+@c @c Tandem ST2000 (phone switch) target: @set ST2000 @cdiff -urN gdb-4.18/gdb/doc/gdb.texinfo gdb-4.18-new/gdb/doc/gdb.texinfo--- gdb-4.18/gdb/doc/gdb.texinfo	Thu Feb 11 20:02:45 1999+++ gdb-4.18-new/gdb/doc/gdb.texinfo	Thu Aug 19 14:18:02 1999@@ -413,6 +413,10 @@ * Simulator::                   Simulated CPU target @end ifset +@ifset BDM+* Motorola BDM Target::         @value{GDBN} and Motorola 68k/Coldfire BDM targets+@end ifset+ Controlling @value{GDBN}  * Prompt::                      Prompt@@ -8527,6 +8531,12 @@ @item target bug @var{dev} BUG monitor, running on a MVME187 (m88k) board. +@ifset BDM+@kindex target bdm+Background Debug Mode interface to Motorola 68k/Coldfire machine.+@xref{Motorola BDM Target, ,@value{GDBN} and Motorola 68k/Coldfire BDM}.+@end ifset+ @kindex target cpu32bug @item target cpu32bug @var{dev} CPU32BUG monitor, running on a CPU32 (M68K) board.@@ -8819,6 +8829,11 @@ @ifset SIMS * Simulator::                   Simulated CPU target @end ifset+@ifset BDM+* Motorola BDM Target::         @value{GDBN} and Motorola 68k/Coldfire Background Debug +Mode+@end ifset+ @end menu  @include remote.texidiff -urN gdb-4.18/gdb/doc/remote.texi gdb-4.18-new/gdb/doc/remote.texi--- gdb-4.18/gdb/doc/remote.texi	Fri Feb  5 19:28:34 1999+++ gdb-4.18-new/gdb/doc/remote.texi	Thu Aug 19 14:18:02 1999@@ -1705,4 +1705,101 @@ simulated clock ticks. @end ifset ++@ifset BDM+@node Motorola BDM Target+@subsection @value{GDBN} and Motorola BDM++@cindex BDM+@cindex CPU32+@cindex Coldfire+Background Debug Mode (@dfn{BDM}) provides a full set of debug options+including the ability to:+@itemize @bullet+@item Insert breakpoints+@item Single-step+@item Display register contents+@item Display memory contents+@item Modify register contents+@item Modify memory contents+@end itemize++A small interface circuit connects the BDM interface port on the+target machine to a parallel printer port on the debugging host.+A target system can be configured and a program downloaded and+executed with no bootstrap memory on the target machine and no other+connection between the debugging host and the target machine.++The @code{target} command tells @value{GDBN}+to debug a program running on a target machine+@xref{Target Commands, ,Commands for managing targets}.+For example, the following command tells @value{GDBN} to use a BDM+interface connected to the @code{LPT0} parallel port:+@example+target bdm /dev/bdm0+@end example++Do not attempt to use the parallel port for any other purpose while+@value{GDBN} is using it to control a BDM target.++Once the BDM target has been selected a few other commands become+available:++@table @code+@item bdm_reset+@kindex bdm_reset+Reset the target machine and enable BDM operation in the target.++@item bdm_restart+@kindex bdm_restart+Reset the target machine and disable BDM operation in the target.+This command is useful only if the target machine has some kind of+bootstrap memory installed.++@item bdm_status+@kindex bdm_status+Print the status of the target machine and the BDM interface.++@item bdm_setdelay @var{N}+@kindex bdm_setdelay+Some BDM interface circuits can not handle high-speed data transfer.+This command lets you insert a delay between each BDM clock.+The larger the value of @var{N}, the longer the delay.+On most machines the default delay of @var{0} should work just fine.++@item bdm_setdebug @var{N}+@kindex bdm_setdebug+Setting the level (@var{N}) to a non-zero value turns on+debugging messages in the BDM support library.++@item bdm_setdriverdebug @var{N}+@kindex bdm_setdriverdebug+Setting the level (@var{N}) to a non-zero value turns on+debugging messages in the BDM device driver.++@end table++The registers which can be displayed and modified are:+@itemize @bullet+@item The data registers: @code{$d0}-@code{$d7}+@item The address registers: @code{$a0}-@code{$a5}, @code{$fp}, @code{$sp}+@item The program counter: @code{$pc}+@item The status register: @code{$ps}+@item The program counter at the beginning of the most recently executed+instruction: @code{$pcc}+@item The user stack pointer: @code{$usp}+@item The supervisor stack pointer: @code{$ssp}+@item The source function code register: @code{$sfc}+@item The destinaton function code register: @code{$dfc}+@item The vector base register: @code{$vbr}+@item The fault address register: @code{$far}+@item The BDM temporary register: @code{$atemp}+@item The module base address register: @code{$mbar}+@end itemize++Target processor interrupts are disabled during single-step (step, next,+stepi, nexti) operations.++@end ifset+ @c need to add much more detail about sims!diff -urN gdb-4.18/gdb/findvar.c gdb-4.18-new/gdb/findvar.c--- gdb-4.18/gdb/findvar.c	Fri Jan 29 03:46:03 1999+++ gdb-4.18-new/gdb/findvar.c	Tue Dec  7 13:23:36 1999@@ -253,6 +253,7 @@      LONGEST val; {   if( TARGET_BYTE_ORDER == BIG_ENDIAN+      && HOST_BYTE_ORDER != LITTLE_ENDIAN       &&  len != sizeof( LONGEST )) {     /* On big-endian machines (e.g., HPPA 2.0, narrow mode)      * just letting this fall through to the call below willdiff -urN gdb-4.18/gdb/remote-m68k-bdm.c gdb-4.18-new/gdb/remote-m68k-bdm.c--- gdb-4.18/gdb/remote-m68k-bdm.c	Wed Dec 31 18:00:00 1969+++ gdb-4.18-new/gdb/remote-m68k-bdm.c	Thu Aug 19 14:18:02 1999@@ -0,0 +1,1241 @@+/*+ * Motorola Background Debug Mode Target+ * Copyright (C) 1995  W. Eric Norum+ * Copyright (C) 1998  Chris Johns (ccj@acm.org)+ *+ * Based on:+ *  1. `A Background Debug Mode Driver Package for Motorola's+ *     16- and 32-Bit Microcontrollers', Scott Howard, Motorola+ *     Canada, 1993.+ *  2. `Linux device driver for public domain BDM Interface',+ *     M. Schraut, Technische Universitaet Muenchen, Lehrstuhl+ *     fuer Prozessrechner, 1995.+ *  3. BDM support for gdb by W. Eric Norum+ *     Saskatchewan Accelerator Laboratory+ *     University of Saskatchewan+ *     107 North Road+ *     Saskatoon, Saskatchewan, CANADA+ *     S7N 5C6+ *  4. Coldfire support added by C Johns.+ *+ * 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.+ *+ * W. Eric Norum+ * Saskatchewan Accelerator Laboratory+ * University of Saskatchewan+ * 107 North Road+ * Saskatoon, Saskatchewan, CANADA+ * S7N 5C6+ * + * eric@skatter.usask.ca+ *+ * Coldfire support by:+ * Chris Johns+ * Objective Design Systems+ * 35 Cairo Street+ * Cammeray, Sydney, 2062, Australia+ *+ * ccj@acm.org+ */++/*+ * $Revision: 1.1 $    $Date: 2004/03/28 23:13:10 $   $Author: codewiz $+ */++#include "defs.h"+#include "gdbcore.h"+#include "target.h"+#include "wait.h"+#include <unistd.h>+#include <stdlib.h>+#include <stdarg.h>+#include <errno.h>+#include <signal.h>+#include <string.h>+#include <stdio.h>+#include <fcntl.h>+#include <ctype.h>+#include <sys/types.h>+#include <sys/ioctl.h>+#include <sys/time.h>+#include "command.h"+#include "inferior.h"+#include "value.h"+#include "breakpoint.h"+#include "BDMlib.h"++extern struct target_ops bdm_ops;	/* Forward declaration */++/*+ * The name of the BDM driver special file+ */+static char *dev_name;+static int cpu_type;++/*+ * The different register names for the processors.+ */+static const char *cpu32_reg_names[NUM_REGS] = {+ "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7",+ "a0", "a1", "a2", "a3", "a4", "a5", "fp", "sp",+ "ps", "pc",+ "pcc", "usp", "ssp", "sfc", "dfc", "atemp", "far",+ "vbr",+ NULL, NULL, NULL, NULL,+ "mbar",+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,+};++static const char *cf_reg_names[NUM_REGS] = {+ "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7",+ "a0", "a1", "a2", "a3", "a4", "a5", "fp", "sp",+ "ps", "pc",+ NULL, NULL, NULL, NULL, NULL, NULL, NULL,+ "vbr",+ "cacr", "acr0", "acr1", "rambar",+ "mbar",+ "csr", "aatr", "tdr", "pbr", "pbmr", "abhr", "ablr", "dbr", "dbmr",+};++static const char **bdm_reg_names = cpu32_reg_names;++const char *bdm_register_name(int i)+{+	if ((i < 0) || (i >= NUM_REGS))+		return NULL;+	return bdm_reg_names[i];+}++static int reg_to_dev_num[] = +{ BDM_REG_SR, +  BDM_REG_RPC,+  BDM_REG_PCC,+  BDM_REG_USP,+  BDM_REG_SSP,+  BDM_REG_SFC,+  BDM_REG_DFC,+  BDM_REG_ATEMP,+  BDM_REG_FAR,+  BDM_REG_VBR,+  BDM_REG_CACR,+  BDM_REG_ACR0,+  BDM_REG_ACR1,+  BDM_REG_RAMBAR,+  BDM_REG_MBAR,+  BDM_REG_CSR,+  BDM_REG_AATR,+  BDM_REG_TDR,+  BDM_REG_PBR,+  BDM_REG_PBMR,+  BDM_REG_ABHR,+  BDM_REG_ABLR,+  BDM_REG_DBR,+  BDM_REG_DBMR+ };++/*+ * The name of the most recently loaded program+ */+static char *bdm_prog_loaded;++/*+ * default delay for interface+ */+#define	BDM_DEFAULT_DELAY	0+static int bdm_delay = -1;++/*+ * does gdb wait or not, only valid for a Coldfire processor+ */+static int bdm_gdb_no_wait = 0;++/*+ * Hold BDM ATEMP register (CPU32 only).+ */+static unsigned long atemp;+static int haveAtemp;++/*+ * Forward declarations+ */+static void bdm_load (char *, int);++/*+ * give target time to come up after reset+ * time in usec+ */+#define	TIME_TO_COME_UP	60000++/*+ * Downloader routines+ */+static int downLoaderReturn;+static int downLoaderFirst;+static unsigned long downLoadBaseAddress, downLoadStartAddress;+static int bdmDebugLevel;+static const char *downloadErrorString;++static void+downloadSection (bfd *abfd, sec_ptr sec, PTR ignore)+{+	unsigned long dfc;+	unsigned long address;+	unsigned long nleft;+	int count;+	file_ptr offset;+	char cbuf[1024];++	/*+	 * See if the section needs loading+	 */+	if (bdmDebugLevel)+		printf_filtered ("Section flags:%#x", bfd_get_section_flags (abfd, sec));+	if ((downLoaderReturn < 0) ||+			((bfd_get_section_flags (abfd, sec) & SEC_HAS_CONTENTS) == 0) ||+			((bfd_get_section_flags (abfd, sec) & SEC_LOAD) == 0))+		return;+	address = bfd_section_lma (abfd, sec);+	if (bdmDebugLevel)+		printf_filtered ("Section address:%#x", address);+	if (downLoaderFirst && (bfd_get_section_flags (abfd, sec) & SEC_CODE)) {

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -