#------------------------------------------------------------------------------\r
#\r
-# Copyright (c) 2006, Intel Corporation\r
-# All rights reserved. This program and the accompanying materials\r
+# Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>\r
+# This program and the accompanying materials\r
# are licensed and made available under the terms and conditions of the BSD License\r
# which accompanies this distribution. The full text of the license may be found at\r
# http://opensource.org/licenses/bsd-license.php\r
#\r
# Module Name:\r
#\r
-# SetMem.Asm\r
+# SetMem.S\r
#\r
# Abstract:\r
#\r
# IN UINT8 Value\r
# )\r
#------------------------------------------------------------------------------\r
-.intel_syntax noprefix\r
-.globl ASM_PFX(InternalMemSetMem)\r
-ASM_PFX(InternalMemZeroMem):\r
- push rdi\r
- push rbx\r
- push rcx # push Buffer\r
- mov rax, r8 # rax = Value\r
- and rax, 0xff # rax = lower 8 bits of r8, upper 56 bits are 0\r
- mov ah, al # ah = al\r
- mov bx, ax # bx = ax\r
- shl rax, 0x10 # rax = ax << 16\r
- mov ax, bx # ax = bx\r
- mov rbx, rax # ebx = eax\r
- shl rax, 0x20 # rax = rax << 32\r
- or rax, rbx # eax = ebx\r
- mov rdi, rcx # rdi = Buffer\r
- mov rcx, rdx # rcx = Count\r
- shr rcx, 3 # rcx = rcx / 8\r
+ASM_GLOBAL ASM_PFX(InternalMemSetMem)\r
+ASM_PFX(InternalMemSetMem):\r
+ pushq %rdi\r
+ pushq %rbx\r
+ pushq %rcx # push Buffer\r
+ movq %r8, %rax # rax = Value\r
+ andq $0xff, %rax # rax = lower 8 bits of r8, upper 56 bits are 0\r
+ movb %al, %ah # ah = al\r
+ movw %ax, %bx # bx = ax\r
+ shlq $0x10, %rax # rax = ax << 16\r
+ movw %bx, %ax # ax = bx\r
+ movq %rax, %rbx # ebx = eax\r
+ shlq $0x20, %rax # rax = rax << 32\r
+ orq %rbx, %rax # eax = ebx\r
+ movq %rcx, %rdi # rdi = Buffer\r
+ movq %rdx, %rcx # rcx = Count\r
+ shrq $3, %rcx # rcx = rcx / 8\r
cld\r
- rep stosq \r
- mov rcx, rdx # rcx = rdx\r
- and rcx, 7 # rcx = rcx & 7\r
- rep stosb \r
- pop rax # rax = Buffer\r
- pop rbx\r
- pop rdi\r
+ rep stosq \r
+ movq %rdx, %rcx # rcx = rdx\r
+ andq $7, %rcx # rcx = rcx & 7\r
+ rep stosb \r
+ popq %rax # rax = Buffer\r
+ popq %rbx\r
+ popq %rdi\r
ret\r