VirtualBox

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

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

InnoTek -> innotek part 4: more miscellaneous files.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 2.2 KB
Line 
1; $Id: mempcpy.asm 2988 2007-06-01 17:36:09Z vboxsync $
2;; @file
3; innotek Portable Runtime - No-CRT mempcpy - 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(mempcpy)
31 cld ; paranoia
32
33 ; Do the bulk of the work.
34%ifdef __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 shr rcx, 3
46 rep movsq
47%else
48 mov eax, edi ; saving edi in eax
49 push esi
50
51 mov ecx, [esp + 0ch + 4]
52 mov edi, [esp + 04h + 4]
53 mov esi, [esp + 08h + 4]
54 mov edx, ecx
55 shr 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 ; restore & return
76%ifdef __AMD64__
77 mov rax, rdi
78 %ifdef ASM_CALL64_MSC
79 mov rsi, r11
80 mov rdi, r10
81 %endif
82%else
83 pop esi
84 xchg eax, edi
85%endif
86 ret
87ENDPROC RT_NOCRT(mempcpy)
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