VirtualBox

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

Last change on this file since 5285 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: mempcpy.asm 4071 2007-08-07 17:07:59Z 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%include "iprt/asmdefs.mac"
18
19BEGINCODE
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]
25BEGINPROC RT_NOCRT(mempcpy)
26 cld ; paranoia
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 shr rcx, 3
41 rep movsq
42%else
43 mov eax, edi ; saving edi in eax
44 push esi
45
46 mov ecx, [esp + 0ch + 4]
47 mov edi, [esp + 04h + 4]
48 mov esi, [esp + 08h + 4]
49 mov edx, ecx
50 shr ecx, 2
51 rep movsd
52%endif
53
54 ; The remaining bytes.
55%ifdef RT_ARCH_AMD64
56 test dl, 4
57 jz .dont_move_dword
58 movsd
59%endif
60.dont_move_dword:
61 test dl, 2
62 jz .dont_move_word
63 movsw
64.dont_move_word:
65 test dl, 1
66 jz .dont_move_byte
67 movsb
68.dont_move_byte:
69
70 ; restore & return
71%ifdef RT_ARCH_AMD64
72 mov rax, rdi
73 %ifdef ASM_CALL64_MSC
74 mov rsi, r11
75 mov rdi, r10
76 %endif
77%else
78 pop esi
79 xchg eax, edi
80%endif
81 ret
82ENDPROC RT_NOCRT(mempcpy)
83
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