aboutsummaryrefslogtreecommitdiffstats
path: root/arch/s390
diff options
context:
space:
mode:
Diffstat (limited to 'arch/s390')
-rw-r--r--arch/s390/Kconfig4
-rw-r--r--arch/s390/defconfig41
-rw-r--r--arch/s390/kernel/compat_linux.c103
-rw-r--r--arch/s390/kernel/compat_signal.c105
-rw-r--r--arch/s390/kernel/compat_wrapper.S143
-rw-r--r--arch/s390/kernel/entry.S51
-rw-r--r--arch/s390/kernel/entry64.S75
-rw-r--r--arch/s390/kernel/machine_kexec.c5
-rw-r--r--arch/s390/kernel/process.c4
-rw-r--r--arch/s390/kernel/setup.c2
-rw-r--r--arch/s390/kernel/signal.c146
-rw-r--r--arch/s390/kernel/smp.c73
-rw-r--r--arch/s390/kernel/sys_s390.c4
-rw-r--r--arch/s390/kernel/syscalls.S23
-rw-r--r--arch/s390/kernel/time.c11
-rw-r--r--arch/s390/kernel/traps.c2
-rw-r--r--arch/s390/lib/Makefile2
-rw-r--r--arch/s390/lib/delay.c2
-rw-r--r--arch/s390/lib/spinlock.c15
-rw-r--r--arch/s390/lib/uaccess.S6
-rw-r--r--arch/s390/lib/uaccess64.S6
-rw-r--r--arch/s390/mm/cmm.c10
22 files changed, 472 insertions, 361 deletions
diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig
index b66602ad7b..b7ca5bf9ac 100644
--- a/arch/s390/Kconfig
+++ b/arch/s390/Kconfig
@@ -80,6 +80,10 @@ config HOTPLUG_CPU
80 can be controlled through /sys/devices/system/cpu/cpu#. 80 can be controlled through /sys/devices/system/cpu/cpu#.
81 Say N if you want to disable CPU hotplug. 81 Say N if you want to disable CPU hotplug.
82 82
83config DEFAULT_MIGRATION_COST
84 int
85 default "1000000"
86
83config MATHEMU 87config MATHEMU
84 bool "IEEE FPU emulation" 88 bool "IEEE FPU emulation"
85 depends on MARCH_G5 89 depends on MARCH_G5
diff --git a/arch/s390/defconfig b/arch/s390/defconfig
index 7d23edc6fa..f8d0cd540a 100644
--- a/arch/s390/defconfig
+++ b/arch/s390/defconfig
@@ -1,19 +1,17 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.15-rc2 3# Linux kernel version: 2.6.16-rc2
4# Mon Nov 21 13:51:30 2005 4# Wed Feb 8 10:44:39 2006
5# 5#
6CONFIG_MMU=y 6CONFIG_MMU=y
7CONFIG_RWSEM_XCHGADD_ALGORITHM=y 7CONFIG_RWSEM_XCHGADD_ALGORITHM=y
8CONFIG_GENERIC_CALIBRATE_DELAY=y 8CONFIG_GENERIC_CALIBRATE_DELAY=y
9CONFIG_S390=y 9CONFIG_S390=y
10CONFIG_UID16=y
11 10
12# 11#
13# Code maturity level options 12# Code maturity level options
14# 13#
15CONFIG_EXPERIMENTAL=y 14CONFIG_EXPERIMENTAL=y
16CONFIG_CLEAN_COMPILE=y
17CONFIG_LOCK_KERNEL=y 15CONFIG_LOCK_KERNEL=y
18CONFIG_INIT_ENV_ARG_LIMIT=32 16CONFIG_INIT_ENV_ARG_LIMIT=32
19 17
@@ -29,18 +27,20 @@ CONFIG_POSIX_MQUEUE=y
29CONFIG_SYSCTL=y 27CONFIG_SYSCTL=y
30CONFIG_AUDIT=y 28CONFIG_AUDIT=y
31# CONFIG_AUDITSYSCALL is not set 29# CONFIG_AUDITSYSCALL is not set
32CONFIG_HOTPLUG=y
33CONFIG_KOBJECT_UEVENT=y
34CONFIG_IKCONFIG=y 30CONFIG_IKCONFIG=y
35CONFIG_IKCONFIG_PROC=y 31CONFIG_IKCONFIG_PROC=y
36# CONFIG_CPUSETS is not set 32# CONFIG_CPUSETS is not set
37CONFIG_INITRAMFS_SOURCE="" 33CONFIG_INITRAMFS_SOURCE=""
34CONFIG_UID16=y
35# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
38# CONFIG_EMBEDDED is not set 36# CONFIG_EMBEDDED is not set
39CONFIG_KALLSYMS=y 37CONFIG_KALLSYMS=y
40# CONFIG_KALLSYMS_ALL is not set 38# CONFIG_KALLSYMS_ALL is not set
41# CONFIG_KALLSYMS_EXTRA_PASS is not set 39# CONFIG_KALLSYMS_EXTRA_PASS is not set
40CONFIG_HOTPLUG=y
42CONFIG_PRINTK=y 41CONFIG_PRINTK=y
43CONFIG_BUG=y 42CONFIG_BUG=y
43CONFIG_ELF_CORE=y
44CONFIG_BASE_FULL=y 44CONFIG_BASE_FULL=y
45CONFIG_FUTEX=y 45CONFIG_FUTEX=y
46CONFIG_EPOLL=y 46CONFIG_EPOLL=y
@@ -49,8 +49,10 @@ CONFIG_CC_ALIGN_FUNCTIONS=0
49CONFIG_CC_ALIGN_LABELS=0 49CONFIG_CC_ALIGN_LABELS=0
50CONFIG_CC_ALIGN_LOOPS=0 50CONFIG_CC_ALIGN_LOOPS=0
51CONFIG_CC_ALIGN_JUMPS=0 51CONFIG_CC_ALIGN_JUMPS=0
52CONFIG_SLAB=y
52# CONFIG_TINY_SHMEM is not set 53# CONFIG_TINY_SHMEM is not set
53CONFIG_BASE_SMALL=0 54CONFIG_BASE_SMALL=0
55# CONFIG_SLOB is not set
54 56
55# 57#
56# Loadable module support 58# Loadable module support
@@ -76,11 +78,11 @@ CONFIG_IOSCHED_NOOP=y
76CONFIG_IOSCHED_AS=y 78CONFIG_IOSCHED_AS=y
77CONFIG_IOSCHED_DEADLINE=y 79CONFIG_IOSCHED_DEADLINE=y
78CONFIG_IOSCHED_CFQ=y 80CONFIG_IOSCHED_CFQ=y
79CONFIG_DEFAULT_AS=y 81# CONFIG_DEFAULT_AS is not set
80# CONFIG_DEFAULT_DEADLINE is not set 82CONFIG_DEFAULT_DEADLINE=y
81# CONFIG_DEFAULT_CFQ is not set 83# CONFIG_DEFAULT_CFQ is not set
82# CONFIG_DEFAULT_NOOP is not set 84# CONFIG_DEFAULT_NOOP is not set
83CONFIG_DEFAULT_IOSCHED="anticipatory" 85CONFIG_DEFAULT_IOSCHED="deadline"
84 86
85# 87#
86# Base setup 88# Base setup
@@ -151,6 +153,7 @@ CONFIG_NET=y
151# 153#
152# Networking options 154# Networking options
153# 155#
156# CONFIG_NETDEBUG is not set
154CONFIG_PACKET=y 157CONFIG_PACKET=y
155# CONFIG_PACKET_MMAP is not set 158# CONFIG_PACKET_MMAP is not set
156CONFIG_UNIX=y 159CONFIG_UNIX=y
@@ -193,6 +196,11 @@ CONFIG_IPV6=y
193# SCTP Configuration (EXPERIMENTAL) 196# SCTP Configuration (EXPERIMENTAL)
194# 197#
195# CONFIG_IP_SCTP is not set 198# CONFIG_IP_SCTP is not set
199
200#
201# TIPC Configuration (EXPERIMENTAL)
202#
203# CONFIG_TIPC is not set
196# CONFIG_ATM is not set 204# CONFIG_ATM is not set
197# CONFIG_BRIDGE is not set 205# CONFIG_BRIDGE is not set
198# CONFIG_VLAN_8021Q is not set 206# CONFIG_VLAN_8021Q is not set
@@ -362,6 +370,7 @@ CONFIG_DM_MULTIPATH=y
362# 370#
363CONFIG_UNIX98_PTYS=y 371CONFIG_UNIX98_PTYS=y
364CONFIG_UNIX98_PTY_COUNT=2048 372CONFIG_UNIX98_PTY_COUNT=2048
373# CONFIG_HANGCHECK_TIMER is not set
365 374
366# 375#
367# Watchdog Cards 376# Watchdog Cards
@@ -488,6 +497,7 @@ CONFIG_FS_MBCACHE=y
488# CONFIG_JFS_FS is not set 497# CONFIG_JFS_FS is not set
489# CONFIG_FS_POSIX_ACL is not set 498# CONFIG_FS_POSIX_ACL is not set
490# CONFIG_XFS_FS is not set 499# CONFIG_XFS_FS is not set
500# CONFIG_OCFS2_FS is not set
491# CONFIG_MINIX_FS is not set 501# CONFIG_MINIX_FS is not set
492# CONFIG_ROMFS_FS is not set 502# CONFIG_ROMFS_FS is not set
493CONFIG_INOTIFY=y 503CONFIG_INOTIFY=y
@@ -520,6 +530,7 @@ CONFIG_TMPFS=y
520# CONFIG_HUGETLB_PAGE is not set 530# CONFIG_HUGETLB_PAGE is not set
521CONFIG_RAMFS=y 531CONFIG_RAMFS=y
522# CONFIG_RELAYFS_FS is not set 532# CONFIG_RELAYFS_FS is not set
533# CONFIG_CONFIGFS_FS is not set
523 534
524# 535#
525# Miscellaneous filesystems 536# Miscellaneous filesystems
@@ -584,6 +595,7 @@ CONFIG_MSDOS_PARTITION=y
584# CONFIG_SGI_PARTITION is not set 595# CONFIG_SGI_PARTITION is not set
585# CONFIG_ULTRIX_PARTITION is not set 596# CONFIG_ULTRIX_PARTITION is not set
586# CONFIG_SUN_PARTITION is not set 597# CONFIG_SUN_PARTITION is not set
598# CONFIG_KARMA_PARTITION is not set
587# CONFIG_EFI_PARTITION is not set 599# CONFIG_EFI_PARTITION is not set
588 600
589# 601#
@@ -592,27 +604,30 @@ CONFIG_MSDOS_PARTITION=y
592# CONFIG_NLS is not set 604# CONFIG_NLS is not set
593 605
594# 606#
595# Profiling support 607# Instrumentation Support
596# 608#
597# CONFIG_PROFILING is not set 609# CONFIG_PROFILING is not set
610# CONFIG_STATISTICS is not set
598 611
599# 612#
600# Kernel hacking 613# Kernel hacking
601# 614#
602# CONFIG_PRINTK_TIME is not set 615# CONFIG_PRINTK_TIME is not set
603CONFIG_DEBUG_KERNEL=y
604CONFIG_MAGIC_SYSRQ=y 616CONFIG_MAGIC_SYSRQ=y
617CONFIG_DEBUG_KERNEL=y
605CONFIG_LOG_BUF_SHIFT=17 618CONFIG_LOG_BUF_SHIFT=17
606CONFIG_DETECT_SOFTLOCKUP=y 619# CONFIG_DETECT_SOFTLOCKUP is not set
607# CONFIG_SCHEDSTATS is not set 620# CONFIG_SCHEDSTATS is not set
608# CONFIG_DEBUG_SLAB is not set 621# CONFIG_DEBUG_SLAB is not set
609CONFIG_DEBUG_PREEMPT=y 622# CONFIG_DEBUG_PREEMPT is not set
623CONFIG_DEBUG_MUTEXES=y
610# CONFIG_DEBUG_SPINLOCK is not set 624# CONFIG_DEBUG_SPINLOCK is not set
611# CONFIG_DEBUG_SPINLOCK_SLEEP is not set 625# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
612# CONFIG_DEBUG_KOBJECT is not set 626# CONFIG_DEBUG_KOBJECT is not set
613# CONFIG_DEBUG_INFO is not set 627# CONFIG_DEBUG_INFO is not set
614CONFIG_DEBUG_FS=y 628CONFIG_DEBUG_FS=y
615# CONFIG_DEBUG_VM is not set 629# CONFIG_DEBUG_VM is not set
630CONFIG_FORCED_INLINING=y
616# CONFIG_RCU_TORTURE_TEST is not set 631# CONFIG_RCU_TORTURE_TEST is not set
617 632
618# 633#
diff --git a/arch/s390/kernel/compat_linux.c b/arch/s390/kernel/compat_linux.c
index bf9a7a361b..cc058dc3bc 100644
--- a/arch/s390/kernel/compat_linux.c
+++ b/arch/s390/kernel/compat_linux.c
@@ -100,12 +100,12 @@
100#define SET_STAT_UID(stat, uid) (stat).st_uid = high2lowuid(uid) 100#define SET_STAT_UID(stat, uid) (stat).st_uid = high2lowuid(uid)
101#define SET_STAT_GID(stat, gid) (stat).st_gid = high2lowgid(gid) 101#define SET_STAT_GID(stat, gid) (stat).st_gid = high2lowgid(gid)
102 102
103asmlinkage long sys32_chown16(const char * filename, u16 user, u16 group) 103asmlinkage long sys32_chown16(const char __user * filename, u16 user, u16 group)
104{ 104{
105 return sys_chown(filename, low2highuid(user), low2highgid(group)); 105 return sys_chown(filename, low2highuid(user), low2highgid(group));
106} 106}
107 107
108asmlinkage long sys32_lchown16(const char * filename, u16 user, u16 group) 108asmlinkage long sys32_lchown16(const char __user * filename, u16 user, u16 group)
109{ 109{
110 return sys_lchown(filename, low2highuid(user), low2highgid(group)); 110 return sys_lchown(filename, low2highuid(user), low2highgid(group));
111} 111}
@@ -141,7 +141,7 @@ asmlinkage long sys32_setresuid16(u16 ruid, u16 euid, u16 suid)
141 low2highuid(suid)); 141 low2highuid(suid));
142} 142}
143 143
144asmlinkage long sys32_getresuid16(u16 *ruid, u16 *euid, u16 *suid) 144asmlinkage long sys32_getresuid16(u16 __user *ruid, u16 __user *euid, u16 __user *suid)
145{ 145{
146 int retval; 146 int retval;
147 147
@@ -158,7 +158,7 @@ asmlinkage long sys32_setresgid16(u16 rgid, u16 egid, u16 sgid)
158 low2highgid(sgid)); 158 low2highgid(sgid));
159} 159}
160 160
161asmlinkage long sys32_getresgid16(u16 *rgid, u16 *egid, u16 *sgid) 161asmlinkage long sys32_getresgid16(u16 __user *rgid, u16 __user *egid, u16 __user *sgid)
162{ 162{
163 int retval; 163 int retval;
164 164
@@ -179,7 +179,7 @@ asmlinkage long sys32_setfsgid16(u16 gid)
179 return sys_setfsgid((gid_t)gid); 179 return sys_setfsgid((gid_t)gid);
180} 180}
181 181
182static int groups16_to_user(u16 *grouplist, struct group_info *group_info) 182static int groups16_to_user(u16 __user *grouplist, struct group_info *group_info)
183{ 183{
184 int i; 184 int i;
185 u16 group; 185 u16 group;
@@ -193,7 +193,7 @@ static int groups16_to_user(u16 *grouplist, struct group_info *group_info)
193 return 0; 193 return 0;
194} 194}
195 195
196static int groups16_from_user(struct group_info *group_info, u16 *grouplist) 196static int groups16_from_user(struct group_info *group_info, u16 __user *grouplist)
197{ 197{
198 int i; 198 int i;
199 u16 group; 199 u16 group;
@@ -207,7 +207,7 @@ static int groups16_from_user(struct group_info *group_info, u16 *grouplist)
207 return 0; 207 return 0;
208} 208}
209 209
210asmlinkage long sys32_getgroups16(int gidsetsize, u16 *grouplist) 210asmlinkage long sys32_getgroups16(int gidsetsize, u16 __user *grouplist)
211{ 211{
212 int i; 212 int i;
213 213
@@ -231,7 +231,7 @@ out:
231 return i; 231 return i;
232} 232}
233 233
234asmlinkage long sys32_setgroups16(int gidsetsize, u16 *grouplist) 234asmlinkage long sys32_setgroups16(int gidsetsize, u16 __user *grouplist)
235{ 235{
236 struct group_info *group_info; 236 struct group_info *group_info;
237 int retval; 237 int retval;
@@ -278,14 +278,14 @@ asmlinkage long sys32_getegid16(void)
278 278
279/* 32-bit timeval and related flotsam. */ 279/* 32-bit timeval and related flotsam. */
280 280
281static inline long get_tv32(struct timeval *o, struct compat_timeval *i) 281static inline long get_tv32(struct timeval *o, struct compat_timeval __user *i)
282{ 282{
283 return (!access_ok(VERIFY_READ, o, sizeof(*o)) || 283 return (!access_ok(VERIFY_READ, o, sizeof(*o)) ||
284 (__get_user(o->tv_sec, &i->tv_sec) || 284 (__get_user(o->tv_sec, &i->tv_sec) ||
285 __get_user(o->tv_usec, &i->tv_usec))); 285 __get_user(o->tv_usec, &i->tv_usec)));
286} 286}
287 287
288static inline long put_tv32(struct compat_timeval *o, struct timeval *i) 288static inline long put_tv32(struct compat_timeval __user *o, struct timeval *i)
289{ 289{
290 return (!access_ok(VERIFY_WRITE, o, sizeof(*o)) || 290 return (!access_ok(VERIFY_WRITE, o, sizeof(*o)) ||
291 (__put_user(i->tv_sec, &o->tv_sec) || 291 (__put_user(i->tv_sec, &o->tv_sec) ||
@@ -341,7 +341,7 @@ asmlinkage long sys32_ipc(u32 call, int first, int second, int third, u32 ptr)
341 return -ENOSYS; 341 return -ENOSYS;
342} 342}
343 343
344asmlinkage long sys32_truncate64(const char * path, unsigned long high, unsigned long low) 344asmlinkage long sys32_truncate64(const char __user * path, unsigned long high, unsigned long low)
345{ 345{
346 if ((int)high < 0) 346 if ((int)high < 0)
347 return -EINVAL; 347 return -EINVAL;
@@ -357,7 +357,7 @@ asmlinkage long sys32_ftruncate64(unsigned int fd, unsigned long high, unsigned
357 return sys_ftruncate(fd, (high << 32) | low); 357 return sys_ftruncate(fd, (high << 32) | low);
358} 358}
359 359
360int cp_compat_stat(struct kstat *stat, struct compat_stat *statbuf) 360int cp_compat_stat(struct kstat *stat, struct compat_stat __user *statbuf)
361{ 361{
362 int err; 362 int err;
363 363
@@ -591,7 +591,7 @@ sys32_delete_module(const char __user *name_user, unsigned int flags)
591 591
592extern struct timezone sys_tz; 592extern struct timezone sys_tz;
593 593
594asmlinkage long sys32_gettimeofday(struct compat_timeval *tv, struct timezone *tz) 594asmlinkage long sys32_gettimeofday(struct compat_timeval __user *tv, struct timezone __user *tz)
595{ 595{
596 if (tv) { 596 if (tv) {
597 struct timeval ktv; 597 struct timeval ktv;
@@ -606,7 +606,7 @@ asmlinkage long sys32_gettimeofday(struct compat_timeval *tv, struct timezone *t
606 return 0; 606 return 0;
607} 607}
608 608
609static inline long get_ts32(struct timespec *o, struct compat_timeval *i) 609static inline long get_ts32(struct timespec *o, struct compat_timeval __user *i)
610{ 610{
611 long usec; 611 long usec;
612 612
@@ -620,7 +620,7 @@ static inline long get_ts32(struct timespec *o, struct compat_timeval *i)
620 return 0; 620 return 0;
621} 621}
622 622
623asmlinkage long sys32_settimeofday(struct compat_timeval *tv, struct timezone *tz) 623asmlinkage long sys32_settimeofday(struct compat_timeval __user *tv, struct timezone __user *tz)
624{ 624{
625 struct timespec kts; 625 struct timespec kts;
626 struct timezone ktz; 626 struct timezone ktz;
@@ -645,7 +645,7 @@ asmlinkage long sys32_pause(void)
645 return -ERESTARTNOHAND; 645 return -ERESTARTNOHAND;
646} 646}
647 647
648asmlinkage long sys32_pread64(unsigned int fd, char *ubuf, 648asmlinkage long sys32_pread64(unsigned int fd, char __user *ubuf,
649 size_t count, u32 poshi, u32 poslo) 649 size_t count, u32 poshi, u32 poslo)
650{ 650{
651 if ((compat_ssize_t) count < 0) 651 if ((compat_ssize_t) count < 0)
@@ -653,7 +653,7 @@ asmlinkage long sys32_pread64(unsigned int fd, char *ubuf,
653 return sys_pread64(fd, ubuf, count, ((loff_t)AA(poshi) << 32) | AA(poslo)); 653 return sys_pread64(fd, ubuf, count, ((loff_t)AA(poshi) << 32) | AA(poslo));
654} 654}
655 655
656asmlinkage long sys32_pwrite64(unsigned int fd, const char *ubuf, 656asmlinkage long sys32_pwrite64(unsigned int fd, const char __user *ubuf,
657 size_t count, u32 poshi, u32 poslo) 657 size_t count, u32 poshi, u32 poslo)
658{ 658{
659 if ((compat_ssize_t) count < 0) 659 if ((compat_ssize_t) count < 0)
@@ -666,7 +666,7 @@ asmlinkage compat_ssize_t sys32_readahead(int fd, u32 offhi, u32 offlo, s32 coun
666 return sys_readahead(fd, ((loff_t)AA(offhi) << 32) | AA(offlo), count); 666 return sys_readahead(fd, ((loff_t)AA(offhi) << 32) | AA(offlo), count);
667} 667}
668 668
669asmlinkage long sys32_sendfile(int out_fd, int in_fd, compat_off_t *offset, size_t count) 669asmlinkage long sys32_sendfile(int out_fd, int in_fd, compat_off_t __user *offset, size_t count)
670{ 670{
671 mm_segment_t old_fs = get_fs(); 671 mm_segment_t old_fs = get_fs();
672 int ret; 672 int ret;
@@ -686,7 +686,7 @@ asmlinkage long sys32_sendfile(int out_fd, int in_fd, compat_off_t *offset, size
686} 686}
687 687
688asmlinkage long sys32_sendfile64(int out_fd, int in_fd, 688asmlinkage long sys32_sendfile64(int out_fd, int in_fd,
689 compat_loff_t *offset, s32 count) 689 compat_loff_t __user *offset, s32 count)
690{ 690{
691 mm_segment_t old_fs = get_fs(); 691 mm_segment_t old_fs = get_fs();
692 int ret; 692 int ret;
@@ -722,7 +722,7 @@ struct timex32 {
722 722
723extern int do_adjtimex(struct timex *); 723extern int do_adjtimex(struct timex *);
724 724
725asmlinkage long sys32_adjtimex(struct timex32 *utp) 725asmlinkage long sys32_adjtimex(struct timex32 __user *utp)
726{ 726{
727 struct timex txc; 727 struct timex txc;
728 int ret; 728 int ret;
@@ -789,12 +789,13 @@ struct __sysctl_args32 {
789 u32 __unused[4]; 789 u32 __unused[4];
790}; 790};
791 791
792asmlinkage long sys32_sysctl(struct __sysctl_args32 *args) 792asmlinkage long sys32_sysctl(struct __sysctl_args32 __user *args)
793{ 793{
794 struct __sysctl_args32 tmp; 794 struct __sysctl_args32 tmp;
795 int error; 795 int error;
796 size_t oldlen, *oldlenp = NULL; 796 size_t oldlen;
797 unsigned long addr = (((long)&args->__unused[0]) + 7) & ~7; 797 size_t __user *oldlenp = NULL;
798 unsigned long addr = (((unsigned long)&args->__unused[0]) + 7) & ~7;
798 799
799 if (copy_from_user(&tmp, args, sizeof(tmp))) 800 if (copy_from_user(&tmp, args, sizeof(tmp)))
800 return -EFAULT; 801 return -EFAULT;
@@ -806,20 +807,20 @@ asmlinkage long sys32_sysctl(struct __sysctl_args32 *args)
806 basically copy the whole sysctl.c here, and 807 basically copy the whole sysctl.c here, and
807 glibc's __sysctl uses rw memory for the structure 808 glibc's __sysctl uses rw memory for the structure
808 anyway. */ 809 anyway. */
809 if (get_user(oldlen, (u32 *)A(tmp.oldlenp)) || 810 if (get_user(oldlen, (u32 __user *)compat_ptr(tmp.oldlenp)) ||
810 put_user(oldlen, (size_t *)addr)) 811 put_user(oldlen, (size_t __user *)addr))
811 return -EFAULT; 812 return -EFAULT;
812 oldlenp = (size_t *)addr; 813 oldlenp = (size_t __user *)addr;
813 } 814 }
814 815
815 lock_kernel(); 816 lock_kernel();
816 error = do_sysctl((int *)A(tmp.name), tmp.nlen, (void *)A(tmp.oldval), 817 error = do_sysctl(compat_ptr(tmp.name), tmp.nlen, compat_ptr(tmp.oldval),
817 oldlenp, (void *)A(tmp.newval), tmp.newlen); 818 oldlenp, compat_ptr(tmp.newval), tmp.newlen);
818 unlock_kernel(); 819 unlock_kernel();
819 if (oldlenp) { 820 if (oldlenp) {
820 if (!error) { 821 if (!error) {
821 if (get_user(oldlen, (size_t *)addr) || 822 if (get_user(oldlen, (size_t __user *)addr) ||
822 put_user(oldlen, (u32 *)A(tmp.oldlenp))) 823 put_user(oldlen, (u32 __user *)compat_ptr(tmp.oldlenp)))
823 error = -EFAULT; 824 error = -EFAULT;
824 } 825 }
825 copy_to_user(args->__unused, tmp.__unused, sizeof(tmp.__unused)); 826 copy_to_user(args->__unused, tmp.__unused, sizeof(tmp.__unused));
@@ -853,7 +854,7 @@ struct stat64_emu31 {
853 unsigned long st_ino; 854 unsigned long st_ino;
854}; 855};
855 856
856static int cp_stat64(struct stat64_emu31 *ubuf, struct kstat *stat) 857static int cp_stat64(struct stat64_emu31 __user *ubuf, struct kstat *stat)
857{ 858{
858 struct stat64_emu31 tmp; 859 struct stat64_emu31 tmp;
859 860
@@ -877,7 +878,7 @@ static int cp_stat64(struct stat64_emu31 *ubuf, struct kstat *stat)
877 return copy_to_user(ubuf,&tmp,sizeof(tmp)) ? -EFAULT : 0; 878 return copy_to_user(ubuf,&tmp,sizeof(tmp)) ? -EFAULT : 0;
878} 879}
879 880
880asmlinkage long sys32_stat64(char * filename, struct stat64_emu31 * statbuf) 881asmlinkage long sys32_stat64(char __user * filename, struct stat64_emu31 __user * statbuf)
881{ 882{
882 struct kstat stat; 883 struct kstat stat;
883 int ret = vfs_stat(filename, &stat); 884 int ret = vfs_stat(filename, &stat);
@@ -886,7 +887,7 @@ asmlinkage long sys32_stat64(char * filename, struct stat64_emu31 * statbuf)
886 return ret; 887 return ret;
887} 888}
888 889
889asmlinkage long sys32_lstat64(char * filename, struct stat64_emu31 * statbuf) 890asmlinkage long sys32_lstat64(char __user * filename, struct stat64_emu31 __user * statbuf)
890{ 891{
891 struct kstat stat; 892 struct kstat stat;
892 int ret = vfs_lstat(filename, &stat); 893 int ret = vfs_lstat(filename, &stat);
@@ -895,7 +896,7 @@ asmlinkage long sys32_lstat64(char * filename, struct stat64_emu31 * statbuf)
895 return ret; 896 return ret;
896} 897}
897 898
898asmlinkage long sys32_fstat64(unsigned long fd, struct stat64_emu31 * statbuf) 899asmlinkage long sys32_fstat64(unsigned long fd, struct stat64_emu31 __user * statbuf)
899{ 900{
900 struct kstat stat; 901 struct kstat stat;
901 int ret = vfs_fstat(fd, &stat); 902 int ret = vfs_fstat(fd, &stat);
@@ -904,6 +905,26 @@ asmlinkage long sys32_fstat64(unsigned long fd, struct stat64_emu31 * statbuf)
904 return ret; 905 return ret;
905} 906}
906 907
908asmlinkage long sys32_fstatat64(unsigned int dfd, char __user *filename,
909 struct stat64_emu31 __user* statbuf, int flag)
910{
911 struct kstat stat;
912 int error = -EINVAL;
913
914 if ((flag & ~AT_SYMLINK_NOFOLLOW) != 0)
915 goto out;
916
917 if (flag & AT_SYMLINK_NOFOLLOW)
918 error = vfs_lstat_fd(dfd, filename, &stat);
919 else
920 error = vfs_stat_fd(dfd, filename, &stat);
921
922 if (!error)
923 error = cp_stat64(statbuf, &stat);
924out:
925 return error;
926}
927
907/* 928/*
908 * Linux/i386 didn't use to be able to handle more than 929 * Linux/i386 didn't use to be able to handle more than
909 * 4 system call parameters, so these system calls used a memory 930 * 4 system call parameters, so these system calls used a memory
@@ -952,7 +973,7 @@ out:
952 973
953 974
954asmlinkage unsigned long 975asmlinkage unsigned long
955old32_mmap(struct mmap_arg_struct_emu31 *arg) 976old32_mmap(struct mmap_arg_struct_emu31 __user *arg)
956{ 977{
957 struct mmap_arg_struct_emu31 a; 978 struct mmap_arg_struct_emu31 a;
958 int error = -EFAULT; 979 int error = -EFAULT;
@@ -970,7 +991,7 @@ out:
970} 991}
971 992
972asmlinkage long 993asmlinkage long
973sys32_mmap2(struct mmap_arg_struct_emu31 *arg) 994sys32_mmap2(struct mmap_arg_struct_emu31 __user *arg)
974{ 995{
975 struct mmap_arg_struct_emu31 a; 996 struct mmap_arg_struct_emu31 a;
976 int error = -EFAULT; 997 int error = -EFAULT;
@@ -982,7 +1003,7 @@ out:
982 return error; 1003 return error;
983} 1004}
984 1005
985asmlinkage long sys32_read(unsigned int fd, char * buf, size_t count) 1006asmlinkage long sys32_read(unsigned int fd, char __user * buf, size_t count)
986{ 1007{
987 if ((compat_ssize_t) count < 0) 1008 if ((compat_ssize_t) count < 0)
988 return -EINVAL; 1009 return -EINVAL;
@@ -990,7 +1011,7 @@ asmlinkage long sys32_read(unsigned int fd, char * buf, size_t count)
990 return sys_read(fd, buf, count); 1011 return sys_read(fd, buf, count);
991} 1012}
992 1013
993asmlinkage long sys32_write(unsigned int fd, char * buf, size_t count) 1014asmlinkage long sys32_write(unsigned int fd, char __user * buf, size_t count)
994{ 1015{
995 if ((compat_ssize_t) count < 0) 1016 if ((compat_ssize_t) count < 0)
996 return -EINVAL; 1017 return -EINVAL;
@@ -1002,12 +1023,12 @@ asmlinkage long sys32_clone(struct pt_regs regs)
1002{ 1023{
1003 unsigned long clone_flags; 1024 unsigned long clone_flags;
1004 unsigned long newsp; 1025 unsigned long newsp;
1005 int *parent_tidptr, *child_tidptr; 1026 int __user *parent_tidptr, *child_tidptr;
1006 1027
1007 clone_flags = regs.gprs[3] & 0xffffffffUL; 1028 clone_flags = regs.gprs[3] & 0xffffffffUL;
1008 newsp = regs.orig_gpr2 & 0x7fffffffUL; 1029 newsp = regs.orig_gpr2 & 0x7fffffffUL;
1009 parent_tidptr = (int *) (regs.gprs[4] & 0x7fffffffUL); 1030 parent_tidptr = compat_ptr(regs.gprs[4]);
1010 child_tidptr = (int *) (regs.gprs[5] & 0x7fffffffUL); 1031 child_tidptr = compat_ptr(regs.gprs[5]);
1011 if (!newsp) 1032 if (!newsp)
1012 newsp = regs.gprs[15]; 1033 newsp = regs.gprs[15];
1013 return do_fork(clone_flags, newsp, &regs, 0, 1034 return do_fork(clone_flags, newsp, &regs, 0,
diff --git a/arch/s390/kernel/compat_signal.c b/arch/s390/kernel/compat_signal.c
index fa2b3bc22f..5291b5f878 100644
--- a/arch/s390/kernel/compat_signal.c
+++ b/arch/s390/kernel/compat_signal.c
@@ -1,8 +1,7 @@
1/* 1/*
2 * arch/s390/kernel/signal32.c 2 * arch/s390/kernel/compat_signal.c
3 * 3 *
4 * S390 version 4 * Copyright (C) IBM Corp. 2000,2006
5 * Copyright (C) 2000 IBM Deutschland Entwicklung GmbH, IBM Corporation
6 * Author(s): Denis Joseph Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com) 5 * Author(s): Denis Joseph Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com)
7 * Gerhard Tonn (ton@de.ibm.com) 6 * Gerhard Tonn (ton@de.ibm.com)
8 * 7 *
@@ -52,8 +51,6 @@ typedef struct
52 struct ucontext32 uc; 51 struct ucontext32 uc;
53} rt_sigframe32; 52} rt_sigframe32;
54 53
55asmlinkage int FASTCALL(do_signal(struct pt_regs *regs, sigset_t *oldset));
56
57int copy_siginfo_to_user32(compat_siginfo_t __user *to, siginfo_t *from) 54int copy_siginfo_to_user32(compat_siginfo_t __user *to, siginfo_t *from)
58{ 55{
59 int err; 56 int err;
@@ -161,66 +158,6 @@ int copy_siginfo_from_user32(siginfo_t *to, compat_siginfo_t __user *from)
161 return err; 158 return err;
162} 159}
163 160
164/*
165 * Atomically swap in the new signal mask, and wait for a signal.
166 */
167asmlinkage int
168sys32_sigsuspend(struct pt_regs * regs,int history0, int history1, old_sigset_t mask)
169{
170 sigset_t saveset;
171
172 mask &= _BLOCKABLE;
173 spin_lock_irq(&current->sighand->siglock);
174 saveset = current->blocked;
175 siginitset(&current->blocked, mask);
176 recalc_sigpending();
177 spin_unlock_irq(&current->sighand->siglock);
178 regs->gprs[2] = -EINTR;
179
180 while (1) {
181 set_current_state(TASK_INTERRUPTIBLE);
182 schedule();
183 if (do_signal(regs, &saveset))
184 return -EINTR;
185 }
186}
187
188asmlinkage int
189sys32_rt_sigsuspend(struct pt_regs * regs, compat_sigset_t __user *unewset,
190 size_t sigsetsize)
191{
192 sigset_t saveset, newset;
193 compat_sigset_t set32;
194
195 /* XXX: Don't preclude handling different sized sigset_t's. */
196 if (sigsetsize != sizeof(sigset_t))
197 return -EINVAL;
198
199 if (copy_from_user(&set32, unewset, sizeof(set32)))
200 return -EFAULT;
201 switch (_NSIG_WORDS) {
202 case 4: newset.sig[3] = set32.sig[6] + (((long)set32.sig[7]) << 32);
203 case 3: newset.sig[2] = set32.sig[4] + (((long)set32.sig[5]) << 32);
204 case 2: newset.sig[1] = set32.sig[2] + (((long)set32.sig[3]) << 32);
205 case 1: newset.sig[0] = set32.sig[0] + (((long)set32.sig[1]) << 32);
206 }
207 sigdelsetmask(&newset, ~_BLOCKABLE);
208
209 spin_lock_irq(&current->sighand->siglock);
210 saveset = current->blocked;
211 current->blocked = newset;
212 recalc_sigpending();
213 spin_unlock_irq(&current->sighand->siglock);
214 regs->gprs[2] = -EINTR;
215
216 while (1) {
217 set_current_state(TASK_INTERRUPTIBLE);
218 schedule();
219 if (do_signal(regs, &saveset))
220 return -EINTR;
221 }
222}
223
224asmlinkage long 161asmlinkage long
225sys32_sigaction(int sig, const struct old_sigaction32 __user *act, 162sys32_sigaction(int sig, const struct old_sigaction32 __user *act,
226 struct old_sigaction32 __user *oact) 163 struct old_sigaction32 __user *oact)
@@ -258,9 +195,6 @@ sys32_sigaction(int sig, const struct old_sigaction32 __user *act,
258 return ret; 195 return ret;
259} 196}
260 197
261int
262do_sigaction(int sig, const struct k_sigaction *act, struct k_sigaction *oact);
263
264asmlinkage long 198asmlinkage long
265sys32_rt_sigaction(int sig, const struct sigaction32 __user *act, 199sys32_rt_sigaction(int sig, const struct sigaction32 __user *act,
266 struct sigaction32 __user *oact, size_t sigsetsize) 200 struct sigaction32 __user *oact, size_t sigsetsize)
@@ -520,7 +454,7 @@ static inline int map_signal(int sig)
520 return sig; 454 return sig;
521} 455}
522 456
523static void setup_frame32(int sig, struct k_sigaction *ka, 457static int setup_frame32(int sig, struct k_sigaction *ka,
524 sigset_t *set, struct pt_regs * regs) 458 sigset_t *set, struct pt_regs * regs)
525{ 459{
526 sigframe32 __user *frame = get_sigframe(ka, regs, sizeof(sigframe32)); 460 sigframe32 __user *frame = get_sigframe(ka, regs, sizeof(sigframe32));
@@ -565,13 +499,14 @@ static void setup_frame32(int sig, struct k_sigaction *ka,
565 /* Place signal number on stack to allow backtrace from handler. */ 499 /* Place signal number on stack to allow backtrace from handler. */
566 if (__put_user(regs->gprs[2], (int __user *) &frame->signo)) 500 if (__put_user(regs->gprs[2], (int __user *) &frame->signo))
567 goto give_sigsegv; 501 goto give_sigsegv;
568 return; 502 return 0;
569 503
570give_sigsegv: 504give_sigsegv:
571 force_sigsegv(sig, current); 505 force_sigsegv(sig, current);
506 return -EFAULT;
572} 507}
573 508
574static void setup_rt_frame32(int sig, struct k_sigaction *ka, siginfo_t *info, 509static int setup_rt_frame32(int sig, struct k_sigaction *ka, siginfo_t *info,
575 sigset_t *set, struct pt_regs * regs) 510 sigset_t *set, struct pt_regs * regs)
576{ 511{
577 int err = 0; 512 int err = 0;
@@ -615,31 +550,37 @@ static void setup_rt_frame32(int sig, struct k_sigaction *ka, siginfo_t *info,
615 regs->gprs[2] = map_signal(sig); 550 regs->gprs[2] = map_signal(sig);
616 regs->gprs[3] = (__u64) &frame->info; 551 regs->gprs[3] = (__u64) &frame->info;
617 regs->gprs[4] = (__u64) &frame->uc; 552 regs->gprs[4] = (__u64) &frame->uc;
618 return; 553 return 0;
619 554
620give_sigsegv: 555give_sigsegv:
621 force_sigsegv(sig, current); 556 force_sigsegv(sig, current);
557 return -EFAULT;
622} 558}
623 559
624/* 560/*
625 * OK, we're invoking a handler 561 * OK, we're invoking a handler
626 */ 562 */
627 563
628void 564int
629handle_signal32(unsigned long sig, struct k_sigaction *ka, 565handle_signal32(unsigned long sig, struct k_sigaction *ka,
630 siginfo_t *info, sigset_t *oldset, struct pt_regs * regs) 566 siginfo_t *info, sigset_t *oldset, struct pt_regs * regs)
631{ 567{
568 int ret;
569
632 /* Set up the stack frame */ 570 /* Set up the stack frame */
633 if (ka->sa.sa_flags & SA_SIGINFO) 571 if (ka->sa.sa_flags & SA_SIGINFO)
634 setup_rt_frame32(sig, ka, info, oldset, regs); 572 ret = setup_rt_frame32(sig, ka, info, oldset, regs);
635 else 573 else
636 setup_frame32(sig, ka, oldset, regs); 574 ret = setup_frame32(sig, ka, oldset, regs);
637 575
638 spin_lock_irq(&current->sighand->siglock); 576 if (ret == 0) {
639 sigorsets(&current->blocked,&current->blocked,&ka->sa.sa_mask); 577 spin_lock_irq(&current->sighand->siglock);
640 if (!(ka->sa.sa_flags & SA_NODEFER)) 578 sigorsets(&current->blocked,&current->blocked,&ka->sa.sa_mask);
641 sigaddset(&current->blocked,sig); 579 if (!(ka->sa.sa_flags & SA_NODEFER))
642 recalc_sigpending(); 580 sigaddset(&current->blocked,sig);
643 spin_unlock_irq(&current->sighand->siglock); 581 recalc_sigpending();
582 spin_unlock_irq(&current->sighand->siglock);
583 }
584 return ret;
644} 585}
645 586
diff --git a/arch/s390/kernel/compat_wrapper.S b/arch/s390/kernel/compat_wrapper.S
index cfde1905d0..50e80138e7 100644
--- a/arch/s390/kernel/compat_wrapper.S
+++ b/arch/s390/kernel/compat_wrapper.S
@@ -1,9 +1,8 @@
1/* 1/*
2* arch/s390/kernel/sys_wrapper31.S 2* arch/s390/kernel/compat_wrapper.S
3* wrapper for 31 bit compatible system calls. 3* wrapper for 31 bit compatible system calls.
4* 4*
5* S390 version 5* Copyright (C) IBM Corp. 2000,2006
6* Copyright (C) 2000 IBM Deutschland Entwicklung GmbH, IBM Corporation
7* Author(s): Gerhard Tonn (ton@de.ibm.com), 6* Author(s): Gerhard Tonn (ton@de.ibm.com),
8* Thomas Spatzier (tspat@de.ibm.com) 7* Thomas Spatzier (tspat@de.ibm.com)
9*/ 8*/
@@ -288,7 +287,12 @@ sys32_setregid16_wrapper:
288 llgfr %r3,%r3 # __kernel_old_gid_emu31_t 287 llgfr %r3,%r3 # __kernel_old_gid_emu31_t
289 jg sys32_setregid16 # branch to system call 288 jg sys32_setregid16 # branch to system call
290 289
291#sys32_sigsuspend_wrapper # done in sigsuspend_glue 290 .globl sys_sigsuspend_wrapper
291sys_sigsuspend_wrapper:
292 lgfr %r2,%r2 # int
293 lgfr %r3,%r3 # int
294 llgfr %r4,%r4 # old_sigset_t
295 jg sys_sigsuspend
292 296
293 .globl compat_sys_sigpending_wrapper 297 .globl compat_sys_sigpending_wrapper
294compat_sys_sigpending_wrapper: 298compat_sys_sigpending_wrapper:
@@ -855,7 +859,11 @@ sys32_rt_sigqueueinfo_wrapper:
855 llgtr %r4,%r4 # siginfo_emu31_t * 859 llgtr %r4,%r4 # siginfo_emu31_t *
856 jg sys32_rt_sigqueueinfo # branch to system call 860 jg sys32_rt_sigqueueinfo # branch to system call
857 861
858#sys32_rt_sigsuspend_wrapper # done in rt_sigsuspend_glue 862 .globl compat_sys_rt_sigsuspend_wrapper
863compat_sys_rt_sigsuspend_wrapper:
864 llgtr %r2,%r2 # compat_sigset_t *
865 llgfr %r3,%r3 # compat_size_t
866 jg compat_sys_rt_sigsuspend
859 867
860 .globl sys32_pread64_wrapper 868 .globl sys32_pread64_wrapper
861sys32_pread64_wrapper: 869sys32_pread64_wrapper:
@@ -1475,3 +1483,128 @@ sys_inotify_rm_watch_wrapper:
1475 lgfr %r2,%r2 # int 1483 lgfr %r2,%r2 # int
1476 llgfr %r3,%r3 # u32 1484 llgfr %r3,%r3 # u32
1477 jg sys_inotify_rm_watch 1485 jg sys_inotify_rm_watch
1486
1487 .globl compat_sys_openat_wrapper
1488compat_sys_openat_wrapper:
1489 llgfr %r2,%r2 # unsigned int
1490 llgtr %r3,%r3 # const char *
1491 lgfr %r4,%r4 # int
1492 lgfr %r5,%r5 # int
1493 jg compat_sys_openat
1494
1495 .globl sys_mkdirat_wrapper
1496sys_mkdirat_wrapper:
1497 lgfr %r2,%r2 # int
1498 llgtr %r3,%r3 # const char *
1499 lgfr %r4,%r4 # int
1500 jg sys_mkdirat
1501
1502 .globl sys_mknodat_wrapper
1503sys_mknodat_wrapper:
1504 lgfr %r2,%r2 # int
1505 llgtr %r3,%r3 # const char *
1506 lgfr %r4,%r4 # int
1507 llgfr %r5,%r5 # unsigned int
1508 jg sys_mknodat
1509
1510 .globl sys_fchownat_wrapper
1511sys_fchownat_wrapper:
1512 lgfr %r2,%r2 # int
1513 llgtr %r3,%r3 # const char *
1514 llgfr %r4,%r4 # uid_t
1515 llgfr %r5,%r5 # gid_t
1516 lgfr %r6,%r6 # int
1517 jg sys_fchownat
1518
1519 .globl compat_sys_futimesat_wrapper
1520compat_sys_futimesat_wrapper:
1521 llgfr %r2,%r2 # unsigned int
1522 llgtr %r3,%r3 # char *
1523 llgtr %r4,%r4 # struct timeval *
1524 jg compat_sys_futimesat
1525
1526 .globl sys32_fstatat64_wrapper
1527sys32_fstatat64_wrapper:
1528 llgfr %r2,%r2 # unsigned int
1529 llgtr %r3,%r3 # char *
1530 llgtr %r4,%r4 # struct stat64 *
1531 lgfr %r5,%r5 # int
1532 jg sys32_fstatat64
1533
1534 .globl sys_unlinkat_wrapper
1535sys_unlinkat_wrapper:
1536 lgfr %r2,%r2 # int
1537 llgtr %r3,%r3 # const char *
1538 lgfr %r4,%r4 # int
1539 jg sys_unlinkat
1540
1541 .globl sys_renameat_wrapper
1542sys_renameat_wrapper:
1543 lgfr %r2,%r2 # int
1544 llgtr %r3,%r3 # const char *
1545 lgfr %r4,%r4 # int
1546 llgtr %r5,%r5 # const char *
1547 jg sys_renameat
1548
1549 .globl sys_linkat_wrapper
1550sys_linkat_wrapper:
1551 lgfr %r2,%r2 # int
1552 llgtr %r3,%r3 # const char *
1553 lgfr %r4,%r4 # int
1554 llgtr %r5,%r5 # const char *
1555 lgfr %r6,%r6 # int
1556 jg sys_linkat
1557
1558 .globl sys_symlinkat_wrapper
1559sys_symlinkat_wrapper:
1560 llgtr %r2,%r2 # const char *
1561 lgfr %r3,%r3 # int
1562 llgtr %r4,%r4 # const char *
1563 jg sys_symlinkat
1564
1565 .globl sys_readlinkat_wrapper
1566sys_readlinkat_wrapper:
1567 lgfr %r2,%r2 # int
1568 llgtr %r3,%r3 # const char *
1569 llgtr %r4,%r4 # char *
1570 lgfr %r5,%r5 # int
1571 jg sys_readlinkat
1572
1573 .globl sys_fchmodat_wrapper
1574sys_fchmodat_wrapper:
1575 lgfr %r2,%r2 # int
1576 llgtr %r3,%r3 # const char *
1577 llgfr %r4,%r4 # mode_t
1578 jg sys_fchmodat
1579
1580 .globl sys_faccessat_wrapper
1581sys_faccessat_wrapper:
1582 lgfr %r2,%r2 # int
1583 llgtr %r3,%r3 # const char *
1584 lgfr %r4,%r4 # int
1585 jg sys_faccessat
1586
1587 .globl compat_sys_pselect6_wrapper
1588compat_sys_pselect6_wrapper:
1589 lgfr %r2,%r2 # int
1590 llgtr %r3,%r3 # fd_set *
1591 llgtr %r4,%r4 # fd_set *
1592 llgtr %r5,%r5 # fd_set *
1593 llgtr %r6,%r6 # struct timespec *
1594 llgt %r0,164(%r15) # void *
1595 stg %r0,160(%r15)
1596 jg compat_sys_pselect6
1597
1598 .globl compat_sys_ppoll_wrapper
1599compat_sys_ppoll_wrapper:
1600 llgtr %r2,%r2 # struct pollfd *
1601 llgfr %r3,%r3 # unsigned int
1602 llgtr %r4,%r4 # struct timespec *
1603 llgtr %r5,%r5 # const sigset_t *
1604 llgfr %r6,%r6 # size_t
1605 jg compat_sys_ppoll
1606
1607 .globl sys_unshare_wrapper
1608sys_unshare_wrapper:
1609 llgfr %r2,%r2 # unsigned long
1610 jg sys_unshare
diff --git a/arch/s390/kernel/entry.S b/arch/s390/kernel/entry.S
index 27b07730b7..b244848785 100644
--- a/arch/s390/kernel/entry.S
+++ b/arch/s390/kernel/entry.S
@@ -2,8 +2,7 @@
2 * arch/s390/kernel/entry.S 2 * arch/s390/kernel/entry.S
3 * S390 low-level entry points. 3 * S390 low-level entry points.
4 * 4 *
5 * S390 version 5 * Copyright (C) IBM Corp. 1999,2006
6 * Copyright (C) 1999,2000 IBM Deutschland Entwicklung GmbH, IBM Corporation
7 * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com), 6 * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com),
8 * Hartmut Penner (hp@de.ibm.com), 7 * Hartmut Penner (hp@de.ibm.com),
9 * Denis Joseph Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com), 8 * Denis Joseph Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com),
@@ -50,9 +49,10 @@ SP_ILC = STACK_FRAME_OVERHEAD + __PT_ILC
50SP_TRAP = STACK_FRAME_OVERHEAD + __PT_TRAP 49SP_TRAP = STACK_FRAME_OVERHEAD + __PT_TRAP
51SP_SIZE = STACK_FRAME_OVERHEAD + __PT_SIZE 50SP_SIZE = STACK_FRAME_OVERHEAD + __PT_SIZE
52 51
53_TIF_WORK_SVC = (_TIF_SIGPENDING | _TIF_NEED_RESCHED | _TIF_MCCK_PENDING | \ 52_TIF_WORK_SVC = (_TIF_SIGPENDING | _TIF_RESTORE_SIGMASK | _TIF_NEED_RESCHED | \
54 _TIF_RESTART_SVC | _TIF_SINGLE_STEP ) 53 _TIF_MCCK_PENDING | _TIF_RESTART_SVC | _TIF_SINGLE_STEP )
55_TIF_WORK_INT = (_TIF_SIGPENDING | _TIF_NEED_RESCHED | _TIF_MCCK_PENDING) 54_TIF_WORK_INT = (_TIF_SIGPENDING | _TIF_RESTORE_SIGMASK | _TIF_NEED_RESCHED | \
55 _TIF_MCCK_PENDING)
56 56
57STACK_SHIFT = PAGE_SHIFT + THREAD_ORDER 57STACK_SHIFT = PAGE_SHIFT + THREAD_ORDER
58STACK_SIZE = 1 << STACK_SHIFT 58STACK_SIZE = 1 << STACK_SHIFT
@@ -251,8 +251,8 @@ sysc_work:
251 bo BASED(sysc_mcck_pending) 251 bo BASED(sysc_mcck_pending)
252 tm __TI_flags+3(%r9),_TIF_NEED_RESCHED 252 tm __TI_flags+3(%r9),_TIF_NEED_RESCHED
253 bo BASED(sysc_reschedule) 253 bo BASED(sysc_reschedule)
254 tm __TI_flags+3(%r9),_TIF_SIGPENDING 254 tm __TI_flags+3(%r9),(_TIF_SIGPENDING | _TIF_RESTORE_SIGMASK)
255 bo BASED(sysc_sigpending) 255 bnz BASED(sysc_sigpending)
256 tm __TI_flags+3(%r9),_TIF_RESTART_SVC 256 tm __TI_flags+3(%r9),_TIF_RESTART_SVC
257 bo BASED(sysc_restart) 257 bo BASED(sysc_restart)
258 tm __TI_flags+3(%r9),_TIF_SINGLE_STEP 258 tm __TI_flags+3(%r9),_TIF_SINGLE_STEP
@@ -276,12 +276,11 @@ sysc_mcck_pending:
276 br %r1 # TIF bit will be cleared by handler 276 br %r1 # TIF bit will be cleared by handler
277 277
278# 278#
279# _TIF_SIGPENDING is set, call do_signal 279# _TIF_SIGPENDING or _TIF_RESTORE_SIGMASK is set, call do_signal
280# 280#
281sysc_sigpending: 281sysc_sigpending:
282 ni __TI_flags+3(%r9),255-_TIF_SINGLE_STEP # clear TIF_SINGLE_STEP 282 ni __TI_flags+3(%r9),255-_TIF_SINGLE_STEP # clear TIF_SINGLE_STEP
283 la %r2,SP_PTREGS(%r15) # load pt_regs 283 la %r2,SP_PTREGS(%r15) # load pt_regs
284 sr %r3,%r3 # clear *oldset
285 l %r1,BASED(.Ldo_signal) 284 l %r1,BASED(.Ldo_signal)
286 basr %r14,%r1 # call do_signal 285 basr %r14,%r1 # call do_signal
287 tm __TI_flags+3(%r9),_TIF_RESTART_SVC 286 tm __TI_flags+3(%r9),_TIF_RESTART_SVC
@@ -397,30 +396,6 @@ sys_rt_sigreturn_glue:
397 l %r1,BASED(.Lrt_sigreturn) 396 l %r1,BASED(.Lrt_sigreturn)
398 br %r1 # branch to sys_sigreturn 397 br %r1 # branch to sys_sigreturn
399 398
400#
401# sigsuspend and rt_sigsuspend need pt_regs as an additional
402# parameter and they have to skip the store of %r2 into the
403# user register %r2 because the return value was set in
404# sigsuspend and rt_sigsuspend already and must not be overwritten!
405#
406
407sys_sigsuspend_glue:
408 lr %r5,%r4 # move mask back
409 lr %r4,%r3 # move history1 parameter
410 lr %r3,%r2 # move history0 parameter
411 la %r2,SP_PTREGS(%r15) # load pt_regs as first parameter
412 l %r1,BASED(.Lsigsuspend)
413 la %r14,4(%r14) # skip store of return value
414 br %r1 # branch to sys_sigsuspend
415
416sys_rt_sigsuspend_glue:
417 lr %r4,%r3 # move sigsetsize parameter
418 lr %r3,%r2 # move unewset parameter
419 la %r2,SP_PTREGS(%r15) # load pt_regs as first parameter
420 l %r1,BASED(.Lrt_sigsuspend)
421 la %r14,4(%r14) # skip store of return value
422 br %r1 # branch to sys_rt_sigsuspend
423
424sys_sigaltstack_glue: 399sys_sigaltstack_glue:
425 la %r4,SP_PTREGS(%r15) # load pt_regs as parameter 400 la %r4,SP_PTREGS(%r15) # load pt_regs as parameter
426 l %r1,BASED(.Lsigaltstack) 401 l %r1,BASED(.Lsigaltstack)
@@ -604,15 +579,16 @@ io_work:
604 lr %r15,%r1 579 lr %r15,%r1
605# 580#
606# One of the work bits is on. Find out which one. 581# One of the work bits is on. Find out which one.
607# Checked are: _TIF_SIGPENDING, _TIF_NEED_RESCHED and _TIF_MCCK_PENDING 582# Checked are: _TIF_SIGPENDING, _TIF_RESTORE_SIGMASK, _TIF_NEED_RESCHED
583# and _TIF_MCCK_PENDING
608# 584#
609io_work_loop: 585io_work_loop:
610 tm __TI_flags+3(%r9),_TIF_MCCK_PENDING 586 tm __TI_flags+3(%r9),_TIF_MCCK_PENDING
611 bo BASED(io_mcck_pending) 587 bo BASED(io_mcck_pending)
612 tm __TI_flags+3(%r9),_TIF_NEED_RESCHED 588 tm __TI_flags+3(%r9),_TIF_NEED_RESCHED
613 bo BASED(io_reschedule) 589 bo BASED(io_reschedule)
614 tm __TI_flags+3(%r9),_TIF_SIGPENDING 590 tm __TI_flags+3(%r9),(_TIF_SIGPENDING | _TIF_RESTORE_SIGMASK)
615 bo BASED(io_sigpending) 591 bnz BASED(io_sigpending)
616 b BASED(io_leave) 592 b BASED(io_leave)
617 593
618# 594#
@@ -636,12 +612,11 @@ io_reschedule:
636 b BASED(io_work_loop) 612 b BASED(io_work_loop)
637 613
638# 614#
639# _TIF_SIGPENDING is set, call do_signal 615# _TIF_SIGPENDING or _TIF_RESTORE_SIGMASK is set, call do_signal
640# 616#
641io_sigpending: 617io_sigpending:
642 stosm __SF_EMPTY(%r15),0x03 # reenable interrupts 618 stosm __SF_EMPTY(%r15),0x03 # reenable interrupts
643 la %r2,SP_PTREGS(%r15) # load pt_regs 619 la %r2,SP_PTREGS(%r15) # load pt_regs
644 sr %r3,%r3 # clear *oldset
645 l %r1,BASED(.Ldo_signal) 620 l %r1,BASED(.Ldo_signal)
646 basr %r14,%r1 # call do_signal 621 basr %r14,%r1 # call do_signal
647 stnsm __SF_EMPTY(%r15),0xfc # disable I/O and ext. interrupts 622 stnsm __SF_EMPTY(%r15),0xfc # disable I/O and ext. interrupts
diff --git a/arch/s390/kernel/entry64.S b/arch/s390/kernel/entry64.S
index 369ab4413e..2ac095bc0e 100644
--- a/arch/s390/kernel/entry64.S
+++ b/arch/s390/kernel/entry64.S
@@ -1,9 +1,8 @@
1/* 1/*
2 * arch/s390/kernel/entry.S 2 * arch/s390/kernel/entry64.S
3 * S390 low-level entry points. 3 * S390 low-level entry points.
4 * 4 *
5 * S390 version 5 * Copyright (C) IBM Corp. 1999,2006
6 * Copyright (C) 1999,2000 IBM Deutschland Entwicklung GmbH, IBM Corporation
7 * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com), 6 * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com),
8 * Hartmut Penner (hp@de.ibm.com), 7 * Hartmut Penner (hp@de.ibm.com),
9 * Denis Joseph Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com), 8 * Denis Joseph Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com),
@@ -53,9 +52,10 @@ SP_SIZE = STACK_FRAME_OVERHEAD + __PT_SIZE
53STACK_SHIFT = PAGE_SHIFT + THREAD_ORDER 52STACK_SHIFT = PAGE_SHIFT + THREAD_ORDER
54STACK_SIZE = 1 << STACK_SHIFT 53STACK_SIZE = 1 << STACK_SHIFT
55 54
56_TIF_WORK_SVC = (_TIF_SIGPENDING | _TIF_NEED_RESCHED | _TIF_MCCK_PENDING | \ 55_TIF_WORK_SVC = (_TIF_SIGPENDING | _TIF_RESTORE_SIGMASK | _TIF_NEED_RESCHED | \
57 _TIF_RESTART_SVC | _TIF_SINGLE_STEP ) 56 _TIF_MCCK_PENDING | _TIF_RESTART_SVC | _TIF_SINGLE_STEP )
58_TIF_WORK_INT = (_TIF_SIGPENDING | _TIF_NEED_RESCHED | _TIF_MCCK_PENDING) 57_TIF_WORK_INT = (_TIF_SIGPENDING | _TIF_RESTORE_SIGMASK | _TIF_NEED_RESCHED | \
58 _TIF_MCCK_PENDING)
59 59
60#define BASED(name) name-system_call(%r13) 60#define BASED(name) name-system_call(%r13)
61 61
@@ -249,8 +249,8 @@ sysc_work:
249 jo sysc_mcck_pending 249 jo sysc_mcck_pending
250 tm __TI_flags+7(%r9),_TIF_NEED_RESCHED 250 tm __TI_flags+7(%r9),_TIF_NEED_RESCHED
251 jo sysc_reschedule 251 jo sysc_reschedule
252 tm __TI_flags+7(%r9),_TIF_SIGPENDING 252 tm __TI_flags+7(%r9),(_TIF_SIGPENDING | _TIF_RESTORE_SIGMASK)
253 jo sysc_sigpending 253 jnz sysc_sigpending
254 tm __TI_flags+7(%r9),_TIF_RESTART_SVC 254 tm __TI_flags+7(%r9),_TIF_RESTART_SVC
255 jo sysc_restart 255 jo sysc_restart
256 tm __TI_flags+7(%r9),_TIF_SINGLE_STEP 256 tm __TI_flags+7(%r9),_TIF_SINGLE_STEP
@@ -272,12 +272,11 @@ sysc_mcck_pending:
272 jg s390_handle_mcck # TIF bit will be cleared by handler 272 jg s390_handle_mcck # TIF bit will be cleared by handler
273 273
274# 274#
275# _TIF_SIGPENDING is set, call do_signal 275# _TIF_SIGPENDING or _TIF_RESTORE_SIGMASK is set, call do_signal
276# 276#
277sysc_sigpending: 277sysc_sigpending:
278 ni __TI_flags+7(%r9),255-_TIF_SINGLE_STEP # clear TIF_SINGLE_STEP 278 ni __TI_flags+7(%r9),255-_TIF_SINGLE_STEP # clear TIF_SINGLE_STEP
279 la %r2,SP_PTREGS(%r15) # load pt_regs 279 la %r2,SP_PTREGS(%r15) # load pt_regs
280 sgr %r3,%r3 # clear *oldset
281 brasl %r14,do_signal # call do_signal 280 brasl %r14,do_signal # call do_signal
282 tm __TI_flags+7(%r9),_TIF_RESTART_SVC 281 tm __TI_flags+7(%r9),_TIF_RESTART_SVC
283 jo sysc_restart 282 jo sysc_restart
@@ -414,52 +413,6 @@ sys32_rt_sigreturn_glue:
414 jg sys32_rt_sigreturn # branch to sys32_sigreturn 413 jg sys32_rt_sigreturn # branch to sys32_sigreturn
415#endif 414#endif
416 415
417#
418# sigsuspend and rt_sigsuspend need pt_regs as an additional
419# parameter and they have to skip the store of %r2 into the
420# user register %r2 because the return value was set in
421# sigsuspend and rt_sigsuspend already and must not be overwritten!
422#
423
424sys_sigsuspend_glue:
425 lgr %r5,%r4 # move mask back
426 lgr %r4,%r3 # move history1 parameter
427 lgr %r3,%r2 # move history0 parameter
428 la %r2,SP_PTREGS(%r15) # load pt_regs as first parameter
429 la %r14,6(%r14) # skip store of return value
430 jg sys_sigsuspend # branch to sys_sigsuspend
431
432#ifdef CONFIG_COMPAT
433sys32_sigsuspend_glue:
434 llgfr %r4,%r4 # unsigned long
435 lgr %r5,%r4 # move mask back
436 lgfr %r3,%r3 # int
437 lgr %r4,%r3 # move history1 parameter
438 lgfr %r2,%r2 # int
439 lgr %r3,%r2 # move history0 parameter
440 la %r2,SP_PTREGS(%r15) # load pt_regs as first parameter
441 la %r14,6(%r14) # skip store of return value
442 jg sys32_sigsuspend # branch to sys32_sigsuspend
443#endif
444
445sys_rt_sigsuspend_glue:
446 lgr %r4,%r3 # move sigsetsize parameter
447 lgr %r3,%r2 # move unewset parameter
448 la %r2,SP_PTREGS(%r15) # load pt_regs as first parameter
449 la %r14,6(%r14) # skip store of return value
450 jg sys_rt_sigsuspend # branch to sys_rt_sigsuspend
451
452#ifdef CONFIG_COMPAT
453sys32_rt_sigsuspend_glue:
454 llgfr %r3,%r3 # size_t
455 lgr %r4,%r3 # move sigsetsize parameter
456 llgtr %r2,%r2 # sigset_emu31_t *
457 lgr %r3,%r2 # move unewset parameter
458 la %r2,SP_PTREGS(%r15) # load pt_regs as first parameter
459 la %r14,6(%r14) # skip store of return value
460 jg sys32_rt_sigsuspend # branch to sys32_rt_sigsuspend
461#endif
462
463sys_sigaltstack_glue: 416sys_sigaltstack_glue:
464 la %r4,SP_PTREGS(%r15) # load pt_regs as parameter 417 la %r4,SP_PTREGS(%r15) # load pt_regs as parameter
465 jg sys_sigaltstack # branch to sys_sigreturn 418 jg sys_sigaltstack # branch to sys_sigreturn
@@ -646,15 +599,16 @@ io_work:
646 lgr %r15,%r1 599 lgr %r15,%r1
647# 600#
648# One of the work bits is on. Find out which one. 601# One of the work bits is on. Find out which one.
649# Checked are: _TIF_SIGPENDING, _TIF_NEED_RESCHED and _TIF_MCCK_PENDING 602# Checked are: _TIF_SIGPENDING, _TIF_RESTORE_SIGPENDING, _TIF_NEED_RESCHED
603# and _TIF_MCCK_PENDING
650# 604#
651io_work_loop: 605io_work_loop:
652 tm __TI_flags+7(%r9),_TIF_MCCK_PENDING 606 tm __TI_flags+7(%r9),_TIF_MCCK_PENDING
653 jo io_mcck_pending 607 jo io_mcck_pending
654 tm __TI_flags+7(%r9),_TIF_NEED_RESCHED 608 tm __TI_flags+7(%r9),_TIF_NEED_RESCHED
655 jo io_reschedule 609 jo io_reschedule
656 tm __TI_flags+7(%r9),_TIF_SIGPENDING 610 tm __TI_flags+7(%r9),(_TIF_SIGPENDING | _TIF_RESTORE_SIGMASK)
657 jo io_sigpending 611 jnz io_sigpending
658 j io_leave 612 j io_leave
659 613
660# 614#
@@ -676,12 +630,11 @@ io_reschedule:
676 j io_work_loop 630 j io_work_loop
677 631
678# 632#
679# _TIF_SIGPENDING is set, call do_signal 633# _TIF_SIGPENDING or _TIF_RESTORE_SIGMASK is set, call do_signal
680# 634#
681io_sigpending: 635io_sigpending:
682 stosm __SF_EMPTY(%r15),0x03 # reenable interrupts 636 stosm __SF_EMPTY(%r15),0x03 # reenable interrupts
683 la %r2,SP_PTREGS(%r15) # load pt_regs 637 la %r2,SP_PTREGS(%r15) # load pt_regs
684 slgr %r3,%r3 # clear *oldset
685 brasl %r14,do_signal # call do_signal 638 brasl %r14,do_signal # call do_signal
686 stnsm __SF_EMPTY(%r15),0xfc # disable I/O and ext. interrupts 639 stnsm __SF_EMPTY(%r15),0xfc # disable I/O and ext. interrupts
687 j io_work_loop 640 j io_work_loop
diff --git a/arch/s390/kernel/machine_kexec.c b/arch/s390/kernel/machine_kexec.c
index f0ed5c642c..bad81b5832 100644
--- a/arch/s390/kernel/machine_kexec.c
+++ b/arch/s390/kernel/machine_kexec.c
@@ -12,15 +12,16 @@
12 * on the S390 architecture. 12 * on the S390 architecture.
13 */ 13 */
14 14
15#include <asm/cio.h>
16#include <asm/setup.h>
17#include <linux/device.h> 15#include <linux/device.h>
18#include <linux/mm.h> 16#include <linux/mm.h>
19#include <linux/kexec.h> 17#include <linux/kexec.h>
20#include <linux/delay.h> 18#include <linux/delay.h>
19#include <asm/cio.h>
20#include <asm/setup.h>
21#include <asm/pgtable.h> 21#include <asm/pgtable.h>
22#include <asm/pgalloc.h> 22#include <asm/pgalloc.h>
23#include <asm/system.h> 23#include <asm/system.h>
24#include <asm/smp.h>
24 25
25static void kexec_halt_all_cpus(void *); 26static void kexec_halt_all_cpus(void *);
26 27
diff --git a/arch/s390/kernel/process.c b/arch/s390/kernel/process.c
index 008c74526f..da6fbae8df 100644
--- a/arch/s390/kernel/process.c
+++ b/arch/s390/kernel/process.c
@@ -128,8 +128,10 @@ void default_idle(void)
128 __ctl_set_bit(8, 15); 128 __ctl_set_bit(8, 15);
129 129
130#ifdef CONFIG_HOTPLUG_CPU 130#ifdef CONFIG_HOTPLUG_CPU
131 if (cpu_is_offline(cpu)) 131 if (cpu_is_offline(cpu)) {
132 preempt_enable_no_resched();
132 cpu_die(); 133 cpu_die();
134 }
133#endif 135#endif
134 136
135 local_mcck_disable(); 137 local_mcck_disable();
diff --git a/arch/s390/kernel/setup.c b/arch/s390/kernel/setup.c
index de87842674..24f62f16c0 100644
--- a/arch/s390/kernel/setup.c
+++ b/arch/s390/kernel/setup.c
@@ -600,6 +600,7 @@ setup_arch(char **cmdline_p)
600 init_mm.brk = (unsigned long) &_end; 600 init_mm.brk = (unsigned long) &_end;
601 601
602 parse_cmdline_early(cmdline_p); 602 parse_cmdline_early(cmdline_p);
603 parse_early_param();
603 604
604 setup_memory(); 605 setup_memory();
605 setup_resources(); 606 setup_resources();
@@ -607,6 +608,7 @@ setup_arch(char **cmdline_p)
607 608
608 cpu_init(); 609 cpu_init();
609 __cpu_logical_map[0] = S390_lowcore.cpu_data.cpu_addr; 610 __cpu_logical_map[0] = S390_lowcore.cpu_data.cpu_addr;
611 smp_setup_cpu_possible_map();
610 612
611 /* 613 /*
612 * Create kernel page tables and switch to virtual addressing. 614 * Create kernel page tables and switch to virtual addressing.
diff --git a/arch/s390/kernel/signal.c b/arch/s390/kernel/signal.c
index 6ae4a77270..ae1927e48c 100644
--- a/arch/s390/kernel/signal.c
+++ b/arch/s390/kernel/signal.c
@@ -1,8 +1,7 @@
1/* 1/*
2 * arch/s390/kernel/signal.c 2 * arch/s390/kernel/signal.c
3 * 3 *
4 * S390 version 4 * Copyright (C) IBM Corp. 1999,2006
5 * Copyright (C) 1999,2000 IBM Deutschland Entwicklung GmbH, IBM Corporation
6 * Author(s): Denis Joseph Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com) 5 * Author(s): Denis Joseph Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com)
7 * 6 *
8 * Based on Intel version 7 * Based on Intel version
@@ -51,60 +50,24 @@ typedef struct
51 struct ucontext uc; 50 struct ucontext uc;
52} rt_sigframe; 51} rt_sigframe;
53 52
54int do_signal(struct pt_regs *regs, sigset_t *oldset);
55
56/* 53/*
57 * Atomically swap in the new signal mask, and wait for a signal. 54 * Atomically swap in the new signal mask, and wait for a signal.
58 */ 55 */
59asmlinkage int 56asmlinkage int
60sys_sigsuspend(struct pt_regs * regs, int history0, int history1, 57sys_sigsuspend(int history0, int history1, old_sigset_t mask)
61 old_sigset_t mask)
62{ 58{
63 sigset_t saveset;
64
65 mask &= _BLOCKABLE; 59 mask &= _BLOCKABLE;
66 spin_lock_irq(&current->sighand->siglock); 60 spin_lock_irq(&current->sighand->siglock);
67 saveset = current->blocked; 61 current->saved_sigmask = current->blocked;
68 siginitset(&current->blocked, mask); 62 siginitset(&current->blocked, mask);
69 recalc_sigpending(); 63 recalc_sigpending();
70 spin_unlock_irq(&current->sighand->siglock); 64 spin_unlock_irq(&current->sighand->siglock);
71 regs->gprs[2] = -EINTR;
72
73 while (1) {
74 set_current_state(TASK_INTERRUPTIBLE);
75 schedule();
76 if (do_signal(regs, &saveset))
77 return -EINTR;
78 }
79}
80
81asmlinkage long
82sys_rt_sigsuspend(struct pt_regs *regs, sigset_t __user *unewset,
83 size_t sigsetsize)
84{
85 sigset_t saveset, newset;
86 65
87 /* XXX: Don't preclude handling different sized sigset_t's. */ 66 current->state = TASK_INTERRUPTIBLE;
88 if (sigsetsize != sizeof(sigset_t)) 67 schedule();
89 return -EINVAL; 68 set_thread_flag(TIF_RESTORE_SIGMASK);
90 69
91 if (copy_from_user(&newset, unewset, sizeof(newset))) 70 return -ERESTARTNOHAND;
92 return -EFAULT;
93 sigdelsetmask(&newset, ~_BLOCKABLE);
94
95 spin_lock_irq(&current->sighand->siglock);
96 saveset = current->blocked;
97 current->blocked = newset;
98 recalc_sigpending();
99 spin_unlock_irq(&current->sighand->siglock);
100 regs->gprs[2] = -EINTR;
101
102 while (1) {
103 set_current_state(TASK_INTERRUPTIBLE);
104 schedule();
105 if (do_signal(regs, &saveset))
106 return -EINTR;
107 }
108} 71}
109 72
110asmlinkage long 73asmlinkage long
@@ -306,8 +269,8 @@ static inline int map_signal(int sig)
306 return sig; 269 return sig;
307} 270}
308 271
309static void setup_frame(int sig, struct k_sigaction *ka, 272static int setup_frame(int sig, struct k_sigaction *ka,
310 sigset_t *set, struct pt_regs * regs) 273 sigset_t *set, struct pt_regs * regs)
311{ 274{
312 sigframe __user *frame; 275 sigframe __user *frame;
313 276
@@ -355,13 +318,14 @@ static void setup_frame(int sig, struct k_sigaction *ka,
355 /* Place signal number on stack to allow backtrace from handler. */ 318 /* Place signal number on stack to allow backtrace from handler. */
356 if (__put_user(regs->gprs[2], (int __user *) &frame->signo)) 319 if (__put_user(regs->gprs[2], (int __user *) &frame->signo))
357 goto give_sigsegv; 320 goto give_sigsegv;
358 return; 321 return 0;
359 322
360give_sigsegv: 323give_sigsegv:
361 force_sigsegv(sig, current); 324 force_sigsegv(sig, current);
325 return -EFAULT;
362} 326}
363 327
364static void setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, 328static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
365 sigset_t *set, struct pt_regs * regs) 329 sigset_t *set, struct pt_regs * regs)
366{ 330{
367 int err = 0; 331 int err = 0;
@@ -409,32 +373,39 @@ static void setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
409 regs->gprs[2] = map_signal(sig); 373 regs->gprs[2] = map_signal(sig);
410 regs->gprs[3] = (unsigned long) &frame->info; 374 regs->gprs[3] = (unsigned long) &frame->info;
411 regs->gprs[4] = (unsigned long) &frame->uc; 375 regs->gprs[4] = (unsigned long) &frame->uc;
412 return; 376 return 0;
413 377
414give_sigsegv: 378give_sigsegv:
415 force_sigsegv(sig, current); 379 force_sigsegv(sig, current);
380 return -EFAULT;
416} 381}
417 382
418/* 383/*
419 * OK, we're invoking a handler 384 * OK, we're invoking a handler
420 */ 385 */
421 386
422static void 387static int
423handle_signal(unsigned long sig, struct k_sigaction *ka, 388handle_signal(unsigned long sig, struct k_sigaction *ka,
424 siginfo_t *info, sigset_t *oldset, struct pt_regs * regs) 389 siginfo_t *info, sigset_t *oldset, struct pt_regs * regs)
425{ 390{
391 int ret;
392
426 /* Set up the stack frame */ 393 /* Set up the stack frame */
427 if (ka->sa.sa_flags & SA_SIGINFO) 394 if (ka->sa.sa_flags & SA_SIGINFO)
428 setup_rt_frame(sig, ka, info, oldset, regs); 395 ret = setup_rt_frame(sig, ka, info, oldset, regs);
429 else 396 else
430 setup_frame(sig, ka, oldset, regs); 397 ret = setup_frame(sig, ka, oldset, regs);
398
399 if (ret == 0) {
400 spin_lock_irq(&current->sighand->siglock);
401 sigorsets(&current->blocked,&current->blocked,&ka->sa.sa_mask);
402 if (!(ka->sa.sa_flags & SA_NODEFER))
403 sigaddset(&current->blocked,sig);
404 recalc_sigpending();
405 spin_unlock_irq(&current->sighand->siglock);
406 }
431 407
432 spin_lock_irq(&current->sighand->siglock); 408 return ret;
433 sigorsets(&current->blocked,&current->blocked,&ka->sa.sa_mask);
434 if (!(ka->sa.sa_flags & SA_NODEFER))
435 sigaddset(&current->blocked,sig);
436 recalc_sigpending();
437 spin_unlock_irq(&current->sighand->siglock);
438} 409}
439 410
440/* 411/*
@@ -446,12 +417,13 @@ handle_signal(unsigned long sig, struct k_sigaction *ka,
446 * the kernel can handle, and then we build all the user-level signal handling 417 * the kernel can handle, and then we build all the user-level signal handling
447 * stack-frames in one go after that. 418 * stack-frames in one go after that.
448 */ 419 */
449int do_signal(struct pt_regs *regs, sigset_t *oldset) 420void do_signal(struct pt_regs *regs)
450{ 421{
451 unsigned long retval = 0, continue_addr = 0, restart_addr = 0; 422 unsigned long retval = 0, continue_addr = 0, restart_addr = 0;
452 siginfo_t info; 423 siginfo_t info;
453 int signr; 424 int signr;
454 struct k_sigaction ka; 425 struct k_sigaction ka;
426 sigset_t *oldset;
455 427
456 /* 428 /*
457 * We want the common case to go fast, which 429 * We want the common case to go fast, which
@@ -460,9 +432,11 @@ int do_signal(struct pt_regs *regs, sigset_t *oldset)
460 * if so. 432 * if so.
461 */ 433 */
462 if (!user_mode(regs)) 434 if (!user_mode(regs))
463 return 1; 435 return;
464 436
465 if (!oldset) 437 if (test_thread_flag(TIF_RESTORE_SIGMASK))
438 oldset = &current->saved_sigmask;
439 else
466 oldset = &current->blocked; 440 oldset = &current->blocked;
467 441
468 /* Are we from a system call? */ 442 /* Are we from a system call? */
@@ -473,12 +447,14 @@ int do_signal(struct pt_regs *regs, sigset_t *oldset)
473 447
474 /* Prepare for system call restart. We do this here so that a 448 /* Prepare for system call restart. We do this here so that a
475 debugger will see the already changed PSW. */ 449 debugger will see the already changed PSW. */
476 if (retval == -ERESTARTNOHAND || 450 switch (retval) {
477 retval == -ERESTARTSYS || 451 case -ERESTARTNOHAND:
478 retval == -ERESTARTNOINTR) { 452 case -ERESTARTSYS:
453 case -ERESTARTNOINTR:
479 regs->gprs[2] = regs->orig_gpr2; 454 regs->gprs[2] = regs->orig_gpr2;
480 regs->psw.addr = restart_addr; 455 regs->psw.addr = restart_addr;
481 } else if (retval == -ERESTART_RESTARTBLOCK) { 456 break;
457 case -ERESTART_RESTARTBLOCK:
482 regs->gprs[2] = -EINTR; 458 regs->gprs[2] = -EINTR;
483 } 459 }
484 } 460 }
@@ -503,17 +479,38 @@ int do_signal(struct pt_regs *regs, sigset_t *oldset)
503 /* Whee! Actually deliver the signal. */ 479 /* Whee! Actually deliver the signal. */
504#ifdef CONFIG_COMPAT 480#ifdef CONFIG_COMPAT
505 if (test_thread_flag(TIF_31BIT)) { 481 if (test_thread_flag(TIF_31BIT)) {
506 extern void handle_signal32(unsigned long sig, 482 extern int handle_signal32(unsigned long sig,
507 struct k_sigaction *ka, 483 struct k_sigaction *ka,
508 siginfo_t *info, 484 siginfo_t *info,
509 sigset_t *oldset, 485 sigset_t *oldset,
510 struct pt_regs *regs); 486 struct pt_regs *regs);
511 handle_signal32(signr, &ka, &info, oldset, regs); 487 if (handle_signal32(
512 return 1; 488 signr, &ka, &info, oldset, regs) == 0) {
489 if (test_thread_flag(TIF_RESTORE_SIGMASK))
490 clear_thread_flag(TIF_RESTORE_SIGMASK);
491 }
492 return;
513 } 493 }
514#endif 494#endif
515 handle_signal(signr, &ka, &info, oldset, regs); 495 if (handle_signal(signr, &ka, &info, oldset, regs) == 0) {
516 return 1; 496 /*
497 * A signal was successfully delivered; the saved
498 * sigmask will have been stored in the signal frame,
499 * and will be restored by sigreturn, so we can simply
500 * clear the TIF_RESTORE_SIGMASK flag.
501 */
502 if (test_thread_flag(TIF_RESTORE_SIGMASK))
503 clear_thread_flag(TIF_RESTORE_SIGMASK);
504 }
505 return;
506 }
507
508 /*
509 * If there's no signal to deliver, we just put the saved sigmask back.
510 */
511 if (test_thread_flag(TIF_RESTORE_SIGMASK)) {
512 clear_thread_flag(TIF_RESTORE_SIGMASK);
513 sigprocmask(SIG_SETMASK, &current->saved_sigmask, NULL);
517 } 514 }
518 515
519 /* Restart a different system call. */ 516 /* Restart a different system call. */
@@ -522,5 +519,4 @@ int do_signal(struct pt_regs *regs, sigset_t *oldset)
522 regs->gprs[2] = __NR_restart_syscall; 519 regs->gprs[2] = __NR_restart_syscall;
523 set_thread_flag(TIF_RESTART_SVC); 520 set_thread_flag(TIF_RESTART_SVC);
524 } 521 }
525 return 0;
526} 522}
diff --git a/arch/s390/kernel/smp.c b/arch/s390/kernel/smp.c
index cbfcfd02a4..7dbe00c76c 100644
--- a/arch/s390/kernel/smp.c
+++ b/arch/s390/kernel/smp.c
@@ -1,8 +1,7 @@
1/* 1/*
2 * arch/s390/kernel/smp.c 2 * arch/s390/kernel/smp.c
3 * 3 *
4 * S390 version 4 * Copyright (C) IBM Corp. 1999,2006
5 * Copyright (C) 1999,2000 IBM Deutschland Entwicklung GmbH, IBM Corporation
6 * Author(s): Denis Joseph Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com), 5 * Author(s): Denis Joseph Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com),
7 * Martin Schwidefsky (schwidefsky@de.ibm.com) 6 * Martin Schwidefsky (schwidefsky@de.ibm.com)
8 * Heiko Carstens (heiko.carstens@de.ibm.com) 7 * Heiko Carstens (heiko.carstens@de.ibm.com)
@@ -41,8 +40,6 @@
41#include <asm/cpcmd.h> 40#include <asm/cpcmd.h>
42#include <asm/tlbflush.h> 41#include <asm/tlbflush.h>
43 42
44/* prototypes */
45
46extern volatile int __cpu_logical_map[]; 43extern volatile int __cpu_logical_map[];
47 44
48/* 45/*
@@ -51,13 +48,11 @@ extern volatile int __cpu_logical_map[];
51 48
52struct _lowcore *lowcore_ptr[NR_CPUS]; 49struct _lowcore *lowcore_ptr[NR_CPUS];
53 50
54cpumask_t cpu_online_map; 51cpumask_t cpu_online_map = CPU_MASK_NONE;
55cpumask_t cpu_possible_map; 52cpumask_t cpu_possible_map = CPU_MASK_NONE;
56 53
57static struct task_struct *current_set[NR_CPUS]; 54static struct task_struct *current_set[NR_CPUS];
58 55
59EXPORT_SYMBOL(cpu_online_map);
60
61/* 56/*
62 * Reboot, halt and power_off routines for SMP. 57 * Reboot, halt and power_off routines for SMP.
63 */ 58 */
@@ -490,10 +485,10 @@ void smp_ctl_clear_bit(int cr, int bit) {
490 * Lets check how many CPUs we have. 485 * Lets check how many CPUs we have.
491 */ 486 */
492 487
493void 488static unsigned int
494__init smp_check_cpus(unsigned int max_cpus) 489__init smp_count_cpus(void)
495{ 490{
496 int cpu, num_cpus; 491 unsigned int cpu, num_cpus;
497 __u16 boot_cpu_addr; 492 __u16 boot_cpu_addr;
498 493
499 /* 494 /*
@@ -503,22 +498,20 @@ __init smp_check_cpus(unsigned int max_cpus)
503 boot_cpu_addr = S390_lowcore.cpu_data.cpu_addr; 498 boot_cpu_addr = S390_lowcore.cpu_data.cpu_addr;
504 current_thread_info()->cpu = 0; 499 current_thread_info()->cpu = 0;
505 num_cpus = 1; 500 num_cpus = 1;
506 for (cpu = 0; cpu <= 65535 && num_cpus < max_cpus; cpu++) { 501 for (cpu = 0; cpu <= 65535; cpu++) {
507 if ((__u16) cpu == boot_cpu_addr) 502 if ((__u16) cpu == boot_cpu_addr)
508 continue; 503 continue;
509 __cpu_logical_map[num_cpus] = (__u16) cpu; 504 __cpu_logical_map[1] = (__u16) cpu;
510 if (signal_processor(num_cpus, sigp_sense) == 505 if (signal_processor(1, sigp_sense) ==
511 sigp_not_operational) 506 sigp_not_operational)
512 continue; 507 continue;
513 cpu_set(num_cpus, cpu_present_map);
514 num_cpus++; 508 num_cpus++;
515 } 509 }
516 510
517 for (cpu = 1; cpu < max_cpus; cpu++)
518 cpu_set(cpu, cpu_possible_map);
519
520 printk("Detected %d CPU's\n",(int) num_cpus); 511 printk("Detected %d CPU's\n",(int) num_cpus);
521 printk("Boot cpu address %2X\n", boot_cpu_addr); 512 printk("Boot cpu address %2X\n", boot_cpu_addr);
513
514 return num_cpus;
522} 515}
523 516
524/* 517/*
@@ -679,6 +672,44 @@ __cpu_up(unsigned int cpu)
679 return 0; 672 return 0;
680} 673}
681 674
675static unsigned int __initdata additional_cpus;
676static unsigned int __initdata possible_cpus;
677
678void __init smp_setup_cpu_possible_map(void)
679{
680 unsigned int phy_cpus, pos_cpus, cpu;
681
682 phy_cpus = smp_count_cpus();
683 pos_cpus = min(phy_cpus + additional_cpus, (unsigned int) NR_CPUS);
684
685 if (possible_cpus)
686 pos_cpus = min(possible_cpus, (unsigned int) NR_CPUS);
687
688 for (cpu = 0; cpu < pos_cpus; cpu++)
689 cpu_set(cpu, cpu_possible_map);
690
691 phy_cpus = min(phy_cpus, pos_cpus);
692
693 for (cpu = 0; cpu < phy_cpus; cpu++)
694 cpu_set(cpu, cpu_present_map);
695}
696
697#ifdef CONFIG_HOTPLUG_CPU
698
699static int __init setup_additional_cpus(char *s)
700{
701 additional_cpus = simple_strtoul(s, NULL, 0);
702 return 0;
703}
704early_param("additional_cpus", setup_additional_cpus);
705
706static int __init setup_possible_cpus(char *s)
707{
708 possible_cpus = simple_strtoul(s, NULL, 0);
709 return 0;
710}
711early_param("possible_cpus", setup_possible_cpus);
712
682int 713int
683__cpu_disable(void) 714__cpu_disable(void)
684{ 715{
@@ -747,6 +778,8 @@ cpu_die(void)
747 for(;;); 778 for(;;);
748} 779}
749 780
781#endif /* CONFIG_HOTPLUG_CPU */
782
750/* 783/*
751 * Cycle through the processors and setup structures. 784 * Cycle through the processors and setup structures.
752 */ 785 */
@@ -760,7 +793,6 @@ void __init smp_prepare_cpus(unsigned int max_cpus)
760 /* request the 0x1201 emergency signal external interrupt */ 793 /* request the 0x1201 emergency signal external interrupt */
761 if (register_external_interrupt(0x1201, do_ext_call_interrupt) != 0) 794 if (register_external_interrupt(0x1201, do_ext_call_interrupt) != 0)
762 panic("Couldn't request external interrupt 0x1201"); 795 panic("Couldn't request external interrupt 0x1201");
763 smp_check_cpus(max_cpus);
764 memset(lowcore_ptr,0,sizeof(lowcore_ptr)); 796 memset(lowcore_ptr,0,sizeof(lowcore_ptr));
765 /* 797 /*
766 * Initialize prefix pages and stacks for all possible cpus 798 * Initialize prefix pages and stacks for all possible cpus
@@ -809,8 +841,6 @@ void __devinit smp_prepare_boot_cpu(void)
809 BUG_ON(smp_processor_id() != 0); 841 BUG_ON(smp_processor_id() != 0);
810 842
811 cpu_set(0, cpu_online_map); 843 cpu_set(0, cpu_online_map);
812 cpu_set(0, cpu_present_map);
813 cpu_set(0, cpu_possible_map);
814 S390_lowcore.percpu_offset = __per_cpu_offset[0]; 844 S390_lowcore.percpu_offset = __per_cpu_offset[0];
815 current_set[0] = current; 845 current_set[0] = current;
816} 846}
@@ -849,6 +879,7 @@ static int __init topology_init(void)
849 879
850subsys_initcall(topology_init); 880subsys_initcall(topology_init);
851 881
882EXPORT_SYMBOL(cpu_online_map);
852EXPORT_SYMBOL(cpu_possible_map); 883EXPORT_SYMBOL(cpu_possible_map);
853EXPORT_SYMBOL(lowcore_ptr); 884EXPORT_SYMBOL(lowcore_ptr);
854EXPORT_SYMBOL(smp_ctl_set_bit); 885EXPORT_SYMBOL(smp_ctl_set_bit);
diff --git a/arch/s390/kernel/sys_s390.c b/arch/s390/kernel/sys_s390.c
index 6a63553493..e351780bb6 100644
--- a/arch/s390/kernel/sys_s390.c
+++ b/arch/s390/kernel/sys_s390.c
@@ -122,8 +122,8 @@ out:
122#ifndef CONFIG_64BIT 122#ifndef CONFIG_64BIT
123struct sel_arg_struct { 123struct sel_arg_struct {
124 unsigned long n; 124 unsigned long n;
125 fd_set *inp, *outp, *exp; 125 fd_set __user *inp, *outp, *exp;
126 struct timeval *tvp; 126 struct timeval __user *tvp;
127}; 127};
128 128
129asmlinkage long old_select(struct sel_arg_struct __user *arg) 129asmlinkage long old_select(struct sel_arg_struct __user *arg)
diff --git a/arch/s390/kernel/syscalls.S b/arch/s390/kernel/syscalls.S
index 426d7cafda..7c88d85c35 100644
--- a/arch/s390/kernel/syscalls.S
+++ b/arch/s390/kernel/syscalls.S
@@ -80,7 +80,7 @@ NI_SYSCALL /* old sgetmask syscall*/
80NI_SYSCALL /* old ssetmask syscall*/ 80NI_SYSCALL /* old ssetmask syscall*/
81SYSCALL(sys_setreuid16,sys_ni_syscall,sys32_setreuid16_wrapper) /* old setreuid16 syscall */ 81SYSCALL(sys_setreuid16,sys_ni_syscall,sys32_setreuid16_wrapper) /* old setreuid16 syscall */
82SYSCALL(sys_setregid16,sys_ni_syscall,sys32_setregid16_wrapper) /* old setregid16 syscall */ 82SYSCALL(sys_setregid16,sys_ni_syscall,sys32_setregid16_wrapper) /* old setregid16 syscall */
83SYSCALL(sys_sigsuspend_glue,sys_sigsuspend_glue,sys32_sigsuspend_glue) 83SYSCALL(sys_sigsuspend,sys_sigsuspend,sys_sigsuspend_wrapper)
84SYSCALL(sys_sigpending,sys_sigpending,compat_sys_sigpending_wrapper) 84SYSCALL(sys_sigpending,sys_sigpending,compat_sys_sigpending_wrapper)
85SYSCALL(sys_sethostname,sys_sethostname,sys32_sethostname_wrapper) 85SYSCALL(sys_sethostname,sys_sethostname,sys32_sethostname_wrapper)
86SYSCALL(sys_setrlimit,sys_setrlimit,compat_sys_setrlimit_wrapper) /* 75 */ 86SYSCALL(sys_setrlimit,sys_setrlimit,compat_sys_setrlimit_wrapper) /* 75 */
@@ -187,7 +187,7 @@ SYSCALL(sys_rt_sigprocmask,sys_rt_sigprocmask,sys32_rt_sigprocmask_wrapper) /* 1
187SYSCALL(sys_rt_sigpending,sys_rt_sigpending,sys32_rt_sigpending_wrapper) 187SYSCALL(sys_rt_sigpending,sys_rt_sigpending,sys32_rt_sigpending_wrapper)
188SYSCALL(sys_rt_sigtimedwait,sys_rt_sigtimedwait,compat_sys_rt_sigtimedwait_wrapper) 188SYSCALL(sys_rt_sigtimedwait,sys_rt_sigtimedwait,compat_sys_rt_sigtimedwait_wrapper)
189SYSCALL(sys_rt_sigqueueinfo,sys_rt_sigqueueinfo,sys32_rt_sigqueueinfo_wrapper) 189SYSCALL(sys_rt_sigqueueinfo,sys_rt_sigqueueinfo,sys32_rt_sigqueueinfo_wrapper)
190SYSCALL(sys_rt_sigsuspend_glue,sys_rt_sigsuspend_glue,sys32_rt_sigsuspend_glue) 190SYSCALL(sys_rt_sigsuspend,sys_rt_sigsuspend,compat_sys_rt_sigsuspend_wrapper)
191SYSCALL(sys_pread64,sys_pread64,sys32_pread64_wrapper) /* 180 */ 191SYSCALL(sys_pread64,sys_pread64,sys32_pread64_wrapper) /* 180 */
192SYSCALL(sys_pwrite64,sys_pwrite64,sys32_pwrite64_wrapper) 192SYSCALL(sys_pwrite64,sys_pwrite64,sys32_pwrite64_wrapper)
193SYSCALL(sys_chown16,sys_ni_syscall,sys32_chown16_wrapper) /* old chown16 syscall */ 193SYSCALL(sys_chown16,sys_ni_syscall,sys32_chown16_wrapper) /* old chown16 syscall */
@@ -293,5 +293,22 @@ SYSCALL(sys_waitid,sys_waitid,compat_sys_waitid_wrapper)
293SYSCALL(sys_ioprio_set,sys_ioprio_set,sys_ioprio_set_wrapper) 293SYSCALL(sys_ioprio_set,sys_ioprio_set,sys_ioprio_set_wrapper)
294SYSCALL(sys_ioprio_get,sys_ioprio_get,sys_ioprio_get_wrapper) 294SYSCALL(sys_ioprio_get,sys_ioprio_get,sys_ioprio_get_wrapper)
295SYSCALL(sys_inotify_init,sys_inotify_init,sys_inotify_init) 295SYSCALL(sys_inotify_init,sys_inotify_init,sys_inotify_init)
296SYSCALL(sys_inotify_add_watch,sys_inotify_add_watch,sys_inotify_add_watch_wrapper) 296SYSCALL(sys_inotify_add_watch,sys_inotify_add_watch,sys_inotify_add_watch_wrapper) /* 285 */
297SYSCALL(sys_inotify_rm_watch,sys_inotify_rm_watch,sys_inotify_rm_watch_wrapper) 297SYSCALL(sys_inotify_rm_watch,sys_inotify_rm_watch,sys_inotify_rm_watch_wrapper)
298NI_SYSCALL /* 287 sys_migrate_pages */
299SYSCALL(sys_openat,sys_openat,compat_sys_openat_wrapper)
300SYSCALL(sys_mkdirat,sys_mkdirat,sys_mkdirat_wrapper)
301SYSCALL(sys_mknodat,sys_mknodat,sys_mknodat_wrapper) /* 290 */
302SYSCALL(sys_fchownat,sys_fchownat,sys_fchownat_wrapper)
303SYSCALL(sys_futimesat,sys_futimesat,compat_sys_futimesat_wrapper)
304SYSCALL(sys_fstatat64,sys_newfstatat,sys32_fstatat64_wrapper)
305SYSCALL(sys_unlinkat,sys_unlinkat,sys_unlinkat_wrapper)
306SYSCALL(sys_renameat,sys_renameat,sys_renameat_wrapper) /* 295 */
307SYSCALL(sys_linkat,sys_linkat,sys_linkat_wrapper)
308SYSCALL(sys_symlinkat,sys_symlinkat,sys_symlinkat_wrapper)
309SYSCALL(sys_readlinkat,sys_readlinkat,sys_readlinkat_wrapper)
310SYSCALL(sys_fchmodat,sys_fchmodat,sys_fchmodat_wrapper)
311SYSCALL(sys_faccessat,sys_faccessat,sys_faccessat_wrapper) /* 300 */
312SYSCALL(sys_pselect6,sys_pselect6,compat_sys_pselect6_wrapper)
313SYSCALL(sys_ppoll,sys_ppoll,compat_sys_ppoll_wrapper)
314SYSCALL(sys_unshare,sys_unshare,sys_unshare_wrapper)
diff --git a/arch/s390/kernel/time.c b/arch/s390/kernel/time.c
index 7c0fe152a1..fea043b69b 100644
--- a/arch/s390/kernel/time.c
+++ b/arch/s390/kernel/time.c
@@ -61,9 +61,18 @@ extern unsigned long wall_jiffies;
61 */ 61 */
62unsigned long long sched_clock(void) 62unsigned long long sched_clock(void)
63{ 63{
64 return ((get_clock() - jiffies_timer_cc) * 1000) >> 12; 64 return ((get_clock() - jiffies_timer_cc) * 125) >> 9;
65} 65}
66 66
67/*
68 * Monotonic_clock - returns # of nanoseconds passed since time_init()
69 */
70unsigned long long monotonic_clock(void)
71{
72 return sched_clock();
73}
74EXPORT_SYMBOL(monotonic_clock);
75
67void tod_to_timeval(__u64 todval, struct timespec *xtime) 76void tod_to_timeval(__u64 todval, struct timespec *xtime)
68{ 77{
69 unsigned long long sec; 78 unsigned long long sec;
diff --git a/arch/s390/kernel/traps.c b/arch/s390/kernel/traps.c
index 5d21e9e6e7..a46793beed 100644
--- a/arch/s390/kernel/traps.c
+++ b/arch/s390/kernel/traps.c
@@ -486,7 +486,7 @@ asmlinkage void illegal_op(struct pt_regs * regs, long interruption_code)
486 info.si_signo = signal; 486 info.si_signo = signal;
487 info.si_errno = 0; 487 info.si_errno = 0;
488 info.si_code = ILL_ILLOPC; 488 info.si_code = ILL_ILLOPC;
489 info.si_addr = (void *) location; 489 info.si_addr = (void __user *) location;
490 do_trap(interruption_code, signal, 490 do_trap(interruption_code, signal,
491 "illegal operation", regs, &info); 491 "illegal operation", regs, &info);
492 } 492 }
diff --git a/arch/s390/lib/Makefile b/arch/s390/lib/Makefile
index f20b51ff1d..e05d087a6e 100644
--- a/arch/s390/lib/Makefile
+++ b/arch/s390/lib/Makefile
@@ -6,4 +6,4 @@ EXTRA_AFLAGS := -traditional
6 6
7lib-y += delay.o string.o 7lib-y += delay.o string.o
8lib-y += $(if $(CONFIG_64BIT),uaccess64.o,uaccess.o) 8lib-y += $(if $(CONFIG_64BIT),uaccess64.o,uaccess.o)
9lib-$(CONFIG_SMP) += spinlock.o \ No newline at end of file 9lib-$(CONFIG_SMP) += spinlock.o
diff --git a/arch/s390/lib/delay.c b/arch/s390/lib/delay.c
index e96c35bdda..71f0a2fb30 100644
--- a/arch/s390/lib/delay.c
+++ b/arch/s390/lib/delay.c
@@ -30,7 +30,7 @@ void __delay(unsigned long loops)
30 */ 30 */
31 __asm__ __volatile__( 31 __asm__ __volatile__(
32 "0: brct %0,0b" 32 "0: brct %0,0b"
33 : /* no outputs */ : "r" (loops/2) ); 33 : /* no outputs */ : "r" ((loops/2) + 1));
34} 34}
35 35
36/* 36/*
diff --git a/arch/s390/lib/spinlock.c b/arch/s390/lib/spinlock.c
index 60f80a4eed..b9b7958a22 100644
--- a/arch/s390/lib/spinlock.c
+++ b/arch/s390/lib/spinlock.c
@@ -2,8 +2,7 @@
2 * arch/s390/lib/spinlock.c 2 * arch/s390/lib/spinlock.c
3 * Out of line spinlock code. 3 * Out of line spinlock code.
4 * 4 *
5 * S390 version 5 * Copyright (C) IBM Corp. 2004, 2006
6 * Copyright (C) 2004 IBM Deutschland Entwicklung GmbH, IBM Corporation
7 * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com) 6 * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com)
8 */ 7 */
9 8
@@ -44,6 +43,8 @@ _raw_spin_lock_wait(raw_spinlock_t *lp, unsigned int pc)
44 _diag44(); 43 _diag44();
45 count = spin_retry; 44 count = spin_retry;
46 } 45 }
46 if (__raw_spin_is_locked(lp))
47 continue;
47 if (_raw_compare_and_swap(&lp->lock, 0, pc) == 0) 48 if (_raw_compare_and_swap(&lp->lock, 0, pc) == 0)
48 return; 49 return;
49 } 50 }
@@ -56,6 +57,8 @@ _raw_spin_trylock_retry(raw_spinlock_t *lp, unsigned int pc)
56 int count = spin_retry; 57 int count = spin_retry;
57 58
58 while (count-- > 0) { 59 while (count-- > 0) {
60 if (__raw_spin_is_locked(lp))
61 continue;
59 if (_raw_compare_and_swap(&lp->lock, 0, pc) == 0) 62 if (_raw_compare_and_swap(&lp->lock, 0, pc) == 0)
60 return 1; 63 return 1;
61 } 64 }
@@ -74,6 +77,8 @@ _raw_read_lock_wait(raw_rwlock_t *rw)
74 _diag44(); 77 _diag44();
75 count = spin_retry; 78 count = spin_retry;
76 } 79 }
80 if (!__raw_read_can_lock(rw))
81 continue;
77 old = rw->lock & 0x7fffffffU; 82 old = rw->lock & 0x7fffffffU;
78 if (_raw_compare_and_swap(&rw->lock, old, old + 1) == old) 83 if (_raw_compare_and_swap(&rw->lock, old, old + 1) == old)
79 return; 84 return;
@@ -88,6 +93,8 @@ _raw_read_trylock_retry(raw_rwlock_t *rw)
88 int count = spin_retry; 93 int count = spin_retry;
89 94
90 while (count-- > 0) { 95 while (count-- > 0) {
96 if (!__raw_read_can_lock(rw))
97 continue;
91 old = rw->lock & 0x7fffffffU; 98 old = rw->lock & 0x7fffffffU;
92 if (_raw_compare_and_swap(&rw->lock, old, old + 1) == old) 99 if (_raw_compare_and_swap(&rw->lock, old, old + 1) == old)
93 return 1; 100 return 1;
@@ -106,6 +113,8 @@ _raw_write_lock_wait(raw_rwlock_t *rw)
106 _diag44(); 113 _diag44();
107 count = spin_retry; 114 count = spin_retry;
108 } 115 }
116 if (!__raw_write_can_lock(rw))
117 continue;
109 if (_raw_compare_and_swap(&rw->lock, 0, 0x80000000) == 0) 118 if (_raw_compare_and_swap(&rw->lock, 0, 0x80000000) == 0)
110 return; 119 return;
111 } 120 }
@@ -118,6 +127,8 @@ _raw_write_trylock_retry(raw_rwlock_t *rw)
118 int count = spin_retry; 127 int count = spin_retry;
119 128
120 while (count-- > 0) { 129 while (count-- > 0) {
130 if (!__raw_write_can_lock(rw))
131 continue;
121 if (_raw_compare_and_swap(&rw->lock, 0, 0x80000000) == 0) 132 if (_raw_compare_and_swap(&rw->lock, 0, 0x80000000) == 0)
122 return 1; 133 return 1;
123 } 134 }
diff --git a/arch/s390/lib/uaccess.S b/arch/s390/lib/uaccess.S
index 88fc94fe64..5d59e26250 100644
--- a/arch/s390/lib/uaccess.S
+++ b/arch/s390/lib/uaccess.S
@@ -198,12 +198,12 @@ __strnlen_user_asm:
1980: srst %r2,%r1 1980: srst %r2,%r1
199 jo 0b 199 jo 0b
200 sacf 0 200 sacf 0
201 jh 1f # \0 found in string ?
202 ahi %r2,1 # strnlen_user result includes the \0 201 ahi %r2,1 # strnlen_user result includes the \0
2031: slr %r2,%r3 202 # or return count+1 if \0 not found
203 slr %r2,%r3
204 br %r14 204 br %r14
2052: sacf 0 2052: sacf 0
206 lhi %r2,-EFAULT 206 slr %r2,%r2 # return 0 on exception
207 br %r14 207 br %r14
208 .section __ex_table,"a" 208 .section __ex_table,"a"
209 .long 0b,2b 209 .long 0b,2b
diff --git a/arch/s390/lib/uaccess64.S b/arch/s390/lib/uaccess64.S
index 50219786fc..19b41a33c2 100644
--- a/arch/s390/lib/uaccess64.S
+++ b/arch/s390/lib/uaccess64.S
@@ -194,12 +194,12 @@ __strnlen_user_asm:
1940: srst %r2,%r1 1940: srst %r2,%r1
195 jo 0b 195 jo 0b
196 sacf 0 196 sacf 0
197 jh 1f # \0 found in string ?
198 aghi %r2,1 # strnlen_user result includes the \0 197 aghi %r2,1 # strnlen_user result includes the \0
1991: slgr %r2,%r3 198 # or return count+1 if \0 not found
199 slgr %r2,%r3
200 br %r14 200 br %r14
2012: sacf 0 2012: sacf 0
202 lghi %r2,-EFAULT 202 slgr %r2,%r2 # return 0 on exception
203 br %r14 203 br %r14
204 .section __ex_table,"a" 204 .section __ex_table,"a"
205 .quad 0b,2b 205 .quad 0b,2b
diff --git a/arch/s390/mm/cmm.c b/arch/s390/mm/cmm.c
index 2d5cb13857..b075ab499d 100644
--- a/arch/s390/mm/cmm.c
+++ b/arch/s390/mm/cmm.c
@@ -42,8 +42,8 @@ static volatile long cmm_timed_pages_target = 0;
42static long cmm_timeout_pages = 0; 42static long cmm_timeout_pages = 0;
43static long cmm_timeout_seconds = 0; 43static long cmm_timeout_seconds = 0;
44 44
45static struct cmm_page_array *cmm_page_list = 0; 45static struct cmm_page_array *cmm_page_list = NULL;
46static struct cmm_page_array *cmm_timed_page_list = 0; 46static struct cmm_page_array *cmm_timed_page_list = NULL;
47 47
48static unsigned long cmm_thread_active = 0; 48static unsigned long cmm_thread_active = 0;
49static struct work_struct cmm_thread_starter; 49static struct work_struct cmm_thread_starter;
@@ -259,7 +259,7 @@ static struct ctl_table cmm_table[];
259 259
260static int 260static int
261cmm_pages_handler(ctl_table *ctl, int write, struct file *filp, 261cmm_pages_handler(ctl_table *ctl, int write, struct file *filp,
262 void *buffer, size_t *lenp, loff_t *ppos) 262 void __user *buffer, size_t *lenp, loff_t *ppos)
263{ 263{
264 char buf[16], *p; 264 char buf[16], *p;
265 long pages; 265 long pages;
@@ -300,7 +300,7 @@ cmm_pages_handler(ctl_table *ctl, int write, struct file *filp,
300 300
301static int 301static int
302cmm_timeout_handler(ctl_table *ctl, int write, struct file *filp, 302cmm_timeout_handler(ctl_table *ctl, int write, struct file *filp,
303 void *buffer, size_t *lenp, loff_t *ppos) 303 void __user *buffer, size_t *lenp, loff_t *ppos)
304{ 304{
305 char buf[64], *p; 305 char buf[64], *p;
306 long pages, seconds; 306 long pages, seconds;
@@ -419,7 +419,7 @@ cmm_init (void)
419#ifdef CONFIG_CMM_IUCV 419#ifdef CONFIG_CMM_IUCV
420 smsg_register_callback(SMSG_PREFIX, cmm_smsg_target); 420 smsg_register_callback(SMSG_PREFIX, cmm_smsg_target);
421#endif 421#endif
422 INIT_WORK(&cmm_thread_starter, (void *) cmm_start_thread, 0); 422 INIT_WORK(&cmm_thread_starter, (void *) cmm_start_thread, NULL);
423 init_waitqueue_head(&cmm_thread_wait); 423 init_waitqueue_head(&cmm_thread_wait);
424 init_timer(&cmm_timer); 424 init_timer(&cmm_timer);
425 return 0; 425 return 0;