/*1* Copyright 2004-2009 Analog Devices Inc.2*3* Licensed under the ADI BSD license or the GPL-2 (or later)4*/56#include <linux/linkage.h>78.align 2910#ifdef CONFIG_MEMSET_L111.section .l1.text12#else13.text14#endif1516/*17* C Library function MEMSET18* R0 = address (leave unchanged to form result)19* R1 = filler byte20* R2 = count21* Favours word aligned data.22* The strncpy assumes that I0 and I1 are not used in this function23*/2425ENTRY(_memset)26P0 = R0 ; /* P0 = address */27P2 = R2 ; /* P2 = count */28R3 = R0 + R2; /* end */29CC = R2 <= 7(IU);30IF CC JUMP .Ltoo_small;31R1 = R1.B (Z); /* R1 = fill char */32R2 = 3;33R2 = R0 & R2; /* addr bottom two bits */34CC = R2 == 0; /* AZ set if zero. */35IF !CC JUMP .Lforce_align ; /* Jump if addr not aligned. */3637.Laligned:38P1 = P2 >> 2; /* count = n/4 */39R2 = R1 << 8; /* create quad filler */40R2.L = R2.L + R1.L(NS);41R2.H = R2.L + R1.H(NS);42P2 = R3;4344LSETUP (.Lquad_loop , .Lquad_loop) LC0=P1;45.Lquad_loop:46[P0++] = R2;4748CC = P0 == P2;49IF !CC JUMP .Lbytes_left;50RTS;5152.Lbytes_left:53R2 = R3; /* end point */54R3 = P0; /* current position */55R2 = R2 - R3; /* bytes left */56P2 = R2;5758.Ltoo_small:59CC = P2 == 0; /* Check zero count */60IF CC JUMP .Lfinished; /* Unusual */6162.Lbytes:63LSETUP (.Lbyte_loop , .Lbyte_loop) LC0=P2;64.Lbyte_loop:65B[P0++] = R1;6667.Lfinished:68RTS;6970.Lforce_align:71CC = BITTST (R0, 0); /* odd byte */72R0 = 4;73R0 = R0 - R2;74P1 = R0;75R0 = P0; /* Recover return address */76IF !CC JUMP .Lskip1;77B[P0++] = R1;78.Lskip1:79CC = R2 <= 2; /* 2 bytes */80P2 -= P1; /* reduce count */81IF !CC JUMP .Laligned;82B[P0++] = R1;83B[P0++] = R1;84JUMP .Laligned;8586ENDPROC(_memset)878889