Commit 5d0381e2 authored by Linus Torvalds's avatar Linus Torvalds

Merge git://git.kernel.org/pub/scm/linux/kernel/git/lethal/sh-2.6.24

* git://git.kernel.org/pub/scm/linux/kernel/git/lethal/sh-2.6.24:
  sh: Force __access_ok() to obey address space limit.
  sh: Fix argument page dcache flushing regression.
parents 22fb53c9 d7587b14
...@@ -43,6 +43,12 @@ extern void __flush_purge_region(void *start, int size); ...@@ -43,6 +43,12 @@ extern void __flush_purge_region(void *start, int size);
extern void __flush_invalidate_region(void *start, int size); extern void __flush_invalidate_region(void *start, int size);
#endif #endif
#define ARCH_HAS_FLUSH_KERNEL_DCACHE_PAGE
static inline void flush_kernel_dcache_page(struct page *page)
{
flush_dcache_page(page);
}
#if defined(CONFIG_CPU_SH4) && !defined(CONFIG_CACHE_OFF) #if defined(CONFIG_CPU_SH4) && !defined(CONFIG_CACHE_OFF)
extern void copy_to_user_page(struct vm_area_struct *vma, extern void copy_to_user_page(struct vm_area_struct *vma,
struct page *page, unsigned long vaddr, void *dst, const void *src, struct page *page, unsigned long vaddr, void *dst, const void *src,
......
...@@ -73,38 +73,26 @@ static inline int __access_ok(unsigned long addr, unsigned long size) ...@@ -73,38 +73,26 @@ static inline int __access_ok(unsigned long addr, unsigned long size)
/* /*
* __access_ok: Check if address with size is OK or not. * __access_ok: Check if address with size is OK or not.
* *
* We do three checks: * Uhhuh, this needs 33-bit arithmetic. We have a carry..
* (1) is it user space?
* (2) addr + size --> carry?
* (3) addr + size >= 0x80000000 (PAGE_OFFSET)
* *
* (1) (2) (3) | RESULT * sum := addr + size; carry? --> flag = true;
* 0 0 0 | ok * if (sum >= addr_limit) flag = true;
* 0 0 1 | ok
* 0 1 0 | bad
* 0 1 1 | bad
* 1 0 0 | ok
* 1 0 1 | bad
* 1 1 0 | bad
* 1 1 1 | bad
*/ */
static inline int __access_ok(unsigned long addr, unsigned long size) static inline int __access_ok(unsigned long addr, unsigned long size)
{ {
unsigned long flag, tmp; unsigned long flag, sum;
__asm__("stc r7_bank, %0\n\t" __asm__("clrt\n\t"
"mov.l @(8,%0), %0\n\t" "addc %3, %1\n\t"
"clrt\n\t" "movt %0\n\t"
"addc %2, %1\n\t" "cmp/hi %4, %1\n\t"
"and %1, %0\n\t" "rotcl %0"
"rotcl %0\n\t" :"=&r" (flag), "=r" (sum)
"rotcl %0\n\t" :"1" (addr), "r" (size),
"and #3, %0" "r" (current_thread_info()->addr_limit.seg)
: "=&z" (flag), "=r" (tmp) :"t");
: "r" (addr), "1" (size)
: "t");
return flag == 0; return flag == 0;
} }
#endif /* CONFIG_MMU */ #endif /* CONFIG_MMU */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment