diff options
Diffstat (limited to 'include')
| -rw-r--r-- | include/asm-sh/cacheflush.h | 6 | ||||
| -rw-r--r-- | include/asm-sh/uaccess.h | 42 | ||||
| -rw-r--r-- | include/linux/scatterlist.h | 4 |
3 files changed, 23 insertions, 29 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 | ||
diff --git a/include/linux/scatterlist.h b/include/linux/scatterlist.h index 416e000dfe81..e3ff21dbac53 100644 --- a/include/linux/scatterlist.h +++ b/include/linux/scatterlist.h | |||
| @@ -191,8 +191,8 @@ static inline void sg_chain(struct scatterlist *prv, unsigned int prv_nents, | |||
| 191 | /* | 191 | /* |
| 192 | * offset and length are unused for chain entry. Clear them. | 192 | * offset and length are unused for chain entry. Clear them. |
| 193 | */ | 193 | */ |
| 194 | prv->offset = 0; | 194 | prv[prv_nents - 1].offset = 0; |
| 195 | prv->length = 0; | 195 | prv[prv_nents - 1].length = 0; |
| 196 | 196 | ||
| 197 | /* | 197 | /* |
| 198 | * Set lowest bit to indicate a link pointer, and make sure to clear | 198 | * Set lowest bit to indicate a link pointer, and make sure to clear |
