diff options
author | Michal Simek <monstr@monstr.eu> | 2009-05-26 10:30:23 -0400 |
---|---|---|
committer | Michal Simek <monstr@monstr.eu> | 2009-05-26 10:45:20 -0400 |
commit | 0d6de9532663a4120ce35f507f16b72df382e360 (patch) | |
tree | 67e0f2f4f7abd401cff056f43afefd4ccf314a67 /arch/microblaze/lib | |
parent | 7db29dde731db02143418cfa008b7b77ccb2fa57 (diff) |
microblaze_mmu_v2: uaccess MMU update
Signed-off-by: Michal Simek <monstr@monstr.eu>
Diffstat (limited to 'arch/microblaze/lib')
-rw-r--r-- | arch/microblaze/lib/uaccess_old.S | 135 |
1 files changed, 135 insertions, 0 deletions
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 | ||