1#
2# ConvertAsm.py: Automatically generated from ZeroMem.asm
3#
4#------------------------------------------------------------------------------
5#
6# Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
7# This program and the accompanying materials
8# are licensed and made available under the terms and conditions of the BSD License
9# which accompanies this distribution.  The full text of the license may be found at
10# http://opensource.org/licenses/bsd-license.php.
11#
12# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
13# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
14#
15# Module Name:
16#
17#   ZeroMem.S
18#
19# Abstract:
20#
21#   ZeroMem function
22#
23# Notes:
24#
25#------------------------------------------------------------------------------
26
27
28#------------------------------------------------------------------------------
29#  VOID *
30#  InternalMemZeroMem (
31#    IN VOID   *Buffer,
32#    IN UINTN  Count
33#    );
34#------------------------------------------------------------------------------
35ASM_GLOBAL ASM_PFX(InternalMemZeroMem)
36ASM_PFX(InternalMemZeroMem):
37    pushq   %rdi
38    movq    %rcx, %rdi
39    xorq    %rcx, %rcx
40    xorl    %eax, %eax
41    subq    %rdi, %rcx
42    andq    $15, %rcx
43    movq    %rdi, %r8
44    jz      L0
45    cmpq    %rdx, %rcx
46    cmova   %rdx, %rcx
47    subq    %rcx, %rdx
48    rep     stosb
49L0:
50    movq    %rdx, %rcx
51    andl    $15, %edx
52    shrq    $4, %rcx
53    jz      L_ZeroBytes
54    pxor    %xmm0, %xmm0
55L1:
56    movntdq %xmm0, (%rdi)                 # rdi should be 16-byte aligned
57    addq    $16, %rdi
58    loop    L1
59    mfence
60L_ZeroBytes:
61    movl    %edx, %ecx
62    rep     stosb
63    movq    %r8, %rax
64    popq    %rdi
65    ret
66