aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm26/lib/csumpartialcopyuser.S
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
commit1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch)
tree0bba044c4ce775e45a88a51686b5d9f90697ea9d /arch/arm26/lib/csumpartialcopyuser.S
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!
Diffstat (limited to 'arch/arm26/lib/csumpartialcopyuser.S')
-rw-r--r--arch/arm26/lib/csumpartialcopyuser.S115
1 files changed, 115 insertions, 0 deletions
diff --git a/arch/arm26/lib/csumpartialcopyuser.S b/arch/arm26/lib/csumpartialcopyuser.S
new file mode 100644
index 000000000000..5b821188e479
--- /dev/null
+++ b/arch/arm26/lib/csumpartialcopyuser.S
@@ -0,0 +1,115 @@
1/*
2 * linux/arch/arm26/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 <linux/config.h>
11#include <linux/linkage.h>
12#include <asm/assembler.h>
13#include <asm/errno.h>
14#include <asm/asm_offsets.h>
15
16 .text
17
18 .macro save_regs
19 stmfd sp!, {r1 - r2, r4 - r9, fp, ip, lr, pc}
20 mov r9, sp, lsr #13
21 mov r9, r9, lsl #13
22 ldr r9, [r9, #TSK_ADDR_LIMIT]
23 mov r9, r9, lsr #24
24 .endm
25
26 .macro load_regs,flags
27 ldm\flags fp, {r1, r2, r4-r9, fp, sp, pc}^
28 .endm
29
30 .macro load1b, reg1
31 tst r9, #0x01
329999: ldreqbt \reg1, [r0], #1
33 ldrneb \reg1, [r0], #1
34 .section __ex_table, "a"
35 .align 3
36 .long 9999b, 6001f
37 .previous
38 .endm
39
40 .macro load2b, reg1, reg2
41 tst r9, #0x01
429999: ldreqbt \reg1, [r0], #1
43 ldrneb \reg1, [r0], #1
449998: ldreqbt \reg2, [r0], #1
45 ldrneb \reg2, [r0], #1
46 .section __ex_table, "a"
47 .long 9999b, 6001f
48 .long 9998b, 6001f
49 .previous
50 .endm
51
52 .macro load1l, reg1
53 tst r9, #0x01
549999: ldreqt \reg1, [r0], #4
55 ldrne \reg1, [r0], #4
56 .section __ex_table, "a"
57 .align 3
58 .long 9999b, 6001f
59 .previous
60 .endm
61
62 .macro load2l, reg1, reg2
63 tst r9, #0x01
64 ldmneia r0!, {\reg1, \reg2}
659999: ldreqt \reg1, [r0], #4
669998: ldreqt \reg2, [r0], #4
67 .section __ex_table, "a"
68 .long 9999b, 6001f
69 .long 9998b, 6001f
70 .previous
71 .endm
72
73 .macro load4l, reg1, reg2, reg3, reg4
74 tst r9, #0x01
75 ldmneia r0!, {\reg1, \reg2, \reg3, \reg4}
769999: ldreqt \reg1, [r0], #4
779998: ldreqt \reg2, [r0], #4
789997: ldreqt \reg3, [r0], #4
799996: ldreqt \reg4, [r0], #4
80 .section __ex_table, "a"
81 .long 9999b, 6001f
82 .long 9998b, 6001f
83 .long 9997b, 6001f
84 .long 9996b, 6001f
85 .previous
86 .endm
87
88/*
89 * unsigned int
90 * csum_partial_copy_from_user(const char *src, char *dst, int len, int sum, int *err_ptr)
91 * r0 = src, r1 = dst, r2 = len, r3 = sum, [sp] = *err_ptr
92 * Returns : r0 = checksum, [[sp, #0], #0] = 0 or -EFAULT
93 */
94
95#define FN_ENTRY ENTRY(csum_partial_copy_from_user)
96
97#include "csumpartialcopygeneric.S"
98
99/*
100 * FIXME: minor buglet here
101 * We don't return the checksum for the data present in the buffer. To do
102 * so properly, we would have to add in whatever registers were loaded before
103 * the fault, which, with the current asm above is not predictable.
104 */
105 .align 4
1066001: mov r4, #-EFAULT
107 ldr r5, [fp, #4] @ *err_ptr
108 str r4, [r5]
109 ldmia sp, {r1, r2} @ retrieve dst, len
110 add r2, r2, r1
111 mov r0, #0 @ zero the buffer
1126002: teq r2, r1
113 strneb r0, [r1], #1
114 bne 6002b
115 load_regs ea