VirtualBox

source: vbox/trunk/src/VBox/Runtime/common/string/bzero.asm@ 72426

Last change on this file since 72426 was 69111, checked in by vboxsync, 7 years ago

(C) year

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.7 KB
Line 
1; $Id: bzero.asm 69111 2017-10-17 14:26:02Z vboxsync $
2;; @file
3; IPRT - No-CRT bzero - AMD64 & X86.
4;
5
6;
7; Copyright (C) 2006-2017 Oracle Corporation
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 (GPL) as published by the Free Software
13; Foundation, in version 2 as it comes in the "COPYING" file of the
14; VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15; hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16;
17; The contents of this file may alternatively be used under the terms
18; of the Common Development and Distribution License Version 1.0
19; (CDDL) only, as it comes in the "COPYING.CDDL" file of the
20; VirtualBox OSE distribution, in which case the provisions of the
21; CDDL are applicable instead of those of the GPL.
22;
23; You may elect to license modified versions of this file under the
24; terms and conditions of either the GPL or the CDDL or both.
25;
26
27%include "iprt/asmdefs.mac"
28
29BEGINCODE
30
31;;
32; @param pvDst gcc: rdi msc: rcx x86:[esp+4]
33; @param cb gcc: rsi msc: rdx x86:[esp+8]
34RT_NOCRT_BEGINPROC bzero
35%ifdef RT_OS_DARWIN
36GLOBALNAME __bzero
37%endif
38 cld
39%ifdef RT_ARCH_AMD64
40 xor eax, eax
41 %ifdef ASM_CALL64_MSC
42 mov r9, rdi ; save rdi in r9
43 mov rdi, rcx
44
45 ; todo: alignment?
46 mov rcx, rdx
47 shr rcx, 3
48 rep stosq
49
50 and rdx, 7
51 mov rcx, rdx
52 rep stosb
53
54 mov rdi, r9 ; restore rdi
55
56 %else ; GCC
57 ; todo: alignment?
58 mov rcx, rsi
59 shr rcx, 3
60 rep stosq
61
62 and rsi, 7
63 mov rcx, rsi
64 rep stosb
65
66 %endif ; GCC
67
68%elif ARCH_BITS == 32
69 push ebp
70 mov ebp, esp
71 push edi
72
73 mov ecx, [ebp + 0ch]
74 mov edi, [ebp + 08h]
75 xor eax, eax
76
77 mov edx, ecx
78 shr ecx, 2
79 rep stosd
80
81 and edx, 3
82 mov ecx, edx
83 rep stosb
84
85 pop edi
86 leave
87
88%elif ARCH_BITS == 16
89 push bp
90 mov bp, sp
91 push di
92
93 mov cx, [bp + 0ch]
94 mov di, [bp + 08h]
95 xor ax, ax
96
97 ; align di.
98 test di, 1
99 jz .aligned
100 jcxz .done
101 stosb
102 dec cx
103 jz .done
104
105.aligned:
106 mov dx, cx
107 shr cx, 1
108 rep stosw
109
110 test dl, 1
111 jz .done
112 stosb
113
114.done:
115 pop di
116 pop bp
117%else
118 %error ARCH_BITS
119%endif ; X86
120 ret
121ENDPROC RT_NOCRT(bzero)
122
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