Last change
on this file since 331 was 3, checked in by vboxsync, 18 years ago |
Include asm memcpy/memset.
|
-
Property svn:keywords
set to
Id
|
File size:
2.2 KB
|
Line | |
---|
1 | ; $Id: memcpy.asm 3 2007-01-15 08:17:06Z vboxsync $
|
---|
2 | ;; @file
|
---|
3 | ; InnoTek Portable Runtime - No-CRT memcpy - AMD64 & X86.
|
---|
4 | ;
|
---|
5 |
|
---|
6 | ;
|
---|
7 | ; Copyright (C) 2006 InnoTek Systemberatung 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 |
|
---|
24 | ;;
|
---|
25 | ; @param pvDst gcc: rdi msc: rcx x86:[esp+4]
|
---|
26 | ; @param pvSrc gcc: rsi msc: rdx x86:[esp+8]
|
---|
27 | ; @param cb gcc: rdx msc: r8 x86:[esp+0ch]
|
---|
28 | BEGINPROC RT_NOCRT(memcpy)
|
---|
29 | cld
|
---|
30 |
|
---|
31 | ; Do the bulk of the work.
|
---|
32 | %ifdef __AMD64__
|
---|
33 | %ifdef ASM_CALL64_MSC
|
---|
34 | mov r10, rdi ; save
|
---|
35 | mov r11, rsi ; save
|
---|
36 | mov rdi, rcx
|
---|
37 | mov rsi, rdx
|
---|
38 | mov rcx, r8
|
---|
39 | mov rdx, r8
|
---|
40 | %else
|
---|
41 | mov rcx, rdx
|
---|
42 | %endif
|
---|
43 | mov rax, rdi ; save the return value
|
---|
44 | shr rcx, 3
|
---|
45 | rep movsq
|
---|
46 | %else
|
---|
47 | push edi
|
---|
48 | push esi
|
---|
49 |
|
---|
50 | mov ecx, [esp + 0ch + 8]
|
---|
51 | mov edi, [esp + 04h + 8]
|
---|
52 | mov esi, [esp + 08h + 8]
|
---|
53 | mov edx, ecx
|
---|
54 | mov eax, edi ; save the return value
|
---|
55 | shl ecx, 2
|
---|
56 | rep movsd
|
---|
57 | %endif
|
---|
58 |
|
---|
59 | ; The remaining bytes.
|
---|
60 | %ifdef __AMD64__
|
---|
61 | test dl, 4
|
---|
62 | jz .dont_move_dword
|
---|
63 | movsd
|
---|
64 | %endif
|
---|
65 | .dont_move_dword:
|
---|
66 | test dl, 2
|
---|
67 | jz .dont_move_word
|
---|
68 | movsw
|
---|
69 | .dont_move_word:
|
---|
70 | test dl, 1
|
---|
71 | jz .dont_move_byte
|
---|
72 | movsb
|
---|
73 | .dont_move_byte:
|
---|
74 |
|
---|
75 | %ifdef __AMD64__
|
---|
76 | %ifdef ASM_CALL64_MSC
|
---|
77 | mov rdi, r10
|
---|
78 | mov rsi, r11
|
---|
79 | %endif
|
---|
80 | %else
|
---|
81 | pop esi
|
---|
82 | pop edi
|
---|
83 | %endif
|
---|
84 | ret
|
---|
85 | ENDPROC RT_NOCRT(memcpy)
|
---|
86 |
|
---|
Note:
See
TracBrowser
for help on using the repository browser.