]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdePkg BaseMemoryLibMmx: Convert Ia32/SetMem.asm to NASM
authorJordan Justen <jordan.l.justen@intel.com>
Tue, 31 May 2016 01:52:06 +0000 (18:52 -0700)
committerLiming Gao <liming.gao@intel.com>
Tue, 28 Jun 2016 01:50:26 +0000 (09:50 +0800)
The BaseTools/Scripts/ConvertMasmToNasm.py script was used to convert
Ia32/SetMem.asm to Ia32/SetMem.nasm

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
MdePkg/Library/BaseMemoryLibMmx/BaseMemoryLibMmx.inf
MdePkg/Library/BaseMemoryLibMmx/Ia32/SetMem.nasm [new file with mode: 0644]

index 7eb8a31c3b6faf78bc62e7164971a2dd95b2bc3f..27a324c448d651e6a12f17900fb3c153c717edc2 100644 (file)
@@ -68,6 +68,7 @@
   Ia32/SetMem16.S\r
   Ia32/ZeroMem.nasm\r
   Ia32/ZeroMem.S\r
+  Ia32/SetMem.nasm\r
   Ia32/SetMem.S\r
   Ia32/CopyMem.S\r
   Ia32/ScanMem64.nasm\r
@@ -88,6 +89,7 @@
   Ia32/SetMem16.asm\r
   Ia32/ZeroMem.nasm\r
   Ia32/ZeroMem.asm\r
+  Ia32/SetMem.nasm\r
   Ia32/SetMem.asm\r
   Ia32/CopyMem.asm\r
 \r
diff --git a/MdePkg/Library/BaseMemoryLibMmx/Ia32/SetMem.nasm b/MdePkg/Library/BaseMemoryLibMmx/Ia32/SetMem.nasm
new file mode 100644 (file)
index 0000000..35e0fc4
--- /dev/null
@@ -0,0 +1,68 @@
+;------------------------------------------------------------------------------\r
+;\r
+; Copyright (c) 2006, 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.nasm\r
+;\r
+; Abstract:\r
+;\r
+;   SetMem function\r
+;\r
+; Notes:\r
+;\r
+;------------------------------------------------------------------------------\r
+\r
+    SECTION .text\r
+\r
+;------------------------------------------------------------------------------\r
+;  VOID *\r
+;  EFIAPI\r
+;  InternalMemSetMem (\r
+;    IN VOID   *Buffer,\r
+;    IN UINTN  Count,\r
+;    IN UINT8  Value\r
+;    )\r
+;------------------------------------------------------------------------------\r
+global ASM_PFX(InternalMemSetMem)\r
+ASM_PFX(InternalMemSetMem):\r
+    push    edi\r
+    mov     al, [esp + 16]\r
+    mov     ah, al\r
+    shrd    edx, eax, 16\r
+    shld    eax, edx, 16\r
+    mov     ecx, [esp + 12]             ; ecx <- Count\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, -0x10\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
+.0:\r
+    movq    [edi], mm0\r
+    add     edi, 8\r
+    loop    .0\r
+    movq    mm0, [esp]                  ; restore mm0\r
+    movq    mm1, [esp + 8]              ; restore mm1\r
+    add     esp, 0x10                    ; stack cleanup\r
+@SetBytes:\r
+    mov     ecx, edx\r
+    rep     stosb\r
+    mov     eax, [esp + 8]              ; eax <- Buffer as return value\r
+    pop     edi\r
+    ret\r
+\r