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