From 749874138887fc42e0eb9b98498ba76c35b68466 Mon Sep 17 00:00:00 2001 From: Kiril Kovachev Date: Fri, 24 Jan 2025 19:01:05 +0000 Subject: [PATCH] Polish up strcpy code --- lib/strcpy.S | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) 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 -