diff -u --recursive --new-file 386/.gdbinit linux/.gdbinit
--- 386/.gdbinit	Thu Jan  1 00:00:00 1970
+++ linux/.gdbinit	Tue Aug 22 02:45:05 1995
@@ -0,0 +1,20 @@
+define ral
+  target remote ral:9174
+ end
+ document ral
+  Connect to port 9174 on Raleigh, assuming kgdb_relay
+  is running on that machine.
+
+end
+define con
+  shell setserial /dev/cua1 spd_normal
+  set remotebaud 38400
+  target remote /dev/cua1
+ end
+ document con
+  Connect to remote kernel via /dev/cua1.
+
+end
+dir	arch/alpha/kernel:arch/alpha/mm:arch/alpha/lib:kernel:fs:mm:ipc:\
+	drivers/char:drivers/block:drivers/scsi:drivers/pci:drivers/net:\
+	net/core:net/ipv4:net/unix
diff -u --recursive --new-file 386/Makefile linux/Makefile
--- 386/Makefile	Fri Oct 13 21:28:17 1995
+++ linux/Makefile	Fri Oct 13 21:27:58 1995
@@ -2,7 +2,7 @@
 PATCHLEVEL = 3
 SUBLEVEL = 34
 
-ARCH = i386
+ARCH = alpha
 
 .EXPORT_ALL_VARIABLES:
 
@@ -70,7 +70,8 @@
 # standard CFLAGS
 #
 
-CFLAGS = -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer
+#CFLAGS = -Wall -Wstrict-prototypes -g -O2 -fomit-frame-pointer
+CFLAGS = -Wall -Wstrict-prototypes -g -O
 
 ifdef CONFIG_CPP
 CFLAGS := $(CFLAGS) -x c++
@@ -125,7 +126,9 @@
 		$(FILESYSTEMS) \
 		$(DRIVERS) \
 		$(LIBS) -o vmlinux
-	$(NM) vmlinux | grep -v '\(compiled\)\|\(\.o$$\)\|\( a \)' | sort > System.map
+	# This is slow when compiling with -g and we might just as well use gdb
+	# in this case...
+	# $(NM) vmlinux | grep -v '\(compiled\)\|\(\.o$$\)\|\( a \)' | sort > System.map
 
 symlinks:
 	rm -f include/asm
diff -u --recursive --new-file 386/arch/alpha/boot/main.c linux/arch/alpha/boot/main.c
--- 386/arch/alpha/boot/main.c	Thu Jun  1 10:22:05 1995
+++ linux/arch/alpha/boot/main.c	Fri Oct 13 00:45:38 1995
@@ -24,13 +24,36 @@
 int printk(const char * fmt, ...)
 {
 	va_list args;
-	int i;
+	int i, j, written, remaining, num_nl;
 	static char buf[1024];
+	char * str;
 
 	va_start(args, fmt);
 	i = vsprintf(buf, fmt, args);
 	va_end(args);
-	puts(buf,i);
+
+	/* expand \n into \r\n: */
+
+	num_nl = 0;
+	for (j = 0; j < i; ++j) {
+	    if (buf[j] == '\n')
+	    	++num_nl;
+	}
+	remaining = i + num_nl;
+	for (j = i - 1; j >= 0; --j) {
+	    buf[j + num_nl] = buf[j];
+	    if (buf[j] == '\n') {
+	    	--num_nl;
+		buf[j + num_nl] = '\r';
+	    }
+	}
+
+	str = buf;
+	do {
+	    written = puts(str, remaining);
+	    remaining -= written;
+	    str += written;
+	} while (remaining > 0);
 	return i;
 }
 
diff -u --recursive --new-file 386/arch/alpha/config.in linux/arch/alpha/config.in
--- 386/arch/alpha/config.in	Fri Oct 13 21:28:17 1995
+++ linux/arch/alpha/config.in	Fri Oct 13 21:27:58 1995
@@ -29,7 +29,8 @@
 bool 'XT harddisk support' CONFIG_BLK_DEV_XD n
 bool 'Networking support' CONFIG_NET y
 choice 'Alpha system type' \
-	"Jensen		CONFIG_ALPHA_JENSEN		\
+	"Avanti		CONFIG_ALPHA_AVANTI		\
+	 Jensen		CONFIG_ALPHA_JENSEN		\
 	 Noname		CONFIG_ALPHA_NONAME		\
 	 Cabriolet	CONFIG_ALPHA_CABRIOLET		\
 	 EB66		CONFIG_ALPHA_EB66		\
@@ -42,7 +43,7 @@
 	define_bool CONFIG_PCI y
 	define_bool CONFIG_ALPHA_LCA y
 fi
-if [ "$CONFIG_ALPHA_CABRIOLET" = "y" \
+if [ "$CONFIG_ALPHA_CABRIOLET" = "y" -o "$CONFIG_ALPHA_AVANTI" = "y" \
 	-o "$CONFIG_ALPHA_EB64" = "y" -o "$CONFIG_ALPHA_EB64P" = "y" ]
 then
 	bool 'Using SRM as bootloader' CONFIG_ALPHA_SRM n
@@ -56,6 +57,7 @@
     bool '   PCI Triton IDE Bus Master DMA support' CONFIG_BLK_DEV_TRITON y
   fi
 fi
+bool 'Kernel GDB support' CONFIG_KGDB n
 bool 'System V IPC' CONFIG_SYSVIPC y
 tristate 'Kernel support for ELF binaries' CONFIG_BINFMT_ELF n
 
@@ -158,8 +160,8 @@
   bool ' CSLIP compressed headers' CONFIG_SLIP_COMPRESSED y
 fi
 tristate 'PPP (point-to-point) support' CONFIG_PPP n
-if [ ! "$CONFIG_PPP" = "n" ]; then
-comment 'CCP compressors for PPP are only built as modules.'
+if [ ! "$CONFIG_PPP" == "n" ]; then
+  comment 'CCP compressors for PPP are only built as modules.'
 fi
 if [ "$CONFIG_AX25" = "y" ]; then
 	bool 'Z8530 SCC kiss emulation driver for AX.25' CONFIG_SCC y
diff -u --recursive --new-file 386/arch/alpha/kernel/Makefile linux/arch/alpha/kernel/Makefile
--- 386/arch/alpha/kernel/Makefile	Thu Sep 28 01:52:04 1995
+++ linux/arch/alpha/kernel/Makefile	Thu Sep 28 01:54:05 1995
@@ -15,6 +15,10 @@
 OBJS  = entry.o traps.o process.o osf_sys.o irq.o signal.o setup.o \
 	bios32.o ptrace.o time.o apecs.o lca.o
 
+#ifdef CONFIG_KGDB
+OBJS += kgdb.o
+#endif
+
 all: kernel.o head.o
 
 head.o: head.s
diff -u --recursive --new-file 386/arch/alpha/kernel/apecs.c linux/arch/alpha/kernel/apecs.c
--- 386/arch/alpha/kernel/apecs.c	Sat Oct  7 04:55:49 1995
+++ linux/arch/alpha/kernel/apecs.c	Fri Oct 13 02:04:13 1995
@@ -28,7 +28,7 @@
 #ifdef CONFIG_ALPHA_APECS
 
 #ifdef DEBUG
-# define DBG(args)	printk(args)
+# define DBG(args)	printk args
 #else
 # define DBG(args)
 #endif
@@ -120,6 +120,21 @@
 	unsigned int stat0, value;
 	unsigned int haxr2 = 0; /* to keep gcc quiet */
 
+#ifdef CONFIG_ALPHA_AVANTI
+	register long s0 asm ("9");
+	register long s1 asm ("10");
+	register long s2 asm ("11");
+	register long s3 asm ("12");
+	register long s4 asm ("13");
+	register long s5 asm ("14");
+	asm volatile ("# %0" : "r="(s0));/* SRM X4.2 on Avanti steps on this */
+	asm volatile ("# %0" : "r="(s1));/* SRM X4.2 on Avanti steps on this */
+	asm volatile ("# %0" : "r="(s2));/* SRM X4.2 on Avanti steps on this */
+	asm volatile ("# %0" : "r="(s3));/* SRM X4.2 on Avanti steps on this */
+	asm volatile ("# %0" : "r="(s4));/* SRM X4.2 on Avanti steps on this */
+	asm volatile ("# %0" : "r="(s5));/* SRM X4.2 on Avanti steps on this */
+#endif
+
 	save_flags(flags);	/* avoid getting hit by machine check */
 	cli();
 
@@ -185,6 +200,14 @@
 		mb();
 	}
 	restore_flags(flags);
+#ifdef CONFIG_ALPHA_AVANTI
+	asm volatile ("# %0" :: "r"(s0));/* SRM X4.2 on Avanti steps on this */
+	asm volatile ("# %0" :: "r"(s1));/* SRM X4.2 on Avanti steps on this */
+	asm volatile ("# %0" :: "r"(s2));/* SRM X4.2 on Avanti steps on this */
+	asm volatile ("# %0" :: "r"(s3));/* SRM X4.2 on Avanti steps on this */
+	asm volatile ("# %0" :: "r"(s4));/* SRM X4.2 on Avanti steps on this */
+	asm volatile ("# %0" :: "r"(s5));/* SRM X4.2 on Avanti steps on this */
+#endif
 	return value;
 }
 
@@ -383,8 +406,8 @@
 #ifdef CONFIG_ALPHA_CABRIOLET
 	/*
 	 * JAE: HACK!!! for now, hardwire if configured...
-	 * davidm: miniloader doesn't seem to get clockfrequency
-	 * right, so fix for now.
+	 * davidm: Older miniloader versions don't set the clockfrequency
+	 * right, so hardcode it for now.
 	 */
 	if (hwrpb->sys_type == ST_DEC_EB64P) {
 		hwrpb->sys_type = ST_DEC_EBPC64;
@@ -438,12 +461,14 @@
 	DBG(("apecs_machine_check: expected %d DCSR 0x%lx PEAR 0x%lx\n",
 	     apecs_mcheck_expected, mchk_sysdata->epic_dcsr, mchk_sysdata->epic_pear));
 #ifdef DEBUG
-	unsigned long *ptr;
-	int i;
+	{
+	    unsigned long *ptr;
+	    int i;
 
-	ptr = (unsigned long *)la_ptr;
-	for (i = 0; i < mchk_header->size / sizeof(long); i += 2) {
-		printk(" +%x %lx %lx\n", i*sizeof(long), ptr[i], ptr[i+1]);
+	    ptr = (unsigned long *)la_ptr;
+	    for (i = 0; i < mchk_header->size / sizeof(long); i += 2) {
+		printk(" +%lx %lx %lx\n", i*sizeof(long), ptr[i], ptr[i+1]);
+	    }
 	}
 #endif /* DEBUG */
 
diff -u --recursive --new-file 386/arch/alpha/kernel/bios32.c linux/arch/alpha/kernel/bios32.c
--- 386/arch/alpha/kernel/bios32.c	Sat Oct  7 04:55:49 1995
+++ linux/arch/alpha/kernel/bios32.c	Fri Oct 13 23:12:46 1995
@@ -541,9 +541,9 @@
 
 
 /*
- * Fixup configuration for Noname boards (AXPpci33).
+ * Fixup configuration for Noname (AXPpci33) and Avanti (AlphaStation 240).
  */
-static inline void noname_fixup(void)
+static inline void avanti_and_noname_fixup(void)
 {
 	struct pci_dev *dev;
 	/*
@@ -556,14 +556,17 @@
 	 * hardwired to 0 (meaning that they use the default INTA
 	 * line, if they are interrupt driven at all).
 	 */
-	static const char pirq_tab[7][5] = {
+	static const char pirq_tab[][5] = {
 		{ 3,  3, -1, -1, -1}, /* idsel  6 (53c810) */ 
-		{-1, -1, -1, -1, -1}, /* idsel  7 (PCI/ISA bridge) */
+		{-1, -1, -1, -1, -1}, /* idsel  7 (SIO: PCI/ISA bridge) */
 		{ 2,  2, -1, -1, -1}, /* idsel  8 (slot closest to ISA) */
 		{-1, -1, -1, -1, -1}, /* idsel  9 (unused) */
 		{-1, -1, -1, -1, -1}, /* idsel 10 (unused) */
-		{ 0,  0, -1, -1, -1}, /* idsel 11 (slot furthest from ISA) */
-		{ 1,  1, -1, -1, -1}, /* idsel 12 (middle slot) */
+		{ 0,  0, -1, -1, -1}, /* idsel 11 (slot furthest from ISA) KN25_PCI_SLOT0 */
+		{ 1,  1, -1, -1, -1}, /* idsel 12 (middle slot) KN25_PCI_SLOT1 */
+#ifdef CONFIG_ALPHA_AVANTI
+		{ 1,  1, -1, -1, -1}, /* idsel 13 KN25_PCI_SLOT2 */
+#endif /* CONFIG_ALPHA_AVANTI */
 	};
 	/*
 	 * route_tab selects irq routing in PCI/ISA bridge so that:
@@ -571,6 +574,9 @@
 	 *		PIRQ1 -> irq  9
 	 *		PIRQ2 -> irq 10
 	 *		PIRQ3 -> irq 11
+	 *
+	 * This probably ought to be configurable via MILO.  For
+	 * example, sound boards seem to like using IRQ 9.
 	 */
 	const unsigned int route_tab = 0x0b0a090f;
 	unsigned char pin;
@@ -587,13 +593,13 @@
 	for (dev = pci_devices; dev; dev = dev->next) {
 		dev->irq = 0;
 		if (dev->bus->number != 0 ||
-		    PCI_SLOT(dev->devfn) < 6 || PCI_SLOT(dev->devfn) > 12)
+		    PCI_SLOT(dev->devfn) < 6 ||
+		    PCI_SLOT(dev->devfn) >= 6 + sizeof(pirq_tab)/sizeof(pirq_tab[0]))
 		{
-			printk("noname_set_irq: no dev on bus %d, slot %d!!\n",
+			printk("bios32.avanti_and_noname_fixup: no dev on bus %d, slot %d!!\n",
 			       dev->bus->number, PCI_SLOT(dev->devfn));
 			continue;
 		}
-
 		pcibios_read_config_byte(dev->bus->number, dev->devfn,
 					 PCI_INTERRUPT_PIN, &pin);
 		pirq = pirq_tab[PCI_SLOT(dev->devfn) - 6][pin];
@@ -644,8 +650,8 @@
 	/*
 	 * Now is the time to do all those dirty little deeds...
 	 */
-#if defined(CONFIG_ALPHA_NONAME)
-	noname_fixup();
+#if defined(CONFIG_ALPHA_NONAME) || defined(CONFIG_ALPHA_AVANTI)
+	avanti_and_noname_fixup();
 #elif defined(CONFIG_ALPHA_CABRIOLET)
 	cabriolet_fixup();
 #elif defined(CONFIG_ALPHA_EB66P)
diff -u --recursive --new-file 386/arch/alpha/kernel/entry.S linux/arch/alpha/kernel/entry.S
--- 386/arch/alpha/kernel/entry.S	Fri Oct 13 21:28:17 1995
+++ linux/arch/alpha/kernel/entry.S	Fri Oct 13 21:27:58 1995
@@ -4,6 +4,7 @@
  * kernel entry-points
  */
 
+#include <linux/config.h>
 #include <asm/system.h>
 
 #define halt	.long PAL_halt
@@ -174,6 +175,36 @@
 .globl	entIF
 .ent	entIF
 entIF:
+#ifdef CONFIG_KGDB
+	bne	$16,1f		/* not a bpt trap -> */
+	/*
+	 * Call kgdb if it's enabled and if "current" is not being
+	 * traced or if we get a bpt in kernel mode (the architecture
+	 * manual defines the values of $17 and $18 as "unpredictable",
+	 * so they are fair game).
+	 */
+	lda	$17,kgdb_enabled
+	ldl	$17,0($17)
+	beq	$17,1f		/* kgdb not enabled -> */
+
+#ifndef CONFIG_ALPHA_CABRIOLET
+	/*
+	 * MILO on Cabriolet doesn't seem to setup the PS in the
+	 * PALframe correctly. (davidm@azstarnet.com)
+	 */
+	ldq	$18,0($30)	/* get ps */
+	and	$18,8,$18
+	beq	$18,entKGDB
+#endif
+
+	lda	$17,current_set
+	ldq	$17,0($17)
+	bis	$31,PF_PTRACED,$18
+	ldq	$17,TASK_FLAGS($17)
+	and	$17,$18,$17
+	beq	$17,entKGDB
+1:
+#endif
 	SAVE_ALL
 	lda	$27,do_entIF
 	lda	$26,ret_from_sys_call
@@ -661,3 +692,126 @@
 	.quad sys_syslog, sys_reboot, sys_clone, sys_uselib, do_entSys
 	.quad do_entSys, do_entSys, do_entSys, do_entSys, do_entSys
 
+
+#ifdef CONFIG_KGDB
+
+#define KGDB_STACK_SIZE	(8*1024)
+
+	.lcomm	kgdb_stack_bottom, KGDB_STACK_SIZE
+
+/*
+ * The following is the nasty part of entering KGDB.  GDB assumes that
+ * it can access the memory below the interrupted thread's stack
+ * pointer (SP).  This means that the stub cannot run on this stack
+ * (interrupts could overwrite changes made by GDB).  Similarly, we do
+ * not want to bother the GDB user with the call chain leading from
+ * the interrupt handler to this function.  That is, the SP reported
+ * to GDB should be the thread's SP at the point it was interrupted.  We
+ * achieve all this by switching to KGDB's own stack before saving any
+ * registers (of course, the PAL-generated frame is already on the stack and
+ * we copy that part explicitly).  GDB does whatever it wants to the
+ * thread's stack; and when it continues execution, we restore the
+ * registers from the private stack and return from the interrupt.
+ *
+ * This is not re-entrant---gdb on the host probably would get confused
+ * anyway, but we probably ought to detect that case at the least...
+ */
+.align 3
+.globl	entKGDB
+.ent	entKGDB
+entKGDB:
+	lda	$16,kgdb_stack_bottom
+	lda	$16,(KGDB_STACK_SIZE-48)($16)
+	bis	$31,$30,$17	/* save real sp in a1 */
+	bis	$31,$16,$30	/* update sp atomically! */
+	SAVE_ALL		/* save regular stuff */
+	/*
+	 * Only now can we disable interrupts (swpipl may step on
+	 * t0,t8..t11, and a0):
+	 */
+	bis	$31,7,$16
+	call_pal PAL_swpipl
+
+	/* copy PAL frame to kgdb stack: */
+
+	ldq	$1,0($17)
+	ldq	$2,8($17)
+	ldq	$3,16($17)
+	ldq	$4,24($17)
+	ldq	$5,32($17)
+	ldq	$6,40($17)
+
+	stq	$1,0+160($30)
+	stq	$2,8+160($30)
+	stq	$3,16+160($30)
+	stq	$4,24+160($30)
+	stq	$5,32+160($30)
+	stq	$6,40+160($30)
+
+	/* allocate space for and save caller saved regs as well as orig sp: */
+
+	lda	$30,-320($30)
+	addq	$17,48,$17	/* pop PAL frame */
+	stq	$17,0($30)	/* save original sp */
+
+	stq	 $9,0x08($30); stq $10,0x10($30); stq $11,0x18($30)
+	stq	$12,0x20($30); stq $13,0x28($30); stq $14,0x30($30)
+	stq	$15,0x38($30)
+
+	stt	$f0,0x40($30);   stt $f1,0x48($30);   stt $f2,0x50($30);   stt $f3,0x58($30)
+	stt	$f4,0x60($30);   stt $f5,0x68($30);   stt $f6,0x70($30);   stt $f7,0x78($30)
+	stt	$f8,0x80($30);   stt $f9,0x88($30);   stt $f10,0x90($30);  stt $f11,0x98($30)
+	stt	$f12,0xa0($30);  stt $f13,0xa8($30);  stt $f14,0xb0($30);  stt $f15,0xb8($30)
+	stt	$f16,0xc0($30);  stt $f17,0xc8($30);  stt $f18,0xd0($30);  stt $f19,0xd8($30)
+	stt	$f20,0xe0($30);  stt $f21,0xe8($30);  stt $f22,0xf0($30);  stt $f23,0xf8($30)
+	stt	$f24,0x100($30); stt $f25,0x108($30); stt $f26,0x110($30); stt $f27,0x118($30)
+	stt	$f28,0x120($30); stt $f29,0x128($30); stt $f30,0x130($30); stt $f31,0x138($30)
+
+	bis	$31,$30,$16
+
+	lda	$27,kgdb_handle_exception
+	jsr	$26,($27),kgdb_handle_exception
+
+	ldq	$17,0($30)	/* load new sp and caller-saved registers */
+
+	ldq	 $9,0x08($30); ldq $10,0x10($30); ldq $11,0x18($30)
+	ldq	$12,0x20($30); ldq $13,0x28($30); ldq $14,0x30($30)
+	ldq	$15,0x38($30)
+
+	ldt	$f0,0x40($30);   ldt $f1,0x48($30);   ldt $f2,0x50($30);   ldt $f3,0x58($30)
+	ldt	$f4,0x60($30);   ldt $f5,0x68($30);   ldt $f6,0x70($30);   ldt $f7,0x78($30)
+	ldt	$f8,0x80($30);   ldt $f9,0x88($30);   ldt $f10,0x90($30);  ldt $f11,0x98($30)
+	ldt	$f12,0xa0($30);  ldt $f13,0xa8($30);  ldt $f14,0xb0($30);  ldt $f15,0xb8($30)
+	ldt	$f16,0xc0($30);  ldt $f17,0xc8($30);  ldt $f18,0xd0($30);  ldt $f19,0xd8($30)
+	ldt	$f20,0xe0($30);  ldt $f21,0xe8($30);  ldt $f22,0xf0($30);  ldt $f23,0xf8($30)
+	ldt	$f24,0x100($30); ldt $f25,0x108($30); ldt $f26,0x110($30); ldt $f27,0x118($30)
+	ldt	$f28,0x120($30); ldt $f29,0x128($30); ldt $f30,0x130($30); ldt $f31,0x138($30)
+	lda	$30,320($30)	/* pop extra register frame */
+
+	/*
+	 * Copy PAL frame from kgdb stack to new stack so we can rti
+	 * to it:
+	 */
+	ldq	$1,0+160($30)
+	ldq	$2,8+160($30)
+	ldq	$3,16+160($30)
+	ldq	$4,24+160($30)
+	ldq	$5,32+160($30)
+	ldq	$6,40+160($30)
+
+	subq	$17,48,$17	/* alloc space for PAL frame on new stack */
+
+	stq	$1,0($17)
+	stq	$2,8($17)
+	stq	$3,16($17)
+	stq	$4,24($17)
+	stq	$5,32($17)
+	stq	$6,40($17)
+
+	RESTORE_ALL
+	bis	$31,$17,$30	/* establish new sp */
+	rti
+
+.end entKGDB
+
+#endif /* CONFIG_KGDB */
diff -u --recursive --new-file 386/arch/alpha/kernel/irq.c linux/arch/alpha/kernel/irq.c
--- 386/arch/alpha/kernel/irq.c	Wed Oct 11 03:20:49 1995
+++ linux/arch/alpha/kernel/irq.c	Fri Oct 13 23:16:56 1995
@@ -29,11 +29,11 @@
 static unsigned char cache_21 = 0xff;
 static unsigned char cache_A1 = 0xff;
 
-#if defined(CONFIG_ALPHA_CABRIOLET) || defined(CONFIG_ALPHA_EB66P)
+#if NR_IRQS == 33
   static unsigned char cache_804 = 0xef;
   static unsigned char cache_805 = 0xff;
   static unsigned char cache_806 = 0xff;
-#elif defined(CONFIG_ALPHA_EB66) || defined(CONFIG_ALPHA_EB64P)
+#elif NR_IRQS == 32
   static unsigned char cache_26 = 0xdf;
   static unsigned char cache_27 = 0xff;
 #endif
@@ -53,7 +53,7 @@
 	} else if (irq_nr < 16) {
 		cache_A1 |= mask;
 		outb(cache_A1,0xA1);
-#if defined(CONFIG_ALPHA_CABRIOLET) || defined(CONFIG_ALPHA_EB66P)
+#if NR_IRQS == 33
 	} else if (irq_nr < 24) {
 		cache_804 |= mask;
 		outb(cache_804, 0x804);
@@ -63,7 +63,7 @@
 	} else {
 		cache_806 |= mask;
 		outb(cache_806, 0x806);
-#elif defined(CONFIG_ALPHA_EB66) || defined(CONFIG_ALPHA_EB64P) 
+#elif NR_IRQS == 32 
 	} else if (irq_nr < 24) {
 		cache_26 |= mask;
 		outb(cache_26, 0x26);
@@ -90,7 +90,7 @@
 	} else if (irq_nr < 16) {
 		cache_A1 &= mask;
 		outb(cache_A1,0xA1);
-#if defined(CONFIG_ALPHA_CABRIOLET) || defined(CONFIG_ALPHA_EB66P)
+#if NR_IRQS == 33
 	} else if (irq_nr < 24) {
 		cache_804 &= mask;
 		outb(cache_804, 0x804);
@@ -100,7 +100,7 @@
 	} else {
 		cache_806 &= mask;
 		outb(cache_806, 0x806);
-#elif defined(CONFIG_ALPHA_EB66) || defined(CONFIG_ALPHA_EB64P)
+#elif NR_IRQS == 32
 	} else if (irq_nr < 24) {
 		cache_26 &= mask;
 		outb(cache_26, 0x26);
@@ -165,7 +165,7 @@
 	} else if (irq < 16) {
 		cache_A1 |= mask;
 		outb(cache_A1, 0xA1);
-#if defined(CONFIG_ALPHA_CABRIOLET) || defined(CONFIG_ALPHA_EB66P)
+#if NR_IRQS == 33
 	} else if (irq < 24) {
 		cache_804 |= mask;
 		outb(cache_804, 0x804);
@@ -175,7 +175,7 @@
 	} else {
 		cache_806 |= mask;
 		outb(cache_806, 0x806);
-#elif defined(CONFIG_ALPHA_EB66) || defined(CONFIG_ALPHA_EB66P)
+#elif NR_IRQS == 32
 	} else if (irq < 24) {
 		cache_26 |= mask;
 		outb(cache_26, 0x26);
@@ -196,7 +196,7 @@
 	} else if (irq < 16) {
 		cache_A1 &= mask;
 		outb(cache_A1, 0xA1);
-#if defined(CONFIG_ALPHA_CABRIOLET) || defined(CONFIG_ALPHA_EB66P)
+#if NR_IRQS == 33
 	} else if (irq < 24) {
 		cache_804 &= mask;
 		outb(cache_804, 0x804);
@@ -294,8 +294,6 @@
 	outb(0x0c, 0x2fc);
 	outb(0,0x61);
 	outb(0,0x461);
-#elif defined(CONFIG_ALPHA_NONAME)
-	printk("61=%02x, 64=%02x, 60=%02x\n", inb(0x61), inb(0x64), inb(0x60));
 #endif
 }
 
@@ -508,11 +506,11 @@
 	
 	/* now filter out any obviously spurious interrupts */
 	irqmask = (((unsigned long)cache_A1)<<8) | (unsigned long) cache_21;
-#if defined(CONFIG_ALPHA_CABRIOLET) || defined(CONFIG_ALPHA_EB66P)
+#if NR_IRQS == 33
 	irqmask |= ((((unsigned long)cache_804)<<16) |
 		    (((unsigned long)cache_805)<<24) |
 		    (((unsigned long)cache_806)<<24));
-#elif defined(CONFIG_ALPHA_EB66) || defined(CONFIG_ALPHA_EB64P)
+#elif NR_IRQS == 32
 	irqmask |= ((((unsigned long)cache_26)<<16) |
 		    (((unsigned long)cache_27)<<24));
 #endif
@@ -531,11 +529,11 @@
 	int i;
 	
 	irqmask = (((unsigned int)cache_A1)<<8) | (unsigned int)cache_21;
-#if defined(CONFIG_ALPHA_CABRIOLET) || defined(CONFIG_ALPHA_EB66P)
+#if NR_IRQS == 33
 	irqmask |= ((((unsigned long)cache_804)<<16) |
 		    (((unsigned long)cache_805)<<24) |
 		    (((unsigned long)cache_806)<<24));
-#elif defined(CONFIG_ALPHA_EB66) || defined(CONFIG_ALPHA_EB64P)
+#elif NR_IRQS == 32
 	irqmask |= ((((unsigned long)cache_26)<<16) |
 		    (((unsigned long)cache_27)<<24));
 #endif
@@ -576,14 +574,14 @@
 			return;
 		case 2:
 			machine_check(vector, la_ptr, &regs);
-			break;
+			return;
 		case 3:
 #if defined(CONFIG_ALPHA_JENSEN) || defined(CONFIG_ALPHA_NONAME) || \
     defined(CONFIG_ALPHA_SRM)
 			srm_device_interrupt(vector, &regs);
-#elif defined(CONFIG_ALPHA_CABRIOLET) || defined(CONFIG_ALPHA_EB66P)
+#elif NR_IRQS == 33
 			cabriolet_and_eb66p_device_interrupt(vector, &regs);
-#elif defined(CONFIG_ALPHA_EB66) || defined(CONFIG_ALPHA_EB64P)
+#elif NR_IRQS == 32
 			eb66_and_eb64p_device_interrupt(vector, &regs);
 #endif
 			return;
@@ -605,11 +603,11 @@
 	dma_outb(0, DMA2_RESET_REG);
 	dma_outb(0, DMA1_CLR_MASK_REG);
 	dma_outb(0, DMA2_CLR_MASK_REG);
-#if defined(CONFIG_ALPHA_CABRIOLET) || defined(CONFIG_ALPHA_EB66P)
+#if NR_IRQS == 33
 	outb(cache_804, 0x804);
 	outb(cache_805, 0x805);
 	outb(cache_806, 0x806);
-#elif defined(CONFIG_ALPHA_EB66) || defined(CONFIG_ALPHA_EB64P)
+#elif NR_IRQS == 32
 	outb(cache_26, 0x26);
 	outb(cache_27, 0x27);
 #endif
diff -u --recursive --new-file 386/arch/alpha/kernel/kgdb.c linux/arch/alpha/kernel/kgdb.c
--- 386/arch/alpha/kernel/kgdb.c	Thu Jan  1 00:00:00 1970
+++ linux/arch/alpha/kernel/kgdb.c	Mon Aug 14 04:02:47 1995
@@ -0,0 +1,997 @@
+/*
+ * linux/arch/alpha/kernel/kgdb.c
+ *
+ * Copyright (c) 1995	David Mosberger (davidm@cs.arizona.edu)
+ */
+/*
+ * This module provides low-level support for GDB and has been adapted
+ * from sparc-stub.c.  Please refer to that file for more on the
+ * history of the module.  The contributors seem to be: Hewlett-Packard,
+ * Glenn Engel, and Cygnus Support (Stu Grossman).
+ *
+ * To enable debugger support, two things need to happen.  One, a call
+ * to kgdb_set_debug_traps() is necessary in order to allow any
+ * breakpoints or error conditions to be properly intercepted and
+ * reported to gdb.  Two, a breakpoint needs to be generated to begin
+ * communication.  This is most easily accomplished by a call to
+ * kgdb_breakpoint().  kgdb_breakpoint() simulates a breakpoint by
+ * executing a call_pal bpt.
+ *
+ *************
+ *
+ *    The following gdb commands are supported:
+ *
+ * command	    function				   Return value
+ *
+ *    g		    return the value of the CPU registers  hex data or ENN
+ *    G		    set the value of the CPU registers	   OK or ENN
+ *    Pn..=v..	    set CPU register n.. to value v..	   OK or ENN
+ *
+ *    mAA..AA,LLLL  Read LLLL bytes at address AA..AA	   hex data or ENN
+ *    MAA..AA,LLLL: Write LLLL bytes at address AA.AA	   OK or ENN
+ *
+ *    c		    Resume at current address		   SNN	 (signal NN)
+ *    cAA..AA	    Continue at address AA..AA		   SNN
+ *
+ *    s		    Step one instruction		   SNN
+ *    sAA..AA	    Step one instruction from AA..AA	   SNN
+ *
+ *    k		    kill
+ *
+ *    ?		    What was the last sigval ?		   SNN	 (signal NN)
+ *
+ *   qXXXX	    Request info about XXXX.
+ *   QXXXX=yyyy	    Set value of XXXX to yyyy.
+ *   qOffsets	    Get section offsets.	     Text=xxx;Data=yyy;Bss=zzz
+ *
+ *		    Send text to stdout.  Only comes from  Otext
+ *		    remote target.
+ *
+ * All commands and responses are sent with a packet which includes a
+ * checksum.  A packet consists of
+ *
+ * $<packet info>#<checksum>.
+ *
+ * where
+ * <packet info> :: <characters representing the command or response>
+ * <checksum>    :: <two hex digits computed as modulo 256 sum of <packetinfo>>
+ *
+ * When a packet is received, it is first acknowledged with either '+' or '-'.
+ * '+' indicates a successful transfer.  '-' indicates a failed transfer.
+ *
+ * Example:
+ *
+ * Host:                  Reply:
+ * $m0,10#2a               +$00010203040506070809101112131415#42
+ *
+ * Responses can be run-length encoded to save space.  A '*' means
+ * that the next characters is giving a repeat count in the range
+ * 3..97.  A repeat count of 3 is encoded as a blank character (0x20)
+ * and a repeat count of 97 is encoded as a tilde character (0x7e).
+ * The repeat count stands for that many repititions of the character
+ * preceding the '*'.  Note that this means that responses cannot
+ * contain '*' (this might be a problem in the console-output
+ * request).
+ *
+ * Example: "0* " means the same as "0000".
+ */
+#include <linux/config.h>
+
+#ifdef CONFIG_KGDB
+
+#include <linux/kernel.h>
+#include <linux/ptrace.h>
+#include <linux/sched.h>
+#include <linux/signal.h>
+#include <linux/string.h>
+
+#include <asm/system.h>
+#include <asm/io.h>
+
+extern void kgdb_enter (void);
+
+struct ext_pt_regs {
+	unsigned long	sp;
+	unsigned long	r9;
+	unsigned long	r10;
+	unsigned long	r11;
+	unsigned long	r12;
+	unsigned long	r13;
+	unsigned long	r14;
+	unsigned long	r15;
+	unsigned long	fpu[32];
+	struct pt_regs	std;
+};
+
+/*
+ * These defines must match the corresponding code in remote.c.
+ */
+#define RLE_MIN_COUNT	3
+#define RLE_MAX_COUNT	(('~' - ' ') + RLE_MIN_COUNT)
+
+#define BREAKINST	0x00000080	/* call_pal bpt */
+
+/*
+ * BUFMAX defines the maximum number of characters in inbound/outbound
+ * buffers at least NUMREGBYTES*2 are needed for register packets.
+ */
+#define BUFMAX 2048
+
+#define NUMREGS		(2*32+1)	/* # of registers */
+#define NUMREGBYTES	(NUMREGS * 8)	/* # of bytes for registers */
+
+enum regnames {
+      V0,   T0,   T1,   T2,   T3,   T4,   T5,   T6,
+      T7,   S0,   S1,   S2,   S3,   S4,   S5,   S6,
+      A0,   A1,   A2,   A3,   A4,   A5,   T8,   T9,
+     T10,  T11,   RA,  T12,   AT,   GP,   SP, ZERO,
+      F0,   F1,   F2,   F3,   F4,   F5,   F6,   F7,
+      F8,   F9,  F10,  F11,  F12,  F13,  F14,  F15,
+     F16,  F17,  F18,  F19,  F20,  F21,  F22,  F23,
+     F24,  F25,  F26,  F27,  F28,  F29,  F30,  F31,
+      PC,  VFP
+};
+
+#define DBG_STACK		0x001
+#define DBG_TRAP		0x002
+#define DBG_IN_PACKETS		0x004
+#define DBG_OUT_PACKETS		0x008
+#define DBG_MEM			0x010
+#define DBG_STORE_REG		0x020
+#define DBG_CMDS		0x040
+#define DBG_SINGLE_STEP		0x080
+#define DBG_FUNCS		0x100
+
+#define DEBUG
+#ifdef DEBUG
+# define DBG(bit,args)	{if (kgdb_debug & (bit)) printk args;}
+#else
+# define DBG(bit,args)
+#endif
+
+int kgdb_debug	 = 0x000;		/* kgdb debugging level */
+
+static const char hexchars[] = "0123456789abcdef";
+
+static int		nsaved = 0;
+static unsigned int	saved_insn[2];
+static unsigned int	*saved_addr[2];
+
+static int initialized = 0;	/* !0 means we've been initialized */
+static char remcomInBuffer[BUFMAX];
+static char remcomOutBuffer[BUFMAX];
+
+/*
+ * Serial I/O routines.  Define SERIAL_LINE either as 0 or 1 depending
+ * on whether you want to use /dev/cua0 or /dev/cua1 for running kgdb.
+ */
+#define SERIAL_LINE	1
+#define SERIAL_BASEADDR	(0x300 - SERIAL_LINE * 0x100)
+#define SERIAL_PORT(p)	(SERIAL_BASEADDR + (p))
+
+
+void putDebugChar(int ch)
+{
+	unsigned long flags;
+	int line_status;
+
+	save_flags(flags);
+	cli();
+
+	/* wait for transmitter holding register to empty: */
+	do {
+		line_status = inb(SERIAL_PORT(0xfd));
+	} while((line_status & 0x60) != 0x60);
+
+	/* send the character out: */
+	outb(ch, SERIAL_PORT(0xf8));
+
+	restore_flags(flags);
+}
+
+
+int getDebugChar(void)
+{
+	unsigned long flags;
+	int line_status, ch;
+
+	save_flags(flags);
+	cli();
+
+	/* wait for "data ready": */
+	do {
+		line_status = inb(SERIAL_PORT(0xfd));
+	} while((line_status & 0x01) == 0);
+
+	ch = inb(SERIAL_PORT(0xf8));
+
+	restore_flags(flags);
+
+	return ch;
+}
+
+
+/*
+ * Look for Ctrl-C.  If we find one, trap into debugger.
+ */
+static void irq_handler(int irq, struct pt_regs *regs)
+{
+	if (getDebugChar() == 0x03) {
+		kgdb_enter();
+	}
+}
+
+
+void initDebugIO(void)
+{
+	int comstat, hi, lo;
+
+	/*
+	 * Initialize the serial port.  JRP This is deliberately
+	 * brain-dead hard-coded bad code so it'll be replaced!
+	 */
+	printk("kgdb: stealing /dev/ttyS%d and initializing it to 38400 baud",
+	       SERIAL_LINE);
+
+	request_irq(4 - SERIAL_LINE, irq_handler, SA_INTERRUPT, "kgdb");
+
+	comstat = inb(SERIAL_PORT(0xfb));	/* turn on dlab */
+	outb(comstat | 0x80, SERIAL_PORT(0xfb));
+	hi = inb(SERIAL_PORT(0xf9));		/* read current baudrate */
+	lo = inb(SERIAL_PORT(0xf8));
+	outb(comstat, SERIAL_PORT(0xfb));	/* turn off dlab */
+
+	outb(0x83, SERIAL_PORT(0xfb));	/* no parity, 8 data, 1 stop bit */
+	outb(0x00, SERIAL_PORT(0xf9));	/* 38400 baud */
+	outb(0x03, SERIAL_PORT(0xf8));
+	outb(0x03, SERIAL_PORT(0xfb));	/* turnoff divisor latch access bit */
+	/*
+	 * Prior to disabling interrupts, read the LSR and RBR
+	 * registers of BOTH devices.
+	 */
+	comstat = inb(SERIAL_PORT(0xfd));	/* COM2 LSR */
+	comstat = inb(SERIAL_PORT(0xf8));	/* COM2 RBR */
+	outb(0x01, SERIAL_PORT(0xf9));	/* enable receive interrupts */
+
+	comstat = inb(SERIAL_PORT(0xfb));
+	comstat = inb(SERIAL_PORT(0xfd));
+}
+
+
+/*
+ * Misc. support routines:
+ */
+static inline long kaddr_range(unsigned long addr, unsigned long size)
+{
+	return ((addr >> 41) == 0x7ffffe) && (((addr + size - 1) >> 41) == 0x7ffffe);
+}
+
+
+static inline void imb(void)
+{
+	asm volatile ("call_pal %0" :: "i"(PAL_imb) : "memory");
+}
+
+
+/*
+ * Don't want to use libraries memset() to avoid infinite recursion:
+ */
+static void private_memset(void *addr, long value, int length)
+{
+	char *dst = addr;
+
+	while (length--) *dst++ = value;
+}
+
+
+/*
+ * Convert ch from a hex digit to an int:
+ */
+static int hex(unsigned char ch)
+{
+	if (ch >= 'a' && ch <= 'f') {
+		return ch - 'a' + 10;
+	} else if (ch >= '0' && ch <= '9') {
+		return ch - '0';
+	} else if (ch >= 'A' && ch <= 'F') {
+		return ch - 'A' + 10;
+	} else {
+		return -1;
+	}
+}
+
+
+/*
+ * Scan for the sequence $<data>#<checksum>:
+ */
+static void getpacket(char *buffer)
+{
+	unsigned char checksum;
+	unsigned char xmitcsum;
+	int i;
+	int count;
+	unsigned char ch;
+
+	do {
+		/* wait around for the start character, ignore all others */
+		while ((ch = getDebugChar()) != '$') {
+			/* skip */
+		}
+
+		checksum = 0;
+		xmitcsum = -1;
+
+		count = 0;
+
+		/* now, read until a # or end of buffer is found */
+		while (count < BUFMAX) {
+			ch = getDebugChar();
+			if (ch == '#') {
+				break;
+			}
+			checksum = checksum + ch;
+			buffer[count] = ch;
+			count = count + 1;
+		}
+
+		if (count >= BUFMAX) {
+			continue;
+		}
+
+		buffer[count] = 0;
+
+		if (ch == '#') {
+			xmitcsum = hex(getDebugChar()) << 4;
+			xmitcsum |= hex(getDebugChar());
+			if (checksum != xmitcsum) {
+				putDebugChar('-');	/* failed checksum */
+			} else {
+				putDebugChar('+');	 /* successful xfer */
+				/*
+				 * if a sequence char is present,
+				 * reply the sequence ID:
+				 */
+				if (buffer[2] == ':') {
+					putDebugChar(buffer[0]);
+					putDebugChar(buffer[1]);
+					/* remove sequence chars from buffer */
+					count = strlen(buffer);
+					for (i=3; i <= count; i++) {
+						buffer[i-3] = buffer[i];
+					}
+				}
+			}
+		}
+	} while (checksum != xmitcsum);
+
+	DBG(DBG_IN_PACKETS, ("kgdb: got packet `$%s'\n", remcomInBuffer));
+}
+
+
+/*
+ * Flush out whatever repeated characters we have accumulated
+ * so far.
+ */
+static unsigned char *rle_flush(unsigned char *dst, unsigned char rch,
+				int rcount)
+{
+	if (rcount >= RLE_MIN_COUNT) {
+		/*
+		 * We have a sequence that's long enough to warrant
+		 * encoding, do so:
+		 */
+		*dst++ = '*';
+		*dst++ = (rcount - RLE_MIN_COUNT) + ' ';
+	} else {
+		/*
+		 * The repeated sequence is not long enough to warrant
+		 * rle, so output the repeated characters directly:
+		 */
+		while (rcount--) {
+			*dst++ = rch;
+		}
+	}
+	return dst;
+}
+
+
+/*
+ * Encode sequences of repeated characters by one copy of that
+ * character, a star, and a repeat-count encoded as a ASCII character.
+ */
+static void
+rle_encode(unsigned char *src)
+{
+	unsigned char *dst, ch, rch;
+	int rcount;
+
+	dst = src;
+	rch = '\0';
+	rcount = 0;
+	while ((ch = *src++) != '\0') {
+		if (ch == rch) {
+			++rcount;
+			if (rcount >= RLE_MAX_COUNT) {
+				dst = rle_flush(dst, rch, RLE_MAX_COUNT);
+				rcount -= RLE_MAX_COUNT;
+			}
+		} else {
+			dst = rle_flush(dst, rch, rcount);
+			*dst++ = ch;	/* first character is always output */
+			rch = ch;
+			rcount = 0;
+		}
+	}
+	dst = rle_flush(dst, rch, rcount);
+	*dst++ = '\0';
+}
+
+
+/*
+ * Send the packet in buffer.
+ */
+static void
+putpacket(unsigned char *buffer)
+{
+	unsigned char checksum;
+	unsigned char ch;
+	int count;
+
+	DBG(DBG_OUT_PACKETS, ("kgdb: sending packet `%s'\n", buffer));
+
+	rle_encode(buffer);
+	DBG(DBG_OUT_PACKETS, ("kgdb: encoded packet `%s'\n", buffer));
+
+	/*  $<packet info>#<checksum>. */
+	do {
+		putDebugChar('$');
+		checksum = 0;
+		count = 0;
+
+		while ((ch = buffer[count]) != '\0') {
+			putDebugChar(ch);
+			checksum += ch;
+			count += 1;
+		} /* while */
+
+		putDebugChar('#');
+		putDebugChar(hexchars[checksum >> 4]);
+		putDebugChar(hexchars[checksum & 0xf]);
+
+		DBG(DBG_OUT_PACKETS, ("kgdb: checksum %#x\n", checksum));
+	} while (getDebugChar() == '-');
+}
+
+
+/*
+ * Convert the memory pointed to by mem into hex, placing result in
+ * buf.  Return a pointer to the last char put in buf (null), in case
+ * of mem fault, return 0.  If MAY_FAULT is non-zero, then we will
+ * handle memory faults by returning a 0, else treat a fault like any
+ * other fault in the stub.
+ */
+static unsigned char *mem2hex(unsigned char *mem, unsigned char *buf,
+			      int count, int may_fault)
+{
+	unsigned long l, *lp, flags;
+	unsigned char ch;
+	int byte;
+
+	DBG(DBG_FUNCS, ("kgdb: mem2hex(mem=%p,buf=%p,count=%d,may_fault=%d)\n",
+			mem, buf, count, may_fault));
+
+	lp = (unsigned long*) ((unsigned long) mem & ~0x7);
+	byte = mem - (unsigned char*) lp;
+	save_flags(flags);
+	cli();
+	l = *lp++;
+	l >>= 8 * byte;
+	while (count-- > 0) {
+		draina();
+		if (rdmces() & 0x7) {
+			if (!may_fault) {
+				printk("addr=%p\n", lp - 1);
+				panic("kgdb: mem2hex faulted!");
+			}
+			wrmces(0x7);			/* reset machine check */
+			restore_flags(flags);
+			return 0;			/* return error */
+		}
+		ch = l & 0xff;
+		*buf++ = hexchars[ch >> 4];
+		*buf++ = hexchars[ch & 0xf];
+		l >>= 8;
+		if (++byte >= 8) {
+			byte = 0;
+			l = *lp++;
+		}
+	}
+	*buf = 0;
+	restore_flags(flags);
+	return buf;
+}
+
+
+/*
+ * 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 *hex2mem(unsigned char *buf, unsigned char *mem, int count,
+		     int may_fault)
+{
+	unsigned long l, *lp, flags;
+	unsigned char ch;
+	int byte;
+	int i;
+
+	lp = (unsigned long*) ((unsigned long) mem & ~0x7);
+	byte = mem - (unsigned char*) lp;
+	save_flags(flags);
+	cli();
+	l = *lp;
+	for (i = 0; i < count; ++i) {
+		draina();
+		if (rdmces() & 0x7) {
+			if (!may_fault) {
+				panic("kgdb: hex2mem faulted!");
+			}
+			wrmces(0x7);			/* reset machine check */
+			restore_flags(flags);
+			return 0;			/* return error */
+		}
+		ch = hex(*buf++) << 4;
+		ch |= hex(*buf++);
+		l = (l & ~(0xffL << 8*byte)) | ((long) ch << 8*byte);
+		if (++byte >= 8) {
+			byte = 0;
+			*lp++ = l;
+			draina();
+			if (rdmces() & 0x7) {
+				wrmces(0x7);			/* reset machine check */
+				restore_flags(flags);
+				return 0;			/* return error */
+			}
+			l = *lp;
+		}
+	}
+	if (byte) {
+		*lp = l;
+	}
+	restore_flags(flags);
+	return buf;
+}
+
+
+/*
+ * While we find nice hex chars, build an int.
+ * Return number of chars processed.
+ */
+static int hex2int(char **ptr, int *int_value)
+{
+	int num_chars = 0;
+	int hex_value;
+
+	*int_value = 0;
+
+	while (**ptr) {
+		hex_value = hex(**ptr);
+		if (hex_value < 0) {
+			break;
+		}
+
+		*int_value = (*int_value << 4) | hex_value;
+		num_chars ++;
+
+		(*ptr)++;
+	}
+
+	return num_chars;
+}
+
+
+/*
+ * While we find nice hex chars, build a long.
+ * Return number of chars processed.
+ */
+static int hex2long(char **ptr, long *long_value)
+{
+	int num_chars = 0;
+	long hex_value;
+
+	*long_value = 0;
+
+	while (**ptr) {
+		hex_value = hex(**ptr);
+		if (hex_value < 0) {
+			break;
+		}
+
+		*long_value = (*long_value << 4) | hex_value;
+		num_chars ++;
+
+		(*ptr)++;
+	}
+
+	return num_chars;
+}
+
+
+/*
+ * Convert a register number to the corresponding pointer into
+ * the saved state.  Returns 0 in the case of a bad register.
+ */
+static unsigned long *regno2addr(unsigned int regno, struct ext_pt_regs *regs)
+{
+	static unsigned long zero;
+	unsigned long *addr;
+
+	switch (regno) {
+	      case V0...T7: addr = &regs->std.r0 + regno; break;
+	      case S0...S6: addr = &regs->r9 + regno - S0; break;
+	      case A3...AT: addr = &regs->std.r19 + regno - A3; break;
+	      case A0...A2: addr = &regs->std.r16 + regno - A0; break;
+	      case SP:	    addr = &regs->sp; break;
+	      case PC:	    addr = &regs->std.pc; break;
+	      case GP:	    addr = &regs->std.gp; break;
+	      case ZERO:    addr = &zero; zero = 0L; break;
+	      case F0...F31: addr = &regs->fpu[regno - F0];
+	      default:	    addr = 0; break;
+	}
+	return addr;
+}
+
+
+static int set_breakpoint(struct ext_pt_regs *regs)
+{
+	int displ, reg_b, i;
+	unsigned long *reg_b_addr, flags;
+	unsigned int insn, op_code;
+
+	if (!kaddr_range(regs->std.pc, sizeof(unsigned int))) {
+	    return 0;
+	}
+
+	save_flags(flags);
+	cli();
+	insn = *(unsigned int*)regs->std.pc;
+	draina();
+	if (rdmces() & 0x7) {
+		wrmces(0x7);			/* reset machine check */
+		restore_flags(flags);
+		return 0;			/* return error */
+	}
+
+	op_code = insn >> 26;
+	DBG(DBG_SINGLE_STEP, ("kgdb: single-step over "));
+	if (op_code >= 0x30) {
+		/*
+		 * It's a branch: instead of trying to figure out
+		 * whether the branch will be taken or not, we'll put
+		 * a breakpoint at either location.  This is simpler,
+		 * more reliable, and probably not a whole lot slower
+		 * than the alternative approach of emulating the
+		 * branch (emulation can be tricky for fp branches).
+		 */
+		DBG(DBG_SINGLE_STEP, ("branch"));
+		displ = ((int)(insn<<11)) >> 11;
+		saved_addr[nsaved++] = (unsigned int*)regs->std.pc + 1;
+		if (displ)
+		  saved_addr[nsaved++] = (unsigned int*)regs->std.pc + 1 + displ;
+	} else if (op_code == 0x1a) {
+		/* it's a jump */
+		DBG(DBG_SINGLE_STEP, ("jump"));
+		reg_b = (insn >> 16) & 0x1f;
+		reg_b_addr = regno2addr(reg_b, regs);
+		if (reg_b_addr) {
+			saved_addr[nsaved++] = (unsigned int*) *reg_b_addr;
+		} else {
+			restore_flags(flags);
+			return 0;
+		}
+	} else {
+		DBG(DBG_SINGLE_STEP, ("normal"));
+		saved_addr[nsaved++] = (unsigned int*)regs->std.pc + 1;
+	}
+
+	for (i = 0; i < nsaved; ++i) {
+		if (!kaddr_range((unsigned long)saved_addr[i], sizeof(unsigned int))) {
+			nsaved = 0;
+			restore_flags(flags);
+			return 0;
+		}
+		saved_insn[i] = *saved_addr[i];
+		draina();
+		if (rdmces() & 0x7) {
+			wrmces(0x7);			/* reset machine check */
+			nsaved = 0;
+			restore_flags(flags);
+			return 0;			/* return error */
+		}
+		DBG(DBG_SINGLE_STEP, (" -> next_pc=%p", saved_addr[i]));
+		*saved_addr[i] = BREAKINST;
+		draina();
+		if ((rdmces() & 0x7) || *saved_addr[i] != BREAKINST) {
+			nsaved = 0;
+			wrmces(0x7);			/* reset machine check */
+			restore_flags(flags);
+			return 0;			/* return error */
+		}
+	}
+	DBG(DBG_SINGLE_STEP, ("\n"));
+	restore_flags(flags);
+	return 1;
+}
+
+
+/*
+ * This function does all command processing for interfacing to gdb.  It
+ * returns the new stack pointer.
+ */
+void kgdb_handle_exception(struct ext_pt_regs *regs)
+{
+	unsigned long addr, *reg_addr;
+	int sigval, length, i;
+	unsigned int regno;
+	char *ptr;
+
+	/*
+	 * Restore original instructions as quickly as possible---in
+	 * the case the stub executes the same code.
+	 */
+	for (i = 0; i < nsaved; ++i) {
+		/* restore original instruction */
+		DBG(DBG_SINGLE_STEP,
+		    ("kgdb: single-step restoring instruction %x "
+		     "at %p\n", saved_insn[i], saved_addr[i]));
+		*saved_addr[i] = saved_insn[i];
+	}
+	nsaved = 0;
+
+	if (((unsigned int*)regs->std.pc)[-1] != BREAKINST) {
+		/* make pc point to restored insn: */
+		regs->std.pc -= sizeof(unsigned int);
+	}
+
+	DBG(DBG_TRAP,
+	    ("kgdb: handle_exception(regs=%p, sp=%lx, pc=%lx)\n",
+	     regs, regs->sp, regs->std.pc));
+
+	/*
+	 * Reply to host that an exception has occurred.  Include the
+	 * minimal state GDB needs in order to do anything useful.
+	 * The easiest way to find out which registers should be sent
+	 * is to add a printk to function read_register() in
+	 * gdb/findvar.c and do an "si" after connecting to the stub.
+	 */
+	sigval = SIGTRAP;
+	ptr = remcomOutBuffer;
+	*ptr++ = 'T';
+	*ptr++ = hexchars[sigval >>  4];
+	*ptr++ = hexchars[sigval & 0xf];
+
+	*ptr++ = hexchars[S6 >>  4];	/* s6 also serves as frame pointer */
+	*ptr++ = hexchars[S6 & 0xf];
+	*ptr++ = ':';
+	ptr    = mem2hex((char*)&regs->r15, ptr, 8, 0);
+	*ptr++ = ';';
+
+	*ptr++ = hexchars[SP >>  4];
+	*ptr++ = hexchars[SP & 0xf];
+	*ptr++ = ':';
+	ptr    = mem2hex((char*)&regs->sp, ptr, 8, 0);
+	*ptr++ = ';';
+
+	*ptr++ = hexchars[PC >>  4];
+	*ptr++ = hexchars[PC & 0xf];
+	*ptr++ = ':';
+	ptr    = mem2hex((char*)&regs->std.pc, ptr, 8, 0);
+	*ptr++ = ';';
+
+	/*
+	 * GDB wants VFP --- even though it's a computed value:
+	 */
+	*ptr++ = hexchars[VFP >>  4];
+	*ptr++ = hexchars[VFP & 0xf];
+	*ptr++ = ':';
+	private_memset(ptr, '0', 8 * 2); ptr += 8 * 2;
+	*ptr++ = ';';
+
+	*ptr++ = '\0';
+	DBG(DBG_OUT_PACKETS, ("kgdb: sending trap info `%s'\n",
+			      remcomOutBuffer));
+	putpacket(remcomOutBuffer);
+
+	while (1) {
+		remcomOutBuffer[0] = '\0';
+
+		getpacket(remcomInBuffer);
+		DBG(DBG_CMDS, ("kgdb: got command `%c'\n", remcomInBuffer[0]));
+		switch (remcomInBuffer[0]) {
+		      case '?':	/* return last signal */
+			remcomOutBuffer[0] = 'S';
+			remcomOutBuffer[1] = hexchars[sigval >> 4];
+			remcomOutBuffer[2] = hexchars[sigval & 0xf];
+			remcomOutBuffer[3] = 0;
+			break;
+
+		      case 'd':	/* toggle debug flag */
+			break;
+
+		      case 'g':	/* return the value of the CPU registers */
+			ptr = remcomOutBuffer;
+			ptr = mem2hex((char*) &regs->std.r0, ptr, 9*8, 0);	/* v0..t7 */
+			ptr = mem2hex((char*) &regs->r9, ptr, 7*8, 0);		/* s0..s6 */
+			ptr = mem2hex((char*) &regs->std.r16, ptr, 3*8, 0);	/* a0..a2 */
+			ptr = mem2hex((char*) &regs->std.r19, ptr, 10*8, 0);	/* a3..at */
+			ptr = mem2hex((char*) &regs->std.gp, ptr, 1*8, 0);	/* gp */
+			ptr = mem2hex((char*) &regs->sp, ptr, 1*8, 0);		/* sp */
+			private_memset(ptr, '0', 8*2); ptr += 8*2;		/* zero */
+			ptr = mem2hex((char*) regs->fpu, ptr, 32*8, 0);		/* f0..f31 */
+			ptr = mem2hex((char*) &regs->std.pc, ptr, 1*8, 0);	/* pc */
+			break;
+
+		      case 'G':	/* set the value of the CPU registers - return OK */
+			ptr = &remcomInBuffer[1];
+			ptr = hex2mem(ptr, (char*) &regs->std.r0, 9*8, 0);	/* v0..t7 */
+			ptr = hex2mem(ptr, (char*) &regs->r9, 7*8, 0);		/* s0..s6 */
+			ptr = hex2mem(ptr, (char*) &regs->std.r16, 3*8, 0);	/* a0..a2 */
+			ptr = hex2mem(ptr, (char*) &regs->std.r19, 10*8, 0);	/* a3..at */
+			ptr = hex2mem(ptr, (char*) &regs->std.gp, 1*8, 0);	/* gp */
+			ptr = hex2mem(ptr, (char*) &regs->sp, 1*8, 0);		/* sp */
+			ptr += 8*2;						/* zero */
+			ptr = hex2mem(ptr, (char*) regs->fpu, 32*8, 0);		/* f0..f31 */
+			ptr = hex2mem(ptr, (char*) &regs->std.pc, 1*8, 0);	/* pc */
+			strcpy(remcomOutBuffer, "OK");
+			break;
+
+		      case 'H':	/* set thread */
+			/* not currently supported */
+			sprintf(remcomOutBuffer, "E04, Set thread unsupported");
+			break;
+
+		      case 'P':	/* set the value of one CPU register - return OK */
+			ptr = &remcomInBuffer[1];
+			if (hex2int(&ptr, &regno) && *ptr++ == '=' && regno <= VFP) {
+				reg_addr = regno2addr(regno, regs);
+				DBG(DBG_STORE_REG, ("kgdb: storing %s to reg %d @ %p (regs=%p)\n",
+						    ptr, regno, reg_addr, regs));
+				if (reg_addr) {
+					hex2mem(ptr, (char*)reg_addr, 8, 0);
+				}
+				strcpy(remcomOutBuffer, "OK");
+			} else {
+				strcpy(remcomOutBuffer, "E01");
+			}
+			break;
+
+		      case 'm':	/* mAA..AA,LLLL  Read LLLL bytes at address AA..AA */
+			ptr = &remcomInBuffer[1];
+			if (hex2long(&ptr, &addr) && *ptr++ == ',' && hex2int(&ptr, &length)) {
+				DBG(DBG_MEM, ("kgdb: reading %d bytes at %lx\n", length, addr));
+				if (mem2hex((char *)addr, remcomOutBuffer, length, 1)) {
+					break;
+				}
+				strcpy(remcomOutBuffer, "E03");
+			} else {
+				strcpy(remcomOutBuffer, "E01");
+			}
+			break;
+
+		      case 'M':
+			/* MAA..AA,LLLL: Write LLLL bytes at address AA.AA return OK */
+
+			ptr = &remcomInBuffer[1];
+			if (hex2long(&ptr, &addr) && *ptr++ == ','
+			    && hex2int(&ptr, &length) && *ptr++ == ':')
+			{
+				DBG(DBG_MEM, ("kgdb: writing %d bytes %s at %lx\n",
+					      length, ptr, addr));
+				if (hex2mem(ptr, (char *)addr, length, 1)) {
+					strcpy(remcomOutBuffer, "OK");
+				} else {
+					strcpy(remcomOutBuffer, "E03");
+				}
+			} else {
+				strcpy(remcomOutBuffer, "E02");
+			}
+			break;
+
+		      case 's':	/* sAA..AA    Step at address AA..AA (optional) */
+		      case 'c':	/* cAA..AA    Continue at address AA..AA (optional) */
+			/* try to read optional parameter, pc unchanged if no parm: */
+			ptr = &remcomInBuffer[1];
+			if (hex2long(&ptr, &addr)) {
+				regs->std.pc = addr;
+			} /* if */
+			DBG(DBG_SINGLE_STEP, ("kgdb: continue/step (%c) at %lx\n",
+					      remcomInBuffer[0], regs->std.pc));
+			if (remcomInBuffer[0] == 's' && !set_breakpoint(regs)) {
+				strcpy(remcomOutBuffer, "E03");
+				break;
+			}
+			/*
+			 * Need to flush the instruction cache here,
+			 * as we may have deposited a breakpoint, and
+			 * the icache has no way of knowing that a
+			 * data ref to some location may have changed
+			 * something that is in the instruction cache.
+			 */
+			imb();
+			return;
+
+		      case 'k':	/* kill the program */
+			break;
+
+		      case 'r':	/* reset */
+			halt();
+			break;
+
+		      case 'q':	/* general query request */
+			if (strcmp (&remcomInBuffer[1], "Offsets") == 0) {
+#if 0
+				/*
+				 * This is how qOffsets is supposed to
+				 * work.  However, it just doesn't
+				 * work.  It maybe because OSF/1 uses
+				 * ecoff (see comments in remote.c).
+				 *
+				 * It doesn't seem to be very useful
+				 * anyways.
+				 */
+				extern void _ftext(), _fdata(), _fbss();
+
+				sprintf(remcomOutBuffer,
+					"Text=%lx;Data=%lx;Bss=%lx",
+					(long)_ftext/2, (long)_fdata/2,
+					(long)_fbss/2);
+#endif
+			} else {
+				sprintf(remcomOutBuffer,
+					"E04, Unknown query %s",
+					&remcomInBuffer[1]);
+			}
+			break;
+
+		      default:
+			printk("kgdb: handle_exception: unknown command `%c'\n",
+			       remcomInBuffer[0]);
+			break;
+		}
+
+		/* reply to the request */
+		putpacket(remcomOutBuffer);
+	}
+}
+
+
+/*
+ * This function will generate a breakpoint exception.  It is used at
+ * the beginning of a program to sync up with a debugger and can be
+ * used otherwise as a quick means to stop program execution and
+ * "break" into the debugger.
+ */
+void kgdb_breakpoint(void)
+{
+	if (!initialized) {
+		return;
+	}
+	asm volatile("call_pal %0" :: "i"(PAL_bpt));
+}
+
+
+void kgdb_enter (void)
+{
+	printk("\nkgdb: waiting for gdb to connect...\n");
+	kgdb_breakpoint();
+}
+
+
+void kgdb_init (void)
+{
+	initialized = 1;
+	initDebugIO();
+
+	kgdb_enter();
+}
+
+#endif /* !CONFIG_KGDB */
diff -u --recursive --new-file 386/arch/alpha/kernel/lca.c linux/arch/alpha/kernel/lca.c
--- 386/arch/alpha/kernel/lca.c	Wed Oct 11 03:20:50 1995
+++ linux/arch/alpha/kernel/lca.c	Mon Oct  9 00:37:50 1995
@@ -359,21 +359,6 @@
 		printk("    esr: %lx  ear: %lx\n", el.s->esr, el.s->ear);
 		printk("    dc_stat: %lx  ioc_stat0: %lx  ioc_stat1: %lx\n",
 		       el.s->dc_stat, el.s->ioc_stat0, el.s->ioc_stat1);
-		if (el.c->retry &&
-		    (el.s->esr & (ESR_EAV|ESR_CEE|ESR_UEE|ESR_NXM)) == (ESR_EAV|ESR_CEE))
-		{
-			unsigned long addr, val;
-
-			/* temporarily disable processor/system correctable error logging: */
-			wrmces(0x18);
-			addr = el.s->ear & ~ (0x7<<29 | 0x7);
-			addr += IDENT_ADDR;
-			printk("  correcting quadword at address %lx\n", addr);
-			val = *(volatile long *)addr;
-			*(volatile long *)addr = val;
-			/* reenable all machine checks: */
-			wrmces(0x00);
-		}
 		break;
 
 	      case sizeof(struct el_lca_mcheck_long):
diff -u --recursive --new-file 386/drivers/char/console.c linux/drivers/char/console.c
--- 386/drivers/char/console.c	Wed Oct 11 03:20:57 1995
+++ linux/drivers/char/console.c	Mon Oct 16 00:33:29 1995
@@ -3,7 +3,6 @@
  *
  *  Copyright (C) 1991, 1992  Linus Torvalds
  */
-
 /*
  *	console.c
  *
@@ -316,6 +315,123 @@
 #define vcmode		(vt_cons[currcons]->vc_mode)
 #define structsize	(sizeof(struct vc_data) + sizeof(struct vt_struct))
 
+
+#define CONFIG_SERIAL_ECHO
+#ifdef CONFIG_SERIAL_ECHO
+
+#include <linux/serial_reg.h>
+
+extern int serial_echo_init (int base);
+extern int serial_echo_print (const char *s);
+
+/*
+ * this defines the address for the port to which printk echoing is done
+ *  when CONFIG_SERIAL_ECHO is defined
+ */
+#define SERIAL_ECHO_PORT	0x3f8	/* COM1 */
+
+static int serial_echo_port = 0;
+
+#define serial_echo_outb(v,a) outb((v),(a)+serial_echo_port)
+#define serial_echo_inb(a)    inb((a)+serial_echo_port)
+
+#define BOTH_EMPTY (UART_LSR_TEMT | UART_LSR_THRE)
+
+/* Wait for transmitter & holding register to empty */
+#define WAIT_FOR_XMITR \
+ do { \
+       lsr = serial_echo_inb(UART_LSR); \
+ } while ((lsr & BOTH_EMPTY) != BOTH_EMPTY)
+
+/* These two functions abstract the actual communications with the
+ * debug port.	This is so we can change the underlying communications
+ * mechanism without modifying the rest of the code.
+ */
+int
+serial_echo_print(const char *s)
+{
+	int     lsr, ier;
+	int     i;
+
+	if (!serial_echo_port) return (0);
+
+	/*
+	 * First save the IER then disable the interrupts
+	 */
+	ier = serial_echo_inb(UART_IER);
+	serial_echo_outb(0x00, UART_IER);
+
+	/*
+	 * Now, do each character
+	 */
+	for (i = 0; *s; i++, s++) {
+		WAIT_FOR_XMITR;
+
+		/* Send the character out. */
+		serial_echo_outb(*s, UART_TX);
+
+		/* if a LF, also do CR... */
+		if (*s == 10) {
+			WAIT_FOR_XMITR;
+			serial_echo_outb(13, UART_TX);
+		}
+	}
+
+	/*
+	 * Finally, Wait for transmitter & holding register to empty
+	 *  and restore the IER
+	 */
+	do {
+		lsr = serial_echo_inb(UART_LSR);
+	} while ((lsr & BOTH_EMPTY) != BOTH_EMPTY);
+	serial_echo_outb(ier, UART_IER);
+
+	return (0);
+}
+
+
+int
+serial_echo_init(int base)
+{
+	int comstat, hi, lo;
+	
+	if (base != 0x2f8 && base != 0x3f8) {
+		serial_echo_port = 0;
+		return (0);
+	} else
+	  serial_echo_port = base;
+
+	/*
+	 * read the Divisor Latch
+	 */
+	comstat = serial_echo_inb(UART_LCR);
+	serial_echo_outb(comstat | UART_LCR_DLAB, UART_LCR);
+	hi = serial_echo_inb(UART_DLM);
+	lo = serial_echo_inb(UART_DLL);
+	serial_echo_outb(comstat, UART_LCR);
+
+	/*
+	 * now do hardwired init
+	 */
+	serial_echo_outb(0x03, UART_LCR); /* No parity, 8 data bits, 1 stop */
+	serial_echo_outb(0x83, UART_LCR); /* Access divisor latch */
+	serial_echo_outb(0x00, UART_DLM); /* 9600 baud */
+	serial_echo_outb(0x0c, UART_DLL);
+	serial_echo_outb(0x03, UART_LCR); /* Done with divisor */
+
+	/* Prior to disabling interrupts, read the LSR and RBR
+	 * registers
+	 */
+	comstat = serial_echo_inb(UART_LSR); /* COM? LSR */
+	comstat = serial_echo_inb(UART_RX);	/* COM? RBR */
+	serial_echo_outb(0x00, UART_IER); /* Disable all interrupts */
+
+	return(0);
+}
+
+#endif /* CONFIG_SERIAL_ECHO */
+
+
 static void memsetw(void * s, unsigned short c, unsigned int count)
 {
 	unsigned short * addr = (unsigned short *) s;
@@ -1909,6 +2025,10 @@
 	unsigned char c;
 	static int printing = 0;
 
+#ifdef CONFIG_SERIAL_ECHO
+	serial_echo_print(b);
+#endif /* CONFIG_SERIAL_ECHO */
+
 	if (!printable || printing)
 		return;	 /* console not yet initialized */
 	printing = 1;
@@ -2175,6 +2295,10 @@
 		default_font_height = video_font_height = ORIG_VIDEO_POINTS;
 		/* This may be suboptimal but is a safe bet - go with it */
 		video_scan_lines = video_font_height * video_num_lines;
+
+#ifdef CONFIG_SERIAL_ECHO
+		serial_echo_init(SERIAL_ECHO_PORT);
+#endif /* CONFIG_SERIAL_ECHO */
 
 		printk("Console: %ld point font, %ld scans\n",
 		       video_font_height, video_scan_lines);
diff -u --recursive --new-file 386/drivers/char/serial.c linux/drivers/char/serial.c
--- 386/drivers/char/serial.c	Wed Oct 11 03:21:00 1995
+++ linux/drivers/char/serial.c	Wed Oct 11 03:20:20 1995
@@ -2668,6 +2668,16 @@
 			info->irq = 9;
 		if (!(info->flags & ASYNC_BOOT_AUTOCONF))
 			continue;
+#ifdef CONFIG_KGDB
+		{
+			extern int kgdb_enabled;
+
+			if (kgdb_enabled && i < 2) {
+				if (request_irq(4 - i, 0, 0, 0) == -EBUSY)
+					continue;
+			}
+		}
+#endif
 		autoconfig(info);
 		if (info->type == PORT_UNKNOWN)
 			continue;
diff -u --recursive --new-file 386/drivers/net/ppp.c linux/drivers/net/ppp.c
--- 386/drivers/net/ppp.c	Wed Oct 11 03:21:06 1995
+++ linux/drivers/net/ppp.c	Wed Oct 11 04:14:33 1995
@@ -3143,8 +3143,8 @@
  * Validate the tty linkage
  */
 	if (ppp->flags & SC_DEBUG)
-		printk (KERN_DEBUG "ppp_dev_xmit [%s]: skb %X\n",
-			dev->name, (int) skb);
+		printk (KERN_DEBUG "ppp_dev_xmit [%s]: skb %p\n",
+			dev->name, skb);
 /*
  * Validate the tty interface
  */
diff -u --recursive --new-file 386/include/asm-alpha/a.out.h linux/include/asm-alpha/a.out.h
--- 386/include/asm-alpha/a.out.h	Thu Jul 13 16:03:03 1995
+++ linux/include/asm-alpha/a.out.h	Fri Oct 13 21:40:54 1995
@@ -1,6 +1,8 @@
 #ifndef __ALPHA_A_OUT_H__
 #define __ALPHA_A_OUT_H__
 
+#include <linux/types.h>
+
 /*
  * OSF/1 ECOFF header structs.  ECOFF files consist of:
  * 	- a file header (struct filehdr),
diff -u --recursive --new-file 386/include/asm-alpha/io.h linux/include/asm-alpha/io.h
--- 386/include/asm-alpha/io.h	Thu Oct  5 00:39:37 1995
+++ linux/include/asm-alpha/io.h	Thu Oct 12 03:04:58 1995
@@ -61,6 +61,8 @@
  * accomodate things like XFree or svgalib that like to define their
  * own versions of inb etc.
  */
+extern void __sethae (unsigned long addr);	/* syscall */
+extern void _sethae (unsigned long addr);	/* cached version */
 extern unsigned int _inb (unsigned long port);
 extern unsigned int _inw (unsigned long port);
 extern unsigned int _inl (unsigned long port);
diff -u --recursive --new-file 386/include/asm-alpha/lca.h linux/include/asm-alpha/lca.h
--- 386/include/asm-alpha/lca.h	Sat Oct  7 04:55:51 1995
+++ linux/include/asm-alpha/lca.h	Mon Oct  9 00:45:07 1995
@@ -344,6 +344,7 @@
 	struct el_common	h;		/* common logout header */
 	unsigned long		pt[32];		/* PAL temps (pt[0] is reason) */
 	unsigned long		exc_addr;	/* exception address */
+	unsigned long		pad1[3];
 	unsigned long		pal_base;	/* PALcode base address */
 	unsigned long		hier;		/* hw interrupt enable */
 	unsigned long		hirr;		/* hw interrupt request */
diff -u --recursive --new-file 386/include/asm-alpha/system.h linux/include/asm-alpha/system.h
--- 386/include/asm-alpha/system.h	Sat Oct  7 04:55:51 1995
+++ linux/include/asm-alpha/system.h	Fri Oct 13 22:19:03 1995
@@ -97,6 +97,12 @@
 #define save_flags(flags)	do { flags = getipl(); } while (0)
 #define restore_flags(flags)	setipl(flags)
 
+/*
+ * Give prototypes to shut up gcc.
+ */
+extern inline unsigned long xchg_u32 (volatile int * m, unsigned long val);
+extern inline unsigned long xchg_u64 (volatile long * m, unsigned long val);
+
 extern inline unsigned long xchg_u32(volatile int * m, unsigned long val)
 {
 	unsigned long dummy, dummy2;
diff -u --recursive --new-file 386/include/linux/rpcsock.h linux/include/linux/rpcsock.h
--- 386/include/linux/rpcsock.h	Sat Oct  7 04:55:51 1995
+++ linux/include/linux/rpcsock.h	Sun Oct  8 22:50:10 1995
@@ -31,7 +31,7 @@
 	int			*buf;
 	int			len;
 	char			gotit;
-	u32			xid;
+	__u32			xid;
 };
 
 struct rpc_sock {
diff -u --recursive --new-file 386/init/main.c linux/init/main.c
--- 386/init/main.c	Fri Oct 13 21:28:22 1995
+++ linux/init/main.c	Fri Oct 13 21:28:02 1995
@@ -127,6 +127,14 @@
 static char * argv[] = { "-/bin/sh",NULL };
 static char * envp[] = { "HOME=/usr/root", "TERM=linux", NULL };
 
+#ifdef CONFIG_KGDB
+
+int kgdb_enabled = 0;
+
+extern void kgdb_init(void);
+
+#endif /* CONFIG_KGDB */
+
 char *get_options(char *str, int *ints)
 {
 	char *cur = str;
@@ -396,6 +404,12 @@
 			console_loglevel = 10;
 			continue;
 		}
+#ifdef CONFIG_KGDB
+		if (!strcmp(line,"kgdb")) {
+			kgdb_enabled = 1;
+			continue;
+		}
+#endif
 		if (checksetup(line))
 			continue;
 		/*
@@ -514,6 +528,11 @@
 		memory_start += prof_len * sizeof(unsigned long);
 	}
 	memory_start = console_init(memory_start,memory_end);
+#ifdef CONFIG_KGDB
+	if (kgdb_enabled) {
+		kgdb_init();
+	}
+#endif
 #ifdef CONFIG_PCI
 	memory_start = pci_init(memory_start,memory_end);
 #endif
diff -u --recursive --new-file 386/mkfloppy linux/mkfloppy
--- 386/mkfloppy	Thu Jan  1 00:00:00 1970
+++ linux/mkfloppy	Mon Aug 14 04:02:47 1995
@@ -0,0 +1,4 @@
+#!/bin/sh
+cat arch/alpha/boot/tools/lxboot arch/alpha/boot/tools/bootlx \
+    arch/alpha/boot/vmlinux | dd of=/dev/fd0
+eject
