]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Library/BaseMemoryLibMmx/Ia32/SetMem32.nasm
MdePkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / MdePkg / Library / BaseMemoryLibMmx / Ia32 / SetMem32.nasm
CommitLineData
b8f62ba2
JJ
1;------------------------------------------------------------------------------\r
2;\r
3; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>\r
9344f092 4; SPDX-License-Identifier: BSD-2-Clause-Patent\r
b8f62ba2
JJ
5;\r
6; Module Name:\r
7;\r
8; SetMem32.nasm\r
9;\r
10; Abstract:\r
11;\r
12; SetMem32 function\r
13;\r
14; Notes:\r
15;\r
16;------------------------------------------------------------------------------\r
17\r
18 SECTION .text\r
19\r
20;------------------------------------------------------------------------------\r
21; VOID *\r
22; EFIAPI\r
23; InternalMemSetMem32 (\r
24; IN VOID *Buffer,\r
25; IN UINTN Count,\r
26; IN UINT32 Value\r
27; );\r
28;------------------------------------------------------------------------------\r
29global ASM_PFX(InternalMemSetMem32)\r
30ASM_PFX(InternalMemSetMem32):\r
31 mov eax, [esp + 4] ; eax <- Buffer as return value\r
32 mov ecx, [esp + 8] ; ecx <- Count\r
33 movd mm0, dword [esp + 12] ; mm0 <- Value\r
34 shr ecx, 1 ; ecx <- number of qwords to set\r
35 mov edx, eax ; edx <- Buffer\r
36 jz @SetDwords\r
37 movq mm1, mm0\r
38 psllq mm1, 32\r
39 por mm0, mm1\r
40.0:\r
41 movq qword [edx], mm0\r
42 lea edx, [edx + 8] ; use "lea" to avoid change in flags\r
43 loop .0\r
44@SetDwords:\r
45 jnc .1\r
46 movd dword [edx], mm0\r
47.1:\r
48 ret\r
49\r