VirtualBox

source: vbox/trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-MemZero.asm@ 60009

Last change on this file since 60009 was 58720, checked in by vboxsync, 9 years ago

bs3kit: More code.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.6 KB
Line 
1; $Id: bs3-cmn-MemZero.asm 58720 2015-11-17 13:03:19Z vboxsync $
2;; @file
3; BS3Kit - Bs3MemZero.
4;
5
6;
7; Copyright (C) 2007-2015 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 "bs3kit-template-header.mac"
28
29;;
30; @cproto BS3_DECL(void) Bs3MemZero_c16(void BS3_FAR *pvDst, size_t cbDst);
31;
32BS3_PROC_BEGIN_CMN Bs3MemZero
33%ifdef RT_ARCH_AMD64
34 push rdi
35
36 mov rdi, rcx ; rdi = pvDst
37 mov rcx, rdx ; rcx = cbDst
38 shr rcx, 3 ; calc qword count.
39 xor eax, eax ; rax = 0 (filler qword)
40 cld
41 rep stosq
42
43 mov rcx, rdx ; cbDst
44 and rcx, 7 ; calc trailing byte count.
45 rep stosb
46
47 pop rdi
48 ret
49
50%elif ARCH_BITS == 16
51 push bp
52 mov bp, sp
53 push edi
54 push es
55
56 mov di, [bp + 4] ; pvDst.off
57 mov dx, [bp + 4 + 2] ; pvDst.sel
58 mov es, dx
59 mov cx, [bp + 4 + 4] ; cbDst
60 shr cx, 2 ; calc dword count.
61 xor eax, eax
62 rep stosd
63
64 mov cx, [bp + 4 + 4] ; cbDst
65 and cx, 3 ; calc tailing byte count.
66 rep stosb
67
68 pop es
69 pop edi
70 leave
71 ret
72
73%elif ARCH_BITS == 32
74 push edi
75
76 mov edi, [esp + 8] ; pvDst
77 mov ecx, [esp + 8 + 4] ; cbDst
78 shr cx, 2 ; calc dword count.
79 xor eax, eax
80 rep stosd
81
82 mov ecx, [esp + 8 + 4] ; cbDst
83 and ecx, 3 ; calc tailing byte count.
84 rep stosb
85
86 pop edi
87 ret
88
89%else
90 %error "Unknown bitness."
91%endif
92BS3_PROC_END_CMN Bs3MemZero
93
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