]>
Commit | Line | Data |
---|---|---|
2fb8d3e2 | 1 | #------------------------------------------------------------------------------\r |
2 | #\r | |
adc29a97 HT |
3 | # Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>\r |
4 | # This program and the accompanying materials\r | |
2fb8d3e2 | 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 | |
2fc59a00 | 7 | # http://opensource.org/licenses/bsd-license.php.\r |
2fb8d3e2 | 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 | |
5da37dda | 14 | # SetMem.S\r |
2fb8d3e2 | 15 | #\r |
16 | # Abstract:\r | |
17 | #\r | |
18 | # SetMem function\r | |
19 | #\r | |
20 | # Notes:\r | |
21 | #\r | |
22 | #------------------------------------------------------------------------------\r | |
23 | #------------------------------------------------------------------------------\r | |
24 | # VOID *\r | |
25 | # EFIAPI\r | |
26 | # InternalMemSetMem (\r | |
27 | # IN VOID *Buffer,\r | |
28 | # IN UINTN Count,\r | |
29 | # IN UINT8 Value\r | |
30 | # )\r | |
31 | #------------------------------------------------------------------------------\r | |
132f41f0 | 32 | ASM_GLOBAL ASM_PFX(InternalMemSetMem)\r |
2c0bbf43 | 33 | ASM_PFX(InternalMemSetMem):\r |
1fef058f | 34 | pushq %rdi\r |
35 | pushq %rbx\r | |
36 | pushq %rcx # push Buffer\r | |
37 | movq %r8, %rax # rax = Value\r | |
38 | andq $0xff, %rax # rax = lower 8 bits of r8, upper 56 bits are 0\r | |
39 | movb %al, %ah # ah = al\r | |
40 | movw %ax, %bx # bx = ax\r | |
41 | shlq $0x10, %rax # rax = ax << 16\r | |
42 | movw %bx, %ax # ax = bx\r | |
43 | movq %rax, %rbx # ebx = eax\r | |
44 | shlq $0x20, %rax # rax = rax << 32\r | |
45 | orq %rbx, %rax # eax = ebx\r | |
46 | movq %rcx, %rdi # rdi = Buffer\r | |
47 | movq %rdx, %rcx # rcx = Count\r | |
48 | shrq $3, %rcx # rcx = rcx / 8\r | |
1dc58db3 | 49 | cld\r |
6f890d5b | 50 | rep stosq \r |
1fef058f | 51 | movq %rdx, %rcx # rcx = rdx\r |
52 | andq $7, %rcx # rcx = rcx & 7\r | |
6f890d5b | 53 | rep stosb \r |
1fef058f | 54 | popq %rax # rax = Buffer\r |
55 | popq %rbx\r | |
56 | popq %rdi\r | |
1dc58db3 | 57 | ret\r |