]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/blame - arch/arm/lib/clear_user.S
treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500
[mirror_ubuntu-hirsute-kernel.git] / arch / arm / lib / clear_user.S
CommitLineData
d2912cb1 1/* SPDX-License-Identifier: GPL-2.0-only */
a0c6fdb9
NP
2/*
3 * linux/arch/arm/lib/clear_user.S
4 *
5 * Copyright (C) 1995, 1996,1997,1998 Russell King
a0c6fdb9
NP
6 */
7#include <linux/linkage.h>
8#include <asm/assembler.h>
6f56a68d 9#include <asm/unwind.h>
a0c6fdb9
NP
10
11 .text
12
3fba7e23 13/* Prototype: unsigned long arm_clear_user(void *addr, size_t sz)
a0c6fdb9
NP
14 * Purpose : clear some user memory
15 * Params : addr - user memory address to clear
16 * : sz - number of bytes to clear
17 * Returns : number of bytes NOT cleared
18 */
a1f98849 19ENTRY(__clear_user_std)
3fba7e23 20WEAK(arm_clear_user)
6f56a68d
SB
21UNWIND(.fnstart)
22UNWIND(.save {r1, lr})
a0c6fdb9
NP
23 stmfd sp!, {r1, lr}
24 mov r2, #0
25 cmp r1, #4
26 blt 2f
27 ands ip, r0, #3
28 beq 1f
29 cmp ip, #2
8b592783
CM
30 strusr r2, r0, 1
31 strusr r2, r0, 1, le
32 strusr r2, r0, 1, lt
a0c6fdb9
NP
33 rsb ip, ip, #4
34 sub r1, r1, ip @ 7 6 5 4 3 2 1
351: subs r1, r1, #8 @ -1 -2 -3 -4 -5 -6 -7
8b592783 36 strusr r2, r0, 4, pl, rept=2
a0c6fdb9
NP
37 bpl 1b
38 adds r1, r1, #4 @ 3 2 1 0 -1 -2 -3
8b592783 39 strusr r2, r0, 4, pl
a0c6fdb9 402: tst r1, #2 @ 1x 1x 0x 0x 1x 1x 0x
8b592783 41 strusr r2, r0, 1, ne, rept=2
a0c6fdb9 42 tst r1, #1 @ x1 x0 x1 x0 x1 x0 x1
8b592783 43 it ne @ explicit IT needed for the label
e44fc388 44USER( strbtne r2, [r0])
a0c6fdb9 45 mov r0, #0
1b93a717 46 ldmfd sp!, {r1, pc}
6f56a68d 47UNWIND(.fnend)
3fba7e23 48ENDPROC(arm_clear_user)
e814d826 49ENDPROC(__clear_user_std)
a0c6fdb9 50
c4a84ae3 51 .pushsection .text.fixup,"ax"
a0c6fdb9 52 .align 0
1b93a717 539001: ldmfd sp!, {r0, pc}
4260415f 54 .popsection
a0c6fdb9 55