]>
Commit | Line | Data |
---|---|---|
b1ff428c | 1 | #\r |
2 | # ConvertAsm.py: Automatically generated from SetMem.asm\r | |
3 | #\r | |
4 | #------------------------------------------------------------------------------\r | |
5 | #\r | |
1fef058f | 6 | # Copyright (c) 2006 - 2009, Intel Corporation\r |
b1ff428c | 7 | # All rights reserved. This program and the accompanying materials\r |
8 | # are licensed and made available under the terms and conditions of the BSD License\r | |
9 | # which accompanies this distribution. The full text of the license may be found at\r | |
10 | # http://opensource.org/licenses/bsd-license.php\r | |
11 | #\r | |
12 | # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
13 | # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
14 | #\r | |
15 | # Module Name:\r | |
16 | #\r | |
17 | # SetMem.S\r | |
18 | #\r | |
19 | # Abstract:\r | |
20 | #\r | |
21 | # SetMem function\r | |
22 | #\r | |
23 | # Notes:\r | |
24 | #\r | |
25 | #------------------------------------------------------------------------------\r | |
26 | \r | |
27 | \r | |
28 | #------------------------------------------------------------------------------\r | |
29 | # VOID *\r | |
30 | # EFIAPI\r | |
31 | # InternalMemSetMem (\r | |
32 | # IN VOID *Buffer,\r | |
33 | # IN UINTN Count,\r | |
34 | # IN UINT8 Value\r | |
35 | # )\r | |
36 | #------------------------------------------------------------------------------\r | |
132f41f0 | 37 | ASM_GLOBAL ASM_PFX(InternalMemSetMem)\r |
b1ff428c | 38 | ASM_PFX(InternalMemSetMem):\r |
1fef058f | 39 | pushq %rdi\r |
40 | movq %rcx, %rdi # rdi <- Buffer\r | |
41 | movb %r8b, %al # al <- Value\r | |
42 | movq %rdi, %r9 # r9 <- Buffer as return value\r | |
43 | xorq %rcx, %rcx\r | |
44 | subq %rdi, %rcx\r | |
45 | andq $15, %rcx # rcx + rdi aligns on 16-byte boundary\r | |
b1ff428c | 46 | jz L0\r |
1fef058f | 47 | cmpq %rdx, %rcx\r |
48 | cmova %rdx, %rcx\r | |
49 | subq %rcx, %rdx\r | |
b1ff428c | 50 | rep stosb\r |
51 | L0:\r | |
1fef058f | 52 | movq %rdx, %rcx\r |
53 | andq $15, %rdx\r | |
54 | shrq $4, %rcx\r | |
b1ff428c | 55 | jz L_SetBytes\r |
1fef058f | 56 | movb %al, %ah # ax <- Value repeats twice\r |
57 | movdqa %xmm0, 0x10(%rsp) # save xmm0\r | |
58 | movd %eax, %xmm0 # xmm0[0..16] <- Value repeats twice\r | |
59 | pshuflw $0, %xmm0, %xmm0 # xmm0[0..63] <- Value repeats 8 times\r | |
60 | movlhps %xmm0, %xmm0 # xmm0 <- Value repeats 16 times\r | |
b1ff428c | 61 | L1:\r |
1fef058f | 62 | movntdq %xmm0, (%rdi) # rdi should be 16-byte aligned\r |
63 | add $16, %rdi\r | |
b1ff428c | 64 | loop L1\r |
65 | mfence\r | |
1fef058f | 66 | movdqa 0x10(%rsp), %xmm0 # restore xmm0\r |
b1ff428c | 67 | L_SetBytes:\r |
1fef058f | 68 | movl %edx, %ecx # high 32 bits of rcx are always zero\r |
b1ff428c | 69 | rep stosb\r |
1fef058f | 70 | movq %r9, %rax # rax <- Return value\r |
71 | popq %rdi\r | |
b1ff428c | 72 | ret\r |