Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-only */
0002 /*
0003  *  linux/arch/arm/lib/clear_user.S
0004  *
0005  *  Copyright (C) 1995, 1996,1997,1998 Russell King
0006  */
0007 #include <linux/linkage.h>
0008 #include <asm/assembler.h>
0009 #include <asm/unwind.h>
0010 
0011         .text
0012 
0013 /* Prototype: unsigned long arm_clear_user(void *addr, size_t sz)
0014  * Purpose  : clear some user memory
0015  * Params   : addr - user memory address to clear
0016  *          : sz   - number of bytes to clear
0017  * Returns  : number of bytes NOT cleared
0018  */
0019 ENTRY(__clear_user_std)
0020 WEAK(arm_clear_user)
0021 UNWIND(.fnstart)
0022 UNWIND(.save {r1, lr})
0023         stmfd   sp!, {r1, lr}
0024         mov r2, #0
0025         cmp r1, #4
0026         blt 2f
0027         ands    ip, r0, #3
0028         beq 1f
0029         cmp ip, #2
0030         strusr  r2, r0, 1
0031         strusr  r2, r0, 1, le
0032         strusr  r2, r0, 1, lt
0033         rsb ip, ip, #4
0034         sub r1, r1, ip      @  7  6  5  4  3  2  1
0035 1:      subs    r1, r1, #8      @ -1 -2 -3 -4 -5 -6 -7
0036         strusr  r2, r0, 4, pl, rept=2
0037         bpl 1b
0038         adds    r1, r1, #4      @  3  2  1  0 -1 -2 -3
0039         strusr  r2, r0, 4, pl
0040 2:      tst r1, #2          @ 1x 1x 0x 0x 1x 1x 0x
0041         strusr  r2, r0, 1, ne, rept=2
0042         tst r1, #1          @ x1 x0 x1 x0 x1 x0 x1
0043         it  ne          @ explicit IT needed for the label
0044 USER(       strbtne r2, [r0])
0045         mov r0, #0
0046         ldmfd   sp!, {r1, pc}
0047 UNWIND(.fnend)
0048 ENDPROC(arm_clear_user)
0049 ENDPROC(__clear_user_std)
0050 
0051         .pushsection .text.fixup,"ax"
0052         .align  0
0053 9001:       ldmfd   sp!, {r0, pc}
0054         .popsection
0055