1;------------------------------------------------------------------------------
2;
3; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
4; SPDX-License-Identifier: BSD-2-Clause-Patent
5;
6; Module Name:
7;
8;   ZeroMem.Asm
9;
10; Abstract:
11;
12;   ZeroMem function
13;
14; Notes:
15;
16;------------------------------------------------------------------------------
17
18    DEFAULT REL
19    SECTION .text
20
21;------------------------------------------------------------------------------
22;  VOID *
23;  InternalMemZeroMem (
24;    IN VOID   *Buffer,
25;    IN UINTN  Count
26;    );
27;------------------------------------------------------------------------------
28global ASM_PFX(InternalMemZeroMem)
29ASM_PFX(InternalMemZeroMem):
30    push    rdi
31    push    rcx       ; push Buffer
32    xor     rax, rax  ; rax = 0
33    mov     rdi, rcx  ; rdi = Buffer
34    mov     rcx, rdx  ; rcx = Count
35    shr     rcx, 3    ; rcx = rcx / 8
36    and     rdx, 7    ; rdx = rdx & 7
37    cld
38    rep     stosq
39    mov     rcx, rdx  ; rcx = rdx
40    rep     stosb
41    pop     rax       ; rax = Buffer
42    pop     rdi
43    ret
44
45