Commit d2ca1196 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] s390: core fixes.

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.
parent c9503ff2
......@@ -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
......@@ -109,6 +112,12 @@ CONFIG_SCSI_MULTI_LUN=y
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
#
......@@ -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
#
......
This diff is collapsed.
......@@ -161,7 +161,7 @@ sys32_rt_sigsuspend(struct pt_regs * regs,compat_sigset_t *unewset, size_t sigse
}
}
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 sigaction32 *act,
return ret;
}
asmlinkage int
asmlinkage long
sys32_sigaltstack(const stack_t32 *uss, stack_t32 *uoss, struct pt_regs *regs)
{
stack_t kss, koss;
......
......@@ -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
......
......@@ -277,12 +277,12 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long new_stackp,
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 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 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;
......
......@@ -616,7 +616,7 @@ do_ptrace(struct task_struct *child, long request, long addr, long data)
return -EIO;
}
asmlinkage int
asmlinkage long
sys_ptrace(long request, long pid, long addr, long data)
{
struct task_struct *child;
......
......@@ -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;
......
......@@ -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 @@ asmlinkage long sys_mmap2(struct mmap_arg_struct *arg)
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, unsigned long addr,
*
* 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 call, int first, int second,
}
#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_utsname * name)
return ret;
}
asmlinkage int s390x_personality(unsigned long personality)
asmlinkage long s390x_personality(unsigned long personality)
{
int ret;
......
......@@ -731,6 +731,9 @@ ccw_device_w4sense(struct ccw_device *cdev, enum dev_event dev_event)
(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 *cdev, enum dev_event dev_event)
(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 *cdev, enum dev_event dev_event)
}
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 *cdev, enum dev_event dev_event)
/* 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);
......
......@@ -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(spinlock_t *lp)
#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(rwlock_t *rw)
__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;
}
......
......@@ -543,19 +543,14 @@ static inline pid_t waitpid(int pid, int *wait_stat, int flags)
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,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment