blob: 81041a3f8d50e373f210d446a68701627bcc2fce [file] [log] [blame]
Nicolas Pitrea0c6fdb2005-11-01 19:52:22 +00001/*
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
13 .text
14
Russell King02fcb972006-06-21 14:44:52 +010015/* Prototype: int __clear_user(void *addr, size_t sz)
Nicolas Pitrea0c6fdb2005-11-01 19:52:22 +000016 * Purpose : clear some user memory
17 * Params : addr - user memory address to clear
18 * : sz - number of bytes to clear
19 * Returns : number of bytes NOT cleared
20 */
Russell King02fcb972006-06-21 14:44:52 +010021ENTRY(__clear_user)
Nicolas Pitrea0c6fdb2005-11-01 19:52:22 +000022 stmfd sp!, {r1, lr}
23 mov r2, #0
24 cmp r1, #4
25 blt 2f
26 ands ip, r0, #3
27 beq 1f
28 cmp ip, #2
29USER( strbt r2, [r0], #1)
30USER( strlebt r2, [r0], #1)
31USER( strltbt r2, [r0], #1)
32 rsb ip, ip, #4
33 sub r1, r1, ip @ 7 6 5 4 3 2 1
341: subs r1, r1, #8 @ -1 -2 -3 -4 -5 -6 -7
35USER( strplt r2, [r0], #4)
36USER( strplt r2, [r0], #4)
37 bpl 1b
38 adds r1, r1, #4 @ 3 2 1 0 -1 -2 -3
39USER( strplt r2, [r0], #4)
402: tst r1, #2 @ 1x 1x 0x 0x 1x 1x 0x
41USER( strnebt r2, [r0], #1)
42USER( strnebt r2, [r0], #1)
43 tst r1, #1 @ x1 x0 x1 x0 x1 x0 x1
44USER( strnebt r2, [r0], #1)
45 mov r0, #0
Russell King1b93a712006-06-25 11:23:45 +010046 ldmfd sp!, {r1, pc}
Catalin Marinas93ed3972008-08-28 11:22:32 +010047ENDPROC(__clear_user)
Nicolas Pitrea0c6fdb2005-11-01 19:52:22 +000048
49 .section .fixup,"ax"
50 .align 0
Russell King1b93a712006-06-25 11:23:45 +0100519001: ldmfd sp!, {r0, pc}
Nicolas Pitrea0c6fdb2005-11-01 19:52:22 +000052 .previous
53