VirtualBox

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

Last change on this file since 3672 was 3672, checked in by vboxsync, 17 years ago

RT_OS_* and RT_ARCH_* for Runtime/ and Support/

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 2.2 KB
Line 
1; $Id: memcpy.asm 3672 2007-07-17 12:39:30Z vboxsync $
2;; @file
3; innotek Portable Runtime - No-CRT memcpy - AMD64 & X86.
4;
5
6;
7; Copyright (C) 2006-2007 innotek GmbH
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 as published by the Free Software Foundation,
13; in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
14; distribution. VirtualBox OSE is distributed in the hope that it will
15; be useful, but WITHOUT ANY WARRANTY of any kind.
16;
17; If you received this file as part of a commercial VirtualBox
18; distribution, then only the terms of your commercial VirtualBox
19; license agreement apply instead of the previous paragraph.
20;
21
22%include "iprt/asmdefs.mac"
23
24BEGINCODE
25
26;;
27; @param pvDst gcc: rdi msc: rcx x86:[esp+4]
28; @param pvSrc gcc: rsi msc: rdx x86:[esp+8]
29; @param cb gcc: rdx msc: r8 x86:[esp+0ch]
30BEGINPROC RT_NOCRT(memcpy)
31 cld
32
33 ; Do the bulk of the work.
34%ifdef RT_ARCH_AMD64
35 %ifdef ASM_CALL64_MSC
36 mov r10, rdi ; save
37 mov r11, rsi ; save
38 mov rdi, rcx
39 mov rsi, rdx
40 mov rcx, r8
41 mov rdx, r8
42 %else
43 mov rcx, rdx
44 %endif
45 mov rax, rdi ; save the return value
46 shr rcx, 3
47 rep movsq
48%else
49 push edi
50 push esi
51
52 mov ecx, [esp + 0ch + 8]
53 mov edi, [esp + 04h + 8]
54 mov esi, [esp + 08h + 8]
55 mov edx, ecx
56 mov eax, edi ; save the return value
57 shr ecx, 2
58 rep movsd
59%endif
60
61 ; The remaining bytes.
62%ifdef RT_ARCH_AMD64
63 test dl, 4
64 jz .dont_move_dword
65 movsd
66%endif
67.dont_move_dword:
68 test dl, 2
69 jz .dont_move_word
70 movsw
71.dont_move_word:
72 test dl, 1
73 jz .dont_move_byte
74 movsb
75.dont_move_byte:
76
77%ifdef RT_ARCH_AMD64
78 %ifdef ASM_CALL64_MSC
79 mov rdi, r10
80 mov rsi, r11
81 %endif
82%else
83 pop esi
84 pop edi
85%endif
86 ret
87ENDPROC RT_NOCRT(memcpy)
88
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