diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-06-12 16:15:17 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-06-12 16:15:17 -0400 |
commit | 02a99ed6207e9a1d787bb360ef97de023c7edf4a (patch) | |
tree | f5818df7dd3f3741d02afbdd4271deed48c41f3d /arch/microblaze/lib | |
parent | 2b10dc45d15150434d7f206264e912eacbff734b (diff) | |
parent | 3447ef29a7f3b1fd0d8d58376950e695e04f6f8b (diff) |
Merge branch 'for-linus' of git://git.monstr.eu/linux-2.6-microblaze
* 'for-linus' of git://git.monstr.eu/linux-2.6-microblaze: (55 commits)
microblaze: Don't use access_ok for unaligned
microblaze: remove unused flat_stack_align() definition
microblaze: Fix problem with early_printk in startup
microblaze_mmu_v2: Makefiles
microblaze_mmu_v2: Kconfig update
microblaze_mmu_v2: stat.h MMU update
microblaze_mmu_v2: Elf update
microblaze_mmu_v2: Update dma.h for MMU
microblaze_mmu_v2: Update cacheflush.h
microblaze_mmu_v2: Update signal returning address
microblaze_mmu_v2: Traps MMU update
microblaze_mmu_v2: Enable fork syscall for MMU and add fork as vfork for noMMU
microblaze_mmu_v2: Update linker script for MMU
microblaze_mmu_v2: Add MMU related exceptions handling
microblaze_mmu_v2: uaccess MMU update
microblaze_mmu_v2: Update exception handling - MMU exception
microblaze_mmu_v2: entry.S, entry.h
microblaze_mmu_v2: Add CURRENT_TASK for entry.S
microblaze_mmu_v2: MMU asm offset update
microblaze_mmu_v2: Update tlb.h and tlbflush.h
...
Diffstat (limited to 'arch/microblaze/lib')
-rw-r--r-- | arch/microblaze/lib/Makefile | 3 | ||||
-rw-r--r-- | arch/microblaze/lib/checksum.c | 31 | ||||
-rw-r--r-- | arch/microblaze/lib/memcpy.c | 5 | ||||
-rw-r--r-- | arch/microblaze/lib/uaccess_old.S | 135 |
4 files changed, 157 insertions, 17 deletions
diff --git a/arch/microblaze/lib/Makefile b/arch/microblaze/lib/Makefile index d27126bf306a..71c8cb6c9e43 100644 --- a/arch/microblaze/lib/Makefile +++ b/arch/microblaze/lib/Makefile | |||
@@ -10,4 +10,5 @@ else | |||
10 | lib-y += memcpy.o memmove.o | 10 | lib-y += memcpy.o memmove.o |
11 | endif | 11 | endif |
12 | 12 | ||
13 | lib-y += uaccess.o | 13 | lib-$(CONFIG_NO_MMU) += uaccess.o |
14 | lib-$(CONFIG_MMU) += uaccess_old.o | ||
diff --git a/arch/microblaze/lib/checksum.c b/arch/microblaze/lib/checksum.c index 809340070a13..f08e74591418 100644 --- a/arch/microblaze/lib/checksum.c +++ b/arch/microblaze/lib/checksum.c | |||
@@ -32,9 +32,10 @@ | |||
32 | /* Revised by Kenneth Albanowski for m68knommu. Basic problem: unaligned access | 32 | /* Revised by Kenneth Albanowski for m68knommu. Basic problem: unaligned access |
33 | kills, so most of the assembly has to go. */ | 33 | kills, so most of the assembly has to go. */ |
34 | 34 | ||
35 | #include <net/checksum.h> | ||
36 | #include <asm/checksum.h> | ||
37 | #include <linux/module.h> | 35 | #include <linux/module.h> |
36 | #include <net/checksum.h> | ||
37 | |||
38 | #include <asm/byteorder.h> | ||
38 | 39 | ||
39 | static inline unsigned short from32to16(unsigned long x) | 40 | static inline unsigned short from32to16(unsigned long x) |
40 | { | 41 | { |
@@ -102,6 +103,7 @@ __sum16 ip_fast_csum(const void *iph, unsigned int ihl) | |||
102 | { | 103 | { |
103 | return (__force __sum16)~do_csum(iph, ihl*4); | 104 | return (__force __sum16)~do_csum(iph, ihl*4); |
104 | } | 105 | } |
106 | EXPORT_SYMBOL(ip_fast_csum); | ||
105 | 107 | ||
106 | /* | 108 | /* |
107 | * computes the checksum of a memory block at buff, length len, | 109 | * computes the checksum of a memory block at buff, length len, |
@@ -115,15 +117,16 @@ __sum16 ip_fast_csum(const void *iph, unsigned int ihl) | |||
115 | * | 117 | * |
116 | * it's best to have buff aligned on a 32-bit boundary | 118 | * it's best to have buff aligned on a 32-bit boundary |
117 | */ | 119 | */ |
118 | __wsum csum_partial(const void *buff, int len, __wsum sum) | 120 | __wsum csum_partial(const void *buff, int len, __wsum wsum) |
119 | { | 121 | { |
122 | unsigned int sum = (__force unsigned int)wsum; | ||
120 | unsigned int result = do_csum(buff, len); | 123 | unsigned int result = do_csum(buff, len); |
121 | 124 | ||
122 | /* add in old sum, and carry.. */ | 125 | /* add in old sum, and carry.. */ |
123 | result += sum; | 126 | result += sum; |
124 | if (sum > result) | 127 | if (sum > result) |
125 | result += 1; | 128 | result += 1; |
126 | return result; | 129 | return (__force __wsum)result; |
127 | } | 130 | } |
128 | EXPORT_SYMBOL(csum_partial); | 131 | EXPORT_SYMBOL(csum_partial); |
129 | 132 | ||
@@ -131,9 +134,9 @@ EXPORT_SYMBOL(csum_partial); | |||
131 | * this routine is used for miscellaneous IP-like checksums, mainly | 134 | * this routine is used for miscellaneous IP-like checksums, mainly |
132 | * in icmp.c | 135 | * in icmp.c |
133 | */ | 136 | */ |
134 | __sum16 ip_compute_csum(const unsigned char *buff, int len) | 137 | __sum16 ip_compute_csum(const void *buff, int len) |
135 | { | 138 | { |
136 | return ~do_csum(buff, len); | 139 | return (__force __sum16)~do_csum(buff, len); |
137 | } | 140 | } |
138 | EXPORT_SYMBOL(ip_compute_csum); | 141 | EXPORT_SYMBOL(ip_compute_csum); |
139 | 142 | ||
@@ -141,12 +144,18 @@ EXPORT_SYMBOL(ip_compute_csum); | |||
141 | * copy from fs while checksumming, otherwise like csum_partial | 144 | * copy from fs while checksumming, otherwise like csum_partial |
142 | */ | 145 | */ |
143 | __wsum | 146 | __wsum |
144 | csum_partial_copy_from_user(const char __user *src, char *dst, int len, | 147 | csum_partial_copy_from_user(const void __user *src, void *dst, int len, |
145 | int sum, int *csum_err) | 148 | __wsum sum, int *csum_err) |
146 | { | 149 | { |
147 | if (csum_err) | 150 | int missing; |
151 | |||
152 | missing = __copy_from_user(dst, src, len); | ||
153 | if (missing) { | ||
154 | memset(dst + len - missing, 0, missing); | ||
155 | *csum_err = -EFAULT; | ||
156 | } else | ||
148 | *csum_err = 0; | 157 | *csum_err = 0; |
149 | memcpy(dst, src, len); | 158 | |
150 | return csum_partial(dst, len, sum); | 159 | return csum_partial(dst, len, sum); |
151 | } | 160 | } |
152 | EXPORT_SYMBOL(csum_partial_copy_from_user); | 161 | EXPORT_SYMBOL(csum_partial_copy_from_user); |
@@ -155,7 +164,7 @@ EXPORT_SYMBOL(csum_partial_copy_from_user); | |||
155 | * copy from ds while checksumming, otherwise like csum_partial | 164 | * copy from ds while checksumming, otherwise like csum_partial |
156 | */ | 165 | */ |
157 | __wsum | 166 | __wsum |
158 | csum_partial_copy(const char *src, char *dst, int len, int sum) | 167 | csum_partial_copy(const void *src, void *dst, int len, __wsum sum) |
159 | { | 168 | { |
160 | memcpy(dst, src, len); | 169 | memcpy(dst, src, len); |
161 | return csum_partial(dst, len, sum); | 170 | return csum_partial(dst, len, sum); |
diff --git a/arch/microblaze/lib/memcpy.c b/arch/microblaze/lib/memcpy.c index 5880119c4487..6a907c58a4bc 100644 --- a/arch/microblaze/lib/memcpy.c +++ b/arch/microblaze/lib/memcpy.c | |||
@@ -154,8 +154,3 @@ void *memcpy(void *v_dst, const void *v_src, __kernel_size_t c) | |||
154 | } | 154 | } |
155 | EXPORT_SYMBOL(memcpy); | 155 | EXPORT_SYMBOL(memcpy); |
156 | #endif /* __HAVE_ARCH_MEMCPY */ | 156 | #endif /* __HAVE_ARCH_MEMCPY */ |
157 | |||
158 | void *cacheable_memcpy(void *d, const void *s, __kernel_size_t c) | ||
159 | { | ||
160 | return memcpy(d, s, c); | ||
161 | } | ||
diff --git a/arch/microblaze/lib/uaccess_old.S b/arch/microblaze/lib/uaccess_old.S new file mode 100644 index 000000000000..67f991c14b8a --- /dev/null +++ b/arch/microblaze/lib/uaccess_old.S | |||
@@ -0,0 +1,135 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2009 Michal Simek <monstr@monstr.eu> | ||
3 | * Copyright (C) 2009 PetaLogix | ||
4 | * Copyright (C) 2007 LynuxWorks, Inc. | ||
5 | * | ||
6 | * This file is subject to the terms and conditions of the GNU General Public | ||
7 | * License. See the file "COPYING" in the main directory of this archive | ||
8 | * for more details. | ||
9 | */ | ||
10 | |||
11 | #include <linux/errno.h> | ||
12 | #include <linux/linkage.h> | ||
13 | |||
14 | /* | ||
15 | * int __strncpy_user(char *to, char *from, int len); | ||
16 | * | ||
17 | * Returns: | ||
18 | * -EFAULT for an exception | ||
19 | * len if we hit the buffer limit | ||
20 | * bytes copied | ||
21 | */ | ||
22 | |||
23 | .text | ||
24 | .globl __strncpy_user; | ||
25 | .align 4; | ||
26 | __strncpy_user: | ||
27 | |||
28 | /* | ||
29 | * r5 - to | ||
30 | * r6 - from | ||
31 | * r7 - len | ||
32 | * r3 - temp count | ||
33 | * r4 - temp val | ||
34 | */ | ||
35 | addik r3,r7,0 /* temp_count = len */ | ||
36 | beqi r3,3f | ||
37 | 1: | ||
38 | lbu r4,r6,r0 | ||
39 | sb r4,r5,r0 | ||
40 | |||
41 | addik r3,r3,-1 | ||
42 | beqi r3,2f /* break on len */ | ||
43 | |||
44 | addik r5,r5,1 | ||
45 | bneid r4,1b | ||
46 | addik r6,r6,1 /* delay slot */ | ||
47 | addik r3,r3,1 /* undo "temp_count--" */ | ||
48 | 2: | ||
49 | rsubk r3,r3,r7 /* temp_count = len - temp_count */ | ||
50 | 3: | ||
51 | rtsd r15,8 | ||
52 | nop | ||
53 | |||
54 | |||
55 | .section .fixup, "ax" | ||
56 | .align 2 | ||
57 | 4: | ||
58 | brid 3b | ||
59 | addik r3,r0, -EFAULT | ||
60 | |||
61 | .section __ex_table, "a" | ||
62 | .word 1b,4b | ||
63 | |||
64 | /* | ||
65 | * int __strnlen_user(char __user *str, int maxlen); | ||
66 | * | ||
67 | * Returns: | ||
68 | * 0 on error | ||
69 | * maxlen + 1 if no NUL byte found within maxlen bytes | ||
70 | * size of the string (including NUL byte) | ||
71 | */ | ||
72 | |||
73 | .text | ||
74 | .globl __strnlen_user; | ||
75 | .align 4; | ||
76 | __strnlen_user: | ||
77 | addik r3,r6,0 | ||
78 | beqi r3,3f | ||
79 | 1: | ||
80 | lbu r4,r5,r0 | ||
81 | beqid r4,2f /* break on NUL */ | ||
82 | addik r3,r3,-1 /* delay slot */ | ||
83 | |||
84 | bneid r3,1b | ||
85 | addik r5,r5,1 /* delay slot */ | ||
86 | |||
87 | addik r3,r3,-1 /* for break on len */ | ||
88 | 2: | ||
89 | rsubk r3,r3,r6 | ||
90 | 3: | ||
91 | rtsd r15,8 | ||
92 | nop | ||
93 | |||
94 | |||
95 | .section .fixup,"ax" | ||
96 | 4: | ||
97 | brid 3b | ||
98 | addk r3,r0,r0 | ||
99 | |||
100 | .section __ex_table,"a" | ||
101 | .word 1b,4b | ||
102 | |||
103 | /* | ||
104 | * int __copy_tofrom_user(char *to, char *from, int len) | ||
105 | * Return: | ||
106 | * 0 on success | ||
107 | * number of not copied bytes on error | ||
108 | */ | ||
109 | .text | ||
110 | .globl __copy_tofrom_user; | ||
111 | .align 4; | ||
112 | __copy_tofrom_user: | ||
113 | /* | ||
114 | * r5 - to | ||
115 | * r6 - from | ||
116 | * r7, r3 - count | ||
117 | * r4 - tempval | ||
118 | */ | ||
119 | addik r3,r7,0 | ||
120 | beqi r3,3f | ||
121 | 1: | ||
122 | lbu r4,r6,r0 | ||
123 | addik r6,r6,1 | ||
124 | 2: | ||
125 | sb r4,r5,r0 | ||
126 | addik r3,r3,-1 | ||
127 | bneid r3,1b | ||
128 | addik r5,r5,1 /* delay slot */ | ||
129 | 3: | ||
130 | rtsd r15,8 | ||
131 | nop | ||
132 | |||
133 | |||
134 | .section __ex_table,"a" | ||
135 | .word 1b,3b,2b,3b | ||