From: Martin Schwidefsky Core s/390 changes: - Add -mbackchain to CFLAGS to prepare for gcc 3.4 with comes with a default setting of -mno-backchain - Add implementation of strcpy. - Pad bytes after string end in strncpy. - Fix __sem_update_count inline assembly for gcc 3.4. - Export smp_ptlb_all for tlb flushing in module code. - Fix sched_clock. - Remove the last KERNEL_VERSION #if in s390 code. - Add dummy implementation for missing dma_{alloc,free}_coherent. - Avoid cast of lvalue in idal_buffer_{from,to}_user. - Remove _exit definition from unistd.h. --- 25-akpm/arch/s390/Makefile | 1 + 25-akpm/arch/s390/kernel/s390_ksyms.c | 1 + 25-akpm/arch/s390/kernel/semaphore.c | 5 +++-- 25-akpm/arch/s390/kernel/smp.c | 1 + 25-akpm/arch/s390/kernel/time.c | 2 +- 25-akpm/arch/s390/lib/Makefile | 4 ++-- 25-akpm/arch/s390/lib/strcpy.S | 20 ++++++++++++++++++++ 25-akpm/arch/s390/lib/strcpy64.S | 20 ++++++++++++++++++++ 25-akpm/arch/s390/lib/strncpy.S | 9 +++++++-- 25-akpm/arch/s390/lib/strncpy64.S | 9 +++++++-- 25-akpm/arch/s390/math-emu/math.c | 1 - 25-akpm/include/asm-s390/byteorder.h | 2 +- 25-akpm/include/asm-s390/debug.h | 6 +----- 25-akpm/include/asm-s390/dma-mapping.h | 14 ++++++++++++++ 25-akpm/include/asm-s390/idals.h | 4 ++-- 25-akpm/include/asm-s390/unistd.h | 1 - 16 files changed, 81 insertions(+), 19 deletions(-) diff -puN arch/s390/kernel/s390_ksyms.c~s390-01-general-update arch/s390/kernel/s390_ksyms.c --- 25/arch/s390/kernel/s390_ksyms.c~s390-01-general-update Tue Feb 24 14:04:09 2004 +++ 25-akpm/arch/s390/kernel/s390_ksyms.c Tue Feb 24 14:04:09 2004 @@ -54,6 +54,7 @@ EXPORT_SYMBOL_NOVERS(strnlen); EXPORT_SYMBOL_NOVERS(strrchr); EXPORT_SYMBOL_NOVERS(strstr); EXPORT_SYMBOL_NOVERS(strpbrk); +EXPORT_SYMBOL_NOVERS(strcpy); /* * binfmt_elf loader diff -puN arch/s390/kernel/semaphore.c~s390-01-general-update arch/s390/kernel/semaphore.c --- 25/arch/s390/kernel/semaphore.c~s390-01-general-update Tue Feb 24 14:04:09 2004 +++ 25-akpm/arch/s390/kernel/semaphore.c Tue Feb 24 14:04:09 2004 @@ -33,8 +33,9 @@ static inline int __sem_update_count(str " cs %0,%1,0(%3)\n" " jl 0b\n" : "=&d" (old_val), "=&d" (new_val), - "+m" (sem->count) - : "a" (&sem->count), "d" (incr) : "cc" ); + "=m" (sem->count) + : "a" (&sem->count), "d" (incr), "m" (sem->count) + : "cc" ); return old_val; } diff -puN arch/s390/kernel/smp.c~s390-01-general-update arch/s390/kernel/smp.c --- 25/arch/s390/kernel/smp.c~s390-01-general-update Tue Feb 24 14:04:09 2004 +++ 25-akpm/arch/s390/kernel/smp.c Tue Feb 24 14:04:09 2004 @@ -350,6 +350,7 @@ void smp_ptlb_all(void) { on_each_cpu(smp_ptlb_callback, NULL, 0, 1); } +EXPORT_SYMBOL(smp_ptlb_all); #endif /* ! CONFIG_ARCH_S390X */ /* diff -puN arch/s390/kernel/time.c~s390-01-general-update arch/s390/kernel/time.c --- 25/arch/s390/kernel/time.c~s390-01-general-update Tue Feb 24 14:04:09 2004 +++ 25-akpm/arch/s390/kernel/time.c Tue Feb 24 14:04:09 2004 @@ -63,7 +63,7 @@ extern unsigned long wall_jiffies; */ unsigned long long sched_clock(void) { - return (get_clock() - jiffies_timer_cc) >> 2; + return ((get_clock() - jiffies_timer_cc) * 1000) >> 12; } void tod_to_timeval(__u64 todval, struct timespec *xtime) diff -puN arch/s390/lib/Makefile~s390-01-general-update arch/s390/lib/Makefile --- 25/arch/s390/lib/Makefile~s390-01-general-update Tue Feb 24 14:04:09 2004 +++ 25-akpm/arch/s390/lib/Makefile Tue Feb 24 14:04:09 2004 @@ -5,5 +5,5 @@ EXTRA_AFLAGS := -traditional lib-y += delay.o -lib-$(CONFIG_ARCH_S390_31) += memset.o strcmp.o strncpy.o uaccess.o -lib-$(CONFIG_ARCH_S390X) += memset64.o strcmp64.o strncpy64.o uaccess64.o +lib-$(CONFIG_ARCH_S390_31) += memset.o strcmp.o strcpy.o strncpy.o uaccess.o +lib-$(CONFIG_ARCH_S390X) += memset64.o strcmp64.o strcpy64.o strncpy64.o uaccess64.o diff -puN /dev/null arch/s390/lib/strcpy64.S --- /dev/null Thu Apr 11 07:25:15 2002 +++ 25-akpm/arch/s390/lib/strcpy64.S Tue Feb 24 14:04:09 2004 @@ -0,0 +1,20 @@ +/* + * arch/s390/kernel/strcpy.S + * S390 strcpy routine + * + * S390 version + * Copyright (C) 2004 IBM Deutschland Entwicklung GmbH, IBM Corporation + * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com), + */ + +/* + * R2 = address of destination + * R3 = address of source string + */ + .globl strcpy +strcpy: + sgr %r0,%r0 +0: mvst %r2,%r3 + jo 0b + br %r14 + diff -puN /dev/null arch/s390/lib/strcpy.S --- /dev/null Thu Apr 11 07:25:15 2002 +++ 25-akpm/arch/s390/lib/strcpy.S Tue Feb 24 14:04:09 2004 @@ -0,0 +1,20 @@ +/* + * arch/s390/kernel/strcpy.S + * S390 strcpy routine + * + * S390 version + * Copyright (C) 2004 IBM Deutschland Entwicklung GmbH, IBM Corporation + * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com), + */ + +/* + * R2 = address of destination + * R3 = address of source string + */ + .globl strcpy +strcpy: + sr %r0,%r0 +0: mvst %r2,%r3 + jo 0b + br %r14 + diff -puN arch/s390/lib/strncpy64.S~s390-01-general-update arch/s390/lib/strncpy64.S --- 25/arch/s390/lib/strncpy64.S~s390-01-general-update Tue Feb 24 14:04:09 2004 +++ 25-akpm/arch/s390/lib/strncpy64.S Tue Feb 24 14:04:09 2004 @@ -23,8 +23,13 @@ strncpy_loop: LA 3,1(3) STC 0,0(1) LA 1,1(1) - JZ strncpy_exit # ICM inserted a 0x00 + JZ strncpy_pad # ICM inserted a 0x00 BRCTG 4,strncpy_loop # R4 -= 1, jump to strncpy_loop if > 0 strncpy_exit: BR 14 - +strncpy_clear: + STC 0,0(1) + LA 1,1(1) +strncpy_pad: + BRCTG 4,strncpy_clear + BR 14 diff -puN arch/s390/lib/strncpy.S~s390-01-general-update arch/s390/lib/strncpy.S --- 25/arch/s390/lib/strncpy.S~s390-01-general-update Tue Feb 24 14:04:09 2004 +++ 25-akpm/arch/s390/lib/strncpy.S Tue Feb 24 14:04:09 2004 @@ -23,8 +23,13 @@ strncpy_loop: LA 3,1(3) STC 0,0(1) LA 1,1(1) - JZ strncpy_exit # ICM inserted a 0x00 + JZ strncpy_pad # ICM inserted a 0x00 BRCT 4,strncpy_loop # R4 -= 1, jump to strncpy_loop if > 0 strncpy_exit: BR 14 - +strncpy_clear: + STC 0,0(1) + LA 1,1(1) +strncpy_pad: + BRCT 4,strncpy_clear + BR 14 diff -puN arch/s390/Makefile~s390-01-general-update arch/s390/Makefile --- 25/arch/s390/Makefile~s390-01-general-update Tue Feb 24 14:04:09 2004 +++ 25-akpm/arch/s390/Makefile Tue Feb 24 14:04:09 2004 @@ -35,6 +35,7 @@ cflags-$(CONFIG_MARCH_Z990) += $(call ch CFLAGS += $(cflags-y) CFLAGS += $(call check_gcc,-finline-limit=10000,) CFLAGS += -pipe -fno-strength-reduce -Wno-sign-compare +CFLAGS += -mbackchain OBJCOPYFLAGS := -O binary LDFLAGS_vmlinux := -e start diff -puN arch/s390/math-emu/math.c~s390-01-general-update arch/s390/math-emu/math.c --- 25/arch/s390/math-emu/math.c~s390-01-general-update Tue Feb 24 14:04:09 2004 +++ 25-akpm/arch/s390/math-emu/math.c Tue Feb 24 14:04:09 2004 @@ -99,7 +99,6 @@ int sysctl_ieee_emulation_warnings=1; static void display_emulation_not_implemented(struct pt_regs *regs, char *instr) { - struct pt_regs *regs; __u16 *location; #ifdef CONFIG_SYSCTL diff -puN include/asm-s390/byteorder.h~s390-01-general-update include/asm-s390/byteorder.h --- 25/include/asm-s390/byteorder.h~s390-01-general-update Tue Feb 24 14:04:09 2004 +++ 25-akpm/include/asm-s390/byteorder.h Tue Feb 24 14:04:09 2004 @@ -67,7 +67,7 @@ static __inline__ __u32 ___arch__swab32( __asm__ __volatile__ ( " lrvr %0,%1" - : "=d" (result) : "d" (x), "m" (x) ); + : "=d" (result) : "d" (x) ); return result; #endif /* __s390x__ */ } diff -puN include/asm-s390/debug.h~s390-01-general-update include/asm-s390/debug.h --- 25/include/asm-s390/debug.h~s390-01-general-update Tue Feb 24 14:04:09 2004 +++ 25-akpm/include/asm-s390/debug.h Tue Feb 24 14:04:09 2004 @@ -35,11 +35,7 @@ struct __debug_entry{ #ifdef __KERNEL__ #include -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,3,0)) - #include -#else - #include -#endif /* LINUX_VERSION_CODE */ +#include #include #include #include diff -puN include/asm-s390/dma-mapping.h~s390-01-general-update include/asm-s390/dma-mapping.h --- 25/include/asm-s390/dma-mapping.h~s390-01-general-update Tue Feb 24 14:04:09 2004 +++ 25-akpm/include/asm-s390/dma-mapping.h Tue Feb 24 14:04:09 2004 @@ -8,4 +8,18 @@ #ifndef _ASM_DMA_MAPPING_H #define _ASM_DMA_MAPPING_H + +static inline void *dma_alloc_coherent(struct device *dev, size_t size, + dma_addr_t *dma_handle, int flag) +{ + BUG(); + return 0; +} + +static inline void dma_free_coherent(struct device *dev, size_t size, + void *vaddr, dma_addr_t dma_handle) +{ + BUG(); +} + #endif /* _ASM_DMA_MAPPING_H */ diff -puN include/asm-s390/idals.h~s390-01-general-update include/asm-s390/idals.h --- 25/include/asm-s390/idals.h~s390-01-general-update Tue Feb 24 14:04:09 2004 +++ 25-akpm/include/asm-s390/idals.h Tue Feb 24 14:04:09 2004 @@ -228,7 +228,7 @@ idal_buffer_to_user(struct idal_buffer * left = copy_to_user(to, ib->data[i], IDA_BLOCK_SIZE); if (left) return left + count - IDA_BLOCK_SIZE; - (addr_t) to += IDA_BLOCK_SIZE; + to = (void *) to + IDA_BLOCK_SIZE; count -= IDA_BLOCK_SIZE; } return copy_to_user(to, ib->data[i], count); @@ -248,7 +248,7 @@ idal_buffer_from_user(struct idal_buffer left = copy_from_user(ib->data[i], from, IDA_BLOCK_SIZE); if (left) return left + count - IDA_BLOCK_SIZE; - (addr_t) from += IDA_BLOCK_SIZE; + from = (void *) from + IDA_BLOCK_SIZE; count -= IDA_BLOCK_SIZE; } return copy_from_user(ib->data[i], from, count); diff -puN include/asm-s390/unistd.h~s390-01-general-update include/asm-s390/unistd.h --- 25/include/asm-s390/unistd.h~s390-01-general-update Tue Feb 24 14:04:09 2004 +++ 25-akpm/include/asm-s390/unistd.h Tue Feb 24 14:04:09 2004 @@ -533,7 +533,6 @@ static inline _syscall1(int,dup,int,fd) static inline _syscall3(int,execve,const char *,file,char **,argv,char **,envp) static inline _syscall3(int,open,const char *,file,int,flag,int,mode) static inline _syscall1(int,close,int,fd) -static inline _syscall1(int,_exit,int,exitcode) static inline _syscall2(long,stat,char *,filename,struct stat *,statbuf) static inline pid_t waitpid(int pid, int *wait_stat, int flags) _