Last change
on this file since 5409 was 4071, checked in by vboxsync, 17 years ago |
Biggest check-in ever. New source code headers for all (C) innotek files.
|
-
Property svn:eol-style
set to
native
-
Property svn:keywords
set to
Id
|
File size:
2.0 KB
|
Line | |
---|
1 | ; $Id: memcpy.asm 4071 2007-08-07 17:07:59Z 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 | %include "iprt/asmdefs.mac"
|
---|
18 |
|
---|
19 | BEGINCODE
|
---|
20 |
|
---|
21 | ;;
|
---|
22 | ; @param pvDst gcc: rdi msc: rcx x86:[esp+4]
|
---|
23 | ; @param pvSrc gcc: rsi msc: rdx x86:[esp+8]
|
---|
24 | ; @param cb gcc: rdx msc: r8 x86:[esp+0ch]
|
---|
25 | BEGINPROC RT_NOCRT(memcpy)
|
---|
26 | cld
|
---|
27 |
|
---|
28 | ; Do the bulk of the work.
|
---|
29 | %ifdef RT_ARCH_AMD64
|
---|
30 | %ifdef ASM_CALL64_MSC
|
---|
31 | mov r10, rdi ; save
|
---|
32 | mov r11, rsi ; save
|
---|
33 | mov rdi, rcx
|
---|
34 | mov rsi, rdx
|
---|
35 | mov rcx, r8
|
---|
36 | mov rdx, r8
|
---|
37 | %else
|
---|
38 | mov rcx, rdx
|
---|
39 | %endif
|
---|
40 | mov rax, rdi ; save the return value
|
---|
41 | shr rcx, 3
|
---|
42 | rep movsq
|
---|
43 | %else
|
---|
44 | push edi
|
---|
45 | push esi
|
---|
46 |
|
---|
47 | mov ecx, [esp + 0ch + 8]
|
---|
48 | mov edi, [esp + 04h + 8]
|
---|
49 | mov esi, [esp + 08h + 8]
|
---|
50 | mov edx, ecx
|
---|
51 | mov eax, edi ; save the return value
|
---|
52 | shr ecx, 2
|
---|
53 | rep movsd
|
---|
54 | %endif
|
---|
55 |
|
---|
56 | ; The remaining bytes.
|
---|
57 | %ifdef RT_ARCH_AMD64
|
---|
58 | test dl, 4
|
---|
59 | jz .dont_move_dword
|
---|
60 | movsd
|
---|
61 | %endif
|
---|
62 | .dont_move_dword:
|
---|
63 | test dl, 2
|
---|
64 | jz .dont_move_word
|
---|
65 | movsw
|
---|
66 | .dont_move_word:
|
---|
67 | test dl, 1
|
---|
68 | jz .dont_move_byte
|
---|
69 | movsb
|
---|
70 | .dont_move_byte:
|
---|
71 |
|
---|
72 | %ifdef RT_ARCH_AMD64
|
---|
73 | %ifdef ASM_CALL64_MSC
|
---|
74 | mov rdi, r10
|
---|
75 | mov rsi, r11
|
---|
76 | %endif
|
---|
77 | %else
|
---|
78 | pop esi
|
---|
79 | pop edi
|
---|
80 | %endif
|
---|
81 | ret
|
---|
82 | ENDPROC RT_NOCRT(memcpy)
|
---|
83 |
|
---|
Note:
See
TracBrowser
for help on using the repository browser.