]>
Commit | Line | Data |
---|---|---|
2fb8d3e2 | 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 | # 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 | |
1dc58db3 | 32 | .intel_syntax noprefix\r |
33 | .globl ASM_PFX(InternalMemSetMem)\r | |
34 | ASM_PFX(InternalMemZeroMem):\r | |
1dc58db3 | 35 | push rdi\r |
36 | push rbx\r | |
2fb8d3e2 | 37 | push rcx # push Buffer\r |
38 | mov rax, r8 # rax = Value\r | |
39 | and rax, 0xff # rax = lower 8 bits of r8, upper 56 bits are 0\r | |
40 | mov ah, al # ah = al\r | |
41 | mov bx, ax # bx = ax\r | |
42 | shl rax, 0x10 # rax = ax << 16\r | |
43 | mov ax, bx # ax = bx\r | |
44 | mov rbx, rax # ebx = eax\r | |
45 | shl rax, 0x20 # rax = rax << 32\r | |
46 | or rax, rbx # eax = ebx\r | |
47 | mov rdi, rcx # rdi = Buffer\r | |
48 | mov rcx, rdx # rcx = Count\r | |
49 | shr rcx, 3 # rcx = rcx / 8\r | |
1dc58db3 | 50 | cld\r |
51 | rep stosq \r | |
2fb8d3e2 | 52 | mov rcx, rdx # rcx = rdx\r |
53 | and rcx, 7 # rcx = rcx & 7\r | |
1dc58db3 | 54 | rep stosb \r |
2fb8d3e2 | 55 | pop rax # rax = Buffer\r |
1dc58db3 | 56 | pop rbx\r |
57 | pop rdi\r | |
58 | ret\r |