mirror of
https://github.com/CloverHackyColor/CloverBootloader.git
synced 2024-12-04 13:23:26 +01:00
45 lines
1.1 KiB
NASM
45 lines
1.1 KiB
NASM
|
;------------------------------------------------------------------------------
|
||
|
;
|
||
|
; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
|
||
|
; SPDX-License-Identifier: BSD-2-Clause-Patent
|
||
|
;
|
||
|
; Module Name:
|
||
|
;
|
||
|
; ZeroMem.Asm
|
||
|
;
|
||
|
; Abstract:
|
||
|
;
|
||
|
; ZeroMem function
|
||
|
;
|
||
|
; Notes:
|
||
|
;
|
||
|
;------------------------------------------------------------------------------
|
||
|
|
||
|
DEFAULT REL
|
||
|
SECTION .text
|
||
|
|
||
|
;------------------------------------------------------------------------------
|
||
|
; VOID *
|
||
|
; InternalMemZeroMem (
|
||
|
; IN VOID *Buffer,
|
||
|
; IN UINTN Count
|
||
|
; );
|
||
|
;------------------------------------------------------------------------------
|
||
|
global ASM_PFX(InternalMemZeroMem)
|
||
|
ASM_PFX(InternalMemZeroMem):
|
||
|
push rdi
|
||
|
push rcx ; push Buffer
|
||
|
xor rax, rax ; rax = 0
|
||
|
mov rdi, rcx ; rdi = Buffer
|
||
|
mov rcx, rdx ; rcx = Count
|
||
|
shr rcx, 3 ; rcx = rcx / 8
|
||
|
and rdx, 7 ; rdx = rdx & 7
|
||
|
cld
|
||
|
rep stosq
|
||
|
mov rcx, rdx ; rcx = rdx
|
||
|
rep stosb
|
||
|
pop rax ; rax = Buffer
|
||
|
pop rdi
|
||
|
ret
|
||
|
|