]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdePkg/Library/BaseMemoryLibMmx/Ia32/SetMem.asm
1. Updated function headers for all assembly function
[mirror_edk2.git] / MdePkg / Library / BaseMemoryLibMmx / Ia32 / SetMem.asm
index f2c55f1296408ca40f94172472b3e092f3d06841..c9c48ecf9d3a6fc2620d43630a6171db5304a4a2 100644 (file)
 \r
     .686\r
     .model  flat,C\r
-    .xmm\r
+    .mmx\r
     .code\r
 \r
 ;------------------------------------------------------------------------------\r
 ;  VOID *\r
-;  _mem_SetMem (\r
+;  EFIAPI\r
+;  InternalMemSetMem (\r
 ;    IN VOID   *Buffer,\r
 ;    IN UINTN  Count,\r
 ;    IN UINT8  Value\r
 ;    )\r
 ;------------------------------------------------------------------------------\r
 InternalMemSetMem   PROC    USES    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
-    mov     al, [esp + 16]              ; al <- Value\r
     jz      @SetBytes\r
-    mov     ah, al                      ; ax <- Value | (Value << 8)\r
-    push    ecx\r
-    push    ecx\r
+    add     esp, -10h\r
     movq    [esp], mm0                  ; save mm0\r
+    movq    [esp + 8], mm1              ; save mm1\r
     movd    mm0, eax\r
-    pshufw  mm0, mm0, 0                 ; fill mm0 with 8 Value's\r
+    movd    mm1, eax\r
+    psllq   mm0, 32\r
+    por     mm0, mm1                    ; fill mm0 with 8 Value's\r
 @@:\r
-    movntq  [edi], mm0\r
+    movq    [edi], mm0\r
     add     edi, 8\r
     loop    @B\r
-    mfence\r
     movq    mm0, [esp]                  ; restore mm0\r
-    pop     ecx                         ; stack cleanup\r
-    pop     ecx\r
+    movq    mm1, [esp + 8]              ; restore mm1\r
+    add     esp, 10h                    ; stack cleanup\r
 @SetBytes:\r
-    and     edx, 7\r
     mov     ecx, edx\r
     rep     stosb\r
     mov     eax, [esp + 8]              ; eax <- Buffer as return value\r