]>
Commit | Line | Data |
---|---|---|
b1ff428c | 1 | #\r |
2 | # ConvertAsm.py: Automatically generated from ZeroMem.asm\r | |
3 | #\r | |
4 | #------------------------------------------------------------------------------\r | |
5 | #\r | |
6 | # Copyright (c) 2006, Intel Corporation\r | |
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 | # ZeroMem.S\r | |
18 | #\r | |
19 | # Abstract:\r | |
20 | #\r | |
21 | # ZeroMem function\r | |
22 | #\r | |
23 | # Notes:\r | |
24 | #\r | |
25 | #------------------------------------------------------------------------------\r | |
26 | \r | |
27 | \r | |
28 | #------------------------------------------------------------------------------\r | |
29 | # VOID *\r | |
30 | # InternalMemZeroMem (\r | |
31 | # IN VOID *Buffer,\r | |
32 | # IN UINTN Count\r | |
33 | # );\r | |
34 | #------------------------------------------------------------------------------\r | |
35 | .intel_syntax noprefix\r | |
36 | .globl ASM_PFX(InternalMemZeroMem)\r | |
37 | ASM_PFX(InternalMemZeroMem):\r | |
38 | push rdi\r | |
39 | mov rdi, rcx\r | |
40 | xor rcx, rcx\r | |
41 | xor eax, eax\r | |
42 | sub rcx, rdi\r | |
43 | and rcx, 15\r | |
44 | mov r8, rdi\r | |
45 | jz L0\r | |
46 | cmp rcx, rdx\r | |
47 | cmova rcx, rdx\r | |
48 | sub rdx, rcx\r | |
49 | rep stosb\r | |
50 | L0:\r | |
51 | mov rcx, rdx\r | |
52 | and edx, 15\r | |
53 | shr rcx, 4\r | |
54 | jz L_ZeroBytes\r | |
55 | pxor xmm0, xmm0\r | |
56 | L1:\r | |
57 | movntdq [rdi], xmm0 # rdi should be 16-byte aligned\r | |
58 | add rdi, 16\r | |
59 | loop L1\r | |
60 | mfence\r | |
61 | L_ZeroBytes:\r | |
62 | mov ecx, edx\r | |
63 | rep stosb\r | |
64 | mov rax, r8\r | |
65 | pop rdi\r | |
66 | ret\r |