6e3b8c47 |
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 | # SetMem32.asm |
15 | # |
16 | # Abstract: |
17 | # |
18 | # SetMem32 function |
19 | # |
20 | # Notes: |
21 | # |
22 | #------------------------------------------------------------------------------ |
23 | |
b7089db1 |
24 | .globl _InternalMemSetMem32 |
6e3b8c47 |
25 | |
26 | #------------------------------------------------------------------------------ |
27 | # VOID * |
eb227e96 |
28 | # EFIAPI |
29 | # InternalMemSetMem32 ( |
6e3b8c47 |
30 | # IN VOID *Buffer, |
31 | # IN UINTN Count, |
32 | # IN UINT32 Value |
eb227e96 |
33 | # ); |
6e3b8c47 |
34 | #------------------------------------------------------------------------------ |
6e3b8c47 |
35 | _InternalMemSetMem32: |
36 | push %edi |
37 | movl 12(%esp), %edx |
38 | movl 8(%esp), %edi |
39 | xorl %ecx, %ecx |
40 | subl %edi, %ecx |
41 | andl $15, %ecx # ecx + edi aligns on 16-byte boundary |
42 | movl 16(%esp), %eax |
43 | jz L0 |
44 | shrl $2, %ecx |
45 | cmpl %edx, %ecx |
46 | cmova %edx, %ecx |
47 | subl %ecx, %edx |
48 | rep |
49 | stosl |
eb227e96 |
50 | L0: |
6e3b8c47 |
51 | movl %edx, %ecx |
52 | andl $3, %edx |
53 | shrl $2, %ecx |
b7089db1 |
54 | jz L_SetDwords |
6e3b8c47 |
55 | movd %eax, %xmm0 |
56 | pshufd $0, %xmm0, %xmm0 |
eb227e96 |
57 | L1: |
6e3b8c47 |
58 | movntdq %xmm0, (%edi) |
59 | addl $16, %edi |
60 | loop L1 |
61 | mfence |
b7089db1 |
62 | L_SetDwords: |
6e3b8c47 |
63 | movl %edx, %ecx |
64 | rep |
65 | stosl |
66 | movl 8(%esp), %eax |
67 | pop %edi |
68 | ret |