Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 310693
b: refs/heads/master
c: 7d0c399
h: refs/heads/master
i:
  310691: b65dff6
v: v3
  • Loading branch information
Paul Mundt committed Jun 11, 2012
1 parent 5aec93d commit f8d96d8
Show file tree
Hide file tree
Showing 28 changed files with 290 additions and 174 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: cba8df4be3bdf10c86a26c458c5fc2ca978eeb2c
refs/heads/master: 7d0c399fe94d4fe572eadc7405654a282e5df63d
2 changes: 1 addition & 1 deletion trunk/arch/m68k/include/asm/m528xsim.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
/*
* QSPI module.
*/
#define MCFQSPI_BASE (MCF_IPSBAR + 0x340)
#define MCFQSPI_IOBASE (MCF_IPSBAR + 0x340)
#define MCFQSPI_SIZE 0x40

#define MCFQSPI_CS0 147
Expand Down
2 changes: 1 addition & 1 deletion trunk/arch/m68k/kernel/ptrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ asmlinkage void syscall_trace(void)
}
}

#if defined(CONFIG_COLDFIRE) || !defined(CONFIG_MMU)
#ifdef CONFIG_COLDFIRE
asmlinkage int syscall_trace_enter(void)
{
int ret = 0;
Expand Down
4 changes: 2 additions & 2 deletions trunk/arch/m68k/kernel/time.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ void __init time_init(void)
mach_sched_init(timer_interrupt);
}

#ifdef CONFIG_ARCH_USES_GETTIMEOFFSET
#ifdef CONFIG_M68KCLASSIC

u32 arch_gettimeoffset(void)
{
Expand All @@ -108,4 +108,4 @@ static int __init rtc_init(void)

module_init(rtc_init);

#endif /* CONFIG_ARCH_USES_GETTIMEOFFSET */
#endif /* CONFIG_M68KCLASSIC */
6 changes: 2 additions & 4 deletions trunk/arch/m68k/platform/68328/timers.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@
#endif

static u32 m68328_tick_cnt;
static irq_handler_t timer_interrupt;

/***************************************************************************/

Expand All @@ -63,7 +62,7 @@ static irqreturn_t hw_tick(int irq, void *dummy)
TSTAT &= 0;

m68328_tick_cnt += TICKS_PER_JIFFY;
return timer_interrupt(irq, dummy);
return arch_timer_interrupt(irq, dummy);
}

/***************************************************************************/
Expand Down Expand Up @@ -100,7 +99,7 @@ static struct clocksource m68328_clk = {

/***************************************************************************/

void hw_timer_init(irq_handler_t handler)
void hw_timer_init(void)
{
/* disable timer 1 */
TCTL = 0;
Expand All @@ -116,7 +115,6 @@ void hw_timer_init(irq_handler_t handler)
/* Enable timer 1 */
TCTL |= TCTL_TEN;
clocksource_register_hz(&m68328_clk, TICKS_PER_JIFFY*HZ);
timer_interrupt = handler;
}

/***************************************************************************/
Expand Down
7 changes: 2 additions & 5 deletions trunk/arch/m68k/platform/68360/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ extern void m360_cpm_reset(void);
#define OSCILLATOR (unsigned long int)33000000
#endif

static irq_handler_t timer_interrupt;
unsigned long int system_clock;

extern QUICC *pquicc;
Expand All @@ -53,7 +52,7 @@ static irqreturn_t hw_tick(int irq, void *dummy)

pquicc->timer_ter1 = 0x0002; /* clear timer event */

return timer_interrupt(irq, dummy);
return arch_timer_interrupt(irq, dummy);
}

static struct irqaction m68360_timer_irq = {
Expand All @@ -62,7 +61,7 @@ static struct irqaction m68360_timer_irq = {
.handler = hw_tick,
};

void hw_timer_init(irq_handler_t handler)
void hw_timer_init(void)
{
unsigned char prescaler;
unsigned short tgcr_save;
Expand Down Expand Up @@ -95,8 +94,6 @@ void hw_timer_init(irq_handler_t handler)

pquicc->timer_ter1 = 0x0003; /* clear timer events */

timer_interrupt = handler;

/* enable timer 1 interrupt in CIMR */
setup_irq(CPMVEC_TIMER1, &m68360_timer_irq);

Expand Down
2 changes: 0 additions & 2 deletions trunk/arch/sh/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ 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
75 changes: 68 additions & 7 deletions trunk/arch/sh/include/asm/uaccess.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@
(__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 @@ -102,11 +100,6 @@ 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 @@ -144,6 +137,37 @@ __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 @@ -168,6 +192,43 @@ 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: 75 additions & 0 deletions trunk/arch/sh/include/asm/uaccess_32.h
Original file line number Diff line number Diff line change
Expand Up @@ -170,4 +170,79 @@ __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: 4 additions & 0 deletions trunk/arch/sh/include/asm/uaccess_64.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,4 +84,8 @@ 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 */
53 changes: 0 additions & 53 deletions trunk/arch/sh/include/asm/word-at-a-time.h

This file was deleted.

Loading

0 comments on commit f8d96d8

Please sign in to comment.