diff options
author | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2008-01-11 14:48:59 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2008-01-11 14:48:59 -0500 |
commit | 5d0381e21ebf55df88e1cdca2810f4a49fe0ee62 (patch) | |
tree | 31a3a5251faa7c6b79e272b665909a5cf4a57998 /include | |
parent | 22fb53c943b0ad4f86639bccb7ad8753be8ce435 (diff) | |
parent | d7587b1445c0087cfcaa03ceae79b52eef4e9e4b (diff) |
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.
Diffstat (limited to 'include')
-rw-r--r-- | include/asm-sh/cacheflush.h | 6 | ||||
-rw-r--r-- | include/asm-sh/uaccess.h | 42 |
2 files changed, 21 insertions, 27 deletions
diff --git a/include/asm-sh/cacheflush.h b/include/asm-sh/cacheflush.h index 9d528ada3c14..e034c3604111 100644 --- a/include/asm-sh/cacheflush.h +++ b/include/asm-sh/cacheflush.h | |||
@@ -43,6 +43,12 @@ extern void __flush_purge_region(void *start, int size); | |||
43 | extern void __flush_invalidate_region(void *start, int size); | 43 | extern void __flush_invalidate_region(void *start, int size); |
44 | #endif | 44 | #endif |
45 | 45 | ||
46 | #define ARCH_HAS_FLUSH_KERNEL_DCACHE_PAGE | ||
47 | static inline void flush_kernel_dcache_page(struct page *page) | ||
48 | { | ||
49 | flush_dcache_page(page); | ||
50 | } | ||
51 | |||
46 | #if defined(CONFIG_CPU_SH4) && !defined(CONFIG_CACHE_OFF) | 52 | #if defined(CONFIG_CPU_SH4) && !defined(CONFIG_CACHE_OFF) |
47 | extern void copy_to_user_page(struct vm_area_struct *vma, | 53 | extern void copy_to_user_page(struct vm_area_struct *vma, |
48 | struct page *page, unsigned long vaddr, void *dst, const void *src, | 54 | struct page *page, unsigned long vaddr, void *dst, const void *src, |
diff --git a/include/asm-sh/uaccess.h b/include/asm-sh/uaccess.h index f18a1a5c95c0..77c391fa93d6 100644 --- a/include/asm-sh/uaccess.h +++ b/include/asm-sh/uaccess.h | |||
@@ -73,38 +73,26 @@ static inline int __access_ok(unsigned long addr, unsigned long size) | |||
73 | /* | 73 | /* |
74 | * __access_ok: Check if address with size is OK or not. | 74 | * __access_ok: Check if address with size is OK or not. |
75 | * | 75 | * |
76 | * We do three checks: | 76 | * Uhhuh, this needs 33-bit arithmetic. We have a carry.. |
77 | * (1) is it user space? | ||
78 | * (2) addr + size --> carry? | ||
79 | * (3) addr + size >= 0x80000000 (PAGE_OFFSET) | ||
80 | * | 77 | * |
81 | * (1) (2) (3) | RESULT | 78 | * sum := addr + size; carry? --> flag = true; |
82 | * 0 0 0 | ok | 79 | * if (sum >= addr_limit) flag = true; |
83 | * 0 0 1 | ok | ||
84 | * 0 1 0 | bad | ||
85 | * 0 1 1 | bad | ||
86 | * 1 0 0 | ok | ||
87 | * 1 0 1 | bad | ||
88 | * 1 1 0 | bad | ||
89 | * 1 1 1 | bad | ||
90 | */ | 80 | */ |
91 | static inline int __access_ok(unsigned long addr, unsigned long size) | 81 | static inline int __access_ok(unsigned long addr, unsigned long size) |
92 | { | 82 | { |
93 | unsigned long flag, tmp; | 83 | unsigned long flag, sum; |
94 | 84 | ||
95 | __asm__("stc r7_bank, %0\n\t" | 85 | __asm__("clrt\n\t" |
96 | "mov.l @(8,%0), %0\n\t" | 86 | "addc %3, %1\n\t" |
97 | "clrt\n\t" | 87 | "movt %0\n\t" |
98 | "addc %2, %1\n\t" | 88 | "cmp/hi %4, %1\n\t" |
99 | "and %1, %0\n\t" | 89 | "rotcl %0" |
100 | "rotcl %0\n\t" | 90 | :"=&r" (flag), "=r" (sum) |
101 | "rotcl %0\n\t" | 91 | :"1" (addr), "r" (size), |
102 | "and #3, %0" | 92 | "r" (current_thread_info()->addr_limit.seg) |
103 | : "=&z" (flag), "=r" (tmp) | 93 | :"t"); |
104 | : "r" (addr), "1" (size) | ||
105 | : "t"); | ||
106 | |||
107 | return flag == 0; | 94 | return flag == 0; |
95 | |||
108 | } | 96 | } |
109 | #endif /* CONFIG_MMU */ | 97 | #endif /* CONFIG_MMU */ |
110 | 98 | ||