riscv: memcpy: check src and dst before copy
Add src and dst address checking, if they are the same address, just return and don't copy data anymore. Signed-off-by: Rick Chen <rick@andestech.com> Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
This commit is contained in:
parent
5b71b7bf92
commit
3c60e59a4f
1 changed files with 2 additions and 0 deletions
|
@ -9,6 +9,7 @@
|
|||
/* void *memcpy(void *, const void *, size_t) */
|
||||
ENTRY(__memcpy)
|
||||
WEAK(memcpy)
|
||||
beq a0, a1, .copy_end
|
||||
/* Save for return value */
|
||||
mv t6, a0
|
||||
|
||||
|
@ -121,6 +122,7 @@ WEAK(memcpy)
|
|||
2:
|
||||
|
||||
mv a0, t6
|
||||
.copy_end:
|
||||
ret
|
||||
|
||||
.Lmisaligned_word_copy:
|
||||
|
|
Loading…
Reference in a new issue