/*
 *               Copyright (C) 2005, BroadOn Communications Corp.
 *
 *  These coded instructions, statements, and computer programs contain
 *  unpublished  proprietary information of BroadOn Communications Corp.,
 *  and  are protected by Federal copyright law. They may not be disclosed
 *  to  third  parties or copied or duplicated in any form, in whole or in
 *  part, without the prior written consent of BroadOn Communications Corp.
 *
 */

#include <ios.h>
#include <arm.h>
#include <asm.h>

/* Clear all bytes of large aligned buffer
 * Input: r0 = buf, r1 = size.
 * Caller ensures: buf is word aligned.
 *                 size (bytes) is a non-zero multiple of 128
 */
BEGIN_PROC(memclear)
    stmfd sp!, {r2-r9}
    mov r2, #0
    mov r3, #0
    mov r4, #0
    mov r5, #0
    mov r6, #0
    mov r7, #0
    mov r8, #0
    mov r9, #0

    subs r1, r1, #128
word32_cpy:
    stmia r0!, {r2-r9}
    stmia r0!, {r2-r9}
    stmia r0!, {r2-r9}
    stmia r0!, {r2-r9}
    subs r1, r1, #128
    bge word32_cpy

    ldmfd sp!, {r2-r9}
    bx lr
END_PROC(__memsets)
