1. Updated function headers for all assembly function
2. Optimized register usage in SetMemXX functions in all lib instances 3. Fixed a logical error in CopyMem for all lib instances git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1139 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
@@ -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
|
||||
|
Reference in New Issue
Block a user