aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-generic
diff options
context:
space:
mode:
Diffstat (limited to 'include/asm-generic')
-rw-r--r--include/asm-generic/checksum.h4
-rw-r--r--include/asm-generic/io.h2
-rw-r--r--include/asm-generic/uaccess.h14
-rw-r--r--include/asm-generic/unistd.h9
4 files changed, 27 insertions, 2 deletions
diff --git a/include/asm-generic/checksum.h b/include/asm-generic/checksum.h
index c084767c88bc..59811df58c5b 100644
--- a/include/asm-generic/checksum.h
+++ b/include/asm-generic/checksum.h
@@ -38,12 +38,15 @@ extern __wsum csum_partial_copy_from_user(const void __user *src, void *dst,
38 csum_partial_copy((src), (dst), (len), (sum)) 38 csum_partial_copy((src), (dst), (len), (sum))
39#endif 39#endif
40 40
41#ifndef ip_fast_csum
41/* 42/*
42 * This is a version of ip_compute_csum() optimized for IP headers, 43 * This is a version of ip_compute_csum() optimized for IP headers,
43 * which always checksum on 4 octet boundaries. 44 * which always checksum on 4 octet boundaries.
44 */ 45 */
45extern __sum16 ip_fast_csum(const void *iph, unsigned int ihl); 46extern __sum16 ip_fast_csum(const void *iph, unsigned int ihl);
47#endif
46 48
49#ifndef csum_fold
47/* 50/*
48 * Fold a partial checksum 51 * Fold a partial checksum
49 */ 52 */
@@ -54,6 +57,7 @@ static inline __sum16 csum_fold(__wsum csum)
54 sum = (sum & 0xffff) + (sum >> 16); 57 sum = (sum & 0xffff) + (sum >> 16);
55 return (__force __sum16)~sum; 58 return (__force __sum16)~sum;
56} 59}
60#endif
57 61
58#ifndef csum_tcpudp_nofold 62#ifndef csum_tcpudp_nofold
59/* 63/*
diff --git a/include/asm-generic/io.h b/include/asm-generic/io.h
index aba53083297d..ac9da00e9f2c 100644
--- a/include/asm-generic/io.h
+++ b/include/asm-generic/io.h
@@ -346,6 +346,7 @@ extern void ioport_unmap(void __iomem *p);
346#define xlate_dev_kmem_ptr(p) p 346#define xlate_dev_kmem_ptr(p) p
347#define xlate_dev_mem_ptr(p) __va(p) 347#define xlate_dev_mem_ptr(p) __va(p)
348 348
349#ifdef CONFIG_VIRT_TO_BUS
349#ifndef virt_to_bus 350#ifndef virt_to_bus
350static inline unsigned long virt_to_bus(volatile void *address) 351static inline unsigned long virt_to_bus(volatile void *address)
351{ 352{
@@ -357,6 +358,7 @@ static inline void *bus_to_virt(unsigned long address)
357 return (void *) address; 358 return (void *) address;
358} 359}
359#endif 360#endif
361#endif
360 362
361#ifndef memset_io 363#ifndef memset_io
362#define memset_io(a, b, c) memset(__io_virt(a), (b), (c)) 364#define memset_io(a, b, c) memset(__io_virt(a), (b), (c))
diff --git a/include/asm-generic/uaccess.h b/include/asm-generic/uaccess.h
index 9788568f7978..c184aa8ec8cd 100644
--- a/include/asm-generic/uaccess.h
+++ b/include/asm-generic/uaccess.h
@@ -7,7 +7,6 @@
7 * address space, e.g. all NOMMU machines. 7 * address space, e.g. all NOMMU machines.
8 */ 8 */
9#include <linux/sched.h> 9#include <linux/sched.h>
10#include <linux/mm.h>
11#include <linux/string.h> 10#include <linux/string.h>
12 11
13#include <asm/segment.h> 12#include <asm/segment.h>
@@ -32,7 +31,9 @@ static inline void set_fs(mm_segment_t fs)
32} 31}
33#endif 32#endif
34 33
34#ifndef segment_eq
35#define segment_eq(a, b) ((a).seg == (b).seg) 35#define segment_eq(a, b) ((a).seg == (b).seg)
36#endif
36 37
37#define VERIFY_READ 0 38#define VERIFY_READ 0
38#define VERIFY_WRITE 1 39#define VERIFY_WRITE 1
@@ -168,12 +169,18 @@ static inline __must_check long __copy_to_user(void __user *to,
168 -EFAULT; \ 169 -EFAULT; \
169}) 170})
170 171
172#ifndef __put_user_fn
173
171static inline int __put_user_fn(size_t size, void __user *ptr, void *x) 174static inline int __put_user_fn(size_t size, void __user *ptr, void *x)
172{ 175{
173 size = __copy_to_user(ptr, x, size); 176 size = __copy_to_user(ptr, x, size);
174 return size ? -EFAULT : size; 177 return size ? -EFAULT : size;
175} 178}
176 179
180#define __put_user_fn(sz, u, k) __put_user_fn(sz, u, k)
181
182#endif
183
177extern int __put_user_bad(void) __attribute__((noreturn)); 184extern int __put_user_bad(void) __attribute__((noreturn));
178 185
179#define __get_user(x, ptr) \ 186#define __get_user(x, ptr) \
@@ -224,12 +231,17 @@ extern int __put_user_bad(void) __attribute__((noreturn));
224 -EFAULT; \ 231 -EFAULT; \
225}) 232})
226 233
234#ifndef __get_user_fn
227static inline int __get_user_fn(size_t size, const void __user *ptr, void *x) 235static inline int __get_user_fn(size_t size, const void __user *ptr, void *x)
228{ 236{
229 size = __copy_from_user(x, ptr, size); 237 size = __copy_from_user(x, ptr, size);
230 return size ? -EFAULT : size; 238 return size ? -EFAULT : size;
231} 239}
232 240
241#define __get_user_fn(sz, u, k) __get_user_fn(sz, u, k)
242
243#endif
244
233extern int __get_user_bad(void) __attribute__((noreturn)); 245extern int __get_user_bad(void) __attribute__((noreturn));
234 246
235#ifndef __copy_from_user_inatomic 247#ifndef __copy_from_user_inatomic
diff --git a/include/asm-generic/unistd.h b/include/asm-generic/unistd.h
index 257c55ec4f77..4077b5d9ff81 100644
--- a/include/asm-generic/unistd.h
+++ b/include/asm-generic/unistd.h
@@ -17,5 +17,12 @@
17 * but it doesn't work on all toolchains, so we just do it by hand 17 * but it doesn't work on all toolchains, so we just do it by hand
18 */ 18 */
19#ifndef cond_syscall 19#ifndef cond_syscall
20#define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall") 20#ifdef CONFIG_SYMBOL_PREFIX
21#define __SYMBOL_PREFIX CONFIG_SYMBOL_PREFIX
22#else
23#define __SYMBOL_PREFIX
24#endif
25#define cond_syscall(x) asm(".weak\t" __SYMBOL_PREFIX #x "\n\t" \
26 ".set\t" __SYMBOL_PREFIX #x "," \
27 __SYMBOL_PREFIX "sys_ni_syscall")
21#endif 28#endif