VirtualBox

source: vbox/trunk/src/VBox/Runtime/common/string/strcpy.asm@ 69219

Last change on this file since 69219 was 69219, checked in by vboxsync, 7 years ago

Runtime: scm cleanups

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id Revision
File size: 2.2 KB
Line 
1; $Id: strcpy.asm 69219 2017-10-24 15:01:30Z vboxsync $
2;; @file
3; IPRT - No-CRT strcpy - AMD64 & X86.
4;
5
6;
7; Copyright (C) 2006-2017 Oracle Corporation
8;
9; This file is part of VirtualBox Open Source Edition (OSE), as
10; available from http://www.virtualbox.org. This file is free software;
11; you can redistribute it and/or modify it under the terms of the GNU
12; General Public License (GPL) as published by the Free Software
13; Foundation, in version 2 as it comes in the "COPYING" file of the
14; VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15; hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16;
17; The contents of this file may alternatively be used under the terms
18; of the Common Development and Distribution License Version 1.0
19; (CDDL) only, as it comes in the "COPYING.CDDL" file of the
20; VirtualBox OSE distribution, in which case the provisions of the
21; CDDL are applicable instead of those of the GPL.
22;
23; You may elect to license modified versions of this file under the
24; terms and conditions of either the GPL or the CDDL or both.
25;
26
27%include "iprt/asmdefs.mac"
28
29BEGINCODE
30
31;;
32; @param pszDst gcc: rdi msc: rcx x86:[esp+4]
33; @param pszSrc gcc: rsi msc: rdx x86:[esp+8]
34RT_NOCRT_BEGINPROC strcpy
35 ; input
36%ifdef RT_ARCH_AMD64
37 %ifdef ASM_CALL64_MSC
38 %define pszDst rcx
39 %define pszSrc rdx
40 %else
41 %define pszDst rdi
42 %define pszSrc rsi
43 %endif
44 mov r8, pszDst
45%else
46 mov ecx, [esp + 4]
47 mov edx, [esp + 8]
48 %define pszDst ecx
49 %define pszSrc edx
50 push pszDst
51%endif
52
53 ;
54 ; The loop.
55 ;
56.next:
57 mov al, [pszSrc]
58 mov [pszDst], al
59 test al, al
60 jz .done
61
62 mov al, [pszSrc + 1]
63 mov [pszDst + 1], al
64 test al, al
65 jz .done
66
67 mov al, [pszSrc + 2]
68 mov [pszDst + 2], al
69 test al, al
70 jz .done
71
72 mov al, [pszSrc + 3]
73 mov [pszDst + 3], al
74 test al, al
75 jz .done
76
77 add pszDst, 4
78 add pszSrc, 4
79 jmp .next
80
81.done:
82%ifdef RT_ARCH_AMD64
83 mov rax, r8
84%else
85 pop eax
86%endif
87 ret
88ENDPROC RT_NOCRT(strcpy)
89
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette