
From: Martin Schwidefsky <schwidefsky@de.ibm.com>

s390 core changes:
 - Fix return type of some system call functions (long vs. int).
 - Fix prototypes for compat system call handlers.
 - Correct some bugs in the compat system call wrappers.
 - Fix broken pointer arithmetic which causes problems with
   gcc 3.4 and -march=z990
 - Remove unnecessary #ifndef & optimize inline assemblies in spinlock.h.
 - Improve handling of deferred condition code 1.
 - New default configuration.


---

 25-akpm/arch/s390/defconfig               |   31 ++++++++---
 25-akpm/arch/s390/kernel/compat_linux.c   |   84 +++++++++++++++---------------
 25-akpm/arch/s390/kernel/compat_signal.c  |    4 -
 25-akpm/arch/s390/kernel/compat_wrapper.S |   33 +++++------
 25-akpm/arch/s390/kernel/process.c        |    8 +-
 25-akpm/arch/s390/kernel/ptrace.c         |    2 
 25-akpm/arch/s390/kernel/setup.c          |   12 ++--
 25-akpm/arch/s390/kernel/sys_s390.c       |   22 ++-----
 25-akpm/drivers/s390/cio/device_fsm.c     |    8 ++
 25-akpm/include/asm-s390/spinlock.h       |   18 +-----
 25-akpm/include/asm-s390/unistd.h         |   19 ++----
 11 files changed, 122 insertions(+), 119 deletions(-)

diff -puN arch/s390/defconfig~s390-core arch/s390/defconfig
--- 25/arch/s390/defconfig~s390-core	2004-03-26 12:15:55.284244256 -0800
+++ 25-akpm/arch/s390/defconfig	2004-03-26 12:15:55.302241520 -0800
@@ -21,9 +21,11 @@ CONFIG_SYSVIPC=y
 # CONFIG_BSD_PROCESS_ACCT is not set
 CONFIG_SYSCTL=y
 CONFIG_LOG_BUF_SHIFT=17
-# CONFIG_IKCONFIG is not set
+CONFIG_HOTPLUG=y
+CONFIG_IKCONFIG=y
+CONFIG_IKCONFIG_PROC=y
 # CONFIG_EMBEDDED is not set
-# CONFIG_KALLSYMS is not set
+CONFIG_KALLSYMS=y
 CONFIG_FUTEX=y
 CONFIG_EPOLL=y
 CONFIG_IOSCHED_NOOP=y
@@ -84,6 +86,7 @@ CONFIG_PFAULT=y
 # Generic Driver Options
 #
 # CONFIG_FW_LOADER is not set
+# CONFIG_DEBUG_DRIVER is not set
 
 #
 # SCSI device support
@@ -110,6 +113,12 @@ CONFIG_SCSI_CONSTANTS=y
 CONFIG_SCSI_LOGGING=y
 
 #
+# SCSI Transport Attributes
+#
+# CONFIG_SCSI_SPI_ATTRS is not set
+# CONFIG_SCSI_FC_ATTRS is not set
+
+#
 # SCSI low-level drivers
 #
 # CONFIG_SCSI_AIC7XXX_OLD is not set
@@ -185,7 +194,6 @@ CONFIG_S390_TAPE_BLOCK=y
 # S/390 tape hardware support
 #
 CONFIG_S390_TAPE_34XX=m
-CONFIG_HOTPLUG=y
 
 #
 # Networking support
@@ -199,7 +207,7 @@ CONFIG_PACKET=y
 # CONFIG_PACKET_MMAP is not set
 # CONFIG_NETLINK_DEV is not set
 CONFIG_UNIX=y
-# CONFIG_NET_KEY is not set
+CONFIG_NET_KEY=y
 CONFIG_INET=y
 CONFIG_IP_MULTICAST=y
 # CONFIG_IP_ADVANCED_ROUTER is not set
@@ -208,7 +216,6 @@ CONFIG_IP_MULTICAST=y
 # CONFIG_NET_IPGRE is not set
 # CONFIG_IP_MROUTE is not set
 # CONFIG_ARPD is not set
-# CONFIG_INET_ECN is not set
 # CONFIG_SYN_COOKIES is not set
 # CONFIG_INET_AH is not set
 # CONFIG_INET_ESP is not set
@@ -222,11 +229,12 @@ CONFIG_IPV6=y
 # CONFIG_DECNET is not set
 # CONFIG_BRIDGE is not set
 # CONFIG_NETFILTER is not set
+CONFIG_XFRM=y
+# CONFIG_XFRM_USER is not set
 
 #
 # SCTP Configuration (EXPERIMENTAL)
 #
-CONFIG_IPV6_SCTP__=y
 # CONFIG_IP_SCTP is not set
 # CONFIG_ATM is not set
 # CONFIG_VLAN_8021Q is not set
@@ -247,6 +255,7 @@ CONFIG_IPV6_SCTP__=y
 CONFIG_NET_SCHED=y
 CONFIG_NET_SCH_CBQ=m
 # CONFIG_NET_SCH_HTB is not set
+# CONFIG_NET_SCH_HFSC is not set
 CONFIG_NET_SCH_CSZ=m
 CONFIG_NET_SCH_PRIO=m
 CONFIG_NET_SCH_RED=m
@@ -255,6 +264,7 @@ CONFIG_NET_SCH_TEQL=m
 CONFIG_NET_SCH_TBF=m
 CONFIG_NET_SCH_GRED=m
 CONFIG_NET_SCH_DSMARK=m
+# CONFIG_NET_SCH_DELAY is not set
 CONFIG_NET_QOS=y
 CONFIG_NET_ESTIMATOR=y
 CONFIG_NET_CLS=y
@@ -303,6 +313,7 @@ CONFIG_NET_ETHERNET=y
 #
 # CONFIG_TR is not set
 # CONFIG_SHAPER is not set
+# CONFIG_NETCONSOLE is not set
 
 #
 # Wan interfaces
@@ -340,6 +351,8 @@ CONFIG_CCWGROUP=y
 # Bluetooth support
 #
 # CONFIG_BT is not set
+# CONFIG_NETPOLL is not set
+# CONFIG_NET_POLL_CONTROLLER is not set
 
 #
 # File systems
@@ -380,7 +393,6 @@ CONFIG_FS_MBCACHE=y
 CONFIG_PROC_FS=y
 CONFIG_PROC_KCORE=y
 # CONFIG_DEVFS_FS is not set
-CONFIG_DEVPTS_FS=y
 # CONFIG_DEVPTS_FS_XATTR is not set
 CONFIG_TMPFS=y
 # CONFIG_HUGETLB_PAGE is not set
@@ -392,6 +404,7 @@ CONFIG_RAMFS=y
 # CONFIG_ADFS_FS is not set
 # CONFIG_AFFS_FS is not set
 # CONFIG_HFS_FS is not set
+# CONFIG_HFSPLUS_FS is not set
 # CONFIG_BEFS_FS is not set
 # CONFIG_BFS_FS is not set
 # CONFIG_EFS_FS is not set
@@ -417,7 +430,7 @@ CONFIG_LOCKD=y
 CONFIG_LOCKD_V4=y
 CONFIG_EXPORTFS=y
 CONFIG_SUNRPC=y
-# CONFIG_SUNRPC_GSS is not set
+# CONFIG_RPCSEC_GSS_KRB5 is not set
 # CONFIG_SMB_FS is not set
 # CONFIG_CIFS is not set
 # CONFIG_NCP_FS is not set
@@ -484,7 +497,9 @@ CONFIG_CRYPTO=y
 # CONFIG_CRYPTO_AES is not set
 # CONFIG_CRYPTO_CAST5 is not set
 # CONFIG_CRYPTO_CAST6 is not set
+# CONFIG_CRYPTO_ARC4 is not set
 # CONFIG_CRYPTO_DEFLATE is not set
+# CONFIG_CRYPTO_MICHAEL_MIC is not set
 # CONFIG_CRYPTO_TEST is not set
 
 #
diff -puN arch/s390/kernel/compat_linux.c~s390-core arch/s390/kernel/compat_linux.c
--- 25/arch/s390/kernel/compat_linux.c~s390-core	2004-03-26 12:15:55.286243952 -0800
+++ 25-akpm/arch/s390/kernel/compat_linux.c	2004-03-26 12:15:55.306240912 -0800
@@ -298,7 +298,7 @@ static inline long put_tv32(struct compa
  *
  * This is really horribly ugly.
  */
-asmlinkage int sys32_ipc (u32 call, int first, int second, int third, u32 ptr)
+asmlinkage long sys32_ipc(u32 call, int first, int second, int third, u32 ptr)
 {
 	if(call >> 16) /* hack for backward compatibility */
 		return -EINVAL;
@@ -360,7 +360,7 @@ asmlinkage int sys32_ipc (u32 call, int 
 	return -EINVAL;
 }
 
-asmlinkage int sys32_truncate64(const char * path, unsigned long high, unsigned long low)
+asmlinkage long sys32_truncate64(const char * path, unsigned long high, unsigned long low)
 {
 	if ((int)high < 0)
 		return -EINVAL;
@@ -368,7 +368,7 @@ asmlinkage int sys32_truncate64(const ch
 		return sys_truncate(path, (high << 32) | low);
 }
 
-asmlinkage int sys32_ftruncate64(unsigned int fd, unsigned long high, unsigned long low)
+asmlinkage long sys32_ftruncate64(unsigned int fd, unsigned long high, unsigned long low)
 {
 	if ((int)high < 0)
 		return -EINVAL;
@@ -479,7 +479,7 @@ out:
 	return retval;
 }
 
-asmlinkage long sys32_readv(int fd, struct compat_iovec *vector, u32 count)
+asmlinkage long sys32_readv(int fd, struct compat_iovec *vector, unsigned long count)
 {
 	struct file *file;
 	long ret = -EBADF;
@@ -497,7 +497,7 @@ bad_file:
 	return ret;
 }
 
-asmlinkage long sys32_writev(int fd, struct compat_iovec *vector, u32 count)
+asmlinkage long sys32_writev(int fd, struct compat_iovec *vector, unsigned long count)
 {
 	struct file *file;
 	int ret = -EBADF;
@@ -549,7 +549,7 @@ static int fillonedir(void * __buf, cons
 	return 0;
 }
 
-asmlinkage int old32_readdir(unsigned int fd, struct old_linux_dirent32 *dirent, unsigned int count)
+asmlinkage long old32_readdir(unsigned int fd, struct old_linux_dirent32 *dirent, unsigned int count)
 {
 	int error = -EBADF;
 	struct file * file;
@@ -611,7 +611,7 @@ static int filldir(void * __buf, const c
 	return 0;
 }
 
-asmlinkage int sys32_getdents(unsigned int fd, struct linux_dirent32 *dirent, unsigned int count)
+asmlinkage long sys32_getdents(unsigned int fd, struct linux_dirent32 *dirent, unsigned int count)
 {
 	struct file * file;
 	struct linux_dirent32 * lastdirent;
@@ -706,10 +706,10 @@ set_fd_set32(unsigned long n, u32 *ufdse
 #define MAX_SELECT_SECONDS \
 	((unsigned long) (MAX_SCHEDULE_TIMEOUT / HZ)-1)
 
-asmlinkage int sys32_select(int n, u32 *inp, u32 *outp, u32 *exp, u32 tvp_x)
+asmlinkage long sys32_select(int n, u32 *inp, u32 *outp, u32 *exp,
+				struct compat_timeval *tvp)
 {
 	fd_set_bits fds;
-	struct compat_timeval *tvp = (struct compat_timeval *)AA(tvp_x);
 	char *bits;
 	unsigned long nn;
 	long timeout;
@@ -914,7 +914,7 @@ static int copy_mount_stuff_to_kernel(co
 #define SMBFS_NAME	"smbfs"
 #define NCPFS_NAME	"ncpfs"
 
-asmlinkage int sys32_mount(char *dev_name, char *dir_name, char *type, unsigned long new_flags, u32 data)
+asmlinkage long sys32_mount(char *dev_name, char *dir_name, char *type, unsigned long new_flags, void *data)
 {
 	unsigned long type_page = 0;
 	unsigned long data_page = 0;
@@ -936,7 +936,7 @@ asmlinkage int sys32_mount(char *dev_nam
 	is_smb = !strcmp((char *)type_page, SMBFS_NAME);
 	is_ncp = !strcmp((char *)type_page, NCPFS_NAME);
 
-	err = copy_mount_stuff_to_kernel((const void *)AA(data), &data_page);
+	err = copy_mount_stuff_to_kernel(data, &data_page);
 	if (err)
 		goto type_out;
 
@@ -996,7 +996,7 @@ struct sysinfo32 {
         char _f[8];
 };
 
-asmlinkage int sys32_sysinfo(struct sysinfo32 __user *info)
+asmlinkage long sys32_sysinfo(struct sysinfo32 __user *info)
 {
 	struct sysinfo s;
 	int ret, err;
@@ -1024,7 +1024,7 @@ asmlinkage int sys32_sysinfo(struct sysi
 	return ret;
 }
 
-asmlinkage int sys32_sched_rr_get_interval(compat_pid_t pid,
+asmlinkage long sys32_sched_rr_get_interval(compat_pid_t pid,
 				struct compat_timespec __user *interval)
 {
 	struct timespec t;
@@ -1039,8 +1039,8 @@ asmlinkage int sys32_sched_rr_get_interv
 	return ret;
 }
 
-asmlinkage int sys32_rt_sigprocmask(int how, compat_sigset_t __user *set,
-			compat_sigset_t __user *oset, compat_size_t sigsetsize)
+asmlinkage long sys32_rt_sigprocmask(int how, compat_sigset_t __user *set,
+			compat_sigset_t __user *oset, size_t sigsetsize)
 {
 	sigset_t s;
 	compat_sigset_t s32;
@@ -1074,8 +1074,8 @@ asmlinkage int sys32_rt_sigprocmask(int 
 	return 0;
 }
 
-asmlinkage int sys32_rt_sigpending(compat_sigset_t __user *set,
-				compat_size_t sigsetsize)
+asmlinkage long sys32_rt_sigpending(compat_sigset_t __user *set,
+				size_t sigsetsize)
 {
 	sigset_t s;
 	compat_sigset_t s32;
@@ -1101,9 +1101,9 @@ asmlinkage int sys32_rt_sigpending(compa
 extern int
 copy_siginfo_to_user32(siginfo_t32 *to, siginfo_t *from);
 
-asmlinkage int
+asmlinkage long
 sys32_rt_sigtimedwait(compat_sigset_t *uthese, siginfo_t32 *uinfo,
-		      struct compat_timespec *uts, compat_size_t sigsetsize)
+		      struct compat_timespec *uts, size_t sigsetsize)
 {
 	int ret, sig;
 	sigset_t these;
@@ -1182,7 +1182,7 @@ sys32_rt_sigtimedwait(compat_sigset_t *u
 	return ret;
 }
 
-asmlinkage int
+asmlinkage long
 sys32_rt_sigqueueinfo(int pid, int sig, siginfo_t32 __user *uinfo)
 {
 	siginfo_t info;
@@ -1384,7 +1384,7 @@ out_file:
  * sys32_execve() executes a new program after the asm stub has set
  * things up for us.  This should basically do what I want it to.
  */
-asmlinkage int
+asmlinkage long
 sys32_execve(struct pt_regs regs)
 {
         int error;
@@ -1412,14 +1412,14 @@ out:
 
 #ifdef CONFIG_MODULES
 
-asmlinkage int
+asmlinkage long
 sys32_init_module(void __user *umod, unsigned long len,
 		const char __user *uargs)
 {
 	return sys_init_module(umod, len, uargs);
 }
 
-asmlinkage int
+asmlinkage long
 sys32_delete_module(const char __user *name_user, unsigned int flags)
 {
 	return sys_delete_module(name_user, flags);
@@ -1427,14 +1427,14 @@ sys32_delete_module(const char __user *n
 
 #else /* CONFIG_MODULES */
 
-asmlinkage int
+asmlinkage long
 sys32_init_module(void __user *umod, unsigned long len,
 		const char __user *uargs)
 {
 	return -ENOSYS;
 }
 
-asmlinkage int
+asmlinkage long
 sys32_delete_module(const char __user *name_user, unsigned int flags)
 {
 	return -ENOSYS;
@@ -1599,7 +1599,7 @@ static int nfs_getfh32_res_trans(union n
 	return copy_to_user(res32, kres, sizeof(*res32)) ? -EFAULT : 0;
 }
 
-int asmlinkage sys32_nfsservctl(int cmd, struct nfsctl_arg32 *arg32, union nfsctl_res32 *res32)
+long asmlinkage sys32_nfsservctl(int cmd, struct nfsctl_arg32 *arg32, union nfsctl_res32 *res32)
 {
 	struct nfsctl_arg *karg = NULL;
 	union nfsctl_res *kres = NULL;
@@ -1667,7 +1667,7 @@ done:
 
 extern struct timezone sys_tz;
 
-asmlinkage int sys32_gettimeofday(struct compat_timeval *tv, struct timezone *tz)
+asmlinkage long sys32_gettimeofday(struct compat_timeval *tv, struct timezone *tz)
 {
 	if (tv) {
 		struct timeval ktv;
@@ -1696,7 +1696,7 @@ static inline long get_ts32(struct times
 	return 0;
 }
 
-asmlinkage int sys32_settimeofday(struct compat_timeval *tv, struct timezone *tz)
+asmlinkage long sys32_settimeofday(struct compat_timeval *tv, struct timezone *tz)
 {
 	struct timespec kts;
 	struct timezone ktz;
@@ -1714,23 +1714,23 @@ asmlinkage int sys32_settimeofday(struct
 }
 
 /* These are here just in case some old sparc32 binary calls it. */
-asmlinkage int sys32_pause(void)
+asmlinkage long sys32_pause(void)
 {
 	current->state = TASK_INTERRUPTIBLE;
 	schedule();
 	return -ERESTARTNOHAND;
 }
 
-asmlinkage compat_ssize_t sys32_pread64(unsigned int fd, char *ubuf,
-				 compat_size_t count, u32 poshi, u32 poslo)
+asmlinkage long sys32_pread64(unsigned int fd, char *ubuf,
+				size_t count, u32 poshi, u32 poslo)
 {
 	if ((compat_ssize_t) count < 0)
 		return -EINVAL;
 	return sys_pread64(fd, ubuf, count, ((loff_t)AA(poshi) << 32) | AA(poslo));
 }
 
-asmlinkage compat_ssize_t sys32_pwrite64(unsigned int fd, char *ubuf,
-				  compat_size_t count, u32 poshi, u32 poslo)
+asmlinkage long sys32_pwrite64(unsigned int fd, const char *ubuf,
+				size_t count, u32 poshi, u32 poslo)
 {
 	if ((compat_ssize_t) count < 0)
 		return -EINVAL;
@@ -1742,7 +1742,7 @@ asmlinkage compat_ssize_t sys32_readahea
 	return sys_readahead(fd, ((loff_t)AA(offhi) << 32) | AA(offlo), count);
 }
 
-asmlinkage int sys32_sendfile(int out_fd, int in_fd, compat_off_t *offset, s32 count)
+asmlinkage long sys32_sendfile(int out_fd, int in_fd, compat_off_t *offset, size_t count)
 {
 	mm_segment_t old_fs = get_fs();
 	int ret;
@@ -1761,7 +1761,7 @@ asmlinkage int sys32_sendfile(int out_fd
 	return ret;
 }
 
-asmlinkage int sys32_sendfile64(int out_fd, int in_fd, 
+asmlinkage long sys32_sendfile64(int out_fd, int in_fd,
 				compat_loff_t *offset, s32 count)
 {
 	mm_segment_t old_fs = get_fs();
@@ -1798,7 +1798,7 @@ struct timex32 {
 
 extern int do_adjtimex(struct timex *);
 
-asmlinkage int sys32_adjtimex(struct timex32 *utp)
+asmlinkage long sys32_adjtimex(struct timex32 *utp)
 {
 	struct timex txc;
 	int ret;
@@ -1951,7 +1951,7 @@ static int cp_stat64(struct stat64_emu31
 	return copy_to_user(ubuf,&tmp,sizeof(tmp)) ? -EFAULT : 0; 
 }
 
-asmlinkage long sys32_stat64(char * filename, struct stat64_emu31 * statbuf, long flags)
+asmlinkage long sys32_stat64(char * filename, struct stat64_emu31 * statbuf)
 {
 	struct kstat stat;
 	int ret = vfs_stat(filename, &stat);
@@ -1960,7 +1960,7 @@ asmlinkage long sys32_stat64(char * file
 	return ret;
 }
 
-asmlinkage long sys32_lstat64(char * filename, struct stat64_emu31 * statbuf, long flags)
+asmlinkage long sys32_lstat64(char * filename, struct stat64_emu31 * statbuf)
 {
 	struct kstat stat;
 	int ret = vfs_lstat(filename, &stat);
@@ -1969,7 +1969,7 @@ asmlinkage long sys32_lstat64(char * fil
 	return ret;
 }
 
-asmlinkage long sys32_fstat64(unsigned long fd, struct stat64_emu31 * statbuf, long flags)
+asmlinkage long sys32_fstat64(unsigned long fd, struct stat64_emu31 * statbuf)
 {
 	struct kstat stat;
 	int ret = vfs_fstat(fd, &stat);
@@ -2056,7 +2056,7 @@ out:
 	return error;
 }
 
-asmlinkage compat_ssize_t sys32_read(unsigned int fd, char * buf, size_t count)
+asmlinkage long sys32_read(unsigned int fd, char * buf, size_t count)
 {
 	if ((compat_ssize_t) count < 0)
 		return -EINVAL; 
@@ -2064,7 +2064,7 @@ asmlinkage compat_ssize_t sys32_read(uns
 	return sys_read(fd, buf, count);
 }
 
-asmlinkage compat_ssize_t sys32_write(unsigned int fd, char * buf, size_t count)
+asmlinkage long sys32_write(unsigned int fd, char * buf, size_t count)
 {
 	if ((compat_ssize_t) count < 0)
 		return -EINVAL; 
@@ -2072,7 +2072,7 @@ asmlinkage compat_ssize_t sys32_write(un
 	return sys_write(fd, buf, count);
 }
 
-asmlinkage int sys32_clone(struct pt_regs regs)
+asmlinkage long sys32_clone(struct pt_regs regs)
 {
         unsigned long clone_flags;
         unsigned long newsp;
diff -puN arch/s390/kernel/compat_signal.c~s390-core arch/s390/kernel/compat_signal.c
--- 25/arch/s390/kernel/compat_signal.c~s390-core	2004-03-26 12:15:55.288243648 -0800
+++ 25-akpm/arch/s390/kernel/compat_signal.c	2004-03-26 12:15:55.306240912 -0800
@@ -161,7 +161,7 @@ sys32_rt_sigsuspend(struct pt_regs * reg
         }
 }                                                         
 
-asmlinkage int
+asmlinkage long
 sys32_sigaction(int sig, const struct old_sigaction32 *act,
 		 struct old_sigaction32 *oact)
 {
@@ -254,7 +254,7 @@ sys32_rt_sigaction(int sig, const struct
 	return ret;
 }
 
-asmlinkage int
+asmlinkage long
 sys32_sigaltstack(const stack_t32 *uss, stack_t32 *uoss, struct pt_regs *regs)
 {
 	stack_t kss, koss;
diff -puN arch/s390/kernel/compat_wrapper.S~s390-core arch/s390/kernel/compat_wrapper.S
--- 25/arch/s390/kernel/compat_wrapper.S~s390-core	2004-03-26 12:15:55.290243344 -0800
+++ 25-akpm/arch/s390/kernel/compat_wrapper.S	2004-03-26 12:15:55.308240608 -0800
@@ -126,7 +126,7 @@ sys32_ptrace_wrapper:
 
 	.globl  sys32_alarm_wrapper 
 sys32_alarm_wrapper:
-	llgtr	%r2,%r2			# unsigned int
+	llgfr	%r2,%r2			# unsigned int
 	jg	sys_alarm		# branch to system call
 
 #sys32_pause_wrapper			# void 
@@ -203,7 +203,7 @@ sys32_setgid16_wrapper:
 	.globl sys32_signal_wrapper
 sys32_signal_wrapper:
 	lgfr	%r2,%r2			# int 
-	llgfr	%r3,%r3			# __sighandler_t 
+	llgtr	%r3,%r3			# __sighandler_t
 	jg	sys_signal
 
 #sys32_geteuid16_wrapper		# void 
@@ -243,7 +243,7 @@ sys32_setpgid_wrapper:
 
 	.globl  sys32_umask_wrapper 
 sys32_umask_wrapper:
-	lgfr	%r3,%r3			# int
+	lgfr	%r2,%r2			# int
 	jg	sys_umask		# branch to system call
 
 	.globl  sys32_chroot_wrapper 
@@ -273,6 +273,7 @@ sys32_dup2_wrapper:
 sys32_sigaction_wrapper:
 	lgfr	%r2,%r2			# int 
 	llgtr	%r3,%r3			# const struct old_sigaction *
+	llgtr	%r4,%r4			# struct old_sigaction32 *
 	jg	sys32_sigaction		# branch to system call
 
 	.globl  sys32_setreuid16_wrapper 
@@ -424,8 +425,8 @@ sys32_fchmod_wrapper:
 	.globl  sys32_fchown16_wrapper 
 sys32_fchown16_wrapper:
 	llgfr	%r2,%r2			# unsigned int
-	llgtr	%r3,%r3			# __kernel_old_uid_emu31_t *
-	llgtr	%r4,%r4			# __kernel_old_gid_emu31_t *
+	llgfr	%r3,%r3			# compat_uid_t
+	llgfr	%r4,%r4			# compat_uid_t
 	jg	sys32_fchown16		# branch to system call
 
 	.globl  sys32_getpriority_wrapper 
@@ -523,7 +524,7 @@ sys32_ipc_wrapper:
 	lgfr	%r3,%r3			# int
 	lgfr	%r4,%r4			# int
 	lgfr	%r5,%r5			# int
-	llgtr	%r6,%r6			# void *
+	llgfr	%r6,%r6			# u32
 	jg	sys32_ipc		# branch to system call
 
 	.globl  sys32_fsync_wrapper 
@@ -580,9 +581,9 @@ sys32_delete_module_wrapper:
 
 	.globl  sys32_quotactl_wrapper 
 sys32_quotactl_wrapper:
-	lgfr	%r2,%r2			# int
+	llgfr	%r2,%r2			# unsigned int
 	llgtr	%r3,%r3			# const char *
-	lgfr	%r4,%r4			# int
+	llgfr	%r4,%r4			# qid_t
 	llgtr	%r5,%r5			# caddr_t
 	jg	sys_quotactl		# branch to system call
 
@@ -664,14 +665,14 @@ sys32_msync_wrapper:
 
 	.globl  sys32_readv_wrapper 
 sys32_readv_wrapper:
-	llgfr	%r2,%r2			# unsigned long
+	lgfr	%r2,%r2			# int
 	llgtr	%r3,%r3			# const struct iovec_emu31 *
 	llgfr	%r4,%r4			# unsigned long
 	jg	sys32_readv		# branch to system call
 
 	.globl  sys32_writev_wrapper 
 sys32_writev_wrapper:
-	llgfr	%r2,%r2			# unsigned long
+	lgfr	%r2,%r2			# int
 	llgtr	%r3,%r3			# const struct iovec_emu31 *
 	llgfr	%r4,%r4			# unsigned long
 	jg	sys32_writev		# branch to system call
@@ -830,6 +831,7 @@ sys32_rt_sigprocmask_wrapper:
 	lgfr	%r2,%r2			# int
 	llgtr	%r3,%r3			# old_sigset_emu31 *
 	llgtr	%r4,%r4			# old_sigset_emu31 *
+	llgfr	%r5,%r5			# size_t
 	jg	sys32_rt_sigprocmask	# branch to system call
 
 	.globl  sys32_rt_sigpending_wrapper 
@@ -917,15 +919,15 @@ sys32_sendfile_wrapper:
 	.globl  sys32_truncate64_wrapper 
 sys32_truncate64_wrapper:
 	llgtr	%r2,%r2			# const char *
-	lgfr	%r3,%r3			# s32 
-	llgfr	%r4,%r4			# u32 
+	llgfr	%r3,%r3			# unsigned long
+	llgfr	%r4,%r4			# unsigned long
 	jg	sys32_truncate64	# branch to system call
 
 	.globl  sys32_ftruncate64_wrapper 
 sys32_ftruncate64_wrapper:
 	llgfr	%r2,%r2			# unsigned int
-	lgfr	%r3,%r3			# s32 
-	llgfr	%r4,%r4			# u32 
+	llgfr	%r3,%r3			# unsigned long
+	llgfr	%r4,%r4			# unsigned long
 	jg	sys32_ftruncate64	# branch to system call
 
 	.globl sys32_lchown_wrapper	
@@ -1064,14 +1066,12 @@ compat_sys_fcntl64_wrapper:
 sys32_stat64_wrapper:
 	llgtr	%r2,%r2			# char *
 	llgtr	%r3,%r3			# struct stat64 *
-	llgfr	%r4,%r4			# long
 	jg	sys32_stat64		# branch to system call
 
 	.globl	sys32_lstat64_wrapper
 sys32_lstat64_wrapper:
 	llgtr	%r2,%r2			# char *
 	llgtr	%r3,%r3			# struct stat64 *
-	llgfr	%r4,%r4			# long
 	jg	sys32_lstat64		# branch to system call
 
 	.globl	sys32_stime_wrapper
@@ -1088,7 +1088,6 @@ sys32_sysctl_wrapper:
 sys32_fstat64_wrapper:
 	llgfr	%r2,%r2			# unsigned long
 	llgtr	%r3,%r3			# struct stat64 *
-	llgfr	%r4,%r4			# long
 	jg	sys32_fstat64		# branch to system call
 
 	.globl  compat_sys_futex_wrapper 
diff -puN arch/s390/kernel/process.c~s390-core arch/s390/kernel/process.c
--- 25/arch/s390/kernel/process.c~s390-core	2004-03-26 12:15:55.292243040 -0800
+++ 25-akpm/arch/s390/kernel/process.c	2004-03-26 12:15:55.309240456 -0800
@@ -277,12 +277,12 @@ int copy_thread(int nr, unsigned long cl
         return 0;
 }
 
-asmlinkage int sys_fork(struct pt_regs regs)
+asmlinkage long sys_fork(struct pt_regs regs)
 {
 	return do_fork(SIGCHLD, regs.gprs[15], &regs, 0, NULL, NULL);
 }
 
-asmlinkage int sys_clone(struct pt_regs regs)
+asmlinkage long sys_clone(struct pt_regs regs)
 {
         unsigned long clone_flags;
         unsigned long newsp;
@@ -308,7 +308,7 @@ asmlinkage int sys_clone(struct pt_regs 
  * do not have enough call-clobbered registers to hold all
  * the information you need.
  */
-asmlinkage int sys_vfork(struct pt_regs regs)
+asmlinkage long sys_vfork(struct pt_regs regs)
 {
 	return do_fork(CLONE_VFORK | CLONE_VM | SIGCHLD,
 		       regs.gprs[15], &regs, 0, NULL, NULL);
@@ -317,7 +317,7 @@ asmlinkage int sys_vfork(struct pt_regs 
 /*
  * sys_execve() executes a new program.
  */
-asmlinkage int sys_execve(struct pt_regs regs)
+asmlinkage long sys_execve(struct pt_regs regs)
 {
         int error;
         char * filename;
diff -puN arch/s390/kernel/ptrace.c~s390-core arch/s390/kernel/ptrace.c
--- 25/arch/s390/kernel/ptrace.c~s390-core	2004-03-26 12:15:55.293242888 -0800
+++ 25-akpm/arch/s390/kernel/ptrace.c	2004-03-26 12:15:55.309240456 -0800
@@ -616,7 +616,7 @@ do_ptrace(struct task_struct *child, lon
 	return -EIO;
 }
 
-asmlinkage int
+asmlinkage long
 sys_ptrace(long request, long pid, long addr, long data)
 {
 	struct task_struct *child;
diff -puN arch/s390/kernel/setup.c~s390-core arch/s390/kernel/setup.c
--- 25/arch/s390/kernel/setup.c~s390-core	2004-03-26 12:15:55.295242584 -0800
+++ 25-akpm/arch/s390/kernel/setup.c	2004-03-26 12:15:55.310240304 -0800
@@ -492,20 +492,20 @@ void __init setup_arch(char **cmdline_p)
 #endif /* CONFIG_ARCH_S390X */
 	lc->restart_psw.mask = PSW_BASE_BITS;
 	lc->restart_psw.addr =
-		PSW_ADDR_AMODE + (unsigned long) restart_int_handler;
+		PSW_ADDR_AMODE | (unsigned long) restart_int_handler;
 	lc->external_new_psw.mask = PSW_KERNEL_BITS;
 	lc->external_new_psw.addr =
-		PSW_ADDR_AMODE + (unsigned long) ext_int_handler;
+		PSW_ADDR_AMODE | (unsigned long) ext_int_handler;
 	lc->svc_new_psw.mask = PSW_KERNEL_BITS;
-	lc->svc_new_psw.addr = PSW_ADDR_AMODE + (unsigned long) system_call;
+	lc->svc_new_psw.addr = PSW_ADDR_AMODE | (unsigned long) system_call;
 	lc->program_new_psw.mask = PSW_KERNEL_BITS;
 	lc->program_new_psw.addr =
-		PSW_ADDR_AMODE + (unsigned long)pgm_check_handler;
+		PSW_ADDR_AMODE | (unsigned long)pgm_check_handler;
 	lc->mcck_new_psw.mask = PSW_KERNEL_BITS;
 	lc->mcck_new_psw.addr =
-		PSW_ADDR_AMODE + (unsigned long) mcck_int_handler;
+		PSW_ADDR_AMODE | (unsigned long) mcck_int_handler;
 	lc->io_new_psw.mask = PSW_KERNEL_BITS;
-	lc->io_new_psw.addr = PSW_ADDR_AMODE + (unsigned long) io_int_handler;
+	lc->io_new_psw.addr = PSW_ADDR_AMODE | (unsigned long) io_int_handler;
 	lc->ipl_device = S390_lowcore.ipl_device;
 	lc->jiffy_timer = -1LL;
 	lc->kernel_stack = ((unsigned long) &init_thread_union) + THREAD_SIZE;
diff -puN arch/s390/kernel/sys_s390.c~s390-core arch/s390/kernel/sys_s390.c
--- 25/arch/s390/kernel/sys_s390.c~s390-core	2004-03-26 12:15:55.296242432 -0800
+++ 25-akpm/arch/s390/kernel/sys_s390.c	2004-03-26 12:15:55.311240152 -0800
@@ -32,17 +32,11 @@
 #include <asm/uaccess.h>
 #include <asm/ipc.h>
 
-#ifndef CONFIG_ARCH_S390X
-#define __SYS_RETTYPE int
-#else
-#define __SYS_RETTYPE long
-#endif /* CONFIG_ARCH_S390X */
-
 /*
  * sys_pipe() is the normal C calling standard for creating
  * a pipe. It's not the way Unix traditionally does this, though.
  */
-asmlinkage __SYS_RETTYPE sys_pipe(unsigned long * fildes)
+asmlinkage long sys_pipe(unsigned long * fildes)
 {
 	int fd[2];
 	int error;
@@ -61,7 +55,7 @@ static inline long do_mmap2(
 	unsigned long prot, unsigned long flags,
 	unsigned long fd, unsigned long pgoff)
 {
-	__SYS_RETTYPE error = -EBADF;
+	long error = -EBADF;
 	struct file * file = NULL;
 
 	flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
@@ -109,10 +103,10 @@ out:
 	return error;
 }
 
-asmlinkage __SYS_RETTYPE old_mmap(struct mmap_arg_struct *arg)
+asmlinkage long old_mmap(struct mmap_arg_struct *arg)
 {
 	struct mmap_arg_struct a;
-	__SYS_RETTYPE error = -EFAULT;
+	long error = -EFAULT;
 
 	if (copy_from_user(&a, arg, sizeof(a)))
 		goto out;
@@ -133,7 +127,7 @@ struct sel_arg_struct {
 	struct timeval *tvp;
 };
 
-asmlinkage int old_select(struct sel_arg_struct *arg)
+asmlinkage long old_select(struct sel_arg_struct *arg)
 {
 	struct sel_arg_struct a;
 
@@ -182,7 +176,7 @@ arch_get_unmapped_area(struct file *filp
  *
  * This is really horribly ugly.
  */
-asmlinkage __SYS_RETTYPE sys_ipc (uint call, int first, int second, 
+asmlinkage long sys_ipc (uint call, int first, int second,
 				  unsigned long third, void *ptr)
 {
         struct ipc_kludge tmp;
@@ -246,7 +240,7 @@ asmlinkage __SYS_RETTYPE sys_ipc (uint c
 }
 
 #ifdef CONFIG_ARCH_S390X
-asmlinkage int s390x_newuname(struct new_utsname * name)
+asmlinkage long s390x_newuname(struct new_utsname * name)
 {
 	int ret = sys_newuname(name);
 
@@ -257,7 +251,7 @@ asmlinkage int s390x_newuname(struct new
 	return ret;
 }
 
-asmlinkage int s390x_personality(unsigned long personality)
+asmlinkage long s390x_personality(unsigned long personality)
 {
 	int ret;
 
diff -puN drivers/s390/cio/device_fsm.c~s390-core drivers/s390/cio/device_fsm.c
--- 25/drivers/s390/cio/device_fsm.c~s390-core	2004-03-26 12:15:55.297242280 -0800
+++ 25-akpm/drivers/s390/cio/device_fsm.c	2004-03-26 12:15:55.312240000 -0800
@@ -731,6 +731,9 @@ ccw_device_w4sense(struct ccw_device *cd
 	    		(SCSW_STCTL_STATUS_PEND | SCSW_STCTL_ALERT_STATUS)) {
 		if (cdev->handler)
 			cdev->handler (cdev, 0, irb);
+		if (irb->scsw.cc == 1)
+			/* Basic sense hasn't started. Try again. */
+			ccw_device_do_sense(cdev, irb);
 		return;
 	}
 	/* Add basic sense info to irb. */
@@ -828,6 +831,8 @@ ccw_device_wait4io_irq(struct ccw_device
 	    		(SCSW_STCTL_STATUS_PEND | SCSW_STCTL_ALERT_STATUS)) {
 		if (cdev->handler)
 			cdev->handler (cdev, 0, irb);
+		if (irb->scsw.cc == 1)
+			goto call_handler;
 		return;
 	}
 	/*
@@ -841,6 +846,7 @@ ccw_device_wait4io_irq(struct ccw_device
 		}
 		return;
 	}
+call_handler:
 	/* Iff device is idle, reset timeout. */
 	sch = to_subchannel(cdev->dev.parent);
 	if (!stsch(sch->irq, &sch->schib))
@@ -908,6 +914,8 @@ ccw_device_stlck_done(struct ccw_device 
 		/* Check for unsolicited interrupt. */
 		if (irb->scsw.stctl ==
 		    (SCSW_STCTL_STATUS_PEND | SCSW_STCTL_ALERT_STATUS))
+			/* FIXME: we should restart stlck here, but this
+			 * is extremely unlikely ... */
 			goto out_wakeup;
 
 		ccw_device_accumulate_irb(cdev, irb);
diff -puN include/asm-s390/spinlock.h~s390-core include/asm-s390/spinlock.h
--- 25/include/asm-s390/spinlock.h~s390-core	2004-03-26 12:15:55.299241976 -0800
+++ 25-akpm/include/asm-s390/spinlock.h	2004-03-26 12:15:55.313239848 -0800
@@ -35,13 +35,8 @@
  */
 
 typedef struct {
-#ifndef __s390x__
-	volatile unsigned long lock;
-} spinlock_t;
-#else /* __s390x__ */
 	volatile unsigned int lock;
 } __attribute__ ((aligned (4))) spinlock_t;
-#endif /* __s390x__ */
 
 #define SPIN_LOCK_UNLOCKED (spinlock_t) { 0 }
 #define spin_lock_init(lp) do { (lp)->lock = 0; } while(0)
@@ -80,11 +75,10 @@ extern inline int _raw_spin_trylock(spin
 #else /* __s390x__ */
 	unsigned int result, reg;
 #endif /* __s390x__ */
-	__asm__ __volatile("    slr   %0,%0\n"
-			   "    basr  %1,0\n"
+	__asm__ __volatile("    basr  %1,0\n"
 			   "0:  cs    %0,%1,0(%3)"
-			   : "=&d" (result), "=&d" (reg), "=m" (lp->lock)
-			   : "a" (&lp->lock), "m" (lp->lock)
+			   : "=d" (result), "=&d" (reg), "=m" (lp->lock)
+			   : "a" (&lp->lock), "m" (lp->lock), "0" (0)
 			   : "cc", "memory" );
 	return !result;
 }
@@ -224,17 +218,15 @@ extern inline int _raw_write_trylock(rwl
 	
 	__asm__ __volatile__(
 #ifndef __s390x__
-			     "   slr  %0,%0\n"
 			     "   lhi  %1,1\n"
 			     "   sll  %1,31\n"
 			     "   cs   %0,%1,0(%3)"
 #else /* __s390x__ */
-			     "   slgr  %0,%0\n"
 			     "   llihh %1,0x8000\n"
 			     "0: csg %0,%1,0(%3)\n"
 #endif /* __s390x__ */
-			     : "=&d" (result), "=&d" (reg), "=m" (rw->lock)
-			     : "a" (&rw->lock), "m" (rw->lock)
+			     : "=d" (result), "=&d" (reg), "=m" (rw->lock)
+			     : "a" (&rw->lock), "m" (rw->lock), "0" (0)
 			     : "cc", "memory" );
 	return result == 0;
 }
diff -puN include/asm-s390/unistd.h~s390-core include/asm-s390/unistd.h
--- 25/include/asm-s390/unistd.h~s390-core	2004-03-26 12:15:55.300241824 -0800
+++ 25-akpm/include/asm-s390/unistd.h	2004-03-26 12:15:55.314239696 -0800
@@ -543,19 +543,14 @@ static inline pid_t waitpid(int pid, int
 	return sys_wait4(pid, wait_stat, flags, NULL);
 }
 struct mmap_arg_struct;
-asmlinkage long sys_mmap2(struct mmap_arg_struct *arg);
+asmlinkage long sys_mmap2(struct mmap_arg_struct __user *arg);
 
-asmlinkage int sys_execve(struct pt_regs regs);
-asmlinkage int sys_clone(struct pt_regs regs);
-asmlinkage int sys_fork(struct pt_regs regs);
-asmlinkage int sys_vfork(struct pt_regs regs);
-#ifndef CONFIG_ARCH_S390X
-#define __SYS_RETTYPE int
-#else
-#define __SYS_RETTYPE long
-#endif /* CONFIG_ARCH_S390X */
-asmlinkage __SYS_RETTYPE sys_pipe(unsigned long *fildes);
-asmlinkage int sys_ptrace(long request, long pid, long addr, long data);
+asmlinkage long sys_execve(struct pt_regs regs);
+asmlinkage long sys_clone(struct pt_regs regs);
+asmlinkage long sys_fork(struct pt_regs regs);
+asmlinkage long sys_vfork(struct pt_regs regs);
+asmlinkage long sys_pipe(unsigned long __user *fildes);
+asmlinkage long sys_ptrace(long request, long pid, long addr, long data);
 struct sigaction;
 asmlinkage long sys_rt_sigaction(int sig,
 				const struct sigaction __user *act,

_
