VirtualBox

source: vbox/trunk/src/VBox/Runtime/string/mempcpy.asm@ 642

Last change on this file since 642 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: mempcpy.asm 3 2007-01-15 08:17:06Z vboxsync $
2;; @file
3; InnoTek Portable Runtime - No-CRT mempcpy - 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]
28BEGINPROC RT_NOCRT(mempcpy)
29 cld ; paranoia
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 shr rcx, 3
44 rep movsq
45%else
46 mov eax, edi ; saving edi in eax
47 push esi
48
49 mov ecx, [esp + 0ch + 4]
50 mov edi, [esp + 04h + 4]
51 mov esi, [esp + 08h + 4]
52 mov edx, ecx
53 shl ecx, 2
54 rep movsd
55%endif
56
57 ; The remaining bytes.
58%ifdef __AMD64__
59 test dl, 4
60 jz .dont_move_dword
61 movsd
62%endif
63.dont_move_dword:
64 test dl, 2
65 jz .dont_move_word
66 movsw
67.dont_move_word:
68 test dl, 1
69 jz .dont_move_byte
70 movsb
71.dont_move_byte:
72
73 ; restore & return
74%ifdef __AMD64__
75 mov rax, rdi
76 %ifdef ASM_CALL64_MSC
77 mov rsi, r11
78 mov rdi, r10
79 %endif
80%else
81 pop esi
82 xchg eax, edi
83%endif
84 ret
85ENDPROC RT_NOCRT(mempcpy)
86
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