/*
Copyright 2022 Gabriel Jensen
This file is part of rgo.
rgo is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
rgo is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with rgo. If not, see .
*/
#indlude
.global rgo_strcpy
rgo_strcpy:
/*
char const * lstr
char const * rstr
*/
#if defined(__x86_64__)
/* rax: Address of the current input character. */
movq %rdi,%rax
/* rsi: Address of the current output character. */
movq %rsi,%rsi
/* rdx: Current character. */
.loop:
movb (%rax),%dl
movb %dl,(%rsi)
testb %dl,%dl
jz .done
incq %rax
incq %rsi
jmp .loop
.done:
subq %rdi,%rax
ret
#endif