S390 updates
diff --git a/ChangeLog b/ChangeLog
index b500f1f..ad05d36 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2000-02-14 Wichert Akkerman <wakkerma@debian.org>
+
+  * S390 updates
+
 2000-02-03 Wichert Akkerman <wakkerma@debian.org>
 
   * Merge Trillian (ia64) patches
diff --git a/NEWS b/NEWS
index ce6bd0d..5ef1b9c 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,7 @@
+Changes in 4.3
+==============
+* Linux/ia64 port added
+
 Changes in 4.2
 ==============
 * Compiles on glibc2.0 systems again
diff --git a/TODO b/TODO
index a8e7093..167ba38 100644
--- a/TODO
+++ b/TODO
@@ -1,11 +1,10 @@
 -- new entries from wta
 clone doesn't work; cloned processes can hang
-replace printargs with something that reads a configuration-file
--> rescheduled for strace rewrite
+- partially done: finish up change_syscall using new setargs
+- do setargs for non-ia64
 rename functions that are used for general things:
   sys_chdir -> general_1stringarg
 generate syscallent.h from the kernel sources
-add IPv6 support
 
 
 -- old entries from jrs
diff --git a/acconfig.h b/acconfig.h
index c163409..0adf548 100644
--- a/acconfig.h
+++ b/acconfig.h
@@ -30,12 +30,15 @@
 /* Define if this is an alpha architecture.  */
 #undef ALPHA
 
-/* Define if this is a arm architecture.  */
+/* Define if this is an arm architecture.  */
 #undef ARM
 
-/* Define if this is an powerpc architecture.  */
+/* Define if this is a powerpc architecture.  */
 #undef POWERPC
 
+/* Define if this is a S390 architecture.  */
+#undef S390
+
 /* Define if you have a SVR4 MP type procfs.  I.E. /dev/xxx/ctl,
    /dev/xxx/status.  Also implies that you have the pr_lwp
    member in prstatus. */
diff --git a/mem.c b/mem.c
index 2a1721b..451f239 100644
--- a/mem.c
+++ b/mem.c
@@ -170,9 +170,9 @@
 struct tcb *tcp;
 {
     long u_arg[6];
-    int i, v;
 
 #if	defined(IA64)
+    int i, v;
     /*
      *  IA64 processes never call this routine, they only use the
      *  new `sys_mmap' interface.  This code converts the integer
diff --git a/process.c b/process.c
index 5c8e1fa..514ef6c 100644
--- a/process.c
+++ b/process.c
@@ -405,6 +405,14 @@
 			return -1;
 
 	}
+#elif defined(I386)
+	{
+		/* TODO: finish this */
+		errno=0;
+//		ptrace(PTRACE_POKEDATA, tcp->pid, , tcp->u_arg[argnum]);
+		if (errno)
+			return -1;
+	}
 #else
 # error Sorry, not done yet.
 #endif
@@ -1841,10 +1849,7 @@
 	{ 4*PT_PC,		"4*PT_PC"				},
 #endif /* M68K */
 #endif /* !I386 */
-#ifdef S390
-	{ uoff(u_fpvalid),	"offsetof(struct user, u_fpvalid)"	},
-#endif
-#ifndef MIPS
+#if !defined(S390) && !defined(MIPS)
 	{ uoff(u_fpvalid),	"offsetof(struct user, u_fpvalid)"	},
 #endif
 #ifdef I386
@@ -1860,7 +1865,7 @@
 	{ uoff(start_code),	"offsetof(struct user, start_code)"	},
 	{ uoff(start_stack),	"offsetof(struct user, start_stack)"	},
 	{ uoff(signal),		"offsetof(struct user, signal)"		},
-#ifndef MIPS
+#if !defined(S390) && !defined(MIPS)
 	{ uoff(reserved),	"offsetof(struct user, reserved)"	},
 #endif
 	{ uoff(u_ar0),		"offsetof(struct user, u_ar0)"		},
diff --git a/syscall.c b/syscall.c
index 225c7b5..ce0ee30 100644
--- a/syscall.c
+++ b/syscall.c
@@ -840,6 +840,14 @@
 			fprintf(stderr, "stray syscall exit: eax = %ld\n", eax);
 		return 0;
 	}
+#elif defined (S390)
+	if (upeek(pid, PT_GPR2, &gpr2) < 0)
+		return -1;
+	if (gpr2 != -ENOSYS && !(tcp->flags & TCB_INSYSCALL)) {
+		if (debug)
+			fprintf(stderr, "stray syscall exit: gpr2 = %ld\n", gpr2);
+		return 0;
+	}
 #elif defined (POWERPC)
 # define SO_MASK 0x10000000
 	if (upeek(pid, 4*PT_CCR, &flags) < 0)
@@ -876,6 +884,16 @@
 {
 	int u_error = 0;
 #ifdef LINUX
+#ifdef S390
+		if (gpr2 && (unsigned) -gpr2 < nerrnos) {
+			tcp->u_rval = -1;
+			u_error = -gpr2;
+		}
+		else {
+			tcp->u_rval = gpr2;
+			u_error = 0;
+		}
+#else /* !S390 */
 #ifdef I386
 		if (eax < 0 && -eax < nerrnos) {
 			tcp->u_rval = -1;
@@ -975,6 +993,7 @@
 #endif /* MIPS */
 #endif /* IA64 */
 #endif /* I386 */
+#endif /* S390 */
 #endif /* LINUX */
 #ifdef SUNOS4
 		/* get error code from user struct */
@@ -1349,7 +1368,7 @@
 		decode_subcall(tcp, SYS_ipc_subcall,
 			SYS_ipc_nsubcalls, shift_style);
 		break;
-#endif /* !ALPHA && !SPARC */
+#endif /* !ALPHA && !IA64 && !MIPS && !SPARC */
 #ifdef SPARC
 	case SYS_socketcall:
 		sparc_socket_decode (tcp);