VirtualBox

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

Last change on this file since 78398 was 76553, checked in by vboxsync, 6 years ago

scm --update-copyright-year

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.8 KB
Line 
1; $Id: bzero.asm 76553 2019-01-01 01:45:53Z vboxsync $
2;; @file
3; IPRT - No-CRT bzero - AMD64 & X86.
4;
5
6;
7; Copyright (C) 2006-2019 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] wcall:eax
33; @param cb gcc: rsi msc: rdx x86:[esp+8] wcall:edx
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 %ifdef ASM_CALL32_WATCOM
74 mov ecx, edx
75 mov edi, eax
76 %else
77 mov ecx, [ebp + 0ch]
78 mov edi, [ebp + 08h]
79 %endif
80 xor eax, eax
81
82 mov edx, ecx
83 shr ecx, 2
84 rep stosd
85
86 and edx, 3
87 mov ecx, edx
88 rep stosb
89
90 pop edi
91 leave
92
93%elif ARCH_BITS == 16
94 push bp
95 mov bp, sp
96 push di
97
98 mov cx, [bp + 0ch]
99 mov di, [bp + 08h]
100 xor ax, ax
101
102 ; align di.
103 test di, 1
104 jz .aligned
105 jcxz .done
106 stosb
107 dec cx
108 jz .done
109
110.aligned:
111 mov dx, cx
112 shr cx, 1
113 rep stosw
114
115 test dl, 1
116 jz .done
117 stosb
118
119.done:
120 pop di
121 pop bp
122%else
123 %error ARCH_BITS
124%endif ; X86
125 ret
126ENDPROC RT_NOCRT(bzero)
127
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