Fix capitalization issues
[mirror_edk2.git] / MdePkg / Library / BaseMemoryLibMmx / Ia32 / SetMem.s
1 #------------------------------------------------------------------------------
2 #
3 # Copyright (c) 2006, Intel Corporation
4 # All rights reserved. This program and the accompanying materials
5 # are licensed and made available under the terms and conditions of the BSD License
6 # which accompanies this distribution. The full text of the license may be found at
7 # http://opensource.org/licenses/bsd-license.php
8 #
9 # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
11 #
12 # Module Name:
13 #
14 # SetMem.asm
15 #
16 # Abstract:
17 #
18 # SetMem function
19 #
20 # Notes:
21 #
22 #------------------------------------------------------------------------------
23
24 .686:
25 #.MODEL flat,C
26 .xmm:
27 .code:
28
29 #------------------------------------------------------------------------------
30 # VOID *
31 # _mem_SetMem (
32 # IN VOID *Buffer,
33 # IN UINTN Count,
34 # IN UINT8 Value
35 # )
36 #------------------------------------------------------------------------------
37 .global _InternalMemSetMem
38 _InternalMemSetMem:
39 push %edi
40 movl 12(%esp), %ecx # ecx <- Count
41 movl 8(%esp), %edi # edi <- Buffer
42 movl %ecx, %edx
43 shrl $3, %ecx # # of Qwords to set
44 movb 16(%esp), %al # al <- Value
45 jz @SetBytes
46 movb %al, %ah # ax <- Value | (Value << 8)
47 pushl %ecx
48 pushl %ecx
49 movq %mm0, (%esp) # save mm0
50 movd %eax, %mm0
51 pshufw $0x0,%mm0,%mm0
52 L0:
53 movntq %mm0, (%edi)
54 addl $8, %edi
55 loop L0
56 mfence
57 movq (%esp), %mm0 # restore mm0
58 popl %ecx # stack cleanup
59 popl %ecx
60 @SetBytes:
61 andl $7, %edx
62 movl %edx, %ecx
63 rep
64 stosb
65 movl 8(%esp), %eax # eax <- Buffer as return value
66 pop %edi
67 ret