+++ /dev/null
-;------------------------------------------------------------------------------\r
-;\r
-; Copyright (c) 2007, 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
-; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-;\r
-; Module Name:\r
-;\r
-; SetMem.asm\r
-;\r
-; Abstract:\r
-;\r
-; memset function\r
-;\r
-; Notes:\r
-;\r
-;------------------------------------------------------------------------------\r
-\r
- .686\r
- .model flat,C\r
- .mmx\r
- .code\r
-\r
-;------------------------------------------------------------------------------\r
-; VOID *\r
-; memset (\r
-; OUT VOID *Buffer,\r
-; IN UINT8 Value,\r
-; IN UINTN Count\r
-; )\r
-;------------------------------------------------------------------------------\r
-memset PROC USES edi\r
- mov al, [esp + 12]\r
- mov ah, al\r
- shrd edx, eax, 16\r
- shld eax, edx, 16\r
- mov ecx, [esp + 16] ; ecx <- Count\r
- cmp ecx, 0 ; if Count == 0, do nothing\r
- je @SetDone\r
- mov edi, [esp + 8] ; edi <- Buffer\r
- mov edx, ecx\r
- and edx, 7\r
- shr ecx, 3 ; # of Qwords to set\r
- jz @SetBytes\r
- add esp, -10h\r
- movq [esp], mm0 ; save mm0\r
- movq [esp + 8], mm1 ; save mm1\r
- movd mm0, eax\r
- movd mm1, eax\r
- psllq mm0, 32\r
- por mm0, mm1 ; fill mm0 with 8 Value's\r
-@@:\r
- movq [edi], mm0\r
- add edi, 8\r
- loop @B\r
- movq mm0, [esp] ; restore mm0\r
- movq mm1, [esp + 8] ; restore mm1\r
- add esp, 10h ; stack cleanup\r
-@SetBytes:\r
- mov ecx, edx\r
- rep stosb\r
-@SetDone: \r
- mov eax, [esp + 8] ; eax <- Buffer as return value\r
- ret\r
-memset ENDP\r
-\r
- END\r