diff --git a/lib/strcpy.S b/lib/strcpy.S index 147e2eb..abd1a40 100644 --- a/lib/strcpy.S +++ b/lib/strcpy.S @@ -1,23 +1,17 @@ .intel_syntax noprefix - .globl _start - .text - -# String-copying routine. -# Commented-out lines would also return the starting address of the destination address. +# String-copying routine. Strings should be null-terminated. +# Input: rdi = source string base, rsi = destination string base +# No check is done for buffer overflow. strcpy: -# push rsi -.loop: movb r10b, [rdi] cmpb r10b, 0 je .end movb [rsi], r10b inc rdi inc rsi - jmp .loop + jmp strcpy .end: -# pop rax ret -