/* SPDX-License-Identifier: GPL-2.0-only */1/*2* linux/arch/arm/lib/clear_user.S3*4* Copyright (C) 1995, 1996,1997,1998 Russell King5*/6#include <linux/linkage.h>7#include <asm/assembler.h>8#include <asm/unwind.h>910.text1112/* Prototype: unsigned long arm_clear_user(void *addr, size_t sz)13* Purpose : clear some user memory14* Params : addr - user memory address to clear15* : sz - number of bytes to clear16* Returns : number of bytes NOT cleared17*/18ENTRY(__clear_user_std)19WEAK(arm_clear_user)20UNWIND(.fnstart)21UNWIND(.save {r1, lr})22stmfd sp!, {r1, lr}23mov r2, #024cmp r1, #425blt 2f26ands ip, r0, #327beq 1f28cmp ip, #229strusr r2, r0, 130strusr r2, r0, 1, le31strusr r2, r0, 1, lt32rsb ip, ip, #433sub r1, r1, ip @ 7 6 5 4 3 2 1341: subs r1, r1, #8 @ -1 -2 -3 -4 -5 -6 -735strusr r2, r0, 4, pl, rept=236bpl 1b37adds r1, r1, #4 @ 3 2 1 0 -1 -2 -338strusr r2, r0, 4, pl392: tst r1, #2 @ 1x 1x 0x 0x 1x 1x 0x40strusr r2, r0, 1, ne, rept=241tst r1, #1 @ x1 x0 x1 x0 x1 x0 x142it ne @ explicit IT needed for the label43USER( strbtne r2, [r0])44mov r0, #045ldmfd sp!, {r1, pc}46UNWIND(.fnend)47ENDPROC(arm_clear_user)48ENDPROC(__clear_user_std)4950.pushsection .text.fixup,"ax"51.align 0529001: ldmfd sp!, {r0, pc}53.popsection54555657