VirtualBox

source: vbox/trunk/src/VBox/Runtime/common/string/memcpy.asm@ 81106

Last change on this file since 81106 was 76553, checked in by vboxsync, 6 years ago

scm --update-copyright-year

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id Revision
File size: 2.6 KB
Line 
1; $Id: memcpy.asm 76553 2019-01-01 01:45:53Z vboxsync $
2;; @file
3; IPRT - No-CRT memcpy - AMD64 & X86.
4;
5
6;
7; Copyright (C) 2006-2019 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 pvDst gcc: rdi msc: rcx x86:[esp+4] wcall: eax
33; @param pvSrc gcc: rsi msc: rdx x86:[esp+8] wcall: edx
34; @param cb gcc: rdx msc: r8 x86:[esp+0ch] wcall: ebx
35RT_NOCRT_BEGINPROC memcpy
36 cld
37
38 ; Do the bulk of the work.
39%ifdef RT_ARCH_AMD64
40 %ifdef ASM_CALL64_MSC
41 mov r10, rdi ; save
42 mov r11, rsi ; save
43 mov rdi, rcx
44 mov rsi, rdx
45 mov rcx, r8
46 mov rdx, r8
47 %else
48 mov rcx, rdx
49 %endif
50 mov rax, rdi ; save the return value
51 shr rcx, 3
52 rep movsq
53%else
54 push edi
55 push esi
56
57 %ifdef ASM_CALL32_WATCOM
58 mov edi, eax
59 mov esi, edx
60 mov ecx, ebx
61 mov edx, ebx
62 %else
63 mov ecx, [esp + 0ch + 8]
64 mov edi, [esp + 04h + 8]
65 mov esi, [esp + 08h + 8]
66 mov edx, ecx
67 mov eax, edi ; save the return value
68 %endif
69 shr ecx, 2
70 rep movsd
71%endif
72
73 ; The remaining bytes.
74%ifdef RT_ARCH_AMD64
75 test dl, 4
76 jz .dont_move_dword
77 movsd
78%endif
79.dont_move_dword:
80 test dl, 2
81 jz .dont_move_word
82 movsw
83.dont_move_word:
84 test dl, 1
85 jz .dont_move_byte
86 movsb
87.dont_move_byte:
88
89%ifdef RT_ARCH_AMD64
90 %ifdef ASM_CALL64_MSC
91 mov rdi, r10
92 mov rsi, r11
93 %endif
94%else
95 pop esi
96 pop edi
97%endif
98 ret
99ENDPROC RT_NOCRT(memcpy)
100
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