1. Added '#pragma pack' directive in BaseLib.h for the structure IA32_DESCRIPTOR

2. Updated SetMem64.asm's to remove any SSE3 instructions.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@901 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
bxing 2006-07-12 09:23:28 +00:00
parent 7867eb23e8
commit db8f40e294
4 changed files with 55 additions and 55 deletions

View File

@ -2905,10 +2905,12 @@ typedef union {
// Byte packed structure for an IDTR, GDTR, LDTR descriptor // Byte packed structure for an IDTR, GDTR, LDTR descriptor
/// @bug How to make this structure byte-packed in a compiler independent way? /// @bug How to make this structure byte-packed in a compiler independent way?
// //
#pragma pack (1)
typedef struct { typedef struct {
UINT16 Limit; UINT16 Limit;
UINTN Base; UINTN Base;
} IA32_DESCRIPTOR; } IA32_DESCRIPTOR;
#pragma pack ()
#define IA32_IDT_GATE_TYPE_TASK 0x85 #define IA32_IDT_GATE_TYPE_TASK 0x85
#define IA32_IDT_GATE_TYPE_INTERRUPT_16 0x86 #define IA32_IDT_GATE_TYPE_INTERRUPT_16 0x86

View File

@ -34,14 +34,14 @@
; IN UINT64 Value ; IN UINT64 Value
; ) ; )
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
InternalMemSetMem64 PROC USES edi InternalMemSetMem64 PROC
movq mm0, [esp + 16] mov eax, [esp + 4]
mov ecx, [esp + 12] mov ecx, [esp + 8]
mov edi, [esp + 8] movq mm0, [esp + 12]
mov eax, edi mov edx, eax
@@: @@:
movntq [edi], mm0 movntq [edx], mm0
add edi, 8 add edx, 8
loop @B loop @B
mfence mfence
ret ret

View File

@ -28,34 +28,34 @@
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
; VOID * ; VOID *
; _mem_SetMem64 ( ; InternalMemSetMem64 (
; IN VOID *Buffer, ; IN VOID *Buffer,
; IN UINTN Count, ; IN UINTN Count,
; IN UINT64 Value ; IN UINT64 Value
; ) ; )
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
InternalMemSetMem64 PROC USES edi InternalMemSetMem64 PROC
mov ecx, [esp + 12] mov eax, [esp + 4]
mov edi, [esp + 8] mov ecx, [esp + 8]
test edi, 8 test al, 8
DB 0f2h, 0fh, 12h, 44h, 24h, 16 ; movddup xmm0, [esp + 16] mov edx, eax
movq xmm0, [esp + 12]
jz @F jz @F
movq [edi], xmm0 movq [edx], xmm0
add edi, 8 add edx, 8
dec ecx dec ecx
@@: @@:
mov edx, ecx
shr ecx, 1 shr ecx, 1
jz @SetQwords jz @SetQwords
movlhps xmm0, xmm0
@@: @@:
movntdq [edi], xmm0 movntdq [edx], xmm0
add edi, 16 lea edx, [edx + 16]
loop @B loop @B
mfence mfence
@SetQwords: @SetQwords:
test dl, 1 jnc @F
jz @F movq [edx], xmm0
movq [edi], xmm0
@@: @@:
ret ret
InternalMemSetMem64 ENDP InternalMemSetMem64 ENDP

View File

@ -25,35 +25,33 @@
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
; VOID * ; VOID *
; _mem_SetMem64 ( ; InternalMemSetMem64 (
; IN VOID *Buffer, ; IN VOID *Buffer,
; IN UINTN Count, ; IN UINTN Count,
; IN UINT8 Value ; IN UINT64 Value
; ) ; )
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
InternalMemSetMem64 PROC USES rdi InternalMemSetMem64 PROC
mov rdi, rcx mov rax, rcx
mov r9, rcx test dl, 8
test cl, 8 xchg rcx, rdx
jz @F jz @F
mov [rdi], r8 mov [rdx], r8
add rdi, 8 add rdx, 8
dec rdx dec rcx
@@: @@:
mov rcx, rdx
shr rcx, 1 shr rcx, 1
jz @SetQwords jz @SetQwords
movd xmm0, r8 movd xmm0, r8
movlhps xmm0, xmm0 movlhps xmm0, xmm0
@@: @@:
movntdq [rdi], xmm0 movntdq [rdx], xmm0
add rdi, 16 lea rdx, [rdx + 16]
loop @B loop @B
mfence mfence
@SetQwords: @SetQwords:
test dl, 1 jnc @F
jz @F mov [rdx], r8
mov [rdi], r8
@@: @@:
ret ret
InternalMemSetMem64 ENDP InternalMemSetMem64 ENDP