diff options
Diffstat (limited to 'MdePkg/Library/BaseMemoryLibMmx/Ia32/SetMem.asm')
-rw-r--r-- | MdePkg/Library/BaseMemoryLibMmx/Ia32/SetMem.asm | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/MdePkg/Library/BaseMemoryLibMmx/Ia32/SetMem.asm b/MdePkg/Library/BaseMemoryLibMmx/Ia32/SetMem.asm index f2c55f1296..c9c48ecf9d 100644 --- a/MdePkg/Library/BaseMemoryLibMmx/Ia32/SetMem.asm +++ b/MdePkg/Library/BaseMemoryLibMmx/Ia32/SetMem.asm @@ -23,40 +23,44 @@ .686
.model flat,C
- .xmm
+ .mmx
.code
;------------------------------------------------------------------------------
; VOID *
-; _mem_SetMem (
+; EFIAPI
+; InternalMemSetMem (
; IN VOID *Buffer,
; IN UINTN Count,
; IN UINT8 Value
; )
;------------------------------------------------------------------------------
InternalMemSetMem PROC USES edi
+ mov al, [esp + 16]
+ mov ah, al
+ shrd edx, eax, 16
+ shld eax, edx, 16
mov ecx, [esp + 12] ; ecx <- Count
mov edi, [esp + 8] ; edi <- Buffer
mov edx, ecx
+ and edx, 7
shr ecx, 3 ; # of Qwords to set
- mov al, [esp + 16] ; al <- Value
jz @SetBytes
- mov ah, al ; ax <- Value | (Value << 8)
- push ecx
- push ecx
+ add esp, -10h
movq [esp], mm0 ; save mm0
+ movq [esp + 8], mm1 ; save mm1
movd mm0, eax
- pshufw mm0, mm0, 0 ; fill mm0 with 8 Value's
+ movd mm1, eax
+ psllq mm0, 32
+ por mm0, mm1 ; fill mm0 with 8 Value's
@@:
- movntq [edi], mm0
+ movq [edi], mm0
add edi, 8
loop @B
- mfence
movq mm0, [esp] ; restore mm0
- pop ecx ; stack cleanup
- pop ecx
+ movq mm1, [esp + 8] ; restore mm1
+ add esp, 10h ; stack cleanup
@SetBytes:
- and edx, 7
mov ecx, edx
rep stosb
mov eax, [esp + 8] ; eax <- Buffer as return value
|