OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [linux/] [linux-2.4/] [arch/] [arm/] [lib/] [csumpartialcopyuser.S] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1275 phoenix
/*
2
 *  linux/arch/arm/lib/csumpartialcopyuser.S
3
 *
4
 *  Copyright (C) 1995-1998 Russell King
5
 *
6
 * This program is free software; you can redistribute it and/or modify
7
 * it under the terms of the GNU General Public License version 2 as
8
 * published by the Free Software Foundation.
9
 */
10
#include 
11
#include 
12
#include 
13
#include 
14
#include 
15
 
16
                .text
17
 
18
#if defined(CONFIG_CPU_32)
19
 
20
                .macro  save_regs
21
                stmfd   sp!, {r1 - r2, r4 - r8, fp, ip, lr, pc}
22
                .endm
23
 
24
                .macro  load_regs,flags
25
                ldm\flags       fp, {r1, r2, r4-r8, fp, sp, pc}
26
                .endm
27
 
28
                .macro  load1b, reg1
29
9999:           ldrbt   \reg1, [r0], $1
30
                .section __ex_table, "a"
31
                .align  3
32
                .long   9999b, 6001f
33
                .previous
34
                .endm
35
 
36
                .macro  load2b, reg1, reg2
37
9999:           ldrbt   \reg1, [r0], $1
38
9998:           ldrbt   \reg2, [r0], $1
39
                .section __ex_table, "a"
40
                .long   9999b, 6001f
41
                .long   9998b, 6001f
42
                .previous
43
                .endm
44
 
45
                .macro  load1l, reg1
46
9999:           ldrt    \reg1, [r0], $4
47
                .section __ex_table, "a"
48
                .align  3
49
                .long   9999b, 6001f
50
                .previous
51
                .endm
52
 
53
                .macro  load2l, reg1, reg2
54
9999:           ldrt    \reg1, [r0], $4
55
9998:           ldrt    \reg2, [r0], $4
56
                .section __ex_table, "a"
57
                .long   9999b, 6001f
58
                .long   9998b, 6001f
59
                .previous
60
                .endm
61
 
62
                .macro  load4l, reg1, reg2, reg3, reg4
63
9999:           ldrt    \reg1, [r0], $4
64
9998:           ldrt    \reg2, [r0], $4
65
9997:           ldrt    \reg3, [r0], $4
66
9996:           ldrt    \reg4, [r0], $4
67
                .section __ex_table, "a"
68
                .long   9999b, 6001f
69
                .long   9998b, 6001f
70
                .long   9997b, 6001f
71
                .long   9996b, 6001f
72
                .previous
73
                .endm
74
 
75
#elif defined(CONFIG_CPU_26)
76
 
77
                .macro  save_regs
78
                stmfd   sp!, {r1 - r2, r4 - r9, fp, ip, lr, pc}
79
                mov     r9, sp, lsr #13
80
                mov     r9, r9, lsl #13
81
                ldr     r9, [r9, #TSK_ADDR_LIMIT]
82
                mov     r9, r9, lsr #24
83
                .endm
84
 
85
                .macro  load_regs,flags
86
                ldm\flags       fp, {r1, r2, r4-r9, fp, sp, pc}^
87
                .endm
88
 
89
                .macro  load1b, reg1
90
                tst     r9, #0x01
91
9999:           ldreqbt \reg1, [r0], #1
92
                ldrneb  \reg1, [r0], #1
93
                .section __ex_table, "a"
94
                .align  3
95
                .long   9999b, 6001f
96
                .previous
97
                .endm
98
 
99
                .macro  load2b, reg1, reg2
100
                tst     r9, #0x01
101
9999:           ldreqbt \reg1, [r0], #1
102
                ldrneb  \reg1, [r0], #1
103
9998:           ldreqbt \reg2, [r0], #1
104
                ldrneb  \reg2, [r0], #1
105
                .section __ex_table, "a"
106
                .long   9999b, 6001f
107
                .long   9998b, 6001f
108
                .previous
109
                .endm
110
 
111
                .macro  load1l, reg1
112
                tst     r9, #0x01
113
9999:           ldreqt  \reg1, [r0], #4
114
                ldrne   \reg1, [r0], #4
115
                .section __ex_table, "a"
116
                .align  3
117
                .long   9999b, 6001f
118
                .previous
119
                .endm
120
 
121
                .macro  load2l, reg1, reg2
122
                tst     r9, #0x01
123
                ldmneia r0!, {\reg1, \reg2}
124
9999:           ldreqt  \reg1, [r0], #4
125
9998:           ldreqt  \reg2, [r0], #4
126
                .section __ex_table, "a"
127
                .long   9999b, 6001f
128
                .long   9998b, 6001f
129
                .previous
130
                .endm
131
 
132
                .macro  load4l, reg1, reg2, reg3, reg4
133
                tst     r9, #0x01
134
                ldmneia r0!, {\reg1, \reg2, \reg3, \reg4}
135
9999:           ldreqt  \reg1, [r0], #4
136
9998:           ldreqt  \reg2, [r0], #4
137
9997:           ldreqt  \reg3, [r0], #4
138
9996:           ldreqt  \reg4, [r0], #4
139
                .section __ex_table, "a"
140
                .long   9999b, 6001f
141
                .long   9998b, 6001f
142
                .long   9997b, 6001f
143
                .long   9996b, 6001f
144
                .previous
145
                .endm
146
 
147
#else
148
#error Unknown CPU architecture
149
#endif
150
 
151
/*
152
 * unsigned int
153
 * csum_partial_copy_from_user(const char *src, char *dst, int len, int sum, int *err_ptr)
154
 *  r0 = src, r1 = dst, r2 = len, r3 = sum, [sp] = *err_ptr
155
 *  Returns : r0 = checksum, [[sp, #0], #0] = 0 or -EFAULT
156
 */
157
 
158
#define FN_ENTRY        ENTRY(csum_partial_copy_from_user)
159
 
160
#include "csumpartialcopygeneric.S"
161
 
162
/*
163
 * FIXME: minor buglet here
164
 * We don't return the checksum for the data present in the buffer.  To do
165
 * so properly, we would have to add in whatever registers were loaded before
166
 * the fault, which, with the current asm above is not predictable.
167
 */
168
#if defined(CONFIG_CPU_32)
169
                .section .fixup,"ax"
170
#endif
171
                .align  4
172
6001:           mov     r4, #-EFAULT
173
                ldr     r5, [fp, #4]            @ *err_ptr
174
                str     r4, [r5]
175
                ldmia   sp, {r1, r2}            @ retrieve dst, len
176
                add     r2, r2, r1
177
                mov     r0, #0                  @ zero the buffer
178
6002:           teq     r2, r1
179
                strneb  r0, [r1], #1
180
                bne     6002b
181
                load_regs       ea
182
#if defined(CONFIG_CPU_32)
183
                .previous
184
#endif

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.