Path: blob/master/arch/avr32/lib/csum_partial_copy_generic.S
10817 views
/*1* Copyright (C) 2004-2006 Atmel Corporation2*3* This program is free software; you can redistribute it and/or modify4* it under the terms of the GNU General Public License version 2 as5* published by the Free Software Foundation.6*/7#include <asm/errno.h>8#include <asm/asm.h>910/*11* unsigned int csum_partial_copy_generic(const char *src, char *dst, int len12* int sum, int *src_err_ptr,13* int *dst_err_ptr)14*15* Copy src to dst while checksumming, otherwise like csum_partial.16*/1718.macro ld_src size, reg, ptr199999: ld.\size \reg, \ptr20.section __ex_table, "a"21.long 9999b, fixup_ld_src22.previous23.endm2425.macro st_dst size, ptr, reg269999: st.\size \ptr, \reg27.section __ex_table, "a"28.long 9999b, fixup_st_dst29.previous30.endm3132.text33.global csum_partial_copy_generic34.type csum_partial_copy_generic,"function"35.align 136csum_partial_copy_generic:37pushm r4-r7,lr3839/* The inner loop */401: sub r10, 441brlt 5f422: ld_src w, r5, r12++43st_dst w, r11++, r544add r9, r545acr r946sub r10, 447brge 2b4849/* return if we had a whole number of words */505: sub r10, -451brne 7f52536: mov r12, r954popm r4-r7,pc5556/* handle additional bytes at the tail */577: mov r5, 058mov r4, 32598: ld_src ub, r6, r12++60st_dst b, r11++, r661lsl r5, 862sub r4, 863bfins r5, r6, 0, 864sub r10, 165brne 8b6667lsl r5, r5, r468add r9, r569acr r970rjmp 6b7172/* Exception handler */73.section .fixup,"ax"74.align 175fixup_ld_src:76mov r9, -EFAULT77cp.w r8, 078breq 1f79st.w r8[0], r980811: /*82* TODO: zero the complete destination - computing the rest83* is too much work84*/8586mov r9, 087rjmp 6b8889fixup_st_dst:90mov r9, -EFAULT91lddsp r8, sp[20]92cp.w r8, 093breq 1f94st.w r8[0], r9951: mov r9, 096rjmp 6b9798.previous99100101