• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1;------------------------------------------------------------------------------
2;
3; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
4; This program and the accompanying materials
5; are licensed and made available under the terms and conditions of the BSD License
6; which accompanies this distribution.  The full text of the license may be found at
7; http://opensource.org/licenses/bsd-license.php.
8;
9; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
11;
12; Module Name:
13;
14;   ZeroMem.asm
15;
16; Abstract:
17;
18;   ZeroMem function
19;
20; Notes:
21;
22;------------------------------------------------------------------------------
23
24    .686
25    .model  flat,C
26    .xmm
27    .code
28
29;------------------------------------------------------------------------------
30;  VOID *
31;  EFIAPI
32;  InternalMemZeroMem (
33;    IN VOID   *Buffer,
34;    IN UINTN  Count
35;    );
36;------------------------------------------------------------------------------
37InternalMemZeroMem  PROC    USES    edi
38    mov     edi, [esp + 8]
39    mov     edx, [esp + 12]
40    xor     ecx, ecx
41    sub     ecx, edi
42    xor     eax, eax
43    and     ecx, 15
44    jz      @F
45    cmp     ecx, edx
46    cmova   ecx, edx
47    sub     edx, ecx
48    rep     stosb
49@@:
50    mov     ecx, edx
51    and     edx, 15
52    shr     ecx, 4
53    jz      @ZeroBytes
54    pxor    xmm0, xmm0
55@@:
56    movntdq [edi], xmm0
57    add     edi, 16
58    loop    @B
59    mfence
60@ZeroBytes:
61    mov     ecx, edx
62    rep     stosb
63    mov     eax, [esp + 8]
64    ret
65InternalMemZeroMem  ENDP
66
67    END
68