]>
Commit | Line | Data |
---|---|---|
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 | # SetMem.asm | |
15 | # | |
16 | # Abstract: | |
17 | # | |
18 | # SetMem function | |
19 | # | |
20 | # Notes: | |
21 | # | |
22 | #------------------------------------------------------------------------------ | |
23 | ||
eb227e96 | 24 | .global _InternalMemSetMem |
6e3b8c47 | 25 | |
26 | #------------------------------------------------------------------------------ | |
27 | # VOID * | |
eb227e96 | 28 | # InternalMemSetMem ( |
6e3b8c47 | 29 | # IN VOID *Buffer, |
30 | # IN UINTN Count, | |
31 | # IN UINT8 Value | |
32 | # ) | |
33 | #------------------------------------------------------------------------------ | |
6e3b8c47 | 34 | _InternalMemSetMem: |
35 | push %edi | |
eb227e96 | 36 | movb 16(%esp), %al |
37 | movb %al, %ah | |
38 | shrdl $16, %eax, %edx | |
39 | shldl $16, %edx, %eax | |
6e3b8c47 | 40 | movl 12(%esp), %ecx # ecx <- Count |
41 | movl 8(%esp), %edi # edi <- Buffer | |
42 | movl %ecx, %edx | |
eb227e96 | 43 | andl $7, %edx |
6e3b8c47 | 44 | shrl $3, %ecx # # of Qwords to set |
eb227e96 | 45 | jz L1 |
46 | addl $0x-10, %esp | |
6e3b8c47 | 47 | movq %mm0, (%esp) # save mm0 |
eb227e96 | 48 | movq %mm1, 8(%esp) # save mm1 |
6e3b8c47 | 49 | movd %eax, %mm0 |
eb227e96 | 50 | movd %eax, %mm1 |
51 | psllq $32, %mm0 | |
52 | por %mm1, %mm0 # fill mm0 with 8 Value's | |
53 | L0: | |
54 | movq %mm0, (%edi) | |
6e3b8c47 | 55 | addl $8, %edi |
eb227e96 | 56 | loopl L0 |
6e3b8c47 | 57 | movq (%esp), %mm0 # restore mm0 |
eb227e96 | 58 | movq 8(%esp), %mm1 # restore mm1 |
59 | addl $0x10, %esp # stack cleanup | |
60 | L1: | |
6e3b8c47 | 61 | movl %edx, %ecx |
62 | rep | |
63 | stosb | |
64 | movl 8(%esp), %eax # eax <- Buffer as return value | |
65 | pop %edi | |
66 | ret |