diff options
author | Nicolas Pitre <nico@cam.org> | 2005-11-01 14:52:22 -0500 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2005-11-01 14:52:22 -0500 |
commit | a0c6fdb987860e6c7f9b8e57439ca2703f462578 (patch) | |
tree | 4709f4675f3e0fb19016c1245c467408dde36206 /arch/arm/lib | |
parent | 85eb226c446a017996859093cbfb5d3ae2c2117a (diff) |
[ARM] 2946/2: split --arch_clear_user() out of lib/uaccess.S
Patch from Nicolas Pitre
Required for future enhancement patches.
Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/lib')
-rw-r--r-- | arch/arm/lib/Makefile | 5 | ||||
-rw-r--r-- | arch/arm/lib/clear_user.S | 52 | ||||
-rw-r--r-- | arch/arm/lib/uaccess.S | 38 |
3 files changed, 55 insertions, 40 deletions
diff --git a/arch/arm/lib/Makefile b/arch/arm/lib/Makefile index 71e5b99e519e..d3d9b21eb7e4 100644 --- a/arch/arm/lib/Makefile +++ b/arch/arm/lib/Makefile | |||
@@ -9,8 +9,9 @@ lib-y := backtrace.o changebit.o csumipv6.o csumpartial.o \ | |||
9 | copy_page.o delay.o findbit.o memchr.o memcpy.o \ | 9 | copy_page.o delay.o findbit.o memchr.o memcpy.o \ |
10 | memset.o memzero.o setbit.o strncpy_from_user.o \ | 10 | memset.o memzero.o setbit.o strncpy_from_user.o \ |
11 | strnlen_user.o strchr.o strrchr.o testchangebit.o \ | 11 | strnlen_user.o strchr.o strrchr.o testchangebit.o \ |
12 | testclearbit.o testsetbit.o uaccess.o getuser.o \ | 12 | testclearbit.o testsetbit.o uaccess.o \ |
13 | putuser.o ashldi3.o ashrdi3.o lshrdi3.o muldi3.o \ | 13 | getuser.o putuser.o clear_user.o \ |
14 | ashldi3.o ashrdi3.o lshrdi3.o muldi3.o \ | ||
14 | ucmpdi2.o lib1funcs.o div64.o sha1.o \ | 15 | ucmpdi2.o lib1funcs.o div64.o sha1.o \ |
15 | io-readsb.o io-writesb.o io-readsl.o io-writesl.o | 16 | io-readsb.o io-writesb.o io-readsl.o io-writesl.o |
16 | 17 | ||
diff --git a/arch/arm/lib/clear_user.S b/arch/arm/lib/clear_user.S new file mode 100644 index 000000000000..7ff9f831b3f9 --- /dev/null +++ b/arch/arm/lib/clear_user.S | |||
@@ -0,0 +1,52 @@ | |||
1 | /* | ||
2 | * linux/arch/arm/lib/clear_user.S | ||
3 | * | ||
4 | * Copyright (C) 1995, 1996,1997,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/linkage.h> | ||
11 | #include <asm/assembler.h> | ||
12 | |||
13 | .text | ||
14 | |||
15 | /* Prototype: int __arch_clear_user(void *addr, size_t sz) | ||
16 | * Purpose : clear some user memory | ||
17 | * Params : addr - user memory address to clear | ||
18 | * : sz - number of bytes to clear | ||
19 | * Returns : number of bytes NOT cleared | ||
20 | */ | ||
21 | ENTRY(__arch_clear_user) | ||
22 | stmfd sp!, {r1, lr} | ||
23 | mov r2, #0 | ||
24 | cmp r1, #4 | ||
25 | blt 2f | ||
26 | ands ip, r0, #3 | ||
27 | beq 1f | ||
28 | cmp ip, #2 | ||
29 | USER( strbt r2, [r0], #1) | ||
30 | USER( strlebt r2, [r0], #1) | ||
31 | USER( strltbt r2, [r0], #1) | ||
32 | rsb ip, ip, #4 | ||
33 | sub r1, r1, ip @ 7 6 5 4 3 2 1 | ||
34 | 1: subs r1, r1, #8 @ -1 -2 -3 -4 -5 -6 -7 | ||
35 | USER( strplt r2, [r0], #4) | ||
36 | USER( strplt r2, [r0], #4) | ||
37 | bpl 1b | ||
38 | adds r1, r1, #4 @ 3 2 1 0 -1 -2 -3 | ||
39 | USER( strplt r2, [r0], #4) | ||
40 | 2: tst r1, #2 @ 1x 1x 0x 0x 1x 1x 0x | ||
41 | USER( strnebt r2, [r0], #1) | ||
42 | USER( strnebt r2, [r0], #1) | ||
43 | tst r1, #1 @ x1 x0 x1 x0 x1 x0 x1 | ||
44 | USER( strnebt r2, [r0], #1) | ||
45 | mov r0, #0 | ||
46 | LOADREGS(fd,sp!, {r1, pc}) | ||
47 | |||
48 | .section .fixup,"ax" | ||
49 | .align 0 | ||
50 | 9001: LOADREGS(fd,sp!, {r0, pc}) | ||
51 | .previous | ||
52 | |||
diff --git a/arch/arm/lib/uaccess.S b/arch/arm/lib/uaccess.S index d3ed0636c008..c28449157bea 100644 --- a/arch/arm/lib/uaccess.S +++ b/arch/arm/lib/uaccess.S | |||
@@ -657,41 +657,3 @@ USER( ldrgtbt r3, [r1], #1) @ May fault | |||
657 | LOADREGS(fd,sp!, {r4 - r7, pc}) | 657 | LOADREGS(fd,sp!, {r4 - r7, pc}) |
658 | .previous | 658 | .previous |
659 | 659 | ||
660 | /* Prototype: int __arch_clear_user(void *addr, size_t sz) | ||
661 | * Purpose : clear some user memory | ||
662 | * Params : addr - user memory address to clear | ||
663 | * : sz - number of bytes to clear | ||
664 | * Returns : number of bytes NOT cleared | ||
665 | */ | ||
666 | ENTRY(__arch_clear_user) | ||
667 | stmfd sp!, {r1, lr} | ||
668 | mov r2, #0 | ||
669 | cmp r1, #4 | ||
670 | blt 2f | ||
671 | ands ip, r0, #3 | ||
672 | beq 1f | ||
673 | cmp ip, #2 | ||
674 | USER( strbt r2, [r0], #1) | ||
675 | USER( strlebt r2, [r0], #1) | ||
676 | USER( strltbt r2, [r0], #1) | ||
677 | rsb ip, ip, #4 | ||
678 | sub r1, r1, ip @ 7 6 5 4 3 2 1 | ||
679 | 1: subs r1, r1, #8 @ -1 -2 -3 -4 -5 -6 -7 | ||
680 | USER( strplt r2, [r0], #4) | ||
681 | USER( strplt r2, [r0], #4) | ||
682 | bpl 1b | ||
683 | adds r1, r1, #4 @ 3 2 1 0 -1 -2 -3 | ||
684 | USER( strplt r2, [r0], #4) | ||
685 | 2: tst r1, #2 @ 1x 1x 0x 0x 1x 1x 0x | ||
686 | USER( strnebt r2, [r0], #1) | ||
687 | USER( strnebt r2, [r0], #1) | ||
688 | tst r1, #1 @ x1 x0 x1 x0 x1 x0 x1 | ||
689 | USER( strnebt r2, [r0], #1) | ||
690 | mov r0, #0 | ||
691 | LOADREGS(fd,sp!, {r1, pc}) | ||
692 | |||
693 | .section .fixup,"ax" | ||
694 | .align 0 | ||
695 | 9001: LOADREGS(fd,sp!, {r0, pc}) | ||
696 | .previous | ||
697 | |||