diff -u -r -N linux-2.2.4/arch/i386/kernel/entry.S linux/arch/i386/kernel/entry.S
--- linux-2.2.4/arch/i386/kernel/entry.S	Wed Jan 20 13:05:59 1999
+++ linux/arch/i386/kernel/entry.S	Fri Mar 26 08:35:41 1999
@@ -214,8 +214,11 @@
 	movl $-ENOSYS,EAX(%esp)
 	call SYMBOL_NAME(syscall_trace)
 	movl ORIG_EAX(%esp),%eax
+	cmpl $(NR_syscalls),%eax	# ORIG_EAX may have changed
+	jae tracesys_exit
 	call *SYMBOL_NAME(sys_call_table)(,%eax,4)
 	movl %eax,EAX(%esp)		# save the return value
+tracesys_exit:
 	call SYMBOL_NAME(syscall_trace)
 	jmp ret_from_sys_call
 badsys:
diff -u -r -N linux-2.2.4/arch/i386/kernel/ptrace.c linux/arch/i386/kernel/ptrace.c
--- linux-2.2.4/arch/i386/kernel/ptrace.c	Wed Mar 10 18:51:34 1999
+++ linux/arch/i386/kernel/ptrace.c	Fri Mar 26 08:39:45 1999
@@ -290,7 +290,10 @@
 {
 	switch (regno >> 2) {
 		case ORIG_EAX:
-			return -EIO;
+			/* no negative numbers because irqs use them -- mec */
+			if ( ((long) value) < 0 )
+			    return -EIO;
+			break;
 		case FS:
 			if (value && (value & 3) != 3)
 				return -EIO;
@@ -608,7 +611,12 @@
 			for ( i = 0; i < 17*sizeof(long); i += sizeof(long) )
 			  {
 			    __get_user(tmp, (unsigned long *) data);
-			    putreg(child, i, tmp);
+			    /* paranoid compatibility wart.
+			     * probably harmless to set ORIG_EAX,
+			     * but I don't want to risk breaking gdb
+			     * during 2.2.X series.  -- mec */
+			    if ( i != ORIG_EAX * sizeof(long) )
+				putreg(child, i, tmp);
 			    data += sizeof(long);
 			  }
 			ret = 0;


