]> git.kernelconcepts.de Git - karo-tx-linux.git/blob - arch/arm/lib/clear_user.S
Merge remote-tracking branch 'mips/mips-for-linux-next'
[karo-tx-linux.git] / arch / arm / lib / clear_user.S
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 #include <asm/unwind.h>
13
14                 .text
15
16 /* Prototype: unsigned long arm_clear_user(void *addr, size_t sz)
17  * Purpose  : clear some user memory
18  * Params   : addr - user memory address to clear
19  *          : sz   - number of bytes to clear
20  * Returns  : number of bytes NOT cleared
21  */
22 ENTRY(__clear_user_std)
23 WEAK(arm_clear_user)
24 UNWIND(.fnstart)
25 UNWIND(.save {r1, lr})
26                 stmfd   sp!, {r1, lr}
27                 mov     r2, #0
28                 cmp     r1, #4
29                 blt     2f
30                 ands    ip, r0, #3
31                 beq     1f
32                 cmp     ip, #2
33                 strusr  r2, r0, 1
34                 strusr  r2, r0, 1, le
35                 strusr  r2, r0, 1, lt
36                 rsb     ip, ip, #4
37                 sub     r1, r1, ip              @  7  6  5  4  3  2  1
38 1:              subs    r1, r1, #8              @ -1 -2 -3 -4 -5 -6 -7
39                 strusr  r2, r0, 4, pl, rept=2
40                 bpl     1b
41                 adds    r1, r1, #4              @  3  2  1  0 -1 -2 -3
42                 strusr  r2, r0, 4, pl
43 2:              tst     r1, #2                  @ 1x 1x 0x 0x 1x 1x 0x
44                 strusr  r2, r0, 1, ne, rept=2
45                 tst     r1, #1                  @ x1 x0 x1 x0 x1 x0 x1
46                 it      ne                      @ explicit IT needed for the label
47 USER(           strnebt r2, [r0])
48                 mov     r0, #0
49                 ldmfd   sp!, {r1, pc}
50 UNWIND(.fnend)
51 ENDPROC(arm_clear_user)
52 ENDPROC(__clear_user_std)
53
54                 .pushsection .text.fixup,"ax"
55                 .align  0
56 9001:           ldmfd   sp!, {r0, pc}
57                 .popsection
58