1. Updated function headers in all assembly files.

2. Split x86LowLevel.c into a bunch of C files to make images linked with BaseLib smaller.
3. Fixed a few minor bugs.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1066 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
bxing 2006-07-21 08:47:38 +00:00
parent 31a9215c32
commit 3f566587ae
252 changed files with 1840 additions and 2009 deletions

View File

@ -83,8 +83,20 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
<Filename>SwapBytes32.c</Filename> <Filename>SwapBytes32.c</Filename>
<Filename>SwapBytes64.c</Filename> <Filename>SwapBytes64.c</Filename>
<Filename>SwitchStack.c</Filename> <Filename>SwitchStack.c</Filename>
<Filename SupArchList="IA32">x86LowLevel.c</Filename> <Filename SupArchList="IA32">x86DisablePaging32.c</Filename>
<Filename SupArchList="IA32">x86DisablePaging64.c</Filename>
<Filename SupArchList="IA32">x86EnablePaging32.c</Filename>
<Filename SupArchList="IA32">x86EnablePaging64.c</Filename>
<Filename SupArchList="IA32">x86FxRestore.c</Filename>
<Filename SupArchList="IA32">x86FxSave.c</Filename>
<Filename SupArchList="IA32">x86GetInterruptState.c</Filename>
<Filename SupArchList="IA32">x86MemoryFence.c</Filename>
<Filename SupArchList="IA32">x86Msr.c</Filename>
<Filename SupArchList="IA32">x86ReadGdtr.c</Filename>
<Filename SupArchList="IA32">x86ReadIdtr.c</Filename>
<Filename SupArchList="IA32">x86Thunk.c</Filename> <Filename SupArchList="IA32">x86Thunk.c</Filename>
<Filename SupArchList="IA32">x86WriteGdtr.c</Filename>
<Filename SupArchList="IA32">x86WriteIdtr.c</Filename>
<Filename SupArchList="IA32">Unaligned.c</Filename> <Filename SupArchList="IA32">Unaligned.c</Filename>
<Filename SupArchList="IA32">Ia32/Non-existing.c</Filename> <Filename SupArchList="IA32">Ia32/Non-existing.c</Filename>
<Filename SupArchList="IA32">Ia32/InternalSwitchStack.c</Filename> <Filename SupArchList="IA32">Ia32/InternalSwitchStack.c</Filename>
@ -107,7 +119,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
<Filename SupArchList="IA32">Ia32/CpuIdEx.asm</Filename> <Filename SupArchList="IA32">Ia32/CpuIdEx.asm</Filename>
<Filename SupArchList="IA32">Ia32/ReadEflags.asm</Filename> <Filename SupArchList="IA32">Ia32/ReadEflags.asm</Filename>
<Filename SupArchList="IA32">Ia32/ReadMsr64.asm</Filename> <Filename SupArchList="IA32">Ia32/ReadMsr64.asm</Filename>
<Filename SupArchList="IA32">Ia32/WriteMsr32.asm</Filename>
<Filename SupArchList="IA32">Ia32/WriteMsr64.asm</Filename> <Filename SupArchList="IA32">Ia32/WriteMsr64.asm</Filename>
<Filename SupArchList="IA32">Ia32/ReadCr0.asm</Filename> <Filename SupArchList="IA32">Ia32/ReadCr0.asm</Filename>
<Filename SupArchList="IA32">Ia32/ReadCr2.asm</Filename> <Filename SupArchList="IA32">Ia32/ReadCr2.asm</Filename>
@ -205,7 +216,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
<Filename SupArchList="IA32">Ia32/CpuIdEx.S</Filename> <Filename SupArchList="IA32">Ia32/CpuIdEx.S</Filename>
<Filename SupArchList="IA32">Ia32/ReadEflags.S</Filename> <Filename SupArchList="IA32">Ia32/ReadEflags.S</Filename>
<Filename SupArchList="IA32">Ia32/ReadMsr64.S</Filename> <Filename SupArchList="IA32">Ia32/ReadMsr64.S</Filename>
<Filename SupArchList="IA32">Ia32/WriteMsr32.S</Filename>
<Filename SupArchList="IA32">Ia32/WriteMsr64.S</Filename> <Filename SupArchList="IA32">Ia32/WriteMsr64.S</Filename>
<Filename SupArchList="IA32">Ia32/ReadCr0.S</Filename> <Filename SupArchList="IA32">Ia32/ReadCr0.S</Filename>
<Filename SupArchList="IA32">Ia32/ReadCr2.S</Filename> <Filename SupArchList="IA32">Ia32/ReadCr2.S</Filename>
@ -284,8 +294,20 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
<Filename SupArchList="IA32">Ia32/CpuBreakpoint.S</Filename> <Filename SupArchList="IA32">Ia32/CpuBreakpoint.S</Filename>
<Filename SupArchList="IA32">Ia32/CpuFlushTlb.S</Filename> <Filename SupArchList="IA32">Ia32/CpuFlushTlb.S</Filename>
<Filename SupArchList="IA32">Ia32/Thunk16.S</Filename> <Filename SupArchList="IA32">Ia32/Thunk16.S</Filename>
<Filename SupArchList="X64">x86LowLevel.c</Filename> <Filename SupArchList="X64">x86DisablePaging32.c</Filename>
<Filename SupArchList="X64">x86DisablePaging64.c</Filename>
<Filename SupArchList="X64">x86EnablePaging32.c</Filename>
<Filename SupArchList="X64">x86EnablePaging64.c</Filename>
<Filename SupArchList="X64">x86FxRestore.c</Filename>
<Filename SupArchList="X64">x86FxSave.c</Filename>
<Filename SupArchList="X64">x86GetInterruptState.c</Filename>
<Filename SupArchList="X64">x86MemoryFence.c</Filename>
<Filename SupArchList="X64">x86Msr.c</Filename>
<Filename SupArchList="X64">x86ReadGdtr.c</Filename>
<Filename SupArchList="X64">x86ReadIdtr.c</Filename>
<Filename SupArchList="X64">x86Thunk.c</Filename> <Filename SupArchList="X64">x86Thunk.c</Filename>
<Filename SupArchList="X64">x86WriteGdtr.c</Filename>
<Filename SupArchList="X64">x86WriteIdtr.c</Filename>
<Filename SupArchList="X64">Unaligned.c</Filename> <Filename SupArchList="X64">Unaligned.c</Filename>
<Filename SupArchList="X64">Math64.c</Filename> <Filename SupArchList="X64">Math64.c</Filename>
<Filename SupArchList="X64">X64/Non-existing.c</Filename> <Filename SupArchList="X64">X64/Non-existing.c</Filename>
@ -295,9 +317,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
<Filename SupArchList="X64">X64/CpuId.asm</Filename> <Filename SupArchList="X64">X64/CpuId.asm</Filename>
<Filename SupArchList="X64">X64/CpuIdEx.asm</Filename> <Filename SupArchList="X64">X64/CpuIdEx.asm</Filename>
<Filename SupArchList="X64">X64/ReadEflags.asm</Filename> <Filename SupArchList="X64">X64/ReadEflags.asm</Filename>
<Filename SupArchList="X64">X64/ReadMsr32.asm</Filename>
<Filename SupArchList="X64">X64/ReadMsr64.asm</Filename> <Filename SupArchList="X64">X64/ReadMsr64.asm</Filename>
<Filename SupArchList="X64">X64/WriteMsr32.asm</Filename>
<Filename SupArchList="X64">X64/WriteMsr64.asm</Filename> <Filename SupArchList="X64">X64/WriteMsr64.asm</Filename>
<Filename SupArchList="X64">X64/ReadCr0.asm</Filename> <Filename SupArchList="X64">X64/ReadCr0.asm</Filename>
<Filename SupArchList="X64">X64/ReadCr2.asm</Filename> <Filename SupArchList="X64">X64/ReadCr2.asm</Filename>

View File

@ -19,21 +19,23 @@
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
.global _InternalMathARShiftU64 .global _InternalMathARShiftU64
#------------------------------------------------------------------------------
# UINT64
# EFIAPI
# InternalMathARShiftU64 (
# IN UINT64 Operand,
# IN UINTN Count
# );
#------------------------------------------------------------------------------
_InternalMathARShiftU64: _InternalMathARShiftU64:
movb 12(%esp),%cl movb 12(%esp), %cl
movl 8(%esp),%eax movl 8(%esp), %eax
cltd cltd
testb $32,%cl testb $32, %cl
cmovz %eax, %edx cmovz %eax, %edx
cmovz 4(%esp), %eax cmovz 4(%esp), %eax
shrdl %cl,%edx,%eax shrdl %cl, %edx, %eax
sar %cl,%edx sar %cl, %edx
ret ret

View File

@ -23,6 +23,14 @@
.model flat,C .model flat,C
.code .code
;------------------------------------------------------------------------------
; UINT64
; EFIAPI
; InternalMathARShiftU64 (
; IN UINT64 Operand,
; IN UINTN Count
; );
;------------------------------------------------------------------------------
InternalMathARShiftU64 PROC InternalMathARShiftU64 PROC
mov cl, [esp + 12] mov cl, [esp + 12]
mov eax, [esp + 8] mov eax, [esp + 8]

View File

@ -20,10 +20,7 @@
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
.global _CpuBreakpoint
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# VOID # VOID
@ -32,10 +29,6 @@
# VOID # VOID
# ); # );
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
.global _CpuBreakpoint
_CpuBreakpoint: _CpuBreakpoint:
int $3 int $3
ret ret

View File

@ -20,9 +20,7 @@
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
.global _CpuFlushTlb
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# VOID # VOID
@ -31,11 +29,7 @@
# VOID # VOID
# ); # );
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
.global _CpuFlushTlb
_CpuFlushTlb: _CpuFlushTlb:
movl %cr3, %eax movl %cr3, %eax
movl %eax, %cr3 movl %eax, %cr3
ret ret

View File

@ -21,7 +21,7 @@
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
.386p .386p
.model flat .model flat,C
.code .code
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
@ -31,10 +31,10 @@
; VOID ; VOID
; ); ; );
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
_CpuFlushTlb PROC CpuFlushTlb PROC
mov eax, cr3 mov eax, cr3
mov cr3, eax mov cr3, eax
ret ret
_CpuFlushTlb ENDP CpuFlushTlb ENDP
END END

View File

@ -21,6 +21,7 @@
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
.globl _AsmCpuid
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# VOID # VOID
@ -33,14 +34,13 @@
# OUT UINT32 *RegisterOutEdx OPTIONAL # OUT UINT32 *RegisterOutEdx OPTIONAL
# ) # )
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
.globl _AsmCpuid
_AsmCpuid: _AsmCpuid:
pushl %ebx push %ebx
pushl %ebp push %ebp
movl %esp, %ebp movl %esp, %ebp
movl 12(%ebp), %eax movl 12(%ebp), %eax
cpuid cpuid
pushl %ecx push %ecx
movl 16(%ebp), %ecx movl 16(%ebp), %ecx
jecxz L1 jecxz L1
movl %eax, (%ecx) movl %eax, (%ecx)
@ -59,7 +59,5 @@ L3:
L4: L4:
movl 12(%ebp), %eax movl 12(%ebp), %eax
leave leave
popl %ebx pop %ebx
ret ret

View File

@ -34,7 +34,7 @@
; OUT UINT32 *RegisterOutEbx OPTIONAL, ; OUT UINT32 *RegisterOutEbx OPTIONAL,
; OUT UINT32 *RegisterOutEcx OPTIONAL, ; OUT UINT32 *RegisterOutEcx OPTIONAL,
; OUT UINT32 *RegisterOutEdx OPTIONAL ; OUT UINT32 *RegisterOutEdx OPTIONAL
; ) ; );
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
AsmCpuid PROC USES ebx AsmCpuid PROC USES ebx
push ebp push ebp

View File

@ -39,12 +39,12 @@
.globl _AsmCpuidEx .globl _AsmCpuidEx
_AsmCpuidEx: _AsmCpuidEx:
push %ebx push %ebx
pushl %ebp push %ebp
movl %esp, %ebp movl %esp, %ebp
movl 12(%ebp), %eax movl 12(%ebp), %eax
movl 16(%ebp), %ecx movl 16(%ebp), %ecx
cpuid cpuid
pushl %ecx push %ecx
movl 20(%ebp), %ecx movl 20(%ebp), %ecx
jecxz L1 jecxz L1
movl %eax, (%ecx) movl %eax, (%ecx)

View File

@ -20,10 +20,7 @@
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
.global _CpuPause
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# VOID # VOID
@ -32,10 +29,6 @@
# VOID # VOID
# ); # );
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
.global _CpuPause
_CpuPause: _CpuPause:
pause pause
ret ret

View File

@ -21,7 +21,7 @@
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
.686 .686
.model flat .model flat,C
.xmm .xmm
.code .code
@ -32,9 +32,9 @@
; VOID ; VOID
; ); ; );
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
_CpuPause PROC CpuPause PROC
pause pause
ret ret
_CpuPause ENDP CpuPause ENDP
END END

View File

@ -20,9 +20,7 @@
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
.global _CpuSleep
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# VOID # VOID
@ -31,10 +29,6 @@
# VOID # VOID
# ); # );
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
.global _CpuSleep
_CpuSleep: _CpuSleep:
hlt hlt
ret ret

View File

@ -21,7 +21,7 @@
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
.386 .386
.model flat .model flat,C
.code .code
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
@ -31,9 +31,9 @@
; VOID ; VOID
; ); ; );
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
_CpuSleep PROC CpuSleep PROC
hlt hlt
ret ret
_CpuSleep ENDP CpuSleep ENDP
END END

View File

@ -21,9 +21,7 @@
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
.global _DisableInterrupts
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# VOID # VOID
@ -32,10 +30,6 @@
# VOID # VOID
# ); # );
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
.global _DisableInterrupts
_DisableInterrupts: _DisableInterrupts:
cli cli
ret ret

View File

@ -22,7 +22,7 @@
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
.386p .386p
.model flat .model flat,C
.code .code
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
@ -32,9 +32,9 @@
; VOID ; VOID
; ); ; );
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
_DisableInterrupts PROC DisableInterrupts PROC
cli cli
ret ret
_DisableInterrupts ENDP DisableInterrupts ENDP
END END

View File

@ -21,9 +21,7 @@
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
.global _InternalX86DisablePaging32
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# VOID # VOID
@ -35,24 +33,20 @@
# IN VOID *NewStack # IN VOID *NewStack
# ); # );
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
.global _InternalX86DisablePaging32
_InternalX86DisablePaging32: _InternalX86DisablePaging32:
movl 4(%esp),%ebx movl 4(%esp), %ebx
movl 8(%esp),%ecx movl 8(%esp), %ecx
movl 12(%esp),%edx movl 12(%esp), %edx
pushfl pushfl
popl %edi pop %edi
cli cli
movl %cr0, %eax movl %cr0, %eax
btrl $31,%eax btrl $31, %eax
movl 16(%esp),%esp movl 16(%esp), %esp
movl %eax, %cr0 movl %eax, %cr0
pushl %edi push %edi
popfl popfl
pushl %edx push %edx
pushl %ecx push %ecx
call *%ebx call *%ebx
jmp . jmp .

View File

@ -40,18 +40,18 @@ InternalX86DisablePaging32 PROC
mov ecx, [esp + 8] mov ecx, [esp + 8]
mov edx, [esp + 12] mov edx, [esp + 12]
pushfd pushfd
pop edi pop edi ; save EFLAGS to edi
cli cli
mov eax, cr0 mov eax, cr0
btr eax, 31 btr eax, 31
mov esp, [esp + 16] mov esp, [esp + 16]
mov cr0, eax mov cr0, eax
push edi push edi
popfd popfd ; restore EFLAGS from edi
push edx push edx
push ecx push ecx
call ebx call ebx
jmp $ jmp $ ; EntryPoint() should not return
InternalX86DisablePaging32 ENDP InternalX86DisablePaging32 ENDP
END END

View File

@ -19,17 +19,23 @@
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
.386:
.code:
.global _InternalMathDivU64x32 .global _InternalMathDivU64x32
#------------------------------------------------------------------------------
# UINT64
# EFIAPI
# InternalMathDivU64x32 (
# IN UINT64 Dividend,
# IN UINT32 Divisor
# );
#------------------------------------------------------------------------------
_InternalMathDivU64x32: _InternalMathDivU64x32:
movl 8(%esp),%eax movl 8(%esp), %eax
movl 12(%esp),%ecx movl 12(%esp), %ecx
xorl %edx,%edx xorl %edx, %edx
divl %ecx divl %ecx
pushl %eax push %eax
movl 8(%esp),%eax movl 8(%esp), %eax
divl %ecx divl %ecx
popl %edx pop %edx
ret ret

View File

@ -23,15 +23,23 @@
.model flat,C .model flat,C
.code .code
;------------------------------------------------------------------------------
; UINT64
; EFIAPI
; InternalMathDivU64x32 (
; IN UINT64 Dividend,
; IN UINT32 Divisor
; );
;------------------------------------------------------------------------------
InternalMathDivU64x32 PROC InternalMathDivU64x32 PROC
mov eax, [esp + 8] mov eax, [esp + 8]
mov ecx, [esp + 12] mov ecx, [esp + 12]
xor edx, edx xor edx, edx
div ecx div ecx
push eax push eax ; save quotient on stack
mov eax, [esp + 8] mov eax, [esp + 8]
div ecx div ecx
pop edx pop edx ; restore high-order dword of the quotient
ret ret
InternalMathDivU64x32 ENDP InternalMathDivU64x32 ENDP

View File

@ -19,25 +19,28 @@
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
.global _InternalMathDivRemU64x32 .global _InternalMathDivRemU64x32
#------------------------------------------------------------------------------
# UINT64
# EFIAPI
# InternalMathDivRemU64x32 (
# IN UINT64 Dividend,
# IN UINT32 Divisor,
# OUT UINT32 *Remainder
# );
#------------------------------------------------------------------------------
_InternalMathDivRemU64x32: _InternalMathDivRemU64x32:
movl 12(%esp),%ecx movl 12(%esp), %ecx
movl 8(%esp),%eax movl 8(%esp), %eax
xorl %edx,%edx xorl %edx, %edx
divl %ecx divl %ecx
pushl %eax push %eax
movl 8(%esp),%eax movl 8(%esp), %eax
divl %ecx divl %ecx
movl 20(%esp),%ecx movl 20(%esp), %ecx
jecxz L1 jecxz L1
movl %edx,(%ecx) movl %edx, (%ecx)
L1: L1:
popl %edx pop %edx
ret ret

View File

@ -23,6 +23,15 @@
.model flat,C .model flat,C
.code .code
;------------------------------------------------------------------------------
; UINT64
; EFIAPI
; InternalMathDivRemU64x32 (
; IN UINT64 Dividend,
; IN UINT32 Divisor,
; OUT UINT32 *Remainder
; );
;------------------------------------------------------------------------------
InternalMathDivRemU64x32 PROC InternalMathDivRemU64x32 PROC
mov ecx, [esp + 12] mov ecx, [esp + 12]
mov eax, [esp + 8] mov eax, [esp + 8]
@ -32,7 +41,7 @@ InternalMathDivRemU64x32 PROC
mov eax, [esp + 8] mov eax, [esp + 8]
div ecx div ecx
mov ecx, [esp + 20] mov ecx, [esp + 20]
jecxz @F jecxz @F ; abandon remainder if Remainder == NULL
mov [ecx], edx mov [ecx], edx
@@: @@:
pop edx pop edx

View File

@ -20,53 +20,54 @@
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
.global _InternalMathDivRemU64x32, _InternalMathDivRemU64x64
#------------------------------------------------------------------------------
# UINT64
# EFIAPI
.extern _InternalMathDivRemU64x32 # InternalMathDivRemU64x64 (
# IN UINT64 Dividend,
.global _InternalMathDivRemU64x64 # IN UINT64 Divisor,
# OUT UINT64 *Remainder OPTIONAL
# );
#------------------------------------------------------------------------------
_InternalMathDivRemU64x64: _InternalMathDivRemU64x64:
movl 16(%esp),%ecx movl 16(%esp), %ecx
testl %ecx,%ecx testl %ecx, %ecx
jnz _DivRemU64x64 jnz Hard
movl 20(%esp),%ecx movl 20(%esp), %ecx
jecxz L1 jecxz L1
and $0,4(%ecx) and $0, 4(%ecx)
movl %ecx,16(%esp) movl %ecx, 16(%esp)
L1: L1:
jmp _InternalMathDivRemU64x32 jmp _InternalMathDivRemU64x32
Hard:
.global _DivRemU64x64
_DivRemU64x64:
push %ebx push %ebx
push %esi push %esi
push %edi push %edi
mov 20(%esp), %edx mov 20(%esp), %edx
mov 16(%esp), %eax mov 16(%esp), %eax
movl %edx,%edi movl %edx, %edi
movl %eax,%esi movl %eax, %esi
mov 24(%esp), %ebx mov 24(%esp), %ebx
L2: L2:
shrl %edx shrl %edx
rcrl $1,%eax rcrl $1, %eax
shrdl $1,%ecx,%ebx shrdl $1, %ecx, %ebx
shrl %ecx shrl %ecx
jnz L2 jnz L2
divl %ebx divl %ebx
movl %eax,%ebx movl %eax, %ebx
movl 28(%esp),%ecx movl 28(%esp), %ecx
mull 24(%esp) mull 24(%esp)
imull %ebx,%ecx imull %ebx, %ecx
addl %ecx,%edx addl %ecx, %edx
mov 32(%esp), %ecx mov 32(%esp), %ecx
jc TooLarge jc TooLarge
cmpl %edx,%edi cmpl %edx, %edi
ja Correct ja Correct
jb TooLarge jb TooLarge
cmpl %eax,%esi cmpl %eax, %esi
jae Correct jae Correct
TooLarge: TooLarge:
decl %ebx decl %ebx
@ -75,14 +76,14 @@ TooLarge:
sbb 28(%esp), %edx sbb 28(%esp), %edx
Correct: Correct:
jecxz Return jecxz Return
subl %eax,%esi subl %eax, %esi
sbbl %edx,%edi sbbl %edx, %edi
movl %esi,(%ecx) movl %esi, (%ecx)
movl %edi,4(%ecx) movl %edi, 4(%ecx)
Return: Return:
movl %ebx,%eax movl %ebx, %eax
xorl %edx,%edx xorl %edx, %edx
push %edi pop %edi
push %esi pop %esi
push %ebx pop %ebx
ret ret

View File

@ -26,10 +26,19 @@
EXTERN InternalMathDivRemU64x32:PROC EXTERN InternalMathDivRemU64x32:PROC
;------------------------------------------------------------------------------
; UINT64
; EFIAPI
; InternalMathDivRemU64x64 (
; IN UINT64 Dividend,
; IN UINT64 Divisor,
; OUT UINT64 *Remainder OPTIONAL
; );
;------------------------------------------------------------------------------
InternalMathDivRemU64x64 PROC InternalMathDivRemU64x64 PROC
mov ecx, [esp + 16] mov ecx, [esp + 16]
test ecx, ecx test ecx, ecx
jnz _@DivRemU64x64 jnz _@DivRemU64x64 ; call _@DivRemU64x64 if Divisor > 2^32
mov ecx, [esp + 20] mov ecx, [esp + 20]
jecxz @F jecxz @F
and dword ptr [ecx + 4], 0 and dword ptr [ecx + 4], 0
@ -40,10 +49,10 @@ InternalMathDivRemU64x64 ENDP
_@DivRemU64x64 PROC USES ebx esi edi _@DivRemU64x64 PROC USES ebx esi edi
mov edx, dword ptr [esp + 20] mov edx, dword ptr [esp + 20]
mov eax, dword ptr [esp + 16] mov eax, dword ptr [esp + 16] ; edx:eax <- dividend
mov edi, edx mov edi, edx
mov esi, eax mov esi, eax ; edi:esi <- dividend
mov ebx, dword ptr [esp + 24] mov ebx, dword ptr [esp + 24] ; ecx:ebx <- divisor
@@: @@:
shr edx, 1 shr edx, 1
rcr eax, 1 rcr eax, 1
@ -51,31 +60,31 @@ _@DivRemU64x64 PROC USES ebx esi edi
shr ecx, 1 shr ecx, 1
jnz @B jnz @B
div ebx div ebx
mov ebx, eax mov ebx, eax ; ebx <- quotient
mov ecx, [esp + 28] mov ecx, [esp + 28]
mul dword ptr [esp + 24] mul dword ptr [esp + 24]
imul ecx, ebx imul ecx, ebx
add edx, ecx add edx, ecx
mov ecx, dword ptr [esp + 32] mov ecx, dword ptr [esp + 32]
jc @TooLarge jc @TooLarge ; product > 2^64
cmp edi, edx cmp edi, edx ; compare high 32 bits
ja @Correct ja @Correct
jb @TooLarge jb @TooLarge ; product > dividend
cmp esi, eax cmp esi, eax
jae @Correct jae @Correct ; product <= dividend
@TooLarge: @TooLarge:
dec ebx dec ebx ; adjust quotient by -1
jecxz @Return jecxz @Return ; return if Remainder == NULL
sub eax, dword ptr [esp + 24] sub eax, dword ptr [esp + 24]
sbb edx, dword ptr [esp + 28] sbb edx, dword ptr [esp + 28]
@Correct: @Correct:
jecxz @Return jecxz @Return
sub esi, eax sub esi, eax
sbb edi, edx sbb edi, edx ; edi:esi <- remainder
mov [ecx], esi mov [ecx], esi
mov [ecx + 4], edi mov [ecx + 4], edi
@Return: @Return:
mov eax, ebx mov eax, ebx ; eax <- quotient
xor edx, edx xor edx, edx
ret ret
_@DivRemU64x64 ENDP _@DivRemU64x64 ENDP

View File

@ -21,9 +21,7 @@
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
.global _EnableDisableInterrupts
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# VOID # VOID
@ -32,11 +30,7 @@
# VOID # VOID
# ); # );
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
.global _EnableDisableInterrupts
_EnableDisableInterrupts: _EnableDisableInterrupts:
sti sti
cli cli
ret ret

View File

@ -21,9 +21,7 @@
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
.global _EnableInterrupts
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# VOID # VOID
@ -32,10 +30,6 @@
# VOID # VOID
# ); # );
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
.global _EnableInterrupts
_EnableInterrupts: _EnableInterrupts:
sti sti
ret ret

View File

@ -21,9 +21,7 @@
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
.global _InternalX86EnablePaging32
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# VOID # VOID
@ -35,24 +33,20 @@
# IN VOID *NewStack # IN VOID *NewStack
# ); # );
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
.global _InternalX86EnablePaging32
_InternalX86EnablePaging32: _InternalX86EnablePaging32:
movl 4(%esp),%ebx movl 4(%esp), %ebx
movl 8(%esp),%ecx movl 8(%esp), %ecx
movl 12(%esp),%edx movl 12(%esp), %edx
pushfl pushfl
popl %edi pop %edi
cli cli
movl %cr0, %eax movl %cr0, %eax
btsl $31,%eax btsl $31, %eax
movl 16(%esp),%esp movl 16(%esp), %esp
movl %eax, %cr0 movl %eax, %cr0
pushl %edi push %edi
popfl popfl
pushl %edx push %edx
pushl %ecx push %ecx
call *%ebx call *%ebx
jmp . jmp .

View File

@ -21,9 +21,7 @@
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
.global _InternalX86EnablePaging64
#.MODEL flat
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# VOID # VOID
@ -36,7 +34,6 @@
# IN UINT64 NewStack # IN UINT64 NewStack
# ); # );
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
.global _InternalX86EnablePaging64
_InternalX86EnablePaging64: _InternalX86EnablePaging64:
cli cli
movl $LongStart, (%esp) movl $LongStart, (%esp)
@ -52,13 +49,13 @@ _InternalX86EnablePaging64:
movl %eax, %cr0 # enable paging movl %eax, %cr0 # enable paging
lret lret
LongStart: # long mode starts here LongStart: # long mode starts here
.byte 0x67,0x48 .byte 0x67, 0x48
movl (%esp), %ebx # mov rbx, [esp] movl (%esp), %ebx # mov rbx, [esp]
.byte 0x67,0x48 .byte 0x67, 0x48
movl 8(%esp), %ecx # mov rcx, [esp + 8] movl 8(%esp), %ecx # mov rcx, [esp + 8]
.byte 0x67,0x48 .byte 0x67, 0x48
movl 0x10(%esp), %edx # mov rdx, [esp + 10h] movl 0x10(%esp), %edx # mov rdx, [esp + 10h]
.byte 0x67,0x48 .byte 0x67, 0x48
movl 0x18(%esp), %esp # mov rsp, [esp + 18h] movl 0x18(%esp), %esp # mov rsp, [esp + 18h]
.byte 0x48 .byte 0x48
addl $0x-20, %esp # add rsp, -20h addl $0x-20, %esp # add rsp, -20h

View File

@ -25,9 +25,20 @@
.model flat,C .model flat,C
.code .code
;------------------------------------------------------------------------------
; VOID
; EFIAPI
; InternalX86EnablePaging64 (
; IN UINT16 Cs,
; IN UINT64 EntryPoint,
; IN UINT64 Context1, OPTIONAL
; IN UINT64 Context2, OPTIONAL
; IN UINT64 NewStack
; );
;------------------------------------------------------------------------------
InternalX86EnablePaging64 PROC InternalX86EnablePaging64 PROC
cli cli
mov [esp], @F ; offset for far retf mov [esp], @F ; offset for far retf, seg is the 1st arg
mov eax, cr4 mov eax, cr4
or al, (1 SHL 5) or al, (1 SHL 5)
mov cr4, eax ; enable PAE mov cr4, eax ; enable PAE

View File

@ -21,10 +21,7 @@
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
.global _AsmFlushCacheLine
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# VOID # VOID
@ -33,11 +30,7 @@
# IN VOID *LinearAddress # IN VOID *LinearAddress
# ); # );
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
.global _AsmFlushCacheLine
_AsmFlushCacheLine: _AsmFlushCacheLine:
movl 4(%esp),%eax movl 4(%esp), %eax
clflush (%eax) clflush (%eax)
ret ret

View File

@ -22,7 +22,7 @@
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
.586P .586P
.model flat .model flat,C
.xmm .xmm
.code .code
@ -33,10 +33,10 @@
; IN VOID *LinearAddress ; IN VOID *LinearAddress
; ); ; );
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
_AsmFlushCacheLine PROC AsmFlushCacheLine PROC
mov eax, [esp + 4] mov eax, [esp + 4]
clflush [eax] clflush [eax]
ret ret
_AsmFlushCacheLine ENDP AsmFlushCacheLine ENDP
END END

View File

@ -21,10 +21,7 @@
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
.global _InternalX86FxRestore
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# VOID # VOID
@ -33,11 +30,7 @@
# IN CONST IA32_FX_BUFFER *Buffer # IN CONST IA32_FX_BUFFER *Buffer
# ); # );
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
.global _InternalX86FxRestore
_InternalX86FxRestore: _InternalX86FxRestore:
movl 4(%esp),%eax movl 4(%esp), %eax
fxrstor (%eax) fxrstor (%eax)
ret ret

View File

@ -21,7 +21,7 @@
; ;
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
.586P .586
.model flat,C .model flat,C
.xmm .xmm
.code .code

View File

@ -21,10 +21,7 @@
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
.global _InternalX86FxSave
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# VOID # VOID
@ -33,11 +30,7 @@
# OUT IA32_FX_BUFFER *Buffer # OUT IA32_FX_BUFFER *Buffer
# ); # );
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
.global _InternalX86FxSave
_InternalX86FxSave: _InternalX86FxSave:
movl 4(%esp),%eax movl 4(%esp), %eax
fxsave (%eax) fxsave (%eax)
ret ret

View File

@ -21,7 +21,7 @@
; ;
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
.586P .586
.model flat,C .model flat,C
.xmm .xmm
.code .code

View File

@ -21,9 +21,7 @@
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
.global _InternalSyncCompareExchange32
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# UINT32 # UINT32
@ -34,13 +32,10 @@
# IN UINT32 ExchangeValue # IN UINT32 ExchangeValue
# ); # );
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
.global _InternalSyncCompareExchange32
_InternalSyncCompareExchange32: _InternalSyncCompareExchange32:
movl 4(%esp),%ecx movl 4(%esp), %ecx
movl 8(%esp),%eax movl 8(%esp), %eax
movl 12(%esp),%edx movl 12(%esp), %edx
lock cmpxchgl %edx,(%ecx) lock
cmpxchgl %edx, (%ecx)
ret ret

View File

@ -28,7 +28,7 @@
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
; UINT32 ; UINT32
; EFIAPI ; EFIAPI
; InterlockedCompareExchange32 ( ; InternalSyncCompareExchange32 (
; IN UINT32 *Value, ; IN UINT32 *Value,
; IN UINT32 CompareValue, ; IN UINT32 CompareValue,
; IN UINT32 ExchangeValue ; IN UINT32 ExchangeValue

View File

@ -21,9 +21,7 @@
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
.global _InternalSyncCompareExchange64
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# UINT64 # UINT64
@ -34,20 +32,16 @@
# IN UINT64 ExchangeValue # IN UINT64 ExchangeValue
# ); # );
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
.global _InternalSyncCompareExchange64
_InternalSyncCompareExchange64: _InternalSyncCompareExchange64:
push %esi push %esi
push %ebx push %ebx
movl 12(%esp),%esi movl 12(%esp), %esi
movl 16(%esp),%eax movl 16(%esp), %eax
movl 20(%esp),%edx movl 20(%esp), %edx
movl 24(%esp),%ebx movl 24(%esp), %ebx
movl 28(%esp),%ecx movl 28(%esp), %ecx
lock lock
cmpxchg8b (%esi) cmpxchg8b (%esi)
pop %ebx pop %ebx
pop %esi pop %esi
ret ret

View File

@ -28,7 +28,7 @@
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
; UINT64 ; UINT64
; EFIAPI ; EFIAPI
; InterlockedCompareExchange64 ( ; InternalSyncCompareExchange64 (
; IN UINT64 *Value, ; IN UINT64 *Value,
; IN UINT64 CompareValue, ; IN UINT64 CompareValue,
; IN UINT64 ExchangeValue ; IN UINT64 ExchangeValue

View File

@ -21,9 +21,7 @@
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
.global _InternalSyncDecrement
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# UINT32 # UINT32
@ -32,13 +30,9 @@
# IN UINT32 *Value # IN UINT32 *Value
# ); # );
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
.global _InternalSyncDecrement
_InternalSyncDecrement: _InternalSyncDecrement:
movl 4(%esp),%eax movl 4(%esp), %eax
lock lock
decl (%eax) decl (%eax)
movl (%eax),%eax movl (%eax), %eax
ret ret

View File

@ -28,7 +28,7 @@
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
; UINT32 ; UINT32
; EFIAPI ; EFIAPI
; InterlockedDecrement ( ; InternalSyncDecrement (
; IN UINT32 *Value ; IN UINT32 *Value
; ); ; );
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------

View File

@ -21,9 +21,7 @@
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
.global _InternalSyncIncrement
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# UINT32 # UINT32
@ -32,13 +30,9 @@
# IN UINT32 *Value # IN UINT32 *Value
# ); # );
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
.global _InternalSyncIncrement
_InternalSyncIncrement: _InternalSyncIncrement:
movl 4(%esp),%eax movl 4(%esp), %eax
lock lock
incl (%eax) incl (%eax)
movl (%eax),%eax movl (%eax), %eax
ret ret

View File

@ -28,7 +28,7 @@
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
; UINT32 ; UINT32
; EFIAPI ; EFIAPI
; InterlockedIncrement ( ; InternalSyncIncrement (
; IN UINT32 *Value ; IN UINT32 *Value
; ); ; );
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------

View File

@ -21,9 +21,7 @@
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
.global _AsmInvd
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# VOID # VOID
@ -32,10 +30,6 @@
# VOID # VOID
# ); # );
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
.global _AsmInvd
_AsmInvd: _AsmInvd:
invd invd
ret ret

View File

@ -19,26 +19,28 @@
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
.global _InternalMathLRotU64 .global _InternalMathLRotU64
#------------------------------------------------------------------------------
# UINT64
# EFIAPI
# InternalMathLRotU64 (
# IN UINT64 Operand,
# IN UINTN Count
# );
#------------------------------------------------------------------------------
_InternalMathLRotU64: _InternalMathLRotU64:
push %ebx push %ebx
movb 16(%esp),%cl movb 16(%esp), %cl
movl 12(%esp),%edx movl 12(%esp), %edx
movl 8(%esp),%eax movl 8(%esp), %eax
shldl %cl,%edx,%ebx shldl %cl, %edx, %ebx
shldl %cl,%eax,%edx shldl %cl, %eax, %edx
rorl %cl,%ebx rorl %cl, %ebx
shldl %cl,%ebx,%eax shldl %cl, %ebx, %eax
testb $32,%cl testb $32, %cl
cmovnz %eax, %ecx cmovnz %eax, %ecx
cmovnz %edx, %eax cmovnz %edx, %eax
cmovnz %ecx, %edx cmovnz %ecx, %edx
pop %ebx pop %ebx
ret ret

View File

@ -23,6 +23,14 @@
.model flat,C .model flat,C
.code .code
;------------------------------------------------------------------------------
; UINT64
; EFIAPI
; InternalMathLRotU64 (
; IN UINT64 Operand,
; IN UINTN Count
; );
;------------------------------------------------------------------------------
InternalMathLRotU64 PROC USES ebx InternalMathLRotU64 PROC USES ebx
mov cl, [esp + 16] mov cl, [esp + 16]
mov edx, [esp + 12] mov edx, [esp + 12]
@ -31,7 +39,7 @@ InternalMathLRotU64 PROC USES ebx
shld edx, eax, cl shld edx, eax, cl
ror ebx, cl ror ebx, cl
shld eax, ebx, cl shld eax, ebx, cl
test cl, 32 test cl, 32 ; Count >= 32?
cmovnz ecx, eax cmovnz ecx, eax
cmovnz eax, edx cmovnz eax, edx
cmovnz edx, ecx cmovnz edx, ecx

View File

@ -19,11 +19,16 @@
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
.686:
#.MODEL flat,C
.code:
.global _InternalMathLShiftU64 .global _InternalMathLShiftU64
#------------------------------------------------------------------------------
# UINT64
# EFIAPI
# InternalMathLShiftU64 (
# IN UINT64 Operand,
# IN UINTN Count
# );
#------------------------------------------------------------------------------
_InternalMathLShiftU64: _InternalMathLShiftU64:
movb 12(%esp), %cl movb 12(%esp), %cl
xorl %eax, %eax xorl %eax, %eax
@ -31,6 +36,6 @@ _InternalMathLShiftU64:
testb $32, %cl testb $32, %cl
cmovz %edx, %eax cmovz %edx, %eax
cmovz 0x8(%esp), %edx cmovz 0x8(%esp), %edx
shld %cl,%eax,%edx shld %cl, %eax, %edx
shl %cl, %eax shl %cl, %eax
ret ret

View File

@ -23,11 +23,19 @@
.model flat,C .model flat,C
.code .code
;------------------------------------------------------------------------------
; UINT64
; EFIAPI
; InternalMathLShiftU64 (
; IN UINT64 Operand,
; IN UINTN Count
; );
;------------------------------------------------------------------------------
InternalMathLShiftU64 PROC InternalMathLShiftU64 PROC
mov cl, [esp + 12] mov cl, [esp + 12]
xor eax, eax xor eax, eax
mov edx, [esp + 4] mov edx, [esp + 4]
test cl, 32 test cl, 32 ; Count >= 32?
cmovz eax, edx cmovz eax, edx
cmovz edx, [esp + 8] cmovz edx, [esp + 8]
shld edx, eax, cl shld edx, eax, cl

View File

@ -19,20 +19,23 @@
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
.386: .global _InternalLongJump
.code:
.globl _InternalLongJump #------------------------------------------------------------------------------
# VOID
# EFIAPI
# InternalLongJump (
# IN BASE_LIBRARY_JUMP_BUFFER *JumpBuffer,
# IN UINTN Value
# );
#------------------------------------------------------------------------------
_InternalLongJump: _InternalLongJump:
popl %eax pop %eax
popl %edx pop %edx
popl %eax pop %eax
movl (%edx), %ebx movl (%edx), %ebx
movl 4(%edx), %esi movl 4(%edx), %esi
movl 8(%edx), %edi movl 8(%edx), %edi
movl 12(%edx), %ebp movl 12(%edx), %ebp
movl 16(%edx), %esp movl 16(%edx), %esp
jmp *20(%edx) jmp *20(%edx)
#InternalLongJump ENDP

View File

@ -23,10 +23,18 @@
.model flat,C .model flat,C
.code .code
;------------------------------------------------------------------------------
; VOID
; EFIAPI
; InternalLongJump (
; IN BASE_LIBRARY_JUMP_BUFFER *JumpBuffer,
; IN UINTN Value
; );
;------------------------------------------------------------------------------
InternalLongJump PROC InternalLongJump PROC
pop eax pop eax ; skip return address
pop edx pop edx ; edx <- JumpBuffer
pop eax pop eax ; eax <- Value
mov ebx, [edx] mov ebx, [edx]
mov esi, [edx + 4] mov esi, [edx + 4]
mov edi, [edx + 8] mov edi, [edx + 8]

View File

@ -19,20 +19,22 @@
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
.global _InternalMathModU64x32 .global _InternalMathModU64x32
#------------------------------------------------------------------------------
# UINT32
# EFIAPI
# InternalMathModU64x32 (
# IN UINT64 Dividend,
# IN UINT32 Divisor
# );
#------------------------------------------------------------------------------
_InternalMathModU64x32: _InternalMathModU64x32:
movl 8(%esp),%eax movl 8(%esp), %eax
movl 12(%esp),%ecx movl 12(%esp), %ecx
xorl %edx,%edx xorl %edx, %edx
divl %ecx divl %ecx
movl 4(%esp),%eax movl 4(%esp), %eax
divl %ecx divl %ecx
movl %edx,%eax movl %edx, %eax
ret ret

View File

@ -23,6 +23,14 @@
.model flat,C .model flat,C
.code .code
;------------------------------------------------------------------------------
; UINT32
; EFIAPI
; InternalMathModU64x32 (
; IN UINT64 Dividend,
; IN UINT32 Divisor
; );
;------------------------------------------------------------------------------
InternalMathModU64x32 PROC InternalMathModU64x32 PROC
mov eax, [esp + 8] mov eax, [esp + 8]
mov ecx, [esp + 12] mov ecx, [esp + 12]

View File

@ -21,9 +21,7 @@
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
.global _AsmMonitor
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# UINT64 # UINT64
@ -34,13 +32,9 @@
# IN UINTN Edx # IN UINTN Edx
# ); # );
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
.global _AsmMonitor
_AsmMonitor: _AsmMonitor:
movl 4(%esp),%eax movl 4(%esp), %eax
movl 8(%esp),%ecx movl 8(%esp), %ecx
movl 12(%esp),%edx movl 12(%esp), %edx
monitor %eax,%ecx,%edx monitor %eax, %ecx, %edx
ret ret

View File

@ -22,11 +22,11 @@
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
.686 .686
.model flat .model flat,C
.code .code
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
; UINT64 ; UINTN
; EFIAPI ; EFIAPI
; AsmMonitor ( ; AsmMonitor (
; IN UINTN Eax, ; IN UINTN Eax,
@ -34,12 +34,12 @@
; IN UINTN Edx ; IN UINTN Edx
; ); ; );
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
_AsmMonitor PROC AsmMonitor PROC
mov eax, [esp + 4] mov eax, [esp + 4]
mov ecx, [esp + 8] mov ecx, [esp + 8]
mov edx, [esp + 12] mov edx, [esp + 12]
DB 0fh, 1, 0c8h DB 0fh, 1, 0c8h ; monitor
ret ret
_AsmMonitor ENDP AsmMonitor ENDP
END END

View File

@ -23,10 +23,19 @@
.code: .code:
.global _InternalMathMultU64x32 .global _InternalMathMultU64x32
#------------------------------------------------------------------------------
# UINT64
# EFIAPI
# InternalMathMultU64x32 (
# IN UINT64 Multiplicand,
# IN UINT32 Multiplier
# );
#------------------------------------------------------------------------------
_InternalMathMultU64x32: _InternalMathMultU64x32:
movl 12(%esp),%ecx movl 12(%esp), %ecx
movl %ecx,%eax movl %ecx, %eax
imull 8(%esp),%ecx imull 8(%esp), %ecx
mull 0x4(%esp) mull 0x4(%esp)
addl %ecx,%edx addl %ecx, %edx
ret ret

View File

@ -23,10 +23,18 @@
.model flat,C .model flat,C
.code .code
;------------------------------------------------------------------------------
; UINT64
; EFIAPI
; InternalMathMultU64x32 (
; IN UINT64 Multiplicand,
; IN UINT32 Multiplier
; );
;------------------------------------------------------------------------------
InternalMathMultU64x32 PROC InternalMathMultU64x32 PROC
mov ecx, [esp + 12] mov ecx, [esp + 12]
mov eax, ecx mov eax, ecx
imul ecx, [esp + 8] imul ecx, [esp + 8] ; overflow not detectable
mul dword ptr [esp + 4] mul dword ptr [esp + 4]
add edx, ecx add edx, ecx
ret ret

View File

@ -19,24 +19,26 @@
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
.global _InternalMathMultU64x64 .global _InternalMathMultU64x64
#------------------------------------------------------------------------------
# UINT64
# EFIAPI
# InternalMathMultU64x64 (
# IN UINT64 Multiplicand,
# IN UINT64 Multiplier
# );
#------------------------------------------------------------------------------
_InternalMathMultU64x64: _InternalMathMultU64x64:
push %ebx push %ebx
movl 8(%esp),%ebx movl 8(%esp), %ebx
movl 16(%esp),%edx movl 16(%esp), %edx
movl %ebx,%ecx movl %ebx, %ecx
movl %edx,%eax movl %edx, %eax
imull 20(%esp),%ebx imull 20(%esp), %ebx
imull 12(%esp),%edx imull 12(%esp), %edx
addl %edx,%ebx addl %edx, %ebx
mull %ecx mull %ecx
addl %ebx,%edx addl %ebx, %edx
pop %ebx pop %ebx
ret ret

View File

@ -23,6 +23,14 @@
.model flat,C .model flat,C
.code .code
;------------------------------------------------------------------------------
; UINT64
; EFIAPI
; InternalMathMultU64x64 (
; IN UINT64 Multiplicand,
; IN UINT64 Multiplier
; );
;------------------------------------------------------------------------------
InternalMathMultU64x64 PROC USES ebx InternalMathMultU64x64 PROC USES ebx
mov ebx, [esp + 8] mov ebx, [esp + 8]
mov edx, [esp + 16] mov edx, [esp + 16]

View File

@ -21,9 +21,7 @@
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
.global _AsmMwait
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# UINT64 # UINT64
@ -33,12 +31,8 @@
# IN UINTN Ecx # IN UINTN Ecx
# ); # );
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
.global _AsmMwait
_AsmMwait: _AsmMwait:
movl 4(%esp),%eax movl 4(%esp), %eax
movl 8(%esp),%ecx movl 8(%esp), %ecx
mwait %eax,%ecx mwait %eax, %ecx
ret ret

View File

@ -22,22 +22,22 @@
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
.686 .686
.model flat .model flat,C
.code .code
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
; UINT64 ; UINTN
; EFIAPI ; EFIAPI
; AsmMwait ( ; AsmMwait (
; IN UINTN Eax, ; IN UINTN Eax,
; IN UINTN Ecx ; IN UINTN Ecx
; ); ; );
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
_AsmMwait PROC AsmMwait PROC
mov eax, [esp + 4] mov eax, [esp + 4]
mov ecx, [esp + 8] mov ecx, [esp + 8]
DB 0fh, 1, 0c9h DB 0fh, 1, 0c9h ; mwait
ret ret
_AsmMwait ENDP AsmMwait ENDP
END END

View File

@ -19,26 +19,28 @@
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
.global _InternalMathRRotU64 .global _InternalMathRRotU64
#------------------------------------------------------------------------------
# UINT64
# EFIAPI
# InternalMathRRotU64 (
# IN UINT64 Operand,
# IN UINTN Count
# );
#------------------------------------------------------------------------------
_InternalMathRRotU64: _InternalMathRRotU64:
push %ebx push %ebx
movb 16(%esp),%cl movb 16(%esp), %cl
movl 8(%esp),%eax movl 8(%esp), %eax
movl 12(%esp),%edx movl 12(%esp), %edx
shrdl %cl,%eax,%ebx shrdl %cl, %eax, %ebx
shrdl %cl,%edx,%eax shrdl %cl, %edx, %eax
roll %cl,%ebx roll %cl, %ebx
shrdl %cl,%ebx,%edx shrdl %cl, %ebx, %edx
testb $32,%cl testb $32, %cl
cmovnz %eax, %ecx cmovnz %eax, %ecx
cmovnz %edx, %eax cmovnz %edx, %eax
cmovnz %ecx, %edx cmovnz %ecx, %edx
pop %ebx pop %ebx
ret ret

View File

@ -23,6 +23,14 @@
.model flat,C .model flat,C
.code .code
;------------------------------------------------------------------------------
; UINT64
; EFIAPI
; InternalMathRRotU64 (
; IN UINT64 Operand,
; IN UINTN Count
; );
;------------------------------------------------------------------------------
InternalMathRRotU64 PROC USES ebx InternalMathRRotU64 PROC USES ebx
mov cl, [esp + 16] mov cl, [esp + 16]
mov eax, [esp + 8] mov eax, [esp + 8]
@ -31,7 +39,7 @@ InternalMathRRotU64 PROC USES ebx
shrd eax, edx, cl shrd eax, edx, cl
rol ebx, cl rol ebx, cl
shrd edx, ebx, cl shrd edx, ebx, cl
test cl, 32 test cl, 32 ; Count >= 32?
cmovnz ecx, eax cmovnz ecx, eax
cmovnz eax, edx cmovnz eax, edx
cmovnz edx, ecx cmovnz edx, ecx

View File

@ -23,13 +23,22 @@
.code: .code:
.global _InternalMathRShiftU64 .global _InternalMathRShiftU64
#------------------------------------------------------------------------------
# UINT64
# EFIAPI
# InternalMathRShiftU64 (
# IN UINT64 Operand,
# IN UINTN Count
# );
#------------------------------------------------------------------------------
_InternalMathRShiftU64: _InternalMathRShiftU64:
movb 12(%esp),%cl movb 12(%esp), %cl
xorl %edx,%edx xorl %edx, %edx
movl 8(%esp),%eax movl 8(%esp), %eax
testb $32,%cl testb $32, %cl
cmovz %eax, %edx cmovz %eax, %edx
cmovz 0x4(%esp), %eax cmovz 0x4(%esp), %eax
shrdl %cl,%edx,%eax shrdl %cl, %edx, %eax
shr %cl,%edx shr %cl, %edx
ret ret

View File

@ -23,6 +23,14 @@
.model flat,C .model flat,C
.code .code
;------------------------------------------------------------------------------
; UINT64
; EFIAPI
; InternalMathRShiftU64 (
; IN UINT64 Operand,
; IN UINTN Count
; );
;------------------------------------------------------------------------------
InternalMathRShiftU64 PROC InternalMathRShiftU64 PROC
mov cl, [esp + 12] mov cl, [esp + 12]
xor edx, edx xor edx, edx

View File

@ -21,9 +21,7 @@
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
.global _AsmReadCr0
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# UINTN # UINTN
@ -32,10 +30,6 @@
# VOID # VOID
# ); # );
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
.global _AsmReadCr0
_AsmReadCr0: _AsmReadCr0:
movl %cr0, %eax movl %cr0, %eax
ret ret

View File

@ -22,7 +22,7 @@
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
.386p .386p
.model flat .model flat,C
.code .code
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
@ -32,9 +32,9 @@
; VOID ; VOID
; ); ; );
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
_AsmReadCr0 PROC AsmReadCr0 PROC
mov eax, cr0 mov eax, cr0
ret ret
_AsmReadCr0 ENDP AsmReadCr0 ENDP
END END

View File

@ -21,9 +21,7 @@
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
.global _AsmReadCr2
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# UINTN # UINTN
@ -32,10 +30,6 @@
# VOID # VOID
# ); # );
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
.global _AsmReadCr2
_AsmReadCr2: _AsmReadCr2:
movl %cr2, %eax movl %cr2, %eax
ret ret

View File

@ -22,7 +22,7 @@
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
.386p .386p
.model flat .model flat,C
.code .code
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
@ -32,9 +32,9 @@
; VOID ; VOID
; ); ; );
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
_AsmReadCr2 PROC AsmReadCr2 PROC
mov eax, cr2 mov eax, cr2
ret ret
_AsmReadCr2 ENDP AsmReadCr2 ENDP
END END

View File

@ -21,9 +21,7 @@
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
.global _AsmReadCr3
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# UINTN # UINTN
@ -32,10 +30,6 @@
# VOID # VOID
# ); # );
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
.global _AsmReadCr3
_AsmReadCr3: _AsmReadCr3:
movl %cr3, %eax movl %cr3, %eax
ret ret

View File

@ -22,7 +22,7 @@
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
.386p .386p
.model flat .model flat,C
.code .code
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
@ -32,9 +32,9 @@
; VOID ; VOID
; ); ; );
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
_AsmReadCr3 PROC AsmReadCr3 PROC
mov eax, cr3 mov eax, cr3
ret ret
_AsmReadCr3 ENDP AsmReadCr3 ENDP
END END

View File

@ -21,9 +21,7 @@
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
.global _AsmReadCr4
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# UINTN # UINTN
@ -32,10 +30,6 @@
# VOID # VOID
# ); # );
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
.global _AsmReadCr4
_AsmReadCr4: _AsmReadCr4:
movl %cr4, %eax movl %cr4, %eax
ret ret

View File

@ -22,7 +22,7 @@
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
.586p .586p
.model flat .model flat,C
.code .code
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
@ -32,9 +32,9 @@
; VOID ; VOID
; ); ; );
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
_AsmReadCr4 PROC AsmReadCr4 PROC
mov eax, cr4 mov eax, cr4
ret ret
_AsmReadCr4 ENDP AsmReadCr4 ENDP
END END

View File

@ -21,9 +21,7 @@
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
.global _AsmReadCs
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# UINT16 # UINT16
@ -32,10 +30,6 @@
# VOID # VOID
# ); # );
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
.global _AsmReadCs
_AsmReadCs: _AsmReadCs:
movw %cs,%ax movl %cs, %eax
ret ret

View File

@ -22,7 +22,7 @@
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
.386 .386
.model flat .model flat,C
.code .code
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
@ -32,9 +32,9 @@
; VOID ; VOID
; ); ; );
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
_AsmReadCs PROC AsmReadCs PROC
mov ax, cs mov eax, cs
ret ret
_AsmReadCs ENDP AsmReadCs ENDP
END END

View File

@ -21,8 +21,7 @@
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
.global _AsmReadDr0
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# UINTN # UINTN
@ -31,10 +30,6 @@
# VOID # VOID
# ); # );
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
.global _AsmReadDr0
_AsmReadDr0: _AsmReadDr0:
movl %dr0, %eax movl %dr0, %eax
ret ret

View File

@ -22,7 +22,7 @@
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
.586p .586p
.model flat .model flat,C
.code .code
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
@ -32,9 +32,9 @@
; VOID ; VOID
; ); ; );
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
_AsmReadDr0 PROC AsmReadDr0 PROC
mov eax, dr0 mov eax, dr0
ret ret
_AsmReadDr0 ENDP AsmReadDr0 ENDP
END END

View File

@ -21,9 +21,7 @@
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
.global _AsmReadDr1
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# UINTN # UINTN
@ -32,10 +30,6 @@
# VOID # VOID
# ); # );
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
.global _AsmReadDr1
_AsmReadDr1: _AsmReadDr1:
movl %dr1, %eax movl %dr1, %eax
ret ret

View File

@ -22,7 +22,7 @@
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
.586p .586p
.model flat .model flat,C
.code .code
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
@ -32,9 +32,9 @@
; VOID ; VOID
; ); ; );
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
_AsmReadDr1 PROC AsmReadDr1 PROC
mov eax, dr1 mov eax, dr1
ret ret
_AsmReadDr1 ENDP AsmReadDr1 ENDP
END END

View File

@ -21,9 +21,7 @@
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
.global _AsmReadDr2
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# UINTN # UINTN
@ -32,10 +30,6 @@
# VOID # VOID
# ); # );
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
.global _AsmReadDr2
_AsmReadDr2: _AsmReadDr2:
movl %dr2, %eax movl %dr2, %eax
ret ret

View File

@ -22,7 +22,7 @@
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
.586p .586p
.model flat .model flat,C
.code .code
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
@ -32,9 +32,9 @@
; VOID ; VOID
; ); ; );
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
_AsmReadDr2 PROC AsmReadDr2 PROC
mov eax, dr2 mov eax, dr2
ret ret
_AsmReadDr2 ENDP AsmReadDr2 ENDP
END END

View File

@ -21,9 +21,7 @@
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
.global _AsmReadDr3
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# UINTN # UINTN
@ -32,10 +30,6 @@
# VOID # VOID
# ); # );
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
.global _AsmReadDr3
_AsmReadDr3: _AsmReadDr3:
movl %dr3, %eax movl %dr3, %eax
ret ret

View File

@ -22,7 +22,7 @@
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
.586p .586p
.model flat .model flat,C
.code .code
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
@ -32,9 +32,9 @@
; VOID ; VOID
; ); ; );
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
_AsmReadDr3 PROC AsmReadDr3 PROC
mov eax, dr3 mov eax, dr3
ret ret
_AsmReadDr3 ENDP AsmReadDr3 ENDP
END END

View File

@ -21,9 +21,7 @@
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
.global _AsmReadDr4
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# UINTN # UINTN
@ -32,10 +30,6 @@
# VOID # VOID
# ); # );
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
.global _AsmReadDr4
_AsmReadDr4: _AsmReadDr4:
movl %dr4, %eax movl %dr4, %eax
ret ret

View File

@ -22,7 +22,7 @@
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
.586p .586p
.model flat .model flat,C
.code .code
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
@ -32,9 +32,9 @@
; VOID ; VOID
; ); ; );
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
_AsmReadDr4 PROC AsmReadDr4 PROC
DB 0fh, 21h, 0e0h DB 0fh, 21h, 0e0h
ret ret
_AsmReadDr4 ENDP AsmReadDr4 ENDP
END END

View File

@ -21,9 +21,7 @@
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
.global _AsmReadDr5
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# UINTN # UINTN
@ -32,10 +30,6 @@
# VOID # VOID
# ); # );
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
.global _AsmReadDr5
_AsmReadDr5: _AsmReadDr5:
movl %dr5, %eax movl %dr5, %eax
ret ret

View File

@ -22,7 +22,7 @@
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
.586p .586p
.model flat .model flat,C
.code .code
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
@ -32,9 +32,9 @@
; VOID ; VOID
; ); ; );
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
_AsmReadDr5 PROC AsmReadDr5 PROC
DB 0fh, 21h, 0e8h DB 0fh, 21h, 0e8h
ret ret
_AsmReadDr5 ENDP AsmReadDr5 ENDP
END END

View File

@ -21,9 +21,7 @@
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
.global _AsmReadDr6
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# UINTN # UINTN
@ -32,10 +30,6 @@
# VOID # VOID
# ); # );
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
.global _AsmReadDr6
_AsmReadDr6: _AsmReadDr6:
movl %dr6, %eax movl %dr6, %eax
ret ret

View File

@ -22,7 +22,7 @@
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
.586p .586p
.model flat .model flat,C
.code .code
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
@ -32,9 +32,9 @@
; VOID ; VOID
; ); ; );
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
_AsmReadDr6 PROC AsmReadDr6 PROC
mov eax, dr6 mov eax, dr6
ret ret
_AsmReadDr6 ENDP AsmReadDr6 ENDP
END END

View File

@ -21,9 +21,7 @@
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
.global _AsmReadDr7
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# UINTN # UINTN
@ -32,10 +30,6 @@
# VOID # VOID
# ); # );
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
.global _AsmReadDr7
_AsmReadDr7: _AsmReadDr7:
movl %dr7, %eax movl %dr7, %eax
ret ret

View File

@ -22,7 +22,7 @@
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
.586p .586p
.model flat .model flat,C
.code .code
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
@ -32,9 +32,9 @@
; VOID ; VOID
; ); ; );
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
_AsmReadDr7 PROC AsmReadDr7 PROC
mov eax, dr7 mov eax, dr7
ret ret
_AsmReadDr7 ENDP AsmReadDr7 ENDP
END END

View File

@ -21,9 +21,7 @@
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
.global _AsmReadEflags
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# UINT16 # UINT16
@ -32,10 +30,6 @@
# VOID # VOID
# ); # );
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
.global _AsmReadDs
_AsmReadDs: _AsmReadDs:
movw %ds,%ax movl %ds, %eax
ret ret

View File

@ -22,7 +22,7 @@
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
.386 .386
.model flat .model flat,C
.code .code
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
@ -32,9 +32,9 @@
; VOID ; VOID
; ); ; );
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
_AsmReadDs PROC AsmReadDs PROC
mov ax, ds mov eax, ds
ret ret
_AsmReadDs ENDP AsmReadDs ENDP
END END

View File

@ -21,9 +21,7 @@
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
.global _AsmReadEflags
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# UINTN # UINTN
@ -32,11 +30,7 @@
# VOID # VOID
# ); # );
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
.global _AsmReadEflags
_AsmReadEflags: _AsmReadEflags:
pushfl pushfl
popl %eax pop %eax
ret ret

View File

@ -22,7 +22,7 @@
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
.386 .386
.model flat .model flat,C
.code .code
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
@ -32,10 +32,10 @@
; VOID ; VOID
; ); ; );
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
_AsmReadEflags PROC AsmReadEflags PROC
pushfd pushfd
pop eax pop eax
ret ret
_AsmReadEflags ENDP AsmReadEflags ENDP
END END

View File

@ -21,9 +21,7 @@
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
.global _AsmReadEs
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# UINT16 # UINT16
@ -32,10 +30,6 @@
# VOID # VOID
# ); # );
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
.global _AsmReadEs
_AsmReadEs: _AsmReadEs:
movw %es,%ax movl %es, %eax
ret ret

View File

@ -22,7 +22,7 @@
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
.386 .386
.model flat .model flat,C
.code .code
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
@ -32,9 +32,9 @@
; VOID ; VOID
; ); ; );
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
_AsmReadEs PROC AsmReadEs PROC
mov ax, es mov eax, es
ret ret
_AsmReadEs ENDP AsmReadEs ENDP
END END

View File

@ -21,9 +21,7 @@
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
.global _AsmReadFs
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# UINT16 # UINT16
@ -32,10 +30,6 @@
# VOID # VOID
# ); # );
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
.global _AsmReadFs
_AsmReadFs: _AsmReadFs:
movw %fs,%ax movl %fs, %eax
ret ret

View File

@ -22,7 +22,7 @@
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
.386 .386
.model flat .model flat,C
.code .code
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
@ -32,9 +32,9 @@
; VOID ; VOID
; ); ; );
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
_AsmReadFs PROC AsmReadFs PROC
mov ax, fs mov eax, fs
ret ret
_AsmReadFs ENDP AsmReadFs ENDP
END END

View File

@ -21,9 +21,7 @@
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
.global _InternalX86ReadGdtr
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# VOID # VOID
@ -32,11 +30,7 @@
# OUT IA32_DESCRIPTOR *Gdtr # OUT IA32_DESCRIPTOR *Gdtr
# ); # );
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
.global _InternalX86ReadGdtr
_InternalX86ReadGdtr: _InternalX86ReadGdtr:
movl 4(%esp),%eax movl 4(%esp), %eax
sgdt (%eax) sgdt (%eax)
ret ret

View File

@ -21,9 +21,7 @@
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
.global _AsmReadGs
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# UINT16 # UINT16
@ -32,10 +30,6 @@
# VOID # VOID
# ); # );
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
.global _AsmReadGs
_AsmReadGs: _AsmReadGs:
movw %gs,%ax movl %gs, %eax
ret ret

View File

@ -22,7 +22,7 @@
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
.386 .386
.model flat .model flat,C
.code .code
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
@ -32,9 +32,9 @@
; VOID ; VOID
; ); ; );
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
_AsmReadGs PROC AsmReadGs PROC
mov ax, gs mov eax, gs
ret ret
_AsmReadGs ENDP AsmReadGs ENDP
END END

Some files were not shown because too many files have changed in this diff Show More