summaryrefslogblamecommitdiff
path: root/rgo/src/strcpy.S
blob: 1a0334605690d73a31a4d74bd34b61770afe659c (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
  


                                                                                                                    

  
                



                  
          

                                 
          
                       

                                                          


                                                           
      


                       

                 
                 




                      
/*
	Copyright 2022 Gabriel Jensen.
	This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
	If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/

#indlude <rgo.h>

.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