Polish up strcpy code

This commit is contained in:
Kiril Kovachev 2025-01-24 19:01:05 +00:00
parent d23173c8de
commit 7498741388

View File

@ -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