diff options
Diffstat (limited to 'zap/source')
-rw-r--r-- | zap/source/amd64/mem/cp.s | 17 | ||||
-rw-r--r-- | zap/source/any/mem/cp.c | 3 | ||||
-rw-r--r-- | zap/source/any/str/strlen.c | 2 |
3 files changed, 12 insertions, 10 deletions
diff --git a/zap/source/amd64/mem/cp.s b/zap/source/amd64/mem/cp.s index 2860acf..3c9f2e1 100644 --- a/zap/source/amd64/mem/cp.s +++ b/zap/source/amd64/mem/cp.s @@ -19,8 +19,8 @@ zap_cp: vmovdqu ymm0,[rsi] # val02 = *(unsigned int256_t *)src; vmovdqu [rdi],ymm0 # *(unsigned int256_t *)dest = val02; - add rsi,0x20 # dest += 0x20u; - add rdi,0x20 # src += 0x20u; + add rdi,0x20 # dest += 0x20u; + add rsi,0x20 # src += 0x20u; sub rdx,0x20 # num -= 0x20u; jmp short .big02cp # goto big02cp; @@ -31,8 +31,8 @@ zap_cp: movdqu xmm0,[rsi] # val01 = *(unsigned int128_t *)src; movdqu [rdi],xmm0 # *(unsigned int128_t *)dest = val01; - add rsi,0x10 # dest += 0x10u; - add rdi,0x10 # src += 0x10u; + add rdi,0x10 # dest += 0x10u; + add rsi,0x10 # src += 0x10u; sub rdx,0x10 # num -= 0x10u; jmp short .big01cp # goto big01cp; @@ -43,8 +43,8 @@ zap_cp: mov rcx,[rsi] # val8 = *(zap_i04 *)src; mov [rdi],rcx # *(zap_i04 *)dest = val8; - add rdi,0x8 # dest += 0x8u; - add rsi,0x8 # src += 0x8u; + add rsi,0x8 # dest += 0x8u; + add rdi,0x8 # src += 0x8u; sub rdx,0x8 # num -= 0x8u; jmp short .wrdcp # goto wrdcp @@ -53,7 +53,7 @@ zap_cp: jz short .done # goto done mov cl,[rsi] # val1 = *(zap_i8 *)src; - mov [rsi],cl # *(zap_i8 *)dest = val1; + mov [rdi],cl # *(zap_i8 *)dest = val1; inc rdi # ++dest; inc rsi # ++src; @@ -61,4 +61,5 @@ zap_cp: jmp short .bytecp # goto bytecp; .done: - ret # return + mov rax,rdi + ret # return dest; diff --git a/zap/source/any/mem/cp.c b/zap/source/any/mem/cp.c index 9752721..12c6bfd 100644 --- a/zap/source/any/mem/cp.c +++ b/zap/source/any/mem/cp.c @@ -6,9 +6,10 @@ #include <zap/mem.h> -void zap_cp(void * const zap_priv_restr voiddest,void const * const zap_priv_restr voidsrc,zap_sz const num) { +void * zap_cp(void * const zap_priv_restr voiddest,void const * const zap_priv_restr voidsrc,zap_sz const num) { unsigned char * dest = voiddest; unsigned char const * src = voidsrc; unsigned char * const stop = dest + num; while (dest != stop) *dest++ = *src++; + return dest; } diff --git a/zap/source/any/str/strlen.c b/zap/source/any/str/strlen.c index e6e9019..e763701 100644 --- a/zap/source/any/str/strlen.c +++ b/zap/source/any/str/strlen.c @@ -8,6 +8,6 @@ zap_sz zap_strlen(char const * str) { char const * const start = str; - while (*str++); + while (*str++ != '\x0'); return (zap_sz)(str - start) - 0x1u; } |