1;------------------------------------------------------------------------------
2;
3; Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
4; SPDX-License-Identifier: BSD-2-Clause-Patent
5;
6; Module Name:
7;
8;   CompareMem.Asm
9;
10; Abstract:
11;
12;   CompareMem function
13;
14; Notes:
15;
16;   The following BaseMemoryLib instances contain the same copy of this file:
17;
18;       BaseMemoryLibRepStr
19;       BaseMemoryLibMmx
20;       BaseMemoryLibSse2
21;       BaseMemoryLibOptDxe
22;       BaseMemoryLibOptPei
23;
24;------------------------------------------------------------------------------
25
26    DEFAULT REL
27    SECTION .text
28
29;------------------------------------------------------------------------------
30; INTN
31; EFIAPI
32; InternalMemCompareMem (
33;   IN      CONST VOID                *DestinationBuffer,
34;   IN      CONST VOID                *SourceBuffer,
35;   IN      UINTN                     Length
36;   );
37;------------------------------------------------------------------------------
38global ASM_PFX(InternalMemCompareMem)
39ASM_PFX(InternalMemCompareMem):
40    push    rsi
41    push    rdi
42    mov     rsi, rcx
43    mov     rdi, rdx
44    mov     rcx, r8
45    repe    cmpsb
46    movzx   rax, byte [rsi - 1]
47    movzx   rdx, byte [rdi - 1]
48    sub     rax, rdx
49    pop     rdi
50    pop     rsi
51    ret
52
53