2019-06-04 11:11:33 +03:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0-only */
|
2005-11-01 22:52:22 +03:00
|
|
|
/*
|
|
|
|
* linux/arch/arm/lib/clear_user.S
|
|
|
|
*
|
|
|
|
* Copyright (C) 1995, 1996,1997,1998 Russell King
|
|
|
|
*/
|
|
|
|
#include <linux/linkage.h>
|
|
|
|
#include <asm/assembler.h>
|
2015-09-15 02:11:30 +03:00
|
|
|
#include <asm/unwind.h>
|
2005-11-01 22:52:22 +03:00
|
|
|
|
|
|
|
.text
|
|
|
|
|
2015-08-19 13:02:28 +03:00
|
|
|
/* Prototype: unsigned long arm_clear_user(void *addr, size_t sz)
|
2005-11-01 22:52:22 +03:00
|
|
|
* Purpose : clear some user memory
|
|
|
|
* Params : addr - user memory address to clear
|
|
|
|
* : sz - number of bytes to clear
|
|
|
|
* Returns : number of bytes NOT cleared
|
|
|
|
*/
|
2009-03-09 05:34:45 +03:00
|
|
|
ENTRY(__clear_user_std)
|
2015-08-19 13:02:28 +03:00
|
|
|
WEAK(arm_clear_user)
|
2015-09-15 02:11:30 +03:00
|
|
|
UNWIND(.fnstart)
|
|
|
|
UNWIND(.save {r1, lr})
|
2005-11-01 22:52:22 +03:00
|
|
|
stmfd sp!, {r1, lr}
|
|
|
|
mov r2, #0
|
|
|
|
cmp r1, #4
|
|
|
|
blt 2f
|
|
|
|
ands ip, r0, #3
|
|
|
|
beq 1f
|
|
|
|
cmp ip, #2
|
2009-07-24 15:32:57 +04:00
|
|
|
strusr r2, r0, 1
|
|
|
|
strusr r2, r0, 1, le
|
|
|
|
strusr r2, r0, 1, lt
|
2005-11-01 22:52:22 +03:00
|
|
|
rsb ip, ip, #4
|
|
|
|
sub r1, r1, ip @ 7 6 5 4 3 2 1
|
|
|
|
1: subs r1, r1, #8 @ -1 -2 -3 -4 -5 -6 -7
|
2009-07-24 15:32:57 +04:00
|
|
|
strusr r2, r0, 4, pl, rept=2
|
2005-11-01 22:52:22 +03:00
|
|
|
bpl 1b
|
|
|
|
adds r1, r1, #4 @ 3 2 1 0 -1 -2 -3
|
2009-07-24 15:32:57 +04:00
|
|
|
strusr r2, r0, 4, pl
|
2005-11-01 22:52:22 +03:00
|
|
|
2: tst r1, #2 @ 1x 1x 0x 0x 1x 1x 0x
|
2009-07-24 15:32:57 +04:00
|
|
|
strusr r2, r0, 1, ne, rept=2
|
2005-11-01 22:52:22 +03:00
|
|
|
tst r1, #1 @ x1 x0 x1 x0 x1 x0 x1
|
2009-07-24 15:32:57 +04:00
|
|
|
it ne @ explicit IT needed for the label
|
2019-02-18 02:57:38 +03:00
|
|
|
USER( strbtne r2, [r0])
|
2005-11-01 22:52:22 +03:00
|
|
|
mov r0, #0
|
2006-06-25 14:23:45 +04:00
|
|
|
ldmfd sp!, {r1, pc}
|
2015-09-15 02:11:30 +03:00
|
|
|
UNWIND(.fnend)
|
2015-08-19 13:02:28 +03:00
|
|
|
ENDPROC(arm_clear_user)
|
2010-05-07 13:52:32 +04:00
|
|
|
ENDPROC(__clear_user_std)
|
2005-11-01 22:52:22 +03:00
|
|
|
|
2015-03-24 12:41:09 +03:00
|
|
|
.pushsection .text.fixup,"ax"
|
2005-11-01 22:52:22 +03:00
|
|
|
.align 0
|
2006-06-25 14:23:45 +04:00
|
|
|
9001: ldmfd sp!, {r0, pc}
|
2010-04-19 13:15:03 +04:00
|
|
|
.popsection
|
2005-11-01 22:52:22 +03:00
|
|
|
|