Skip to content

Commit

Permalink
Merge tag 'sh-for-linus' of git://github.com/pmundt/linux-sh
Browse files Browse the repository at this point in the history
Pull SuperH fixes from Paul Mundt.

* tag 'sh-for-linus' of git://github.com/pmundt/linux-sh:
  sh: Kill off additional asm-generic wrappers.
  sh: Setup CROSS_COMPILE at the top
  sh: Fix up link time defsym warnings.
  sh: use the new generic strnlen_user() function
  sh: switch to generic strncpy_from_user().
  sh: Kill off last dead UBC header
  serial: sh-sci: Make probe fail for ports that exceed the maximum count
  serial: sh-sci: Fix probe error paths
  clocksource: sh_tmu: Use clockevents_config_and_register().
  clocksource: sh_tmu: Convert timer lock to raw spinlock.
  clocksource: sh_mtu2: Convert timer lock to raw spinlock.
  clocksource: sh_cmt: Convert timer lock to raw spinlock.
  bug.h: need linux/kernel.h for TAINT_WARN.
  sh: convert to kbuild asm-generic support.
  sh64: Fix up fallout from generic init_task conversion.
  sh: arch/sh/kernel/process.c needs asm/fpu.h for unlazy_fpu().
  • Loading branch information
torvalds committed Jun 13, 2012
2 parents c02feee + 380622e commit 790b9d4
Show file tree
Hide file tree
Showing 50 changed files with 153 additions and 386 deletions.
2 changes: 2 additions & 0 deletions arch/sh/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ config SUPERH
select GENERIC_SMP_IDLE_THREAD
select GENERIC_CLOCKEVENTS
select GENERIC_CMOS_UPDATE if SH_SH03 || SH_DREAMCAST
select GENERIC_STRNCPY_FROM_USER
select GENERIC_STRNLEN_USER
help
The SuperH is a RISC processor targeted for use in embedded systems
and consumer electronics; it was also used in the Sega Dreamcast
Expand Down
16 changes: 8 additions & 8 deletions arch/sh/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@
# License. See the file "COPYING" in the main directory of this archive
# for more details.
#
ifneq ($(SUBARCH),$(ARCH))
ifeq ($(CROSS_COMPILE),)
CROSS_COMPILE := $(call cc-cross-prefix, $(UTS_MACHINE)-linux- $(UTS_MACHINE)-linux-gnu- $(UTS_MACHINE)-unknown-linux-gnu-)
endif
endif

isa-y := any
isa-$(CONFIG_SH_DSP) := sh
isa-$(CONFIG_CPU_SH2) := sh2
Expand Down Expand Up @@ -106,19 +112,13 @@ LDFLAGS_vmlinux += --defsym phys_stext=_stext-$(CONFIG_PAGE_OFFSET) \
KBUILD_DEFCONFIG := cayman_defconfig
endif

ifneq ($(SUBARCH),$(ARCH))
ifeq ($(CROSS_COMPILE),)
CROSS_COMPILE := $(call cc-cross-prefix, $(UTS_MACHINE)-linux- $(UTS_MACHINE)-linux-gnu- $(UTS_MACHINE)-unknown-linux-gnu-)
endif
endif

ifdef CONFIG_CPU_LITTLE_ENDIAN
ld-bfd := elf32-$(UTS_MACHINE)-linux
LDFLAGS_vmlinux += --defsym 'jiffies=jiffies_64' --oformat $(ld-bfd)
LDFLAGS_vmlinux += --defsym jiffies=jiffies_64 --oformat $(ld-bfd)
LDFLAGS += -EL
else
ld-bfd := elf32-$(UTS_MACHINE)big-linux
LDFLAGS_vmlinux += --defsym 'jiffies=jiffies_64+4' --oformat $(ld-bfd)
LDFLAGS_vmlinux += --defsym jiffies=jiffies_64+4 --oformat $(ld-bfd)
LDFLAGS += -EB
endif

Expand Down
34 changes: 34 additions & 0 deletions arch/sh/include/asm/Kbuild
Original file line number Diff line number Diff line change
@@ -1,5 +1,39 @@
include include/asm-generic/Kbuild.asm

generic-y += bitsperlong.h
generic-y += cputime.h
generic-y += current.h
generic-y += delay.h
generic-y += div64.h
generic-y += emergency-restart.h
generic-y += errno.h
generic-y += fcntl.h
generic-y += ioctl.h
generic-y += ipcbuf.h
generic-y += irq_regs.h
generic-y += kvm_para.h
generic-y += local.h
generic-y += local64.h
generic-y += param.h
generic-y += parport.h
generic-y += percpu.h
generic-y += poll.h
generic-y += mman.h
generic-y += msgbuf.h
generic-y += resource.h
generic-y += scatterlist.h
generic-y += sembuf.h
generic-y += serial.h
generic-y += shmbuf.h
generic-y += siginfo.h
generic-y += sizes.h
generic-y += socket.h
generic-y += statfs.h
generic-y += termbits.h
generic-y += termios.h
generic-y += ucontext.h
generic-y += xor.h

header-y += cachectl.h
header-y += cpu-features.h
header-y += hw_breakpoint.h
Expand Down
1 change: 0 additions & 1 deletion arch/sh/include/asm/bitsperlong.h

This file was deleted.

6 changes: 0 additions & 6 deletions arch/sh/include/asm/cputime.h

This file was deleted.

1 change: 0 additions & 1 deletion arch/sh/include/asm/current.h

This file was deleted.

1 change: 0 additions & 1 deletion arch/sh/include/asm/delay.h

This file was deleted.

1 change: 0 additions & 1 deletion arch/sh/include/asm/div64.h

This file was deleted.

6 changes: 0 additions & 6 deletions arch/sh/include/asm/emergency-restart.h

This file was deleted.

6 changes: 0 additions & 6 deletions arch/sh/include/asm/errno.h

This file was deleted.

1 change: 0 additions & 1 deletion arch/sh/include/asm/fcntl.h

This file was deleted.

1 change: 0 additions & 1 deletion arch/sh/include/asm/ioctl.h

This file was deleted.

1 change: 0 additions & 1 deletion arch/sh/include/asm/ipcbuf.h

This file was deleted.

1 change: 0 additions & 1 deletion arch/sh/include/asm/irq_regs.h

This file was deleted.

1 change: 0 additions & 1 deletion arch/sh/include/asm/kvm_para.h

This file was deleted.

7 changes: 0 additions & 7 deletions arch/sh/include/asm/local.h

This file was deleted.

1 change: 0 additions & 1 deletion arch/sh/include/asm/local64.h

This file was deleted.

1 change: 0 additions & 1 deletion arch/sh/include/asm/mman.h

This file was deleted.

1 change: 0 additions & 1 deletion arch/sh/include/asm/msgbuf.h

This file was deleted.

1 change: 0 additions & 1 deletion arch/sh/include/asm/param.h

This file was deleted.

1 change: 0 additions & 1 deletion arch/sh/include/asm/parport.h

This file was deleted.

6 changes: 0 additions & 6 deletions arch/sh/include/asm/percpu.h

This file was deleted.

1 change: 0 additions & 1 deletion arch/sh/include/asm/poll.h

This file was deleted.

6 changes: 0 additions & 6 deletions arch/sh/include/asm/resource.h

This file was deleted.

6 changes: 0 additions & 6 deletions arch/sh/include/asm/scatterlist.h

This file was deleted.

1 change: 0 additions & 1 deletion arch/sh/include/asm/sembuf.h

This file was deleted.

1 change: 0 additions & 1 deletion arch/sh/include/asm/serial.h

This file was deleted.

1 change: 0 additions & 1 deletion arch/sh/include/asm/shmbuf.h

This file was deleted.

6 changes: 0 additions & 6 deletions arch/sh/include/asm/siginfo.h

This file was deleted.

1 change: 0 additions & 1 deletion arch/sh/include/asm/sizes.h

This file was deleted.

1 change: 0 additions & 1 deletion arch/sh/include/asm/socket.h

This file was deleted.

6 changes: 0 additions & 6 deletions arch/sh/include/asm/statfs.h

This file was deleted.

1 change: 0 additions & 1 deletion arch/sh/include/asm/termbits.h

This file was deleted.

1 change: 0 additions & 1 deletion arch/sh/include/asm/termios.h

This file was deleted.

75 changes: 7 additions & 68 deletions arch/sh/include/asm/uaccess.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
(__chk_user_ptr(addr), \
__access_ok((unsigned long __force)(addr), (size)))

#define user_addr_max() (current_thread_info()->addr_limit.seg)

/*
* Uh, these should become the main single-value transfer routines ...
* They automatically use the right size if we just have the right
Expand Down Expand Up @@ -100,6 +102,11 @@ struct __large_struct { unsigned long buf[100]; };
# include "uaccess_64.h"
#endif

extern long strncpy_from_user(char *dest, const char __user *src, long count);

extern __must_check long strlen_user(const char __user *str);
extern __must_check long strnlen_user(const char __user *str, long n);

/* Generic arbitrary sized copy. */
/* Return the number of bytes NOT copied */
__kernel_size_t __copy_user(void *to, const void *from, __kernel_size_t n);
Expand Down Expand Up @@ -137,37 +144,6 @@ __kernel_size_t __clear_user(void *addr, __kernel_size_t size);
__cl_size; \
})

/**
* strncpy_from_user: - Copy a NUL terminated string from userspace.
* @dst: Destination address, in kernel space. This buffer must be at
* least @count bytes long.
* @src: Source address, in user space.
* @count: Maximum number of bytes to copy, including the trailing NUL.
*
* Copies a NUL-terminated string from userspace to kernel space.
*
* On success, returns the length of the string (not including the trailing
* NUL).
*
* If access to userspace fails, returns -EFAULT (some data may have been
* copied).
*
* If @count is smaller than the length of the string, copies @count bytes
* and returns @count.
*/
#define strncpy_from_user(dest,src,count) \
({ \
unsigned long __sfu_src = (unsigned long)(src); \
int __sfu_count = (int)(count); \
long __sfu_res = -EFAULT; \
\
if (__access_ok(__sfu_src, __sfu_count)) \
__sfu_res = __strncpy_from_user((unsigned long)(dest), \
__sfu_src, __sfu_count); \
\
__sfu_res; \
})

static inline unsigned long
copy_from_user(void *to, const void __user *from, unsigned long n)
{
Expand All @@ -192,43 +168,6 @@ copy_to_user(void __user *to, const void *from, unsigned long n)
return __copy_size;
}

/**
* strnlen_user: - Get the size of a string in user space.
* @s: The string to measure.
* @n: The maximum valid length
*
* Context: User context only. This function may sleep.
*
* Get the size of a NUL-terminated string in user space.
*
* Returns the size of the string INCLUDING the terminating NUL.
* On exception, returns 0.
* If the string is too long, returns a value greater than @n.
*/
static inline long strnlen_user(const char __user *s, long n)
{
if (!__addr_ok(s))
return 0;
else
return __strnlen_user(s, n);
}

/**
* strlen_user: - Get the size of a string in user space.
* @str: The string to measure.
*
* Context: User context only. This function may sleep.
*
* Get the size of a NUL-terminated string in user space.
*
* Returns the size of the string INCLUDING the terminating NUL.
* On exception, returns 0.
*
* If there is a limit on the length of a valid string, you may wish to
* consider using strnlen_user() instead.
*/
#define strlen_user(str) strnlen_user(str, ~0UL >> 1)

/*
* The exception table consists of pairs of addresses: the first is the
* address of an instruction that is allowed to fault, and the second is
Expand Down
75 changes: 0 additions & 75 deletions arch/sh/include/asm/uaccess_32.h
Original file line number Diff line number Diff line change
Expand Up @@ -170,79 +170,4 @@ __asm__ __volatile__( \

extern void __put_user_unknown(void);

static inline int
__strncpy_from_user(unsigned long __dest, unsigned long __user __src, int __count)
{
__kernel_size_t res;
unsigned long __dummy, _d, _s, _c;

__asm__ __volatile__(
"9:\n"
"mov.b @%2+, %1\n\t"
"cmp/eq #0, %1\n\t"
"bt/s 2f\n"
"1:\n"
"mov.b %1, @%3\n\t"
"dt %4\n\t"
"bf/s 9b\n\t"
" add #1, %3\n\t"
"2:\n\t"
"sub %4, %0\n"
"3:\n"
".section .fixup,\"ax\"\n"
"4:\n\t"
"mov.l 5f, %1\n\t"
"jmp @%1\n\t"
" mov %9, %0\n\t"
".balign 4\n"
"5: .long 3b\n"
".previous\n"
".section __ex_table,\"a\"\n"
" .balign 4\n"
" .long 9b,4b\n"
".previous"
: "=r" (res), "=&z" (__dummy), "=r" (_s), "=r" (_d), "=r"(_c)
: "0" (__count), "2" (__src), "3" (__dest), "4" (__count),
"i" (-EFAULT)
: "memory", "t");

return res;
}

/*
* Return the size of a string (including the ending 0 even when we have
* exceeded the maximum string length).
*/
static inline long __strnlen_user(const char __user *__s, long __n)
{
unsigned long res;
unsigned long __dummy;

__asm__ __volatile__(
"1:\t"
"mov.b @(%0,%3), %1\n\t"
"cmp/eq %4, %0\n\t"
"bt/s 2f\n\t"
" add #1, %0\n\t"
"tst %1, %1\n\t"
"bf 1b\n\t"
"2:\n"
".section .fixup,\"ax\"\n"
"3:\n\t"
"mov.l 4f, %1\n\t"
"jmp @%1\n\t"
" mov #0, %0\n"
".balign 4\n"
"4: .long 2b\n"
".previous\n"
".section __ex_table,\"a\"\n"
" .balign 4\n"
" .long 1b,3b\n"
".previous"
: "=z" (res), "=&r" (__dummy)
: "0" (0), "r" (__s), "r" (__n)
: "t");
return res;
}

#endif /* __ASM_SH_UACCESS_32_H */
4 changes: 0 additions & 4 deletions arch/sh/include/asm/uaccess_64.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,4 @@ extern long __put_user_asm_l(void *, long);
extern long __put_user_asm_q(void *, long);
extern void __put_user_unknown(void);

extern long __strnlen_user(const char *__s, long __n);
extern int __strncpy_from_user(unsigned long __dest,
unsigned long __user __src, int __count);

#endif /* __ASM_SH_UACCESS_64_H */
1 change: 0 additions & 1 deletion arch/sh/include/asm/ucontext.h

This file was deleted.

Loading

0 comments on commit 790b9d4

Please sign in to comment.