/*1* linux/arch/unicore32/lib/clear_user.S2*3* Code specific to PKUnity SoC and UniCore ISA4*5* Copyright (C) 2001-2010 GUAN Xue-tao6*7* This program is free software; you can redistribute it and/or modify8* it under the terms of the GNU General Public License version 2 as9* published by the Free Software Foundation.10*/11#include <linux/linkage.h>12#include <asm/assembler.h>1314.text1516/* Prototype: int __clear_user(void *addr, size_t sz)17* Purpose : clear some user memory18* Params : addr - user memory address to clear19* : sz - number of bytes to clear20* Returns : number of bytes NOT cleared21*/22WEAK(__clear_user)23stm.w (lr), [sp-]24stm.w (r1), [sp-]25mov r2, #026csub.a r1, #427bsl 2f28and.a ip, r0, #329beq 1f30csub.a ip, #231strusr r2, r0, 132strusr r2, r0, 1, el33strusr r2, r0, 1, sl34rsub ip, ip, #435sub r1, r1, ip @ 7 6 5 4 3 2 1361: sub.a r1, r1, #8 @ -1 -2 -3 -4 -5 -6 -737strusr r2, r0, 4, ns, rept=238bns 1b39add.a r1, r1, #4 @ 3 2 1 0 -1 -2 -340strusr r2, r0, 4, ns412: cand.a r1, #2 @ 1x 1x 0x 0x 1x 1x 0x42strusr r2, r0, 1, ne, rept=243cand.a r1, #1 @ x1 x0 x1 x0 x1 x0 x144beq 3f45USER( stb.u r2, [r0])463: mov r0, #047ldm.w (r1), [sp]+48ldm.w (pc), [sp]+49ENDPROC(__clear_user)5051.pushsection .fixup,"ax"52.align 0539001: ldm.w (r0), [sp]+54ldm.w (pc), [sp]+55.popsection56575859