mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-04 18:09:57 +00:00
SuperH fixes for 3.5-rc3
-----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.15 (GNU/Linux) iEYEABECAAYFAk/YA2QACgkQGkmNcg7/o7iquwCg1dTXMRl6iC+/nGrfBylFhbvQ IjQAnj/+piJJlqdN8HDPnnXOvbcgZLNk =hO8d -----END PGP SIGNATURE----- Merge tag 'sh-for-linus' of git://github.com/pmundt/linux-sh 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().
This commit is contained in:
commit
790b9d4bb7
50 changed files with 153 additions and 386 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
#include <asm-generic/bitsperlong.h>
|
|
@ -1,6 +0,0 @@
|
|||
#ifndef __SH_CPUTIME_H
|
||||
#define __SH_CPUTIME_H
|
||||
|
||||
#include <asm-generic/cputime.h>
|
||||
|
||||
#endif /* __SH_CPUTIME_H */
|
|
@ -1 +0,0 @@
|
|||
#include <asm-generic/current.h>
|
|
@ -1 +0,0 @@
|
|||
#include <asm-generic/delay.h>
|
|
@ -1 +0,0 @@
|
|||
#include <asm-generic/div64.h>
|
|
@ -1,6 +0,0 @@
|
|||
#ifndef _ASM_EMERGENCY_RESTART_H
|
||||
#define _ASM_EMERGENCY_RESTART_H
|
||||
|
||||
#include <asm-generic/emergency-restart.h>
|
||||
|
||||
#endif /* _ASM_EMERGENCY_RESTART_H */
|
|
@ -1,6 +0,0 @@
|
|||
#ifndef __ASM_SH_ERRNO_H
|
||||
#define __ASM_SH_ERRNO_H
|
||||
|
||||
#include <asm-generic/errno.h>
|
||||
|
||||
#endif /* __ASM_SH_ERRNO_H */
|
|
@ -1 +0,0 @@
|
|||
#include <asm-generic/fcntl.h>
|
|
@ -1 +0,0 @@
|
|||
#include <asm-generic/ioctl.h>
|
|
@ -1 +0,0 @@
|
|||
#include <asm-generic/ipcbuf.h>
|
|
@ -1 +0,0 @@
|
|||
#include <asm-generic/irq_regs.h>
|
|
@ -1 +0,0 @@
|
|||
#include <asm-generic/kvm_para.h>
|
|
@ -1,7 +0,0 @@
|
|||
#ifndef __ASM_SH_LOCAL_H
|
||||
#define __ASM_SH_LOCAL_H
|
||||
|
||||
#include <asm-generic/local.h>
|
||||
|
||||
#endif /* __ASM_SH_LOCAL_H */
|
||||
|
|
@ -1 +0,0 @@
|
|||
#include <asm-generic/local64.h>
|
|
@ -1 +0,0 @@
|
|||
#include <asm-generic/mman.h>
|
|
@ -1 +0,0 @@
|
|||
#include <asm-generic/msgbuf.h>
|
|
@ -1 +0,0 @@
|
|||
#include <asm-generic/param.h>
|
|
@ -1 +0,0 @@
|
|||
#include <asm-generic/parport.h>
|
|
@ -1,6 +0,0 @@
|
|||
#ifndef __ARCH_SH_PERCPU
|
||||
#define __ARCH_SH_PERCPU
|
||||
|
||||
#include <asm-generic/percpu.h>
|
||||
|
||||
#endif /* __ARCH_SH_PERCPU */
|
|
@ -1 +0,0 @@
|
|||
#include <asm-generic/poll.h>
|
|
@ -1,6 +0,0 @@
|
|||
#ifndef __ASM_SH_RESOURCE_H
|
||||
#define __ASM_SH_RESOURCE_H
|
||||
|
||||
#include <asm-generic/resource.h>
|
||||
|
||||
#endif /* __ASM_SH_RESOURCE_H */
|
|
@ -1,6 +0,0 @@
|
|||
#ifndef __ASM_SH_SCATTERLIST_H
|
||||
#define __ASM_SH_SCATTERLIST_H
|
||||
|
||||
#include <asm-generic/scatterlist.h>
|
||||
|
||||
#endif /* __ASM_SH_SCATTERLIST_H */
|
|
@ -1 +0,0 @@
|
|||
#include <asm-generic/sembuf.h>
|
|
@ -1 +0,0 @@
|
|||
#include <asm-generic/serial.h>
|
|
@ -1 +0,0 @@
|
|||
#include <asm-generic/shmbuf.h>
|
|
@ -1,6 +0,0 @@
|
|||
#ifndef __ASM_SH_SIGINFO_H
|
||||
#define __ASM_SH_SIGINFO_H
|
||||
|
||||
#include <asm-generic/siginfo.h>
|
||||
|
||||
#endif /* __ASM_SH_SIGINFO_H */
|
|
@ -1 +0,0 @@
|
|||
#include <asm-generic/sizes.h>
|
|
@ -1 +0,0 @@
|
|||
#include <asm-generic/socket.h>
|
|
@ -1,6 +0,0 @@
|
|||
#ifndef __ASM_SH_STATFS_H
|
||||
#define __ASM_SH_STATFS_H
|
||||
|
||||
#include <asm-generic/statfs.h>
|
||||
|
||||
#endif /* __ASM_SH_STATFS_H */
|
|
@ -1 +0,0 @@
|
|||
#include <asm-generic/termbits.h>
|
|
@ -1 +0,0 @@
|
|||
#include <asm-generic/termios.h>
|
|
@ -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
|
||||
|
@ -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);
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -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
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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 +0,0 @@
|
|||
#include <asm-generic/ucontext.h>
|
53
arch/sh/include/asm/word-at-a-time.h
Normal file
53
arch/sh/include/asm/word-at-a-time.h
Normal file
|
@ -0,0 +1,53 @@
|
|||
#ifndef __ASM_SH_WORD_AT_A_TIME_H
|
||||
#define __ASM_SH_WORD_AT_A_TIME_H
|
||||
|
||||
#ifdef CONFIG_CPU_BIG_ENDIAN
|
||||
# include <asm-generic/word-at-a-time.h>
|
||||
#else
|
||||
/*
|
||||
* Little-endian version cribbed from x86.
|
||||
*/
|
||||
struct word_at_a_time {
|
||||
const unsigned long one_bits, high_bits;
|
||||
};
|
||||
|
||||
#define WORD_AT_A_TIME_CONSTANTS { REPEAT_BYTE(0x01), REPEAT_BYTE(0x80) }
|
||||
|
||||
/* Carl Chatfield / Jan Achrenius G+ version for 32-bit */
|
||||
static inline long count_masked_bytes(long mask)
|
||||
{
|
||||
/* (000000 0000ff 00ffff ffffff) -> ( 1 1 2 3 ) */
|
||||
long a = (0x0ff0001+mask) >> 23;
|
||||
/* Fix the 1 for 00 case */
|
||||
return a & mask;
|
||||
}
|
||||
|
||||
/* Return nonzero if it has a zero */
|
||||
static inline unsigned long has_zero(unsigned long a, unsigned long *bits, const struct word_at_a_time *c)
|
||||
{
|
||||
unsigned long mask = ((a - c->one_bits) & ~a) & c->high_bits;
|
||||
*bits = mask;
|
||||
return mask;
|
||||
}
|
||||
|
||||
static inline unsigned long prep_zero_mask(unsigned long a, unsigned long bits, const struct word_at_a_time *c)
|
||||
{
|
||||
return bits;
|
||||
}
|
||||
|
||||
static inline unsigned long create_zero_mask(unsigned long bits)
|
||||
{
|
||||
bits = (bits - 1) & ~bits;
|
||||
return bits >> 7;
|
||||
}
|
||||
|
||||
/* The mask we created is directly usable as a bytemask */
|
||||
#define zero_bytemask(mask) (mask)
|
||||
|
||||
static inline unsigned long find_zero(unsigned long mask)
|
||||
{
|
||||
return count_masked_bytes(mask);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -1 +0,0 @@
|
|||
#include <asm-generic/xor.h>
|
|
@ -1,28 +0,0 @@
|
|||
/*
|
||||
* SH-2A UBC definitions
|
||||
*
|
||||
* Copyright (C) 2008 Kieran Bingham
|
||||
*
|
||||
* This file is subject to the terms and conditions of the GNU General Public
|
||||
* License. See the file "COPYING" in the main directory of this archive
|
||||
* for more details.
|
||||
*/
|
||||
|
||||
#ifndef __ASM_CPU_SH2A_UBC_H
|
||||
#define __ASM_CPU_SH2A_UBC_H
|
||||
|
||||
#define UBC_BARA 0xfffc0400
|
||||
#define UBC_BAMRA 0xfffc0404
|
||||
#define UBC_BBRA 0xfffc04a0 /* 16 bit access */
|
||||
#define UBC_BDRA 0xfffc0408
|
||||
#define UBC_BDMRA 0xfffc040c
|
||||
|
||||
#define UBC_BARB 0xfffc0410
|
||||
#define UBC_BAMRB 0xfffc0414
|
||||
#define UBC_BBRB 0xfffc04b0 /* 16 bit access */
|
||||
#define UBC_BDRB 0xfffc0418
|
||||
#define UBC_BDMRB 0xfffc041c
|
||||
|
||||
#define UBC_BRCR 0xfffc04c0
|
||||
|
||||
#endif /* __ASM_CPU_SH2A_UBC_H */
|
|
@ -1568,86 +1568,6 @@ ___clear_user_exit:
|
|||
|
||||
#endif /* CONFIG_MMU */
|
||||
|
||||
/*
|
||||
* int __strncpy_from_user(unsigned long __dest, unsigned long __src,
|
||||
* int __count)
|
||||
*
|
||||
* Inputs:
|
||||
* (r2) target address
|
||||
* (r3) source address
|
||||
* (r4) maximum size in bytes
|
||||
*
|
||||
* Ouputs:
|
||||
* (*r2) copied data
|
||||
* (r2) -EFAULT (in case of faulting)
|
||||
* copied data (otherwise)
|
||||
*/
|
||||
.global __strncpy_from_user
|
||||
__strncpy_from_user:
|
||||
pta ___strncpy_from_user1, tr0
|
||||
pta ___strncpy_from_user_done, tr1
|
||||
or r4, ZERO, r5 /* r5 = original count */
|
||||
beq/u r4, r63, tr1 /* early exit if r4==0 */
|
||||
movi -(EFAULT), r6 /* r6 = reply, no real fixup */
|
||||
or ZERO, ZERO, r7 /* r7 = data, clear top byte of data */
|
||||
|
||||
___strncpy_from_user1:
|
||||
ld.b r3, 0, r7 /* Fault address: only in reading */
|
||||
st.b r2, 0, r7
|
||||
addi r2, 1, r2
|
||||
addi r3, 1, r3
|
||||
beq/u ZERO, r7, tr1
|
||||
addi r4, -1, r4 /* return real number of copied bytes */
|
||||
bne/l ZERO, r4, tr0
|
||||
|
||||
___strncpy_from_user_done:
|
||||
sub r5, r4, r6 /* If done, return copied */
|
||||
|
||||
___strncpy_from_user_exit:
|
||||
or r6, ZERO, r2
|
||||
ptabs LINK, tr0
|
||||
blink tr0, ZERO
|
||||
|
||||
/*
|
||||
* extern long __strnlen_user(const char *__s, long __n)
|
||||
*
|
||||
* Inputs:
|
||||
* (r2) source address
|
||||
* (r3) source size in bytes
|
||||
*
|
||||
* Ouputs:
|
||||
* (r2) -EFAULT (in case of faulting)
|
||||
* string length (otherwise)
|
||||
*/
|
||||
.global __strnlen_user
|
||||
__strnlen_user:
|
||||
pta ___strnlen_user_set_reply, tr0
|
||||
pta ___strnlen_user1, tr1
|
||||
or ZERO, ZERO, r5 /* r5 = counter */
|
||||
movi -(EFAULT), r6 /* r6 = reply, no real fixup */
|
||||
or ZERO, ZERO, r7 /* r7 = data, clear top byte of data */
|
||||
beq r3, ZERO, tr0
|
||||
|
||||
___strnlen_user1:
|
||||
ldx.b r2, r5, r7 /* Fault address: only in reading */
|
||||
addi r3, -1, r3 /* No real fixup */
|
||||
addi r5, 1, r5
|
||||
beq r3, ZERO, tr0
|
||||
bne r7, ZERO, tr1
|
||||
! The line below used to be active. This meant led to a junk byte lying between each pair
|
||||
! of entries in the argv & envp structures in memory. Whilst the program saw the right data
|
||||
! via the argv and envp arguments to main, it meant the 'flat' representation visible through
|
||||
! /proc/$pid/cmdline was corrupt, causing trouble with ps, for example.
|
||||
! addi r5, 1, r5 /* Include '\0' */
|
||||
|
||||
___strnlen_user_set_reply:
|
||||
or r5, ZERO, r6 /* If done, return counter */
|
||||
|
||||
___strnlen_user_exit:
|
||||
or r6, ZERO, r2
|
||||
ptabs LINK, tr0
|
||||
blink tr0, ZERO
|
||||
|
||||
/*
|
||||
* extern long __get_user_asm_?(void *val, long addr)
|
||||
*
|
||||
|
@ -1982,8 +1902,6 @@ asm_uaccess_start:
|
|||
.long ___copy_user2, ___copy_user_exit
|
||||
.long ___clear_user1, ___clear_user_exit
|
||||
#endif
|
||||
.long ___strncpy_from_user1, ___strncpy_from_user_exit
|
||||
.long ___strnlen_user1, ___strnlen_user_exit
|
||||
.long ___get_user_asm_b1, ___get_user_asm_b_exit
|
||||
.long ___get_user_asm_w1, ___get_user_asm_w_exit
|
||||
.long ___get_user_asm_l1, ___get_user_asm_l_exit
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#include <linux/sched.h>
|
||||
#include <linux/export.h>
|
||||
#include <linux/stackprotector.h>
|
||||
#include <asm/fpu.h>
|
||||
|
||||
struct kmem_cache *task_xstate_cachep = NULL;
|
||||
unsigned int xstate_size;
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
#include <asm/switch_to.h>
|
||||
|
||||
struct task_struct *last_task_used_math = NULL;
|
||||
struct pt_regs fake_swapper_regs = { 0, };
|
||||
|
||||
void show_regs(struct pt_regs *regs)
|
||||
{
|
||||
|
|
|
@ -32,8 +32,6 @@ EXPORT_SYMBOL(__get_user_asm_b);
|
|||
EXPORT_SYMBOL(__get_user_asm_w);
|
||||
EXPORT_SYMBOL(__get_user_asm_l);
|
||||
EXPORT_SYMBOL(__get_user_asm_q);
|
||||
EXPORT_SYMBOL(__strnlen_user);
|
||||
EXPORT_SYMBOL(__strncpy_from_user);
|
||||
EXPORT_SYMBOL(__clear_user);
|
||||
EXPORT_SYMBOL(copy_page);
|
||||
EXPORT_SYMBOL(__copy_user);
|
||||
|
|
|
@ -48,13 +48,13 @@ struct sh_cmt_priv {
|
|||
unsigned long next_match_value;
|
||||
unsigned long max_match_value;
|
||||
unsigned long rate;
|
||||
spinlock_t lock;
|
||||
raw_spinlock_t lock;
|
||||
struct clock_event_device ced;
|
||||
struct clocksource cs;
|
||||
unsigned long total_cycles;
|
||||
};
|
||||
|
||||
static DEFINE_SPINLOCK(sh_cmt_lock);
|
||||
static DEFINE_RAW_SPINLOCK(sh_cmt_lock);
|
||||
|
||||
#define CMSTR -1 /* shared register */
|
||||
#define CMCSR 0 /* channel register */
|
||||
|
@ -139,7 +139,7 @@ static void sh_cmt_start_stop_ch(struct sh_cmt_priv *p, int start)
|
|||
unsigned long flags, value;
|
||||
|
||||
/* start stop register shared by multiple timer channels */
|
||||
spin_lock_irqsave(&sh_cmt_lock, flags);
|
||||
raw_spin_lock_irqsave(&sh_cmt_lock, flags);
|
||||
value = sh_cmt_read(p, CMSTR);
|
||||
|
||||
if (start)
|
||||
|
@ -148,7 +148,7 @@ static void sh_cmt_start_stop_ch(struct sh_cmt_priv *p, int start)
|
|||
value &= ~(1 << cfg->timer_bit);
|
||||
|
||||
sh_cmt_write(p, CMSTR, value);
|
||||
spin_unlock_irqrestore(&sh_cmt_lock, flags);
|
||||
raw_spin_unlock_irqrestore(&sh_cmt_lock, flags);
|
||||
}
|
||||
|
||||
static int sh_cmt_enable(struct sh_cmt_priv *p, unsigned long *rate)
|
||||
|
@ -328,9 +328,9 @@ static void sh_cmt_set_next(struct sh_cmt_priv *p, unsigned long delta)
|
|||
{
|
||||
unsigned long flags;
|
||||
|
||||
spin_lock_irqsave(&p->lock, flags);
|
||||
raw_spin_lock_irqsave(&p->lock, flags);
|
||||
__sh_cmt_set_next(p, delta);
|
||||
spin_unlock_irqrestore(&p->lock, flags);
|
||||
raw_spin_unlock_irqrestore(&p->lock, flags);
|
||||
}
|
||||
|
||||
static irqreturn_t sh_cmt_interrupt(int irq, void *dev_id)
|
||||
|
@ -385,7 +385,7 @@ static int sh_cmt_start(struct sh_cmt_priv *p, unsigned long flag)
|
|||
int ret = 0;
|
||||
unsigned long flags;
|
||||
|
||||
spin_lock_irqsave(&p->lock, flags);
|
||||
raw_spin_lock_irqsave(&p->lock, flags);
|
||||
|
||||
if (!(p->flags & (FLAG_CLOCKEVENT | FLAG_CLOCKSOURCE)))
|
||||
ret = sh_cmt_enable(p, &p->rate);
|
||||
|
@ -398,7 +398,7 @@ static int sh_cmt_start(struct sh_cmt_priv *p, unsigned long flag)
|
|||
if ((flag == FLAG_CLOCKSOURCE) && (!(p->flags & FLAG_CLOCKEVENT)))
|
||||
__sh_cmt_set_next(p, p->max_match_value);
|
||||
out:
|
||||
spin_unlock_irqrestore(&p->lock, flags);
|
||||
raw_spin_unlock_irqrestore(&p->lock, flags);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -408,7 +408,7 @@ static void sh_cmt_stop(struct sh_cmt_priv *p, unsigned long flag)
|
|||
unsigned long flags;
|
||||
unsigned long f;
|
||||
|
||||
spin_lock_irqsave(&p->lock, flags);
|
||||
raw_spin_lock_irqsave(&p->lock, flags);
|
||||
|
||||
f = p->flags & (FLAG_CLOCKEVENT | FLAG_CLOCKSOURCE);
|
||||
p->flags &= ~flag;
|
||||
|
@ -420,7 +420,7 @@ static void sh_cmt_stop(struct sh_cmt_priv *p, unsigned long flag)
|
|||
if ((flag == FLAG_CLOCKEVENT) && (p->flags & FLAG_CLOCKSOURCE))
|
||||
__sh_cmt_set_next(p, p->max_match_value);
|
||||
|
||||
spin_unlock_irqrestore(&p->lock, flags);
|
||||
raw_spin_unlock_irqrestore(&p->lock, flags);
|
||||
}
|
||||
|
||||
static struct sh_cmt_priv *cs_to_sh_cmt(struct clocksource *cs)
|
||||
|
@ -435,13 +435,13 @@ static cycle_t sh_cmt_clocksource_read(struct clocksource *cs)
|
|||
unsigned long value;
|
||||
int has_wrapped;
|
||||
|
||||
spin_lock_irqsave(&p->lock, flags);
|
||||
raw_spin_lock_irqsave(&p->lock, flags);
|
||||
value = p->total_cycles;
|
||||
raw = sh_cmt_get_counter(p, &has_wrapped);
|
||||
|
||||
if (unlikely(has_wrapped))
|
||||
raw += p->match_value + 1;
|
||||
spin_unlock_irqrestore(&p->lock, flags);
|
||||
raw_spin_unlock_irqrestore(&p->lock, flags);
|
||||
|
||||
return value + raw;
|
||||
}
|
||||
|
@ -591,7 +591,7 @@ static int sh_cmt_register(struct sh_cmt_priv *p, char *name,
|
|||
p->max_match_value = (1 << p->width) - 1;
|
||||
|
||||
p->match_value = p->max_match_value;
|
||||
spin_lock_init(&p->lock);
|
||||
raw_spin_lock_init(&p->lock);
|
||||
|
||||
if (clockevent_rating)
|
||||
sh_cmt_register_clockevent(p, name, clockevent_rating);
|
||||
|
|
|
@ -43,7 +43,7 @@ struct sh_mtu2_priv {
|
|||
struct clock_event_device ced;
|
||||
};
|
||||
|
||||
static DEFINE_SPINLOCK(sh_mtu2_lock);
|
||||
static DEFINE_RAW_SPINLOCK(sh_mtu2_lock);
|
||||
|
||||
#define TSTR -1 /* shared register */
|
||||
#define TCR 0 /* channel register */
|
||||
|
@ -107,7 +107,7 @@ static void sh_mtu2_start_stop_ch(struct sh_mtu2_priv *p, int start)
|
|||
unsigned long flags, value;
|
||||
|
||||
/* start stop register shared by multiple timer channels */
|
||||
spin_lock_irqsave(&sh_mtu2_lock, flags);
|
||||
raw_spin_lock_irqsave(&sh_mtu2_lock, flags);
|
||||
value = sh_mtu2_read(p, TSTR);
|
||||
|
||||
if (start)
|
||||
|
@ -116,7 +116,7 @@ static void sh_mtu2_start_stop_ch(struct sh_mtu2_priv *p, int start)
|
|||
value &= ~(1 << cfg->timer_bit);
|
||||
|
||||
sh_mtu2_write(p, TSTR, value);
|
||||
spin_unlock_irqrestore(&sh_mtu2_lock, flags);
|
||||
raw_spin_unlock_irqrestore(&sh_mtu2_lock, flags);
|
||||
}
|
||||
|
||||
static int sh_mtu2_enable(struct sh_mtu2_priv *p)
|
||||
|
|
|
@ -45,7 +45,7 @@ struct sh_tmu_priv {
|
|||
struct clocksource cs;
|
||||
};
|
||||
|
||||
static DEFINE_SPINLOCK(sh_tmu_lock);
|
||||
static DEFINE_RAW_SPINLOCK(sh_tmu_lock);
|
||||
|
||||
#define TSTR -1 /* shared register */
|
||||
#define TCOR 0 /* channel register */
|
||||
|
@ -95,7 +95,7 @@ static void sh_tmu_start_stop_ch(struct sh_tmu_priv *p, int start)
|
|||
unsigned long flags, value;
|
||||
|
||||
/* start stop register shared by multiple timer channels */
|
||||
spin_lock_irqsave(&sh_tmu_lock, flags);
|
||||
raw_spin_lock_irqsave(&sh_tmu_lock, flags);
|
||||
value = sh_tmu_read(p, TSTR);
|
||||
|
||||
if (start)
|
||||
|
@ -104,7 +104,7 @@ static void sh_tmu_start_stop_ch(struct sh_tmu_priv *p, int start)
|
|||
value &= ~(1 << cfg->timer_bit);
|
||||
|
||||
sh_tmu_write(p, TSTR, value);
|
||||
spin_unlock_irqrestore(&sh_tmu_lock, flags);
|
||||
raw_spin_unlock_irqrestore(&sh_tmu_lock, flags);
|
||||
}
|
||||
|
||||
static int sh_tmu_enable(struct sh_tmu_priv *p)
|
||||
|
@ -245,12 +245,7 @@ static void sh_tmu_clock_event_start(struct sh_tmu_priv *p, int periodic)
|
|||
|
||||
sh_tmu_enable(p);
|
||||
|
||||
/* TODO: calculate good shift from rate and counter bit width */
|
||||
|
||||
ced->shift = 32;
|
||||
ced->mult = div_sc(p->rate, NSEC_PER_SEC, ced->shift);
|
||||
ced->max_delta_ns = clockevent_delta2ns(0xffffffff, ced);
|
||||
ced->min_delta_ns = 5000;
|
||||
clockevents_config(ced, p->rate);
|
||||
|
||||
if (periodic) {
|
||||
p->periodic = (p->rate + HZ/2) / HZ;
|
||||
|
@ -323,7 +318,8 @@ static void sh_tmu_register_clockevent(struct sh_tmu_priv *p,
|
|||
ced->set_mode = sh_tmu_clock_event_mode;
|
||||
|
||||
dev_info(&p->pdev->dev, "used for clock events\n");
|
||||
clockevents_register_device(ced);
|
||||
|
||||
clockevents_config_and_register(ced, 1, 0x300, 0xffffffff);
|
||||
|
||||
ret = setup_irq(p->irqaction.irq, &p->irqaction);
|
||||
if (ret) {
|
||||
|
|
|
@ -2179,6 +2179,16 @@ static int __devinit sci_init_single(struct platform_device *dev,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void sci_cleanup_single(struct sci_port *port)
|
||||
{
|
||||
sci_free_gpios(port);
|
||||
|
||||
clk_put(port->iclk);
|
||||
clk_put(port->fclk);
|
||||
|
||||
pm_runtime_disable(port->port.dev);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_SERIAL_SH_SCI_CONSOLE
|
||||
static void serial_console_putchar(struct uart_port *port, int ch)
|
||||
{
|
||||
|
@ -2360,14 +2370,10 @@ static int sci_remove(struct platform_device *dev)
|
|||
cpufreq_unregister_notifier(&port->freq_transition,
|
||||
CPUFREQ_TRANSITION_NOTIFIER);
|
||||
|
||||
sci_free_gpios(port);
|
||||
|
||||
uart_remove_one_port(&sci_uart_driver, &port->port);
|
||||
|
||||
clk_put(port->iclk);
|
||||
clk_put(port->fclk);
|
||||
sci_cleanup_single(port);
|
||||
|
||||
pm_runtime_disable(&dev->dev);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -2385,14 +2391,20 @@ static int __devinit sci_probe_single(struct platform_device *dev,
|
|||
index+1, SCI_NPORTS);
|
||||
dev_notice(&dev->dev, "Consider bumping "
|
||||
"CONFIG_SERIAL_SH_SCI_NR_UARTS!\n");
|
||||
return 0;
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
ret = sci_init_single(dev, sciport, index, p);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
return uart_add_one_port(&sci_uart_driver, &sciport->port);
|
||||
ret = uart_add_one_port(&sci_uart_driver, &sciport->port);
|
||||
if (ret) {
|
||||
sci_cleanup_single(sciport);
|
||||
return ret;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int __devinit sci_probe(struct platform_device *dev)
|
||||
|
@ -2413,24 +2425,22 @@ static int __devinit sci_probe(struct platform_device *dev)
|
|||
|
||||
ret = sci_probe_single(dev, dev->id, p, sp);
|
||||
if (ret)
|
||||
goto err_unreg;
|
||||
return ret;
|
||||
|
||||
sp->freq_transition.notifier_call = sci_notifier;
|
||||
|
||||
ret = cpufreq_register_notifier(&sp->freq_transition,
|
||||
CPUFREQ_TRANSITION_NOTIFIER);
|
||||
if (unlikely(ret < 0))
|
||||
goto err_unreg;
|
||||
if (unlikely(ret < 0)) {
|
||||
sci_cleanup_single(sp);
|
||||
return ret;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_SH_STANDARD_BIOS
|
||||
sh_bios_gdb_detach();
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
|
||||
err_unreg:
|
||||
sci_remove(dev);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int sci_suspend(struct device *dev)
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#define _ASM_GENERIC_BUG_H
|
||||
|
||||
#include <linux/compiler.h>
|
||||
#include <linux/kernel.h>
|
||||
|
||||
#ifdef CONFIG_BUG
|
||||
|
||||
|
|
Loading…
Reference in a new issue