]>
Commit | Line | Data |
---|---|---|
c5ecf6c1 | 1 | #------------------------------------------------------------------------------\r |
2 | #\r | |
3 | # Copyright (c) 2006, Intel Corporation\r | |
4 | # All rights reserved. This program and the accompanying materials\r | |
5 | # are licensed and made available under the terms and conditions of the BSD License\r | |
6 | # which accompanies this distribution. The full text of the license may be found at\r | |
7 | # http://opensource.org/licenses/bsd-license.php\r | |
8 | #\r | |
9 | # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
10 | # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
11 | #\r | |
12 | # Module Name:\r | |
13 | #\r | |
14 | # SetMem.asm\r | |
15 | #\r | |
16 | # Abstract:\r | |
17 | #\r | |
18 | # SetMem function\r | |
19 | #\r | |
20 | # Notes:\r | |
21 | #\r | |
22 | #------------------------------------------------------------------------------\r | |
23 | \r | |
24 | .globl _InternalMemSetMem\r | |
25 | \r | |
26 | #------------------------------------------------------------------------------\r | |
27 | # VOID *\r | |
28 | # InternalMemSetMem (\r | |
29 | # IN VOID *Buffer,\r | |
30 | # IN UINTN Count,\r | |
31 | # IN UINT8 Value\r | |
32 | # )\r | |
33 | #------------------------------------------------------------------------------\r | |
34 | _InternalMemSetMem:\r | |
35 | push %edi\r | |
36 | movb 16(%esp), %al\r | |
37 | movb %al, %ah\r | |
38 | shrdl $16, %eax, %edx\r | |
39 | shldl $16, %edx, %eax\r | |
40 | movl 12(%esp), %ecx # ecx <- Count\r | |
41 | movl 8(%esp), %edi # edi <- Buffer\r | |
42 | movl %ecx, %edx\r | |
43 | andl $7, %edx\r | |
44 | shrl $3, %ecx # # of Qwords to set\r | |
45 | jz L1\r | |
46 | addl $0x-10, %esp\r | |
47 | movq %mm0, (%esp) # save mm0\r | |
48 | movq %mm1, 8(%esp) # save mm1\r | |
49 | movd %eax, %mm0\r | |
50 | movd %eax, %mm1\r | |
51 | psllq $32, %mm0\r | |
52 | por %mm1, %mm0 # fill mm0 with 8 Value's\r | |
53 | L0:\r | |
54 | movq %mm0, (%edi)\r | |
55 | addl $8, %edi\r | |
56 | loopl L0\r | |
57 | movq (%esp), %mm0 # restore mm0\r | |
58 | movq 8(%esp), %mm1 # restore mm1\r | |
59 | addl $0x10, %esp # stack cleanup\r | |
60 | L1:\r | |
61 | movl %edx, %ecx\r | |
62 | rep\r | |
63 | stosb\r | |
64 | movl 8(%esp), %eax # eax <- Buffer as return value\r | |
65 | pop %edi\r | |
66 | ret\r |