summaryrefslogtreecommitdiff
path: root/MdePkg
diff options
context:
space:
mode:
authorbxing <bxing@6f19259b-4bc3-4df7-8a09-765794883524>2006-07-21 08:47:38 +0000
committerbxing <bxing@6f19259b-4bc3-4df7-8a09-765794883524>2006-07-21 08:47:38 +0000
commit3f566587aea64bb986866c7f69a6b82891bf59db (patch)
tree406fa713c2baaa46f9c357f49bcef7d710e7f044 /MdePkg
parent31a9215c3223d3818d1709f39d06774e18df103f (diff)
downloadedk2-3f566587aea64bb986866c7f69a6b82891bf59db.zip
edk2-3f566587aea64bb986866c7f69a6b82891bf59db.tar.gz
edk2-3f566587aea64bb986866c7f69a6b82891bf59db.tar.bz2
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
Diffstat (limited to 'MdePkg')
-rw-r--r--MdePkg/Library/BaseLib/BaseLib.msa32
-rw-r--r--MdePkg/Library/BaseLib/Ia32/ARShiftU64.S28
-rw-r--r--MdePkg/Library/BaseLib/Ia32/ARShiftU64.asm10
-rw-r--r--MdePkg/Library/BaseLib/Ia32/CpuBreakpoint.S11
-rw-r--r--MdePkg/Library/BaseLib/Ia32/CpuFlushTlb.S10
-rw-r--r--MdePkg/Library/BaseLib/Ia32/CpuFlushTlb.asm6
-rw-r--r--MdePkg/Library/BaseLib/Ia32/CpuId.S20
-rw-r--r--MdePkg/Library/BaseLib/Ia32/CpuId.asm2
-rw-r--r--MdePkg/Library/BaseLib/Ia32/CpuIdEx.S16
-rw-r--r--MdePkg/Library/BaseLib/Ia32/CpuPause.S11
-rw-r--r--MdePkg/Library/BaseLib/Ia32/CpuPause.asm6
-rw-r--r--MdePkg/Library/BaseLib/Ia32/CpuSleep.S10
-rw-r--r--MdePkg/Library/BaseLib/Ia32/CpuSleep.asm6
-rw-r--r--MdePkg/Library/BaseLib/Ia32/DisableInterrupts.S10
-rw-r--r--MdePkg/Library/BaseLib/Ia32/DisableInterrupts.asm6
-rw-r--r--MdePkg/Library/BaseLib/Ia32/DisablePaging32.S28
-rw-r--r--MdePkg/Library/BaseLib/Ia32/DisablePaging32.asm6
-rw-r--r--MdePkg/Library/BaseLib/Ia32/DivU64x32.S24
-rw-r--r--MdePkg/Library/BaseLib/Ia32/DivU64x32.asm12
-rw-r--r--MdePkg/Library/BaseLib/Ia32/DivU64x32Remainder.S37
-rw-r--r--MdePkg/Library/BaseLib/Ia32/DivU64x32Remainder.asm11
-rw-r--r--MdePkg/Library/BaseLib/Ia32/DivU64x64Remainder.S89
-rw-r--r--MdePkg/Library/BaseLib/Ia32/DivU64x64Remainder.asm35
-rw-r--r--MdePkg/Library/BaseLib/Ia32/EnableDisableInterrupts.S10
-rw-r--r--MdePkg/Library/BaseLib/Ia32/EnableInterrupts.S10
-rw-r--r--MdePkg/Library/BaseLib/Ia32/EnablePaging32.S28
-rw-r--r--MdePkg/Library/BaseLib/Ia32/EnablePaging64.S13
-rw-r--r--MdePkg/Library/BaseLib/Ia32/EnablePaging64.asm13
-rw-r--r--MdePkg/Library/BaseLib/Ia32/FlushCacheLine.S13
-rw-r--r--MdePkg/Library/BaseLib/Ia32/FlushCacheLine.asm6
-rw-r--r--MdePkg/Library/BaseLib/Ia32/FxRestore.S13
-rw-r--r--MdePkg/Library/BaseLib/Ia32/FxRestore.asm2
-rw-r--r--MdePkg/Library/BaseLib/Ia32/FxSave.S13
-rw-r--r--MdePkg/Library/BaseLib/Ia32/FxSave.asm2
-rw-r--r--MdePkg/Library/BaseLib/Ia32/InterlockedCompareExchange32.S19
-rw-r--r--MdePkg/Library/BaseLib/Ia32/InterlockedCompareExchange32.asm2
-rw-r--r--MdePkg/Library/BaseLib/Ia32/InterlockedCompareExchange64.S20
-rw-r--r--MdePkg/Library/BaseLib/Ia32/InterlockedCompareExchange64.asm2
-rw-r--r--MdePkg/Library/BaseLib/Ia32/InterlockedDecrement.S18
-rw-r--r--MdePkg/Library/BaseLib/Ia32/InterlockedDecrement.asm2
-rw-r--r--MdePkg/Library/BaseLib/Ia32/InterlockedIncrement.S18
-rw-r--r--MdePkg/Library/BaseLib/Ia32/InterlockedIncrement.asm2
-rw-r--r--MdePkg/Library/BaseLib/Ia32/Invd.S10
-rw-r--r--MdePkg/Library/BaseLib/Ia32/LRotU64.S34
-rw-r--r--MdePkg/Library/BaseLib/Ia32/LRotU64.asm10
-rw-r--r--MdePkg/Library/BaseLib/Ia32/LShiftU64.S15
-rw-r--r--MdePkg/Library/BaseLib/Ia32/LShiftU64.asm10
-rw-r--r--MdePkg/Library/BaseLib/Ia32/LongJump.S21
-rw-r--r--MdePkg/Library/BaseLib/Ia32/LongJump.asm14
-rw-r--r--MdePkg/Library/BaseLib/Ia32/ModU64x32.S28
-rw-r--r--MdePkg/Library/BaseLib/Ia32/ModU64x32.asm8
-rw-r--r--MdePkg/Library/BaseLib/Ia32/Monitor.S18
-rw-r--r--MdePkg/Library/BaseLib/Ia32/Monitor.asm10
-rw-r--r--MdePkg/Library/BaseLib/Ia32/MultU64x32.S23
-rw-r--r--MdePkg/Library/BaseLib/Ia32/MultU64x32.asm10
-rw-r--r--MdePkg/Library/BaseLib/Ia32/MultU64x64.S34
-rw-r--r--MdePkg/Library/BaseLib/Ia32/MultU64x64.asm8
-rw-r--r--MdePkg/Library/BaseLib/Ia32/Mwait.S16
-rw-r--r--MdePkg/Library/BaseLib/Ia32/Mwait.asm10
-rw-r--r--MdePkg/Library/BaseLib/Ia32/RRotU64.S32
-rw-r--r--MdePkg/Library/BaseLib/Ia32/RRotU64.asm10
-rw-r--r--MdePkg/Library/BaseLib/Ia32/RShiftU64.S25
-rw-r--r--MdePkg/Library/BaseLib/Ia32/RShiftU64.asm10
-rw-r--r--MdePkg/Library/BaseLib/Ia32/ReadCr0.S10
-rw-r--r--MdePkg/Library/BaseLib/Ia32/ReadCr0.asm6
-rw-r--r--MdePkg/Library/BaseLib/Ia32/ReadCr2.S10
-rw-r--r--MdePkg/Library/BaseLib/Ia32/ReadCr2.asm6
-rw-r--r--MdePkg/Library/BaseLib/Ia32/ReadCr3.S10
-rw-r--r--MdePkg/Library/BaseLib/Ia32/ReadCr3.asm6
-rw-r--r--MdePkg/Library/BaseLib/Ia32/ReadCr4.S10
-rw-r--r--MdePkg/Library/BaseLib/Ia32/ReadCr4.asm6
-rw-r--r--MdePkg/Library/BaseLib/Ia32/ReadCs.S12
-rw-r--r--MdePkg/Library/BaseLib/Ia32/ReadCs.asm8
-rw-r--r--MdePkg/Library/BaseLib/Ia32/ReadDr0.S9
-rw-r--r--MdePkg/Library/BaseLib/Ia32/ReadDr0.asm6
-rw-r--r--MdePkg/Library/BaseLib/Ia32/ReadDr1.S10
-rw-r--r--MdePkg/Library/BaseLib/Ia32/ReadDr1.asm6
-rw-r--r--MdePkg/Library/BaseLib/Ia32/ReadDr2.S10
-rw-r--r--MdePkg/Library/BaseLib/Ia32/ReadDr2.asm6
-rw-r--r--MdePkg/Library/BaseLib/Ia32/ReadDr3.S10
-rw-r--r--MdePkg/Library/BaseLib/Ia32/ReadDr3.asm6
-rw-r--r--MdePkg/Library/BaseLib/Ia32/ReadDr4.S10
-rw-r--r--MdePkg/Library/BaseLib/Ia32/ReadDr4.asm6
-rw-r--r--MdePkg/Library/BaseLib/Ia32/ReadDr5.S10
-rw-r--r--MdePkg/Library/BaseLib/Ia32/ReadDr5.asm6
-rw-r--r--MdePkg/Library/BaseLib/Ia32/ReadDr6.S10
-rw-r--r--MdePkg/Library/BaseLib/Ia32/ReadDr6.asm6
-rw-r--r--MdePkg/Library/BaseLib/Ia32/ReadDr7.S10
-rw-r--r--MdePkg/Library/BaseLib/Ia32/ReadDr7.asm6
-rw-r--r--MdePkg/Library/BaseLib/Ia32/ReadDs.S12
-rw-r--r--MdePkg/Library/BaseLib/Ia32/ReadDs.asm8
-rw-r--r--MdePkg/Library/BaseLib/Ia32/ReadEflags.S12
-rw-r--r--MdePkg/Library/BaseLib/Ia32/ReadEflags.asm6
-rw-r--r--MdePkg/Library/BaseLib/Ia32/ReadEs.S12
-rw-r--r--MdePkg/Library/BaseLib/Ia32/ReadEs.asm8
-rw-r--r--MdePkg/Library/BaseLib/Ia32/ReadFs.S12
-rw-r--r--MdePkg/Library/BaseLib/Ia32/ReadFs.asm8
-rw-r--r--MdePkg/Library/BaseLib/Ia32/ReadGdtr.S12
-rw-r--r--MdePkg/Library/BaseLib/Ia32/ReadGs.S12
-rw-r--r--MdePkg/Library/BaseLib/Ia32/ReadGs.asm8
-rw-r--r--MdePkg/Library/BaseLib/Ia32/ReadIdtr.S12
-rw-r--r--MdePkg/Library/BaseLib/Ia32/ReadIdtr.asm11
-rw-r--r--MdePkg/Library/BaseLib/Ia32/ReadLdtr.S10
-rw-r--r--MdePkg/Library/BaseLib/Ia32/ReadLdtr.asm6
-rw-r--r--MdePkg/Library/BaseLib/Ia32/ReadMm0.S21
-rw-r--r--MdePkg/Library/BaseLib/Ia32/ReadMm0.asm12
-rw-r--r--MdePkg/Library/BaseLib/Ia32/ReadMm1.S21
-rw-r--r--MdePkg/Library/BaseLib/Ia32/ReadMm1.asm12
-rw-r--r--MdePkg/Library/BaseLib/Ia32/ReadMm2.S21
-rw-r--r--MdePkg/Library/BaseLib/Ia32/ReadMm2.asm12
-rw-r--r--MdePkg/Library/BaseLib/Ia32/ReadMm3.S21
-rw-r--r--MdePkg/Library/BaseLib/Ia32/ReadMm3.asm12
-rw-r--r--MdePkg/Library/BaseLib/Ia32/ReadMm4.S21
-rw-r--r--MdePkg/Library/BaseLib/Ia32/ReadMm4.asm12
-rw-r--r--MdePkg/Library/BaseLib/Ia32/ReadMm5.S21
-rw-r--r--MdePkg/Library/BaseLib/Ia32/ReadMm5.asm12
-rw-r--r--MdePkg/Library/BaseLib/Ia32/ReadMm6.S21
-rw-r--r--MdePkg/Library/BaseLib/Ia32/ReadMm6.asm12
-rw-r--r--MdePkg/Library/BaseLib/Ia32/ReadMm7.S21
-rw-r--r--MdePkg/Library/BaseLib/Ia32/ReadMm7.asm12
-rw-r--r--MdePkg/Library/BaseLib/Ia32/ReadMsr64.S29
-rw-r--r--MdePkg/Library/BaseLib/Ia32/ReadMsr64.asm22
-rw-r--r--MdePkg/Library/BaseLib/Ia32/ReadPmc.S12
-rw-r--r--MdePkg/Library/BaseLib/Ia32/ReadPmc.asm8
-rw-r--r--MdePkg/Library/BaseLib/Ia32/ReadSs.S12
-rw-r--r--MdePkg/Library/BaseLib/Ia32/ReadSs.asm8
-rw-r--r--MdePkg/Library/BaseLib/Ia32/ReadTr.S10
-rw-r--r--MdePkg/Library/BaseLib/Ia32/ReadTr.asm6
-rw-r--r--MdePkg/Library/BaseLib/Ia32/ReadTsc.S10
-rw-r--r--MdePkg/Library/BaseLib/Ia32/ReadTsc.asm8
-rw-r--r--MdePkg/Library/BaseLib/Ia32/SetJump.S37
-rw-r--r--MdePkg/Library/BaseLib/Ia32/SetJump.asm7
-rw-r--r--MdePkg/Library/BaseLib/Ia32/SwapBytes64.S10
-rw-r--r--MdePkg/Library/BaseLib/Ia32/SwapBytes64.asm9
-rw-r--r--MdePkg/Library/BaseLib/Ia32/Thunk16.S75
-rw-r--r--MdePkg/Library/BaseLib/Ia32/Thunk16.asm29
-rw-r--r--MdePkg/Library/BaseLib/Ia32/Wbinvd.S9
-rw-r--r--MdePkg/Library/BaseLib/Ia32/Wbinvd.asm6
-rw-r--r--MdePkg/Library/BaseLib/Ia32/WriteCr0.S13
-rw-r--r--MdePkg/Library/BaseLib/Ia32/WriteCr0.asm8
-rw-r--r--MdePkg/Library/BaseLib/Ia32/WriteCr2.S13
-rw-r--r--MdePkg/Library/BaseLib/Ia32/WriteCr2.asm8
-rw-r--r--MdePkg/Library/BaseLib/Ia32/WriteCr3.S13
-rw-r--r--MdePkg/Library/BaseLib/Ia32/WriteCr3.asm8
-rw-r--r--MdePkg/Library/BaseLib/Ia32/WriteCr4.S13
-rw-r--r--MdePkg/Library/BaseLib/Ia32/WriteCr4.asm8
-rw-r--r--MdePkg/Library/BaseLib/Ia32/WriteDr0.S13
-rw-r--r--MdePkg/Library/BaseLib/Ia32/WriteDr0.asm8
-rw-r--r--MdePkg/Library/BaseLib/Ia32/WriteDr1.S13
-rw-r--r--MdePkg/Library/BaseLib/Ia32/WriteDr1.asm8
-rw-r--r--MdePkg/Library/BaseLib/Ia32/WriteDr2.S13
-rw-r--r--MdePkg/Library/BaseLib/Ia32/WriteDr2.asm8
-rw-r--r--MdePkg/Library/BaseLib/Ia32/WriteDr3.S13
-rw-r--r--MdePkg/Library/BaseLib/Ia32/WriteDr3.asm8
-rw-r--r--MdePkg/Library/BaseLib/Ia32/WriteDr4.S13
-rw-r--r--MdePkg/Library/BaseLib/Ia32/WriteDr4.asm8
-rw-r--r--MdePkg/Library/BaseLib/Ia32/WriteDr5.S13
-rw-r--r--MdePkg/Library/BaseLib/Ia32/WriteDr5.asm8
-rw-r--r--MdePkg/Library/BaseLib/Ia32/WriteDr6.S13
-rw-r--r--MdePkg/Library/BaseLib/Ia32/WriteDr6.asm8
-rw-r--r--MdePkg/Library/BaseLib/Ia32/WriteDr7.S13
-rw-r--r--MdePkg/Library/BaseLib/Ia32/WriteDr7.asm8
-rw-r--r--MdePkg/Library/BaseLib/Ia32/WriteGdtr.S11
-rw-r--r--MdePkg/Library/BaseLib/Ia32/WriteGdtr.asm9
-rw-r--r--MdePkg/Library/BaseLib/Ia32/WriteIdtr.S11
-rw-r--r--MdePkg/Library/BaseLib/Ia32/WriteIdtr.asm9
-rw-r--r--MdePkg/Library/BaseLib/Ia32/WriteLdtr.S11
-rw-r--r--MdePkg/Library/BaseLib/Ia32/WriteMm0.S14
-rw-r--r--MdePkg/Library/BaseLib/Ia32/WriteMm0.asm12
-rw-r--r--MdePkg/Library/BaseLib/Ia32/WriteMm1.S14
-rw-r--r--MdePkg/Library/BaseLib/Ia32/WriteMm1.asm12
-rw-r--r--MdePkg/Library/BaseLib/Ia32/WriteMm2.S14
-rw-r--r--MdePkg/Library/BaseLib/Ia32/WriteMm2.asm12
-rw-r--r--MdePkg/Library/BaseLib/Ia32/WriteMm3.S14
-rw-r--r--MdePkg/Library/BaseLib/Ia32/WriteMm3.asm12
-rw-r--r--MdePkg/Library/BaseLib/Ia32/WriteMm4.S14
-rw-r--r--MdePkg/Library/BaseLib/Ia32/WriteMm4.asm12
-rw-r--r--MdePkg/Library/BaseLib/Ia32/WriteMm5.S14
-rw-r--r--MdePkg/Library/BaseLib/Ia32/WriteMm5.asm12
-rw-r--r--MdePkg/Library/BaseLib/Ia32/WriteMm6.S14
-rw-r--r--MdePkg/Library/BaseLib/Ia32/WriteMm6.asm12
-rw-r--r--MdePkg/Library/BaseLib/Ia32/WriteMm7.S14
-rw-r--r--MdePkg/Library/BaseLib/Ia32/WriteMm7.asm12
-rw-r--r--MdePkg/Library/BaseLib/Ia32/WriteMsr32.S45
-rw-r--r--MdePkg/Library/BaseLib/Ia32/WriteMsr32.asm44
-rw-r--r--MdePkg/Library/BaseLib/Ia32/WriteMsr64.S15
-rw-r--r--MdePkg/Library/BaseLib/Ia32/WriteMsr64.asm8
-rw-r--r--MdePkg/Library/BaseLib/SetJump.c1
-rw-r--r--MdePkg/Library/BaseLib/X64/DisablePaging64.asm11
-rw-r--r--MdePkg/Library/BaseLib/X64/FxRestore.asm7
-rw-r--r--MdePkg/Library/BaseLib/X64/FxSave.asm7
-rw-r--r--MdePkg/Library/BaseLib/X64/LongJump.asm8
-rw-r--r--MdePkg/Library/BaseLib/X64/ReadCs.asm2
-rw-r--r--MdePkg/Library/BaseLib/X64/ReadDs.asm3
-rw-r--r--MdePkg/Library/BaseLib/X64/ReadEs.asm2
-rw-r--r--MdePkg/Library/BaseLib/X64/ReadFs.asm2
-rw-r--r--MdePkg/Library/BaseLib/X64/ReadGdtr.asm7
-rw-r--r--MdePkg/Library/BaseLib/X64/ReadGs.asm2
-rw-r--r--MdePkg/Library/BaseLib/X64/ReadIdtr.asm7
-rw-r--r--MdePkg/Library/BaseLib/X64/ReadMm0.asm2
-rw-r--r--MdePkg/Library/BaseLib/X64/ReadMm1.asm2
-rw-r--r--MdePkg/Library/BaseLib/X64/ReadMm2.asm2
-rw-r--r--MdePkg/Library/BaseLib/X64/ReadMm3.asm2
-rw-r--r--MdePkg/Library/BaseLib/X64/ReadMm4.asm2
-rw-r--r--MdePkg/Library/BaseLib/X64/ReadMm5.asm2
-rw-r--r--MdePkg/Library/BaseLib/X64/ReadMm6.asm2
-rw-r--r--MdePkg/Library/BaseLib/X64/ReadMm7.asm2
-rw-r--r--MdePkg/Library/BaseLib/X64/ReadMsr32.asm38
-rw-r--r--MdePkg/Library/BaseLib/X64/ReadMsr64.asm6
-rw-r--r--MdePkg/Library/BaseLib/X64/ReadPmc.asm7
-rw-r--r--MdePkg/Library/BaseLib/X64/ReadSs.asm2
-rw-r--r--MdePkg/Library/BaseLib/X64/ReadTsc.asm4
-rw-r--r--MdePkg/Library/BaseLib/X64/SetJump.asm7
-rw-r--r--MdePkg/Library/BaseLib/X64/Thunk16.asm21
-rw-r--r--MdePkg/Library/BaseLib/X64/WriteCr0.asm3
-rw-r--r--MdePkg/Library/BaseLib/X64/WriteCr2.asm3
-rw-r--r--MdePkg/Library/BaseLib/X64/WriteCr3.asm3
-rw-r--r--MdePkg/Library/BaseLib/X64/WriteCr4.asm3
-rw-r--r--MdePkg/Library/BaseLib/X64/WriteDr0.asm3
-rw-r--r--MdePkg/Library/BaseLib/X64/WriteDr1.asm3
-rw-r--r--MdePkg/Library/BaseLib/X64/WriteDr2.asm3
-rw-r--r--MdePkg/Library/BaseLib/X64/WriteDr3.asm3
-rw-r--r--MdePkg/Library/BaseLib/X64/WriteDr4.asm3
-rw-r--r--MdePkg/Library/BaseLib/X64/WriteDr5.asm5
-rw-r--r--MdePkg/Library/BaseLib/X64/WriteDr6.asm3
-rw-r--r--MdePkg/Library/BaseLib/X64/WriteDr7.asm3
-rw-r--r--MdePkg/Library/BaseLib/X64/WriteGdtr.asm7
-rw-r--r--MdePkg/Library/BaseLib/X64/WriteIdtr.asm7
-rw-r--r--MdePkg/Library/BaseLib/X64/WriteMm0.asm4
-rw-r--r--MdePkg/Library/BaseLib/X64/WriteMm1.asm4
-rw-r--r--MdePkg/Library/BaseLib/X64/WriteMm2.asm4
-rw-r--r--MdePkg/Library/BaseLib/X64/WriteMm3.asm4
-rw-r--r--MdePkg/Library/BaseLib/X64/WriteMm4.asm4
-rw-r--r--MdePkg/Library/BaseLib/X64/WriteMm5.asm4
-rw-r--r--MdePkg/Library/BaseLib/X64/WriteMm6.asm4
-rw-r--r--MdePkg/Library/BaseLib/X64/WriteMm7.asm4
-rw-r--r--MdePkg/Library/BaseLib/X64/WriteMsr32.asm41
-rw-r--r--MdePkg/Library/BaseLib/X64/WriteMsr64.asm4
-rw-r--r--MdePkg/Library/BaseLib/x86DisablePaging32.c65
-rw-r--r--MdePkg/Library/BaseLib/x86DisablePaging64.c62
-rw-r--r--MdePkg/Library/BaseLib/x86EnablePaging32.c68
-rw-r--r--MdePkg/Library/BaseLib/x86EnablePaging64.c64
-rw-r--r--MdePkg/Library/BaseLib/x86FxRestore.c48
-rw-r--r--MdePkg/Library/BaseLib/x86FxSave.c47
-rw-r--r--MdePkg/Library/BaseLib/x86GetInterruptState.c39
-rw-r--r--MdePkg/Library/BaseLib/x86MemoryFence.c31
-rw-r--r--MdePkg/Library/BaseLib/x86Msr.c (renamed from MdePkg/Library/BaseLib/x86LowLevel.c)441
-rw-r--r--MdePkg/Library/BaseLib/x86ReadGdtr.c38
-rw-r--r--MdePkg/Library/BaseLib/x86ReadIdtr.c38
-rw-r--r--MdePkg/Library/BaseLib/x86Thunk.c1
-rw-r--r--MdePkg/Library/BaseLib/x86WriteGdtr.c38
-rw-r--r--MdePkg/Library/BaseLib/x86WriteIdtr.c38
252 files changed, 1840 insertions, 2009 deletions
diff --git a/MdePkg/Library/BaseLib/BaseLib.msa b/MdePkg/Library/BaseLib/BaseLib.msa
index cb5359a..3f0224b 100644
--- a/MdePkg/Library/BaseLib/BaseLib.msa
+++ b/MdePkg/Library/BaseLib/BaseLib.msa
@@ -83,8 +83,20 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
<Filename>SwapBytes32.c</Filename>
<Filename>SwapBytes64.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">x86WriteGdtr.c</Filename>
+ <Filename SupArchList="IA32">x86WriteIdtr.c</Filename>
<Filename SupArchList="IA32">Unaligned.c</Filename>
<Filename SupArchList="IA32">Ia32/Non-existing.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/ReadEflags.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/ReadCr0.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/ReadEflags.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/ReadCr0.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/CpuFlushTlb.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">x86WriteGdtr.c</Filename>
+ <Filename SupArchList="X64">x86WriteIdtr.c</Filename>
<Filename SupArchList="X64">Unaligned.c</Filename>
<Filename SupArchList="X64">Math64.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/CpuIdEx.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/WriteMsr32.asm</Filename>
<Filename SupArchList="X64">X64/WriteMsr64.asm</Filename>
<Filename SupArchList="X64">X64/ReadCr0.asm</Filename>
<Filename SupArchList="X64">X64/ReadCr2.asm</Filename>
diff --git a/MdePkg/Library/BaseLib/Ia32/ARShiftU64.S b/MdePkg/Library/BaseLib/Ia32/ARShiftU64.S
index 426ce5b..a41cfdb 100644
--- a/MdePkg/Library/BaseLib/Ia32/ARShiftU64.S
+++ b/MdePkg/Library/BaseLib/Ia32/ARShiftU64.S
@@ -19,21 +19,23 @@
#
#------------------------------------------------------------------------------
-
-
-
-
.global _InternalMathARShiftU64
-_InternalMathARShiftU64:
- movb 12(%esp),%cl
- movl 8(%esp),%eax
+
+#------------------------------------------------------------------------------
+# UINT64
+# EFIAPI
+# InternalMathARShiftU64 (
+# IN UINT64 Operand,
+# IN UINTN Count
+# );
+#------------------------------------------------------------------------------
+_InternalMathARShiftU64:
+ movb 12(%esp), %cl
+ movl 8(%esp), %eax
cltd
- testb $32,%cl
+ testb $32, %cl
cmovz %eax, %edx
cmovz 4(%esp), %eax
- shrdl %cl,%edx,%eax
- sar %cl,%edx
+ shrdl %cl, %edx, %eax
+ sar %cl, %edx
ret
-
-
-
diff --git a/MdePkg/Library/BaseLib/Ia32/ARShiftU64.asm b/MdePkg/Library/BaseLib/Ia32/ARShiftU64.asm
index 6b9cfa1..17f07bb 100644
--- a/MdePkg/Library/BaseLib/Ia32/ARShiftU64.asm
+++ b/MdePkg/Library/BaseLib/Ia32/ARShiftU64.asm
@@ -23,6 +23,14 @@
.model flat,C
.code
+;------------------------------------------------------------------------------
+; UINT64
+; EFIAPI
+; InternalMathARShiftU64 (
+; IN UINT64 Operand,
+; IN UINTN Count
+; );
+;------------------------------------------------------------------------------
InternalMathARShiftU64 PROC
mov cl, [esp + 12]
mov eax, [esp + 8]
@@ -35,4 +43,4 @@ InternalMathARShiftU64 PROC
ret
InternalMathARShiftU64 ENDP
- END \ No newline at end of file
+ END
diff --git a/MdePkg/Library/BaseLib/Ia32/CpuBreakpoint.S b/MdePkg/Library/BaseLib/Ia32/CpuBreakpoint.S
index 859369e..f88dc68 100644
--- a/MdePkg/Library/BaseLib/Ia32/CpuBreakpoint.S
+++ b/MdePkg/Library/BaseLib/Ia32/CpuBreakpoint.S
@@ -20,10 +20,7 @@
#
#------------------------------------------------------------------------------
-
-
-
-
+.global _CpuBreakpoint
#------------------------------------------------------------------------------
# VOID
@@ -32,10 +29,6 @@
# VOID
# );
#------------------------------------------------------------------------------
-.global _CpuBreakpoint
-_CpuBreakpoint:
+_CpuBreakpoint:
int $3
ret
-
-
-
diff --git a/MdePkg/Library/BaseLib/Ia32/CpuFlushTlb.S b/MdePkg/Library/BaseLib/Ia32/CpuFlushTlb.S
index 1d85fa7..c9d6194 100644
--- a/MdePkg/Library/BaseLib/Ia32/CpuFlushTlb.S
+++ b/MdePkg/Library/BaseLib/Ia32/CpuFlushTlb.S
@@ -20,9 +20,7 @@
#
#------------------------------------------------------------------------------
-
-
-
+.global _CpuFlushTlb
#------------------------------------------------------------------------------
# VOID
@@ -31,11 +29,7 @@
# VOID
# );
#------------------------------------------------------------------------------
-.global _CpuFlushTlb
-_CpuFlushTlb:
+_CpuFlushTlb:
movl %cr3, %eax
movl %eax, %cr3
ret
-
-
-
diff --git a/MdePkg/Library/BaseLib/Ia32/CpuFlushTlb.asm b/MdePkg/Library/BaseLib/Ia32/CpuFlushTlb.asm
index de87ad7..3674124 100644
--- a/MdePkg/Library/BaseLib/Ia32/CpuFlushTlb.asm
+++ b/MdePkg/Library/BaseLib/Ia32/CpuFlushTlb.asm
@@ -21,7 +21,7 @@
;------------------------------------------------------------------------------
.386p
- .model flat
+ .model flat,C
.code
;------------------------------------------------------------------------------
@@ -31,10 +31,10 @@
; VOID
; );
;------------------------------------------------------------------------------
-_CpuFlushTlb PROC
+CpuFlushTlb PROC
mov eax, cr3
mov cr3, eax
ret
-_CpuFlushTlb ENDP
+CpuFlushTlb ENDP
END
diff --git a/MdePkg/Library/BaseLib/Ia32/CpuId.S b/MdePkg/Library/BaseLib/Ia32/CpuId.S
index c394de9..592ade6 100644
--- a/MdePkg/Library/BaseLib/Ia32/CpuId.S
+++ b/MdePkg/Library/BaseLib/Ia32/CpuId.S
@@ -21,6 +21,7 @@
#
#------------------------------------------------------------------------------
+.globl _AsmCpuid
#------------------------------------------------------------------------------
# VOID
@@ -33,33 +34,30 @@
# OUT UINT32 *RegisterOutEdx OPTIONAL
# )
#------------------------------------------------------------------------------
-.globl _AsmCpuid
_AsmCpuid:
- pushl %ebx
- pushl %ebp
+ push %ebx
+ push %ebp
movl %esp, %ebp
movl 12(%ebp), %eax
cpuid
- pushl %ecx
+ push %ecx
movl 16(%ebp), %ecx
jecxz L1
movl %eax, (%ecx)
-L1:
+L1:
movl 20(%ebp), %ecx
jecxz L2
movl %ebx, (%ecx)
-L2:
+L2:
movl 24(%ebp), %ecx
jecxz L3
popl (%ecx)
-L3:
+L3:
movl 28(%ebp), %ecx
jecxz L4
movl %edx, (%ecx)
-L4:
+L4:
movl 12(%ebp), %eax
leave
- popl %ebx
+ pop %ebx
ret
-
-
diff --git a/MdePkg/Library/BaseLib/Ia32/CpuId.asm b/MdePkg/Library/BaseLib/Ia32/CpuId.asm
index 2c94e3a..5c0eb1f 100644
--- a/MdePkg/Library/BaseLib/Ia32/CpuId.asm
+++ b/MdePkg/Library/BaseLib/Ia32/CpuId.asm
@@ -34,7 +34,7 @@
; OUT UINT32 *RegisterOutEbx OPTIONAL,
; OUT UINT32 *RegisterOutEcx OPTIONAL,
; OUT UINT32 *RegisterOutEdx OPTIONAL
-; )
+; );
;------------------------------------------------------------------------------
AsmCpuid PROC USES ebx
push ebp
diff --git a/MdePkg/Library/BaseLib/Ia32/CpuIdEx.S b/MdePkg/Library/BaseLib/Ia32/CpuIdEx.S
index e5255fb..ab66fe7 100644
--- a/MdePkg/Library/BaseLib/Ia32/CpuIdEx.S
+++ b/MdePkg/Library/BaseLib/Ia32/CpuIdEx.S
@@ -21,8 +21,8 @@
#
#------------------------------------------------------------------------------
- .686:
- .code:
+ .686:
+ .code:
#------------------------------------------------------------------------------
# UINT32
@@ -39,28 +39,28 @@
.globl _AsmCpuidEx
_AsmCpuidEx:
push %ebx
- pushl %ebp
+ push %ebp
movl %esp, %ebp
movl 12(%ebp), %eax
movl 16(%ebp), %ecx
cpuid
- pushl %ecx
+ push %ecx
movl 20(%ebp), %ecx
jecxz L1
movl %eax, (%ecx)
-L1:
+L1:
movl 24(%ebp), %ecx
jecxz L2
movl %ebx, (%ecx)
-L2:
+L2:
movl 28(%ebp), %ecx
jecxz L3
popl (%ecx)
-L3:
+L3:
movl 32(%ebp), %edx
jecxz L4
movl %edx, (%ecx)
-L4:
+L4:
movl 12(%ebp), %eax
leave
pop %ebx
diff --git a/MdePkg/Library/BaseLib/Ia32/CpuPause.S b/MdePkg/Library/BaseLib/Ia32/CpuPause.S
index ace2c67..7df7432 100644
--- a/MdePkg/Library/BaseLib/Ia32/CpuPause.S
+++ b/MdePkg/Library/BaseLib/Ia32/CpuPause.S
@@ -20,10 +20,7 @@
#
#------------------------------------------------------------------------------
-
-
-
-
+.global _CpuPause
#------------------------------------------------------------------------------
# VOID
@@ -32,10 +29,6 @@
# VOID
# );
#------------------------------------------------------------------------------
-.global _CpuPause
-_CpuPause:
+_CpuPause:
pause
ret
-
-
-
diff --git a/MdePkg/Library/BaseLib/Ia32/CpuPause.asm b/MdePkg/Library/BaseLib/Ia32/CpuPause.asm
index 79a4f2f..4c7135f 100644
--- a/MdePkg/Library/BaseLib/Ia32/CpuPause.asm
+++ b/MdePkg/Library/BaseLib/Ia32/CpuPause.asm
@@ -21,7 +21,7 @@
;------------------------------------------------------------------------------
.686
- .model flat
+ .model flat,C
.xmm
.code
@@ -32,9 +32,9 @@
; VOID
; );
;------------------------------------------------------------------------------
-_CpuPause PROC
+CpuPause PROC
pause
ret
-_CpuPause ENDP
+CpuPause ENDP
END
diff --git a/MdePkg/Library/BaseLib/Ia32/CpuSleep.S b/MdePkg/Library/BaseLib/Ia32/CpuSleep.S
index 9b77131..93106df 100644
--- a/MdePkg/Library/BaseLib/Ia32/CpuSleep.S
+++ b/MdePkg/Library/BaseLib/Ia32/CpuSleep.S
@@ -20,9 +20,7 @@
#
#------------------------------------------------------------------------------
-
-
-
+.global _CpuSleep
#------------------------------------------------------------------------------
# VOID
@@ -31,10 +29,6 @@
# VOID
# );
#------------------------------------------------------------------------------
-.global _CpuSleep
-_CpuSleep:
+_CpuSleep:
hlt
ret
-
-
-
diff --git a/MdePkg/Library/BaseLib/Ia32/CpuSleep.asm b/MdePkg/Library/BaseLib/Ia32/CpuSleep.asm
index 66fb90e..8a779f7 100644
--- a/MdePkg/Library/BaseLib/Ia32/CpuSleep.asm
+++ b/MdePkg/Library/BaseLib/Ia32/CpuSleep.asm
@@ -21,7 +21,7 @@
;------------------------------------------------------------------------------
.386
- .model flat
+ .model flat,C
.code
;------------------------------------------------------------------------------
@@ -31,9 +31,9 @@
; VOID
; );
;------------------------------------------------------------------------------
-_CpuSleep PROC
+CpuSleep PROC
hlt
ret
-_CpuSleep ENDP
+CpuSleep ENDP
END
diff --git a/MdePkg/Library/BaseLib/Ia32/DisableInterrupts.S b/MdePkg/Library/BaseLib/Ia32/DisableInterrupts.S
index cc9c95c..a222d7a 100644
--- a/MdePkg/Library/BaseLib/Ia32/DisableInterrupts.S
+++ b/MdePkg/Library/BaseLib/Ia32/DisableInterrupts.S
@@ -21,9 +21,7 @@
#
#------------------------------------------------------------------------------
-
-
-
+.global _DisableInterrupts
#------------------------------------------------------------------------------
# VOID
@@ -32,10 +30,6 @@
# VOID
# );
#------------------------------------------------------------------------------
-.global _DisableInterrupts
-_DisableInterrupts:
+_DisableInterrupts:
cli
ret
-
-
-
diff --git a/MdePkg/Library/BaseLib/Ia32/DisableInterrupts.asm b/MdePkg/Library/BaseLib/Ia32/DisableInterrupts.asm
index 74bdd0b..35209ff 100644
--- a/MdePkg/Library/BaseLib/Ia32/DisableInterrupts.asm
+++ b/MdePkg/Library/BaseLib/Ia32/DisableInterrupts.asm
@@ -22,7 +22,7 @@
;------------------------------------------------------------------------------
.386p
- .model flat
+ .model flat,C
.code
;------------------------------------------------------------------------------
@@ -32,9 +32,9 @@
; VOID
; );
;------------------------------------------------------------------------------
-_DisableInterrupts PROC
+DisableInterrupts PROC
cli
ret
-_DisableInterrupts ENDP
+DisableInterrupts ENDP
END
diff --git a/MdePkg/Library/BaseLib/Ia32/DisablePaging32.S b/MdePkg/Library/BaseLib/Ia32/DisablePaging32.S
index b4e488f..5ade180 100644
--- a/MdePkg/Library/BaseLib/Ia32/DisablePaging32.S
+++ b/MdePkg/Library/BaseLib/Ia32/DisablePaging32.S
@@ -21,9 +21,7 @@
#
#------------------------------------------------------------------------------
-
-
-
+.global _InternalX86DisablePaging32
#------------------------------------------------------------------------------
# VOID
@@ -35,24 +33,20 @@
# IN VOID *NewStack
# );
#------------------------------------------------------------------------------
-.global _InternalX86DisablePaging32
-_InternalX86DisablePaging32:
- movl 4(%esp),%ebx
- movl 8(%esp),%ecx
- movl 12(%esp),%edx
+_InternalX86DisablePaging32:
+ movl 4(%esp), %ebx
+ movl 8(%esp), %ecx
+ movl 12(%esp), %edx
pushfl
- popl %edi
+ pop %edi
cli
movl %cr0, %eax
- btrl $31,%eax
- movl 16(%esp),%esp
+ btrl $31, %eax
+ movl 16(%esp), %esp
movl %eax, %cr0
- pushl %edi
+ push %edi
popfl
- pushl %edx
- pushl %ecx
+ push %edx
+ push %ecx
call *%ebx
jmp .
-
-
-
diff --git a/MdePkg/Library/BaseLib/Ia32/DisablePaging32.asm b/MdePkg/Library/BaseLib/Ia32/DisablePaging32.asm
index 04ae8cf..d294977 100644
--- a/MdePkg/Library/BaseLib/Ia32/DisablePaging32.asm
+++ b/MdePkg/Library/BaseLib/Ia32/DisablePaging32.asm
@@ -40,18 +40,18 @@ InternalX86DisablePaging32 PROC
mov ecx, [esp + 8]
mov edx, [esp + 12]
pushfd
- pop edi
+ pop edi ; save EFLAGS to edi
cli
mov eax, cr0
btr eax, 31
mov esp, [esp + 16]
mov cr0, eax
push edi
- popfd
+ popfd ; restore EFLAGS from edi
push edx
push ecx
call ebx
- jmp $
+ jmp $ ; EntryPoint() should not return
InternalX86DisablePaging32 ENDP
END
diff --git a/MdePkg/Library/BaseLib/Ia32/DivU64x32.S b/MdePkg/Library/BaseLib/Ia32/DivU64x32.S
index 89d7546..0c7829f 100644
--- a/MdePkg/Library/BaseLib/Ia32/DivU64x32.S
+++ b/MdePkg/Library/BaseLib/Ia32/DivU64x32.S
@@ -19,17 +19,23 @@
#
#------------------------------------------------------------------------------
- .386:
- .code:
-
.global _InternalMathDivU64x32
+
+#------------------------------------------------------------------------------
+# UINT64
+# EFIAPI
+# InternalMathDivU64x32 (
+# IN UINT64 Dividend,
+# IN UINT32 Divisor
+# );
+#------------------------------------------------------------------------------
_InternalMathDivU64x32:
- movl 8(%esp),%eax
- movl 12(%esp),%ecx
- xorl %edx,%edx
+ movl 8(%esp), %eax
+ movl 12(%esp), %ecx
+ xorl %edx, %edx
divl %ecx
- pushl %eax
- movl 8(%esp),%eax
+ push %eax
+ movl 8(%esp), %eax
divl %ecx
- popl %edx
+ pop %edx
ret
diff --git a/MdePkg/Library/BaseLib/Ia32/DivU64x32.asm b/MdePkg/Library/BaseLib/Ia32/DivU64x32.asm
index 1ad5474..25ca074 100644
--- a/MdePkg/Library/BaseLib/Ia32/DivU64x32.asm
+++ b/MdePkg/Library/BaseLib/Ia32/DivU64x32.asm
@@ -23,15 +23,23 @@
.model flat,C
.code
+;------------------------------------------------------------------------------
+; UINT64
+; EFIAPI
+; InternalMathDivU64x32 (
+; IN UINT64 Dividend,
+; IN UINT32 Divisor
+; );
+;------------------------------------------------------------------------------
InternalMathDivU64x32 PROC
mov eax, [esp + 8]
mov ecx, [esp + 12]
xor edx, edx
div ecx
- push eax
+ push eax ; save quotient on stack
mov eax, [esp + 8]
div ecx
- pop edx
+ pop edx ; restore high-order dword of the quotient
ret
InternalMathDivU64x32 ENDP
diff --git a/MdePkg/Library/BaseLib/Ia32/DivU64x32Remainder.S b/MdePkg/Library/BaseLib/Ia32/DivU64x32Remainder.S
index 1f34f18..41537b0 100644
--- a/MdePkg/Library/BaseLib/Ia32/DivU64x32Remainder.S
+++ b/MdePkg/Library/BaseLib/Ia32/DivU64x32Remainder.S
@@ -19,25 +19,28 @@
#
#------------------------------------------------------------------------------
-
-
-
-
.global _InternalMathDivRemU64x32
-_InternalMathDivRemU64x32:
- movl 12(%esp),%ecx
- movl 8(%esp),%eax
- xorl %edx,%edx
+
+#------------------------------------------------------------------------------
+# UINT64
+# EFIAPI
+# InternalMathDivRemU64x32 (
+# IN UINT64 Dividend,
+# IN UINT32 Divisor,
+# OUT UINT32 *Remainder
+# );
+#------------------------------------------------------------------------------
+_InternalMathDivRemU64x32:
+ movl 12(%esp), %ecx
+ movl 8(%esp), %eax
+ xorl %edx, %edx
divl %ecx
- pushl %eax
- movl 8(%esp),%eax
+ push %eax
+ movl 8(%esp), %eax
divl %ecx
- movl 20(%esp),%ecx
+ movl 20(%esp), %ecx
jecxz L1
- movl %edx,(%ecx)
-L1:
- popl %edx
+ movl %edx, (%ecx)
+L1:
+ pop %edx
ret
-
-
-
diff --git a/MdePkg/Library/BaseLib/Ia32/DivU64x32Remainder.asm b/MdePkg/Library/BaseLib/Ia32/DivU64x32Remainder.asm
index f1c6c1f..a836e22 100644
--- a/MdePkg/Library/BaseLib/Ia32/DivU64x32Remainder.asm
+++ b/MdePkg/Library/BaseLib/Ia32/DivU64x32Remainder.asm
@@ -23,6 +23,15 @@
.model flat,C
.code
+;------------------------------------------------------------------------------
+; UINT64
+; EFIAPI
+; InternalMathDivRemU64x32 (
+; IN UINT64 Dividend,
+; IN UINT32 Divisor,
+; OUT UINT32 *Remainder
+; );
+;------------------------------------------------------------------------------
InternalMathDivRemU64x32 PROC
mov ecx, [esp + 12]
mov eax, [esp + 8]
@@ -32,7 +41,7 @@ InternalMathDivRemU64x32 PROC
mov eax, [esp + 8]
div ecx
mov ecx, [esp + 20]
- jecxz @F
+ jecxz @F ; abandon remainder if Remainder == NULL
mov [ecx], edx
@@:
pop edx
diff --git a/MdePkg/Library/BaseLib/Ia32/DivU64x64Remainder.S b/MdePkg/Library/BaseLib/Ia32/DivU64x64Remainder.S
index df1e6ad..90ccc56 100644
--- a/MdePkg/Library/BaseLib/Ia32/DivU64x64Remainder.S
+++ b/MdePkg/Library/BaseLib/Ia32/DivU64x64Remainder.S
@@ -20,69 +20,70 @@
#
#------------------------------------------------------------------------------
+.global _InternalMathDivRemU64x32, _InternalMathDivRemU64x64
-
-
-
-.extern _InternalMathDivRemU64x32
-
-.global _InternalMathDivRemU64x64
-_InternalMathDivRemU64x64:
- movl 16(%esp),%ecx
- testl %ecx,%ecx
- jnz _DivRemU64x64
- movl 20(%esp),%ecx
+#------------------------------------------------------------------------------
+# UINT64
+# EFIAPI
+# InternalMathDivRemU64x64 (
+# IN UINT64 Dividend,
+# IN UINT64 Divisor,
+# OUT UINT64 *Remainder OPTIONAL
+# );
+#------------------------------------------------------------------------------
+_InternalMathDivRemU64x64:
+ movl 16(%esp), %ecx
+ testl %ecx, %ecx
+ jnz Hard
+ movl 20(%esp), %ecx
jecxz L1
- and $0,4(%ecx)
- movl %ecx,16(%esp)
-L1:
+ and $0, 4(%ecx)
+ movl %ecx, 16(%esp)
+L1:
jmp _InternalMathDivRemU64x32
-
-
-.global _DivRemU64x64
-_DivRemU64x64:
- push %ebx
- push %esi
- push %edi
+Hard:
+ push %ebx
+ push %esi
+ push %edi
mov 20(%esp), %edx
mov 16(%esp), %eax
- movl %edx,%edi
- movl %eax,%esi
+ movl %edx, %edi
+ movl %eax, %esi
mov 24(%esp), %ebx
-L2:
+L2:
shrl %edx
- rcrl $1,%eax
- shrdl $1,%ecx,%ebx
+ rcrl $1, %eax
+ shrdl $1, %ecx, %ebx
shrl %ecx
jnz L2
divl %ebx
- movl %eax,%ebx
- movl 28(%esp),%ecx
+ movl %eax, %ebx
+ movl 28(%esp), %ecx
mull 24(%esp)
- imull %ebx,%ecx
- addl %ecx,%edx
+ imull %ebx, %ecx
+ addl %ecx, %edx
mov 32(%esp), %ecx
jc TooLarge
- cmpl %edx,%edi
+ cmpl %edx, %edi
ja Correct
jb TooLarge
- cmpl %eax,%esi
+ cmpl %eax, %esi
jae Correct
-TooLarge:
+TooLarge:
decl %ebx
jecxz Return
sub 24(%esp), %eax
sbb 28(%esp), %edx
-Correct:
+Correct:
jecxz Return
- subl %eax,%esi
- sbbl %edx,%edi
- movl %esi,(%ecx)
- movl %edi,4(%ecx)
-Return:
- movl %ebx,%eax
- xorl %edx,%edx
- push %edi
- push %esi
- push %ebx
+ subl %eax, %esi
+ sbbl %edx, %edi
+ movl %esi, (%ecx)
+ movl %edi, 4(%ecx)
+Return:
+ movl %ebx, %eax
+ xorl %edx, %edx
+ pop %edi
+ pop %esi
+ pop %ebx
ret
diff --git a/MdePkg/Library/BaseLib/Ia32/DivU64x64Remainder.asm b/MdePkg/Library/BaseLib/Ia32/DivU64x64Remainder.asm
index 261211b..61a53d1 100644
--- a/MdePkg/Library/BaseLib/Ia32/DivU64x64Remainder.asm
+++ b/MdePkg/Library/BaseLib/Ia32/DivU64x64Remainder.asm
@@ -26,10 +26,19 @@
EXTERN InternalMathDivRemU64x32:PROC
+;------------------------------------------------------------------------------
+; UINT64
+; EFIAPI
+; InternalMathDivRemU64x64 (
+; IN UINT64 Dividend,
+; IN UINT64 Divisor,
+; OUT UINT64 *Remainder OPTIONAL
+; );
+;------------------------------------------------------------------------------
InternalMathDivRemU64x64 PROC
mov ecx, [esp + 16]
test ecx, ecx
- jnz _@DivRemU64x64
+ jnz _@DivRemU64x64 ; call _@DivRemU64x64 if Divisor > 2^32
mov ecx, [esp + 20]
jecxz @F
and dword ptr [ecx + 4], 0
@@ -40,10 +49,10 @@ InternalMathDivRemU64x64 ENDP
_@DivRemU64x64 PROC USES ebx esi edi
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 esi, eax
- mov ebx, dword ptr [esp + 24]
+ mov esi, eax ; edi:esi <- dividend
+ mov ebx, dword ptr [esp + 24] ; ecx:ebx <- divisor
@@:
shr edx, 1
rcr eax, 1
@@ -51,31 +60,31 @@ _@DivRemU64x64 PROC USES ebx esi edi
shr ecx, 1
jnz @B
div ebx
- mov ebx, eax
+ mov ebx, eax ; ebx <- quotient
mov ecx, [esp + 28]
mul dword ptr [esp + 24]
imul ecx, ebx
add edx, ecx
mov ecx, dword ptr [esp + 32]
- jc @TooLarge
- cmp edi, edx
+ jc @TooLarge ; product > 2^64
+ cmp edi, edx ; compare high 32 bits
ja @Correct
- jb @TooLarge
+ jb @TooLarge ; product > dividend
cmp esi, eax
- jae @Correct
+ jae @Correct ; product <= dividend
@TooLarge:
- dec ebx
- jecxz @Return
+ dec ebx ; adjust quotient by -1
+ jecxz @Return ; return if Remainder == NULL
sub eax, dword ptr [esp + 24]
sbb edx, dword ptr [esp + 28]
@Correct:
jecxz @Return
sub esi, eax
- sbb edi, edx
+ sbb edi, edx ; edi:esi <- remainder
mov [ecx], esi
mov [ecx + 4], edi
@Return:
- mov eax, ebx
+ mov eax, ebx ; eax <- quotient
xor edx, edx
ret
_@DivRemU64x64 ENDP
diff --git a/MdePkg/Library/BaseLib/Ia32/EnableDisableInterrupts.S b/MdePkg/Library/BaseLib/Ia32/EnableDisableInterrupts.S
index 80362a9..c082561 100644
--- a/MdePkg/Library/BaseLib/Ia32/EnableDisableInterrupts.S
+++ b/MdePkg/Library/BaseLib/Ia32/EnableDisableInterrupts.S
@@ -21,9 +21,7 @@
#
#------------------------------------------------------------------------------
-
-
-
+.global _EnableDisableInterrupts
#------------------------------------------------------------------------------
# VOID
@@ -32,11 +30,7 @@
# VOID
# );
#------------------------------------------------------------------------------
-.global _EnableDisableInterrupts
-_EnableDisableInterrupts:
+_EnableDisableInterrupts:
sti
cli
ret
-
-
-
diff --git a/MdePkg/Library/BaseLib/Ia32/EnableInterrupts.S b/MdePkg/Library/BaseLib/Ia32/EnableInterrupts.S
index 74413d8..075b85e 100644
--- a/MdePkg/Library/BaseLib/Ia32/EnableInterrupts.S
+++ b/MdePkg/Library/BaseLib/Ia32/EnableInterrupts.S
@@ -21,9 +21,7 @@
#
#------------------------------------------------------------------------------
-
-
-
+.global _EnableInterrupts
#------------------------------------------------------------------------------
# VOID
@@ -32,10 +30,6 @@
# VOID
# );
#------------------------------------------------------------------------------
-.global _EnableInterrupts
-_EnableInterrupts:
+_EnableInterrupts:
sti
ret
-
-
-
diff --git a/MdePkg/Library/BaseLib/Ia32/EnablePaging32.S b/MdePkg/Library/BaseLib/Ia32/EnablePaging32.S
index 7c97a50..7335e62 100644
--- a/MdePkg/Library/BaseLib/Ia32/EnablePaging32.S
+++ b/MdePkg/Library/BaseLib/Ia32/EnablePaging32.S
@@ -21,9 +21,7 @@
#
#------------------------------------------------------------------------------
-
-
-
+.global _InternalX86EnablePaging32
#------------------------------------------------------------------------------
# VOID
@@ -35,24 +33,20 @@
# IN VOID *NewStack
# );
#------------------------------------------------------------------------------
-.global _InternalX86EnablePaging32
-_InternalX86EnablePaging32:
- movl 4(%esp),%ebx
- movl 8(%esp),%ecx
- movl 12(%esp),%edx
+_InternalX86EnablePaging32:
+ movl 4(%esp), %ebx
+ movl 8(%esp), %ecx
+ movl 12(%esp), %edx
pushfl
- popl %edi
+ pop %edi
cli
movl %cr0, %eax
- btsl $31,%eax
- movl 16(%esp),%esp
+ btsl $31, %eax
+ movl 16(%esp), %esp
movl %eax, %cr0
- pushl %edi
+ push %edi
popfl
- pushl %edx
- pushl %ecx
+ push %edx
+ push %ecx
call *%ebx
jmp .
-
-
-
diff --git a/MdePkg/Library/BaseLib/Ia32/EnablePaging64.S b/MdePkg/Library/BaseLib/Ia32/EnablePaging64.S
index 3758479..61525b8 100644
--- a/MdePkg/Library/BaseLib/Ia32/EnablePaging64.S
+++ b/MdePkg/Library/BaseLib/Ia32/EnablePaging64.S
@@ -21,9 +21,7 @@
#
#------------------------------------------------------------------------------
-
- #.MODEL flat
-
+.global _InternalX86EnablePaging64
#------------------------------------------------------------------------------
# VOID
@@ -36,7 +34,6 @@
# IN UINT64 NewStack
# );
#------------------------------------------------------------------------------
-.global _InternalX86EnablePaging64
_InternalX86EnablePaging64:
cli
movl $LongStart, (%esp)
@@ -52,13 +49,13 @@ _InternalX86EnablePaging64:
movl %eax, %cr0 # enable paging
lret
LongStart: # long mode starts here
- .byte 0x67,0x48
+ .byte 0x67, 0x48
movl (%esp), %ebx # mov rbx, [esp]
- .byte 0x67,0x48
+ .byte 0x67, 0x48
movl 8(%esp), %ecx # mov rcx, [esp + 8]
- .byte 0x67,0x48
+ .byte 0x67, 0x48
movl 0x10(%esp), %edx # mov rdx, [esp + 10h]
- .byte 0x67,0x48
+ .byte 0x67, 0x48
movl 0x18(%esp), %esp # mov rsp, [esp + 18h]
.byte 0x48
addl $0x-20, %esp # add rsp, -20h
diff --git a/MdePkg/Library/BaseLib/Ia32/EnablePaging64.asm b/MdePkg/Library/BaseLib/Ia32/EnablePaging64.asm
index 6c9b0ea..354d1fe 100644
--- a/MdePkg/Library/BaseLib/Ia32/EnablePaging64.asm
+++ b/MdePkg/Library/BaseLib/Ia32/EnablePaging64.asm
@@ -25,9 +25,20 @@
.model flat,C
.code
+;------------------------------------------------------------------------------
+; VOID
+; EFIAPI
+; InternalX86EnablePaging64 (
+; IN UINT16 Cs,
+; IN UINT64 EntryPoint,
+; IN UINT64 Context1, OPTIONAL
+; IN UINT64 Context2, OPTIONAL
+; IN UINT64 NewStack
+; );
+;------------------------------------------------------------------------------
InternalX86EnablePaging64 PROC
cli
- mov [esp], @F ; offset for far retf
+ mov [esp], @F ; offset for far retf, seg is the 1st arg
mov eax, cr4
or al, (1 SHL 5)
mov cr4, eax ; enable PAE
diff --git a/MdePkg/Library/BaseLib/Ia32/FlushCacheLine.S b/MdePkg/Library/BaseLib/Ia32/FlushCacheLine.S
index c14bd11..a1c6275 100644
--- a/MdePkg/Library/BaseLib/Ia32/FlushCacheLine.S
+++ b/MdePkg/Library/BaseLib/Ia32/FlushCacheLine.S
@@ -21,10 +21,7 @@
#
#------------------------------------------------------------------------------
-
-
-
-
+.global _AsmFlushCacheLine
#------------------------------------------------------------------------------
# VOID
@@ -33,11 +30,7 @@
# IN VOID *LinearAddress
# );
#------------------------------------------------------------------------------
-.global _AsmFlushCacheLine
-_AsmFlushCacheLine:
- movl 4(%esp),%eax
+_AsmFlushCacheLine:
+ movl 4(%esp), %eax
clflush (%eax)
ret
-
-
-
diff --git a/MdePkg/Library/BaseLib/Ia32/FlushCacheLine.asm b/MdePkg/Library/BaseLib/Ia32/FlushCacheLine.asm
index c1e6466..f4ad87d 100644
--- a/MdePkg/Library/BaseLib/Ia32/FlushCacheLine.asm
+++ b/MdePkg/Library/BaseLib/Ia32/FlushCacheLine.asm
@@ -22,7 +22,7 @@
;------------------------------------------------------------------------------
.586P
- .model flat
+ .model flat,C
.xmm
.code
@@ -33,10 +33,10 @@
; IN VOID *LinearAddress
; );
;------------------------------------------------------------------------------
-_AsmFlushCacheLine PROC
+AsmFlushCacheLine PROC
mov eax, [esp + 4]
clflush [eax]
ret
-_AsmFlushCacheLine ENDP
+AsmFlushCacheLine ENDP
END
diff --git a/MdePkg/Library/BaseLib/Ia32/FxRestore.S b/MdePkg/Library/BaseLib/Ia32/FxRestore.S
index cc840de..fa19223 100644
--- a/MdePkg/Library/BaseLib/Ia32/FxRestore.S
+++ b/MdePkg/Library/BaseLib/Ia32/FxRestore.S
@@ -21,10 +21,7 @@
#
#------------------------------------------------------------------------------
-
-
-
-
+.global _InternalX86FxRestore
#------------------------------------------------------------------------------
# VOID
@@ -33,11 +30,7 @@
# IN CONST IA32_FX_BUFFER *Buffer
# );
#------------------------------------------------------------------------------
-.global _InternalX86FxRestore
-_InternalX86FxRestore:
- movl 4(%esp),%eax
+_InternalX86FxRestore:
+ movl 4(%esp), %eax
fxrstor (%eax)
ret
-
-
-
diff --git a/MdePkg/Library/BaseLib/Ia32/FxRestore.asm b/MdePkg/Library/BaseLib/Ia32/FxRestore.asm
index e9e37d1..9bcc6ac 100644
--- a/MdePkg/Library/BaseLib/Ia32/FxRestore.asm
+++ b/MdePkg/Library/BaseLib/Ia32/FxRestore.asm
@@ -21,7 +21,7 @@
;
;------------------------------------------------------------------------------
- .586P
+ .586
.model flat,C
.xmm
.code
diff --git a/MdePkg/Library/BaseLib/Ia32/FxSave.S b/MdePkg/Library/BaseLib/Ia32/FxSave.S
index a558816..7bca947 100644
--- a/MdePkg/Library/BaseLib/Ia32/FxSave.S
+++ b/MdePkg/Library/BaseLib/Ia32/FxSave.S
@@ -21,10 +21,7 @@
#
#------------------------------------------------------------------------------
-
-
-
-
+.global _InternalX86FxSave
#------------------------------------------------------------------------------
# VOID
@@ -33,11 +30,7 @@
# OUT IA32_FX_BUFFER *Buffer
# );
#------------------------------------------------------------------------------
-.global _InternalX86FxSave
-_InternalX86FxSave:
- movl 4(%esp),%eax
+_InternalX86FxSave:
+ movl 4(%esp), %eax
fxsave (%eax)
ret
-
-
-
diff --git a/MdePkg/Library/BaseLib/Ia32/FxSave.asm b/MdePkg/Library/BaseLib/Ia32/FxSave.asm
index 22496c5..7d5ea45 100644
--- a/MdePkg/Library/BaseLib/Ia32/FxSave.asm
+++ b/MdePkg/Library/BaseLib/Ia32/FxSave.asm
@@ -21,7 +21,7 @@
;
;------------------------------------------------------------------------------
- .586P
+ .586
.model flat,C
.xmm
.code
diff --git a/MdePkg/Library/BaseLib/Ia32/InterlockedCompareExchange32.S b/MdePkg/Library/BaseLib/Ia32/InterlockedCompareExchange32.S
index b53ca0f..ec0eec1 100644
--- a/MdePkg/Library/BaseLib/Ia32/InterlockedCompareExchange32.S
+++ b/MdePkg/Library/BaseLib/Ia32/InterlockedCompareExchange32.S
@@ -21,9 +21,7 @@
#
#------------------------------------------------------------------------------
-
-
-
+.global _InternalSyncCompareExchange32
#------------------------------------------------------------------------------
# UINT32
@@ -34,13 +32,10 @@
# IN UINT32 ExchangeValue
# );
#------------------------------------------------------------------------------
-.global _InternalSyncCompareExchange32
-_InternalSyncCompareExchange32:
- movl 4(%esp),%ecx
- movl 8(%esp),%eax
- movl 12(%esp),%edx
- lock cmpxchgl %edx,(%ecx)
+_InternalSyncCompareExchange32:
+ movl 4(%esp), %ecx
+ movl 8(%esp), %eax
+ movl 12(%esp), %edx
+ lock
+ cmpxchgl %edx, (%ecx)
ret
-
-
-
diff --git a/MdePkg/Library/BaseLib/Ia32/InterlockedCompareExchange32.asm b/MdePkg/Library/BaseLib/Ia32/InterlockedCompareExchange32.asm
index c8c20fb..47d959f 100644
--- a/MdePkg/Library/BaseLib/Ia32/InterlockedCompareExchange32.asm
+++ b/MdePkg/Library/BaseLib/Ia32/InterlockedCompareExchange32.asm
@@ -28,7 +28,7 @@
;------------------------------------------------------------------------------
; UINT32
; EFIAPI
-; InterlockedCompareExchange32 (
+; InternalSyncCompareExchange32 (
; IN UINT32 *Value,
; IN UINT32 CompareValue,
; IN UINT32 ExchangeValue
diff --git a/MdePkg/Library/BaseLib/Ia32/InterlockedCompareExchange64.S b/MdePkg/Library/BaseLib/Ia32/InterlockedCompareExchange64.S
index 383503f..5c964b9 100644
--- a/MdePkg/Library/BaseLib/Ia32/InterlockedCompareExchange64.S
+++ b/MdePkg/Library/BaseLib/Ia32/InterlockedCompareExchange64.S
@@ -21,9 +21,7 @@
#
#------------------------------------------------------------------------------
-
-
-
+.global _InternalSyncCompareExchange64
#------------------------------------------------------------------------------
# UINT64
@@ -34,20 +32,16 @@
# IN UINT64 ExchangeValue
# );
#------------------------------------------------------------------------------
-.global _InternalSyncCompareExchange64
_InternalSyncCompareExchange64:
push %esi
push %ebx
- movl 12(%esp),%esi
- movl 16(%esp),%eax
- movl 20(%esp),%edx
- movl 24(%esp),%ebx
- movl 28(%esp),%ecx
- lock
+ movl 12(%esp), %esi
+ movl 16(%esp), %eax
+ movl 20(%esp), %edx
+ movl 24(%esp), %ebx
+ movl 28(%esp), %ecx
+ lock
cmpxchg8b (%esi)
pop %ebx
pop %esi
ret
-
-
-
diff --git a/MdePkg/Library/BaseLib/Ia32/InterlockedCompareExchange64.asm b/MdePkg/Library/BaseLib/Ia32/InterlockedCompareExchange64.asm
index cded920..18311e7 100644
--- a/MdePkg/Library/BaseLib/Ia32/InterlockedCompareExchange64.asm
+++ b/MdePkg/Library/BaseLib/Ia32/InterlockedCompareExchange64.asm
@@ -28,7 +28,7 @@
;------------------------------------------------------------------------------
; UINT64
; EFIAPI
-; InterlockedCompareExchange64 (
+; InternalSyncCompareExchange64 (
; IN UINT64 *Value,
; IN UINT64 CompareValue,
; IN UINT64 ExchangeValue
diff --git a/MdePkg/Library/BaseLib/Ia32/InterlockedDecrement.S b/MdePkg/Library/BaseLib/Ia32/InterlockedDecrement.S
index 4256b60..7276503 100644
--- a/MdePkg/Library/BaseLib/Ia32/InterlockedDecrement.S
+++ b/MdePkg/Library/BaseLib/Ia32/InterlockedDecrement.S
@@ -21,9 +21,7 @@
#
#------------------------------------------------------------------------------
-
-
-
+.global _InternalSyncDecrement
#------------------------------------------------------------------------------
# UINT32
@@ -32,13 +30,9 @@
# IN UINT32 *Value
# );
#------------------------------------------------------------------------------
-.global _InternalSyncDecrement
-_InternalSyncDecrement:
- movl 4(%esp),%eax
- lock
- decl (%eax)
- movl (%eax),%eax
+_InternalSyncDecrement:
+ movl 4(%esp), %eax
+ lock
+ decl (%eax)
+ movl (%eax), %eax
ret
-
-
-
diff --git a/MdePkg/Library/BaseLib/Ia32/InterlockedDecrement.asm b/MdePkg/Library/BaseLib/Ia32/InterlockedDecrement.asm
index d849540..082429e 100644
--- a/MdePkg/Library/BaseLib/Ia32/InterlockedDecrement.asm
+++ b/MdePkg/Library/BaseLib/Ia32/InterlockedDecrement.asm
@@ -28,7 +28,7 @@
;------------------------------------------------------------------------------
; UINT32
; EFIAPI
-; InterlockedDecrement (
+; InternalSyncDecrement (
; IN UINT32 *Value
; );
;------------------------------------------------------------------------------
diff --git a/MdePkg/Library/BaseLib/Ia32/InterlockedIncrement.S b/MdePkg/Library/BaseLib/Ia32/InterlockedIncrement.S
index 02cb33b..69f604c 100644
--- a/MdePkg/Library/BaseLib/Ia32/InterlockedIncrement.S
+++ b/MdePkg/Library/BaseLib/Ia32/InterlockedIncrement.S
@@ -21,9 +21,7 @@
#
#------------------------------------------------------------------------------
-
-
-
+.global _InternalSyncIncrement
#------------------------------------------------------------------------------
# UINT32
@@ -32,13 +30,9 @@
# IN UINT32 *Value
# );
#------------------------------------------------------------------------------
-.global _InternalSyncIncrement
-_InternalSyncIncrement:
- movl 4(%esp),%eax
- lock
- incl (%eax)
- movl (%eax),%eax
+_InternalSyncIncrement:
+ movl 4(%esp), %eax
+ lock
+ incl (%eax)
+ movl (%eax), %eax
ret
-
-
-
diff --git a/MdePkg/Library/BaseLib/Ia32/InterlockedIncrement.asm b/MdePkg/Library/BaseLib/Ia32/InterlockedIncrement.asm
index a7bfb6f..ea27e66 100644
--- a/MdePkg/Library/BaseLib/Ia32/InterlockedIncrement.asm
+++ b/MdePkg/Library/BaseLib/Ia32/InterlockedIncrement.asm
@@ -28,7 +28,7 @@
;------------------------------------------------------------------------------
; UINT32
; EFIAPI
-; InterlockedIncrement (
+; InternalSyncIncrement (
; IN UINT32 *Value
; );
;------------------------------------------------------------------------------
diff --git a/MdePkg/Library/BaseLib/Ia32/Invd.S b/MdePkg/Library/BaseLib/Ia32/Invd.S
index 6d6c8d4..f87aa08 100644
--- a/MdePkg/Library/BaseLib/Ia32/Invd.S
+++ b/MdePkg/Library/BaseLib/Ia32/Invd.S
@@ -21,9 +21,7 @@
#
#------------------------------------------------------------------------------
-
-
-
+.global _AsmInvd
#------------------------------------------------------------------------------
# VOID
@@ -32,10 +30,6 @@
# VOID
# );
#------------------------------------------------------------------------------
-.global _AsmInvd
-_AsmInvd:
+_AsmInvd:
invd
ret
-
-
-
diff --git a/MdePkg/Library/BaseLib/Ia32/LRotU64.S b/MdePkg/Library/BaseLib/Ia32/LRotU64.S
index 54cdfad..a9f72d8 100644
--- a/MdePkg/Library/BaseLib/Ia32/LRotU64.S
+++ b/MdePkg/Library/BaseLib/Ia32/LRotU64.S
@@ -19,26 +19,28 @@
#
#------------------------------------------------------------------------------
-
-
-
-
.global _InternalMathLRotU64
+
+#------------------------------------------------------------------------------
+# UINT64
+# EFIAPI
+# InternalMathLRotU64 (
+# IN UINT64 Operand,
+# IN UINTN Count
+# );
+#------------------------------------------------------------------------------
_InternalMathLRotU64:
push %ebx
- movb 16(%esp),%cl
- movl 12(%esp),%edx
- movl 8(%esp),%eax
- shldl %cl,%edx,%ebx
- shldl %cl,%eax,%edx
- rorl %cl,%ebx
- shldl %cl,%ebx,%eax
- testb $32,%cl
+ movb 16(%esp), %cl
+ movl 12(%esp), %edx
+ movl 8(%esp), %eax
+ shldl %cl, %edx, %ebx
+ shldl %cl, %eax, %edx
+ rorl %cl, %ebx
+ shldl %cl, %ebx, %eax
+ testb $32, %cl
cmovnz %eax, %ecx
- cmovnz %edx, %eax
+ cmovnz %edx, %eax
cmovnz %ecx, %edx
pop %ebx
ret
-
-
-
diff --git a/MdePkg/Library/BaseLib/Ia32/LRotU64.asm b/MdePkg/Library/BaseLib/Ia32/LRotU64.asm
index 1d5562a..a6437d8 100644
--- a/MdePkg/Library/BaseLib/Ia32/LRotU64.asm
+++ b/MdePkg/Library/BaseLib/Ia32/LRotU64.asm
@@ -23,6 +23,14 @@
.model flat,C
.code
+;------------------------------------------------------------------------------
+; UINT64
+; EFIAPI
+; InternalMathLRotU64 (
+; IN UINT64 Operand,
+; IN UINTN Count
+; );
+;------------------------------------------------------------------------------
InternalMathLRotU64 PROC USES ebx
mov cl, [esp + 16]
mov edx, [esp + 12]
@@ -31,7 +39,7 @@ InternalMathLRotU64 PROC USES ebx
shld edx, eax, cl
ror ebx, cl
shld eax, ebx, cl
- test cl, 32
+ test cl, 32 ; Count >= 32?
cmovnz ecx, eax
cmovnz eax, edx
cmovnz edx, ecx
diff --git a/MdePkg/Library/BaseLib/Ia32/LShiftU64.S b/MdePkg/Library/BaseLib/Ia32/LShiftU64.S
index 4aa17c6..6912b86 100644
--- a/MdePkg/Library/BaseLib/Ia32/LShiftU64.S
+++ b/MdePkg/Library/BaseLib/Ia32/LShiftU64.S
@@ -19,11 +19,16 @@
#
#------------------------------------------------------------------------------
- .686:
- #.MODEL flat,C
- .code:
-
.global _InternalMathLShiftU64
+
+#------------------------------------------------------------------------------
+# UINT64
+# EFIAPI
+# InternalMathLShiftU64 (
+# IN UINT64 Operand,
+# IN UINTN Count
+# );
+#------------------------------------------------------------------------------
_InternalMathLShiftU64:
movb 12(%esp), %cl
xorl %eax, %eax
@@ -31,6 +36,6 @@ _InternalMathLShiftU64:
testb $32, %cl
cmovz %edx, %eax
cmovz 0x8(%esp), %edx
- shld %cl,%eax,%edx
+ shld %cl, %eax, %edx
shl %cl, %eax
ret
diff --git a/MdePkg/Library/BaseLib/Ia32/LShiftU64.asm b/MdePkg/Library/BaseLib/Ia32/LShiftU64.asm
index 9ce946d..6c3d9a4 100644
--- a/MdePkg/Library/BaseLib/Ia32/LShiftU64.asm
+++ b/MdePkg/Library/BaseLib/Ia32/LShiftU64.asm
@@ -23,11 +23,19 @@
.model flat,C
.code
+;------------------------------------------------------------------------------
+; UINT64
+; EFIAPI
+; InternalMathLShiftU64 (
+; IN UINT64 Operand,
+; IN UINTN Count
+; );
+;------------------------------------------------------------------------------
InternalMathLShiftU64 PROC
mov cl, [esp + 12]
xor eax, eax
mov edx, [esp + 4]
- test cl, 32
+ test cl, 32 ; Count >= 32?
cmovz eax, edx
cmovz edx, [esp + 8]
shld edx, eax, cl
diff --git a/MdePkg/Library/BaseLib/Ia32/LongJump.S b/MdePkg/Library/BaseLib/Ia32/LongJump.S
index 5fa1521..fa17ddd 100644
--- a/MdePkg/Library/BaseLib/Ia32/LongJump.S
+++ b/MdePkg/Library/BaseLib/Ia32/LongJump.S
@@ -19,20 +19,23 @@
#
#------------------------------------------------------------------------------
- .386:
- .code:
+.global _InternalLongJump
-.globl _InternalLongJump
+#------------------------------------------------------------------------------
+# VOID
+# EFIAPI
+# InternalLongJump (
+# IN BASE_LIBRARY_JUMP_BUFFER *JumpBuffer,
+# IN UINTN Value
+# );
+#------------------------------------------------------------------------------
_InternalLongJump:
- popl %eax
- popl %edx
- popl %eax
+ pop %eax
+ pop %edx
+ pop %eax
movl (%edx), %ebx
movl 4(%edx), %esi
movl 8(%edx), %edi
movl 12(%edx), %ebp
movl 16(%edx), %esp
jmp *20(%edx)
-#InternalLongJump ENDP
-
-
diff --git a/MdePkg/Library/BaseLib/Ia32/LongJump.asm b/MdePkg/Library/BaseLib/Ia32/LongJump.asm
index b419215..a634c45 100644
--- a/MdePkg/Library/BaseLib/Ia32/LongJump.asm
+++ b/MdePkg/Library/BaseLib/Ia32/LongJump.asm
@@ -23,10 +23,18 @@
.model flat,C
.code
+;------------------------------------------------------------------------------
+; VOID
+; EFIAPI
+; InternalLongJump (
+; IN BASE_LIBRARY_JUMP_BUFFER *JumpBuffer,
+; IN UINTN Value
+; );
+;------------------------------------------------------------------------------
InternalLongJump PROC
- pop eax
- pop edx
- pop eax
+ pop eax ; skip return address
+ pop edx ; edx <- JumpBuffer
+ pop eax ; eax <- Value
mov ebx, [edx]
mov esi, [edx + 4]
mov edi, [edx + 8]
diff --git a/MdePkg/Library/BaseLib/Ia32/ModU64x32.S b/MdePkg/Library/BaseLib/Ia32/ModU64x32.S
index a8e9574..f2d6cfd 100644
--- a/MdePkg/Library/BaseLib/Ia32/ModU64x32.S
+++ b/MdePkg/Library/BaseLib/Ia32/ModU64x32.S
@@ -19,20 +19,22 @@
#
#------------------------------------------------------------------------------
-
-
-
-
.global _InternalMathModU64x32
-_InternalMathModU64x32:
- movl 8(%esp),%eax
- movl 12(%esp),%ecx
- xorl %edx,%edx
+
+#------------------------------------------------------------------------------
+# UINT32
+# EFIAPI
+# InternalMathModU64x32 (
+# IN UINT64 Dividend,
+# IN UINT32 Divisor
+# );
+#------------------------------------------------------------------------------
+_InternalMathModU64x32:
+ movl 8(%esp), %eax
+ movl 12(%esp), %ecx
+ xorl %edx, %edx
divl %ecx
- movl 4(%esp),%eax
+ movl 4(%esp), %eax
divl %ecx
- movl %edx,%eax
+ movl %edx, %eax
ret
-
-
-
diff --git a/MdePkg/Library/BaseLib/Ia32/ModU64x32.asm b/MdePkg/Library/BaseLib/Ia32/ModU64x32.asm
index 62481ce..9e5f9ae 100644
--- a/MdePkg/Library/BaseLib/Ia32/ModU64x32.asm
+++ b/MdePkg/Library/BaseLib/Ia32/ModU64x32.asm
@@ -23,6 +23,14 @@
.model flat,C
.code
+;------------------------------------------------------------------------------
+; UINT32
+; EFIAPI
+; InternalMathModU64x32 (
+; IN UINT64 Dividend,
+; IN UINT32 Divisor
+; );
+;------------------------------------------------------------------------------
InternalMathModU64x32 PROC
mov eax, [esp + 8]
mov ecx, [esp + 12]
diff --git a/MdePkg/Library/BaseLib/Ia32/Monitor.S b/MdePkg/Library/BaseLib/Ia32/Monitor.S
index 8da0e34..371e183 100644
--- a/MdePkg/Library/BaseLib/Ia32/Monitor.S
+++ b/MdePkg/Library/BaseLib/Ia32/Monitor.S
@@ -21,9 +21,7 @@
#
#------------------------------------------------------------------------------
-
-
-
+.global _AsmMonitor
#------------------------------------------------------------------------------
# UINT64
@@ -34,13 +32,9 @@
# IN UINTN Edx
# );
#------------------------------------------------------------------------------
-.global _AsmMonitor
-_AsmMonitor:
- movl 4(%esp),%eax
- movl 8(%esp),%ecx
- movl 12(%esp),%edx
- monitor %eax,%ecx,%edx
+_AsmMonitor:
+ movl 4(%esp), %eax
+ movl 8(%esp), %ecx
+ movl 12(%esp), %edx
+ monitor %eax, %ecx, %edx
ret
-
-
-
diff --git a/MdePkg/Library/BaseLib/Ia32/Monitor.asm b/MdePkg/Library/BaseLib/Ia32/Monitor.asm
index 5d92d26..174bd76 100644
--- a/MdePkg/Library/BaseLib/Ia32/Monitor.asm
+++ b/MdePkg/Library/BaseLib/Ia32/Monitor.asm
@@ -22,11 +22,11 @@
;------------------------------------------------------------------------------
.686
- .model flat
+ .model flat,C
.code
;------------------------------------------------------------------------------
-; UINT64
+; UINTN
; EFIAPI
; AsmMonitor (
; IN UINTN Eax,
@@ -34,12 +34,12 @@
; IN UINTN Edx
; );
;------------------------------------------------------------------------------
-_AsmMonitor PROC
+AsmMonitor PROC
mov eax, [esp + 4]
mov ecx, [esp + 8]
mov edx, [esp + 12]
- DB 0fh, 1, 0c8h
+ DB 0fh, 1, 0c8h ; monitor
ret
-_AsmMonitor ENDP
+AsmMonitor ENDP
END
diff --git a/MdePkg/Library/BaseLib/Ia32/MultU64x32.S b/MdePkg/Library/BaseLib/Ia32/MultU64x32.S
index 572a312..0b01733 100644
--- a/MdePkg/Library/BaseLib/Ia32/MultU64x32.S
+++ b/MdePkg/Library/BaseLib/Ia32/MultU64x32.S
@@ -19,14 +19,23 @@
#
#------------------------------------------------------------------------------
- .386:
- .code:
+ .386:
+ .code:
.global _InternalMathMultU64x32
+
+#------------------------------------------------------------------------------
+# UINT64
+# EFIAPI
+# InternalMathMultU64x32 (
+# IN UINT64 Multiplicand,
+# IN UINT32 Multiplier
+# );
+#------------------------------------------------------------------------------
_InternalMathMultU64x32:
- movl 12(%esp),%ecx
- movl %ecx,%eax
- imull 8(%esp),%ecx
- mull 0x4(%esp)
- addl %ecx,%edx
+ movl 12(%esp), %ecx
+ movl %ecx, %eax
+ imull 8(%esp), %ecx
+ mull 0x4(%esp)
+ addl %ecx, %edx
ret
diff --git a/MdePkg/Library/BaseLib/Ia32/MultU64x32.asm b/MdePkg/Library/BaseLib/Ia32/MultU64x32.asm
index e2806e3..9c9ef06 100644
--- a/MdePkg/Library/BaseLib/Ia32/MultU64x32.asm
+++ b/MdePkg/Library/BaseLib/Ia32/MultU64x32.asm
@@ -23,10 +23,18 @@
.model flat,C
.code
+;------------------------------------------------------------------------------
+; UINT64
+; EFIAPI
+; InternalMathMultU64x32 (
+; IN UINT64 Multiplicand,
+; IN UINT32 Multiplier
+; );
+;------------------------------------------------------------------------------
InternalMathMultU64x32 PROC
mov ecx, [esp + 12]
mov eax, ecx
- imul ecx, [esp + 8]
+ imul ecx, [esp + 8] ; overflow not detectable
mul dword ptr [esp + 4]
add edx, ecx
ret
diff --git a/MdePkg/Library/BaseLib/Ia32/MultU64x64.S b/MdePkg/Library/BaseLib/Ia32/MultU64x64.S
index 641b0d6..f2e55ad 100644
--- a/MdePkg/Library/BaseLib/Ia32/MultU64x64.S
+++ b/MdePkg/Library/BaseLib/Ia32/MultU64x64.S
@@ -19,24 +19,26 @@
#
#------------------------------------------------------------------------------
-
-
-
-
.global _InternalMathMultU64x64
-_InternalMathMultU64x64:
+
+#------------------------------------------------------------------------------
+# UINT64
+# EFIAPI
+# InternalMathMultU64x64 (
+# IN UINT64 Multiplicand,
+# IN UINT64 Multiplier
+# );
+#------------------------------------------------------------------------------
+_InternalMathMultU64x64:
push %ebx
- movl 8(%esp),%ebx
- movl 16(%esp),%edx
- movl %ebx,%ecx
- movl %edx,%eax
- imull 20(%esp),%ebx
- imull 12(%esp),%edx
- addl %edx,%ebx
+ movl 8(%esp), %ebx
+ movl 16(%esp), %edx
+ movl %ebx, %ecx
+ movl %edx, %eax
+ imull 20(%esp), %ebx
+ imull 12(%esp), %edx
+ addl %edx, %ebx
mull %ecx
- addl %ebx,%edx
+ addl %ebx, %edx
pop %ebx
ret
-
-
-
diff --git a/MdePkg/Library/BaseLib/Ia32/MultU64x64.asm b/MdePkg/Library/BaseLib/Ia32/MultU64x64.asm
index 24c6a7d..377aa51 100644
--- a/MdePkg/Library/BaseLib/Ia32/MultU64x64.asm
+++ b/MdePkg/Library/BaseLib/Ia32/MultU64x64.asm
@@ -23,6 +23,14 @@
.model flat,C
.code
+;------------------------------------------------------------------------------
+; UINT64
+; EFIAPI
+; InternalMathMultU64x64 (
+; IN UINT64 Multiplicand,
+; IN UINT64 Multiplier
+; );
+;------------------------------------------------------------------------------
InternalMathMultU64x64 PROC USES ebx
mov ebx, [esp + 8]
mov edx, [esp + 16]
diff --git a/MdePkg/Library/BaseLib/Ia32/Mwait.S b/MdePkg/Library/BaseLib/Ia32/Mwait.S
index 7e04453..1aad7cb 100644
--- a/MdePkg/Library/BaseLib/Ia32/Mwait.S
+++ b/MdePkg/Library/BaseLib/Ia32/Mwait.S
@@ -21,9 +21,7 @@
#
#------------------------------------------------------------------------------
-
-
-
+.global _AsmMwait
#------------------------------------------------------------------------------
# UINT64
@@ -33,12 +31,8 @@
# IN UINTN Ecx
# );
#------------------------------------------------------------------------------
-.global _AsmMwait
-_AsmMwait:
- movl 4(%esp),%eax
- movl 8(%esp),%ecx
- mwait %eax,%ecx
+_AsmMwait:
+ movl 4(%esp), %eax
+ movl 8(%esp), %ecx
+ mwait %eax, %ecx
ret
-
-
-
diff --git a/MdePkg/Library/BaseLib/Ia32/Mwait.asm b/MdePkg/Library/BaseLib/Ia32/Mwait.asm
index 91d505b..3e5f48c 100644
--- a/MdePkg/Library/BaseLib/Ia32/Mwait.asm
+++ b/MdePkg/Library/BaseLib/Ia32/Mwait.asm
@@ -22,22 +22,22 @@
;------------------------------------------------------------------------------
.686
- .model flat
+ .model flat,C
.code
;------------------------------------------------------------------------------
-; UINT64
+; UINTN
; EFIAPI
; AsmMwait (
; IN UINTN Eax,
; IN UINTN Ecx
; );
;------------------------------------------------------------------------------
-_AsmMwait PROC
+AsmMwait PROC
mov eax, [esp + 4]
mov ecx, [esp + 8]
- DB 0fh, 1, 0c9h
+ DB 0fh, 1, 0c9h ; mwait
ret
-_AsmMwait ENDP
+AsmMwait ENDP
END
diff --git a/MdePkg/Library/BaseLib/Ia32/RRotU64.S b/MdePkg/Library/BaseLib/Ia32/RRotU64.S
index 2d4f42f..4b89a4e 100644
--- a/MdePkg/Library/BaseLib/Ia32/RRotU64.S
+++ b/MdePkg/Library/BaseLib/Ia32/RRotU64.S
@@ -19,26 +19,28 @@
#
#------------------------------------------------------------------------------
-
-
-
-
.global _InternalMathRRotU64
+
+#------------------------------------------------------------------------------
+# UINT64
+# EFIAPI
+# InternalMathRRotU64 (
+# IN UINT64 Operand,
+# IN UINTN Count
+# );
+#------------------------------------------------------------------------------
_InternalMathRRotU64:
push %ebx
- movb 16(%esp),%cl
- movl 8(%esp),%eax
- movl 12(%esp),%edx
- shrdl %cl,%eax,%ebx
- shrdl %cl,%edx,%eax
- roll %cl,%ebx
- shrdl %cl,%ebx,%edx
- testb $32,%cl
+ movb 16(%esp), %cl
+ movl 8(%esp), %eax
+ movl 12(%esp), %edx
+ shrdl %cl, %eax, %ebx
+ shrdl %cl, %edx, %eax
+ roll %cl, %ebx
+ shrdl %cl, %ebx, %edx
+ testb $32, %cl
cmovnz %eax, %ecx
cmovnz %edx, %eax
cmovnz %ecx, %edx
pop %ebx
ret
-
-
-
diff --git a/MdePkg/Library/BaseLib/Ia32/RRotU64.asm b/MdePkg/Library/BaseLib/Ia32/RRotU64.asm
index 062e201..4c58878 100644
--- a/MdePkg/Library/BaseLib/Ia32/RRotU64.asm
+++ b/MdePkg/Library/BaseLib/Ia32/RRotU64.asm
@@ -23,6 +23,14 @@
.model flat,C
.code
+;------------------------------------------------------------------------------
+; UINT64
+; EFIAPI
+; InternalMathRRotU64 (
+; IN UINT64 Operand,
+; IN UINTN Count
+; );
+;------------------------------------------------------------------------------
InternalMathRRotU64 PROC USES ebx
mov cl, [esp + 16]
mov eax, [esp + 8]
@@ -31,7 +39,7 @@ InternalMathRRotU64 PROC USES ebx
shrd eax, edx, cl
rol ebx, cl
shrd edx, ebx, cl
- test cl, 32
+ test cl, 32 ; Count >= 32?
cmovnz ecx, eax
cmovnz eax, edx
cmovnz edx, ecx
diff --git a/MdePkg/Library/BaseLib/Ia32/RShiftU64.S b/MdePkg/Library/BaseLib/Ia32/RShiftU64.S
index f6c28de..3aea31b 100644
--- a/MdePkg/Library/BaseLib/Ia32/RShiftU64.S
+++ b/MdePkg/Library/BaseLib/Ia32/RShiftU64.S
@@ -19,17 +19,26 @@
#
#------------------------------------------------------------------------------
- .686:
- .code:
+ .686:
+ .code:
.global _InternalMathRShiftU64
+
+#------------------------------------------------------------------------------
+# UINT64
+# EFIAPI
+# InternalMathRShiftU64 (
+# IN UINT64 Operand,
+# IN UINTN Count
+# );
+#------------------------------------------------------------------------------
_InternalMathRShiftU64:
- movb 12(%esp),%cl
- xorl %edx,%edx
- movl 8(%esp),%eax
- testb $32,%cl
+ movb 12(%esp), %cl
+ xorl %edx, %edx
+ movl 8(%esp), %eax
+ testb $32, %cl
cmovz %eax, %edx
cmovz 0x4(%esp), %eax
- shrdl %cl,%edx,%eax
- shr %cl,%edx
+ shrdl %cl, %edx, %eax
+ shr %cl, %edx
ret
diff --git a/MdePkg/Library/BaseLib/Ia32/RShiftU64.asm b/MdePkg/Library/BaseLib/Ia32/RShiftU64.asm
index effbc55..793a8f9 100644
--- a/MdePkg/Library/BaseLib/Ia32/RShiftU64.asm
+++ b/MdePkg/Library/BaseLib/Ia32/RShiftU64.asm
@@ -23,6 +23,14 @@
.model flat,C
.code
+;------------------------------------------------------------------------------
+; UINT64
+; EFIAPI
+; InternalMathRShiftU64 (
+; IN UINT64 Operand,
+; IN UINTN Count
+; );
+;------------------------------------------------------------------------------
InternalMathRShiftU64 PROC
mov cl, [esp + 12]
xor edx, edx
@@ -35,4 +43,4 @@ InternalMathRShiftU64 PROC
ret
InternalMathRShiftU64 ENDP
- END \ No newline at end of file
+ END
diff --git a/MdePkg/Library/BaseLib/Ia32/ReadCr0.S b/MdePkg/Library/BaseLib/Ia32/ReadCr0.S
index 3108b71..4ebb51c 100644
--- a/MdePkg/Library/BaseLib/Ia32/ReadCr0.S
+++ b/MdePkg/Library/BaseLib/Ia32/ReadCr0.S
@@ -21,9 +21,7 @@
#
#------------------------------------------------------------------------------
-
-
-
+.global _AsmReadCr0
#------------------------------------------------------------------------------
# UINTN
@@ -32,10 +30,6 @@
# VOID
# );
#------------------------------------------------------------------------------
-.global _AsmReadCr0
-_AsmReadCr0:
+_AsmReadCr0:
movl %cr0, %eax
ret
-
-
-
diff --git a/MdePkg/Library/BaseLib/Ia32/ReadCr0.asm b/MdePkg/Library/BaseLib/Ia32/ReadCr0.asm
index 579cee2..a8fe4a7 100644
--- a/MdePkg/Library/BaseLib/Ia32/ReadCr0.asm
+++ b/MdePkg/Library/BaseLib/Ia32/ReadCr0.asm
@@ -22,7 +22,7 @@
;------------------------------------------------------------------------------
.386p
- .model flat
+ .model flat,C
.code
;------------------------------------------------------------------------------
@@ -32,9 +32,9 @@
; VOID
; );
;------------------------------------------------------------------------------
-_AsmReadCr0 PROC
+AsmReadCr0 PROC
mov eax, cr0
ret
-_AsmReadCr0 ENDP
+AsmReadCr0 ENDP
END
diff --git a/MdePkg/Library/BaseLib/Ia32/ReadCr2.S b/MdePkg/Library/BaseLib/Ia32/ReadCr2.S
index 3ce287a..3080ae9 100644
--- a/MdePkg/Library/BaseLib/Ia32/ReadCr2.S
+++ b/MdePkg/Library/BaseLib/Ia32/ReadCr2.S
@@ -21,9 +21,7 @@
#
#------------------------------------------------------------------------------
-
-
-
+.global _AsmReadCr2
#------------------------------------------------------------------------------
# UINTN
@@ -32,10 +30,6 @@
# VOID
# );
#------------------------------------------------------------------------------
-.global _AsmReadCr2
-_AsmReadCr2:
+_AsmReadCr2:
movl %cr2, %eax
ret
-
-
-
diff --git a/MdePkg/Library/BaseLib/Ia32/ReadCr2.asm b/MdePkg/Library/BaseLib/Ia32/ReadCr2.asm
index 3e4a926..a6a9b8c 100644
--- a/MdePkg/Library/BaseLib/Ia32/ReadCr2.asm
+++ b/MdePkg/Library/BaseLib/Ia32/ReadCr2.asm
@@ -22,7 +22,7 @@
;------------------------------------------------------------------------------
.386p
- .model flat
+ .model flat,C
.code
;------------------------------------------------------------------------------
@@ -32,9 +32,9 @@
; VOID
; );
;------------------------------------------------------------------------------
-_AsmReadCr2 PROC
+AsmReadCr2 PROC
mov eax, cr2
ret
-_AsmReadCr2 ENDP
+AsmReadCr2 ENDP
END
diff --git a/MdePkg/Library/BaseLib/Ia32/ReadCr3.S b/MdePkg/Library/BaseLib/Ia32/ReadCr3.S
index 2bd63c7..b714801 100644
--- a/MdePkg/Library/BaseLib/Ia32/ReadCr3.S
+++ b/MdePkg/Library/BaseLib/Ia32/ReadCr3.S
@@ -21,9 +21,7 @@
#
#------------------------------------------------------------------------------
-
-
-
+.global _AsmReadCr3
#------------------------------------------------------------------------------
# UINTN
@@ -32,10 +30,6 @@
# VOID
# );
#------------------------------------------------------------------------------
-.global _AsmReadCr3
-_AsmReadCr3:
+_AsmReadCr3:
movl %cr3, %eax
ret
-
-
-
diff --git a/MdePkg/Library/BaseLib/Ia32/ReadCr3.asm b/MdePkg/Library/BaseLib/Ia32/ReadCr3.asm
index c24ded8..97b9ee4 100644
--- a/MdePkg/Library/BaseLib/Ia32/ReadCr3.asm
+++ b/MdePkg/Library/BaseLib/Ia32/ReadCr3.asm
@@ -22,7 +22,7 @@
;------------------------------------------------------------------------------
.386p
- .model flat
+ .model flat,C
.code
;------------------------------------------------------------------------------
@@ -32,9 +32,9 @@
; VOID
; );
;------------------------------------------------------------------------------
-_AsmReadCr3 PROC
+AsmReadCr3 PROC
mov eax, cr3
ret
-_AsmReadCr3 ENDP
+AsmReadCr3 ENDP
END
diff --git a/MdePkg/Library/BaseLib/Ia32/ReadCr4.S b/MdePkg/Library/BaseLib/Ia32/ReadCr4.S
index 4d746d8..2129761 100644
--- a/MdePkg/Library/BaseLib/Ia32/ReadCr4.S
+++ b/MdePkg/Library/BaseLib/Ia32/ReadCr4.S
@@ -21,9 +21,7 @@
#
#------------------------------------------------------------------------------
-
-
-
+.global _AsmReadCr4
#------------------------------------------------------------------------------
# UINTN
@@ -32,10 +30,6 @@
# VOID
# );
#------------------------------------------------------------------------------
-.global _AsmReadCr4
-_AsmReadCr4:
+_AsmReadCr4:
movl %cr4, %eax
ret
-
-
-
diff --git a/MdePkg/Library/BaseLib/Ia32/ReadCr4.asm b/MdePkg/Library/BaseLib/Ia32/ReadCr4.asm
index 258f37a..a454903 100644
--- a/MdePkg/Library/BaseLib/Ia32/ReadCr4.asm
+++ b/MdePkg/Library/BaseLib/Ia32/ReadCr4.asm
@@ -22,7 +22,7 @@
;------------------------------------------------------------------------------
.586p
- .model flat
+ .model flat,C
.code
;------------------------------------------------------------------------------
@@ -32,9 +32,9 @@
; VOID
; );
;------------------------------------------------------------------------------
-_AsmReadCr4 PROC
+AsmReadCr4 PROC
mov eax, cr4
ret
-_AsmReadCr4 ENDP
+AsmReadCr4 ENDP
END
diff --git a/MdePkg/Library/BaseLib/Ia32/ReadCs.S b/MdePkg/Library/BaseLib/Ia32/ReadCs.S
index 66bf4b9..97d7606 100644
--- a/MdePkg/Library/BaseLib/Ia32/ReadCs.S
+++ b/MdePkg/Library/BaseLib/Ia32/ReadCs.S
@@ -21,9 +21,7 @@
#
#------------------------------------------------------------------------------
-
-
-
+.global _AsmReadCs
#------------------------------------------------------------------------------
# UINT16
@@ -32,10 +30,6 @@
# VOID
# );
#------------------------------------------------------------------------------
-.global _AsmReadCs
-_AsmReadCs:
- movw %cs,%ax
+_AsmReadCs:
+ movl %cs, %eax
ret
-
-
-
diff --git a/MdePkg/Library/BaseLib/Ia32/ReadCs.asm b/MdePkg/Library/BaseLib/Ia32/ReadCs.asm
index 5972d66..68497e2 100644
--- a/MdePkg/Library/BaseLib/Ia32/ReadCs.asm
+++ b/MdePkg/Library/BaseLib/Ia32/ReadCs.asm
@@ -22,7 +22,7 @@
;------------------------------------------------------------------------------
.386
- .model flat
+ .model flat,C
.code
;------------------------------------------------------------------------------
@@ -32,9 +32,9 @@
; VOID
; );
;------------------------------------------------------------------------------
-_AsmReadCs PROC
- mov ax, cs
+AsmReadCs PROC
+ mov eax, cs
ret
-_AsmReadCs ENDP
+AsmReadCs ENDP
END
diff --git a/MdePkg/Library/BaseLib/Ia32/ReadDr0.S b/MdePkg/Library/BaseLib/Ia32/ReadDr0.S
index 00c521b..8ad15ea 100644
--- a/MdePkg/Library/BaseLib/Ia32/ReadDr0.S
+++ b/MdePkg/Library/BaseLib/Ia32/ReadDr0.S
@@ -21,8 +21,7 @@
#
#------------------------------------------------------------------------------
-
-
+.global _AsmReadDr0
#------------------------------------------------------------------------------
# UINTN
@@ -31,10 +30,6 @@
# VOID
# );
#------------------------------------------------------------------------------
-.global _AsmReadDr0
-_AsmReadDr0:
+_AsmReadDr0:
movl %dr0, %eax
ret
-
-
-
diff --git a/MdePkg/Library/BaseLib/Ia32/ReadDr0.asm b/MdePkg/Library/BaseLib/Ia32/ReadDr0.asm
index 4da1dd8..8792ce4 100644
--- a/MdePkg/Library/BaseLib/Ia32/ReadDr0.asm
+++ b/MdePkg/Library/BaseLib/Ia32/ReadDr0.asm
@@ -22,7 +22,7 @@
;------------------------------------------------------------------------------
.586p
- .model flat
+ .model flat,C
.code
;------------------------------------------------------------------------------
@@ -32,9 +32,9 @@
; VOID
; );
;------------------------------------------------------------------------------
-_AsmReadDr0 PROC
+AsmReadDr0 PROC
mov eax, dr0
ret
-_AsmReadDr0 ENDP
+AsmReadDr0 ENDP
END
diff --git a/MdePkg/Library/BaseLib/Ia32/ReadDr1.S b/MdePkg/Library/BaseLib/Ia32/ReadDr1.S
index 81d0e54..e1d7dab 100644
--- a/MdePkg/Library/BaseLib/Ia32/ReadDr1.S
+++ b/MdePkg/Library/BaseLib/Ia32/ReadDr1.S
@@ -21,9 +21,7 @@
#
#------------------------------------------------------------------------------
-
-
-
+.global _AsmReadDr1
#------------------------------------------------------------------------------
# UINTN
@@ -32,10 +30,6 @@
# VOID
# );
#------------------------------------------------------------------------------
-.global _AsmReadDr1
-_AsmReadDr1:
+_AsmReadDr1:
movl %dr1, %eax
ret
-
-
-
diff --git a/MdePkg/Library/BaseLib/Ia32/ReadDr1.asm b/MdePkg/Library/BaseLib/Ia32/ReadDr1.asm
index 8724dd2..e924407 100644
--- a/MdePkg/Library/BaseLib/Ia32/ReadDr1.asm
+++ b/MdePkg/Library/BaseLib/Ia32/ReadDr1.asm
@@ -22,7 +22,7 @@
;------------------------------------------------------------------------------
.586p
- .model flat
+ .model flat,C
.code
;------------------------------------------------------------------------------
@@ -32,9 +32,9 @@
; VOID
; );
;------------------------------------------------------------------------------
-_AsmReadDr1 PROC
+AsmReadDr1 PROC
mov eax, dr1
ret
-_AsmReadDr1 ENDP
+AsmReadDr1 ENDP
END
diff --git a/MdePkg/Library/BaseLib/Ia32/ReadDr2.S b/MdePkg/Library/BaseLib/Ia32/ReadDr2.S
index 296fff6..1c0ea04 100644
--- a/MdePkg/Library/BaseLib/Ia32/ReadDr2.S
+++ b/MdePkg/Library/BaseLib/Ia32/ReadDr2.S
@@ -21,9 +21,7 @@
#
#------------------------------------------------------------------------------
-
-
-
+.global _AsmReadDr2
#------------------------------------------------------------------------------
# UINTN
@@ -32,10 +30,6 @@
# VOID
# );
#------------------------------------------------------------------------------
-.global _AsmReadDr2
-_AsmReadDr2:
+_AsmReadDr2:
movl %dr2, %eax
ret
-
-
-
diff --git a/MdePkg/Library/BaseLib/Ia32/ReadDr2.asm b/MdePkg/Library/BaseLib/Ia32/ReadDr2.asm
index 9122d42..bbbef7e 100644
--- a/MdePkg/Library/BaseLib/Ia32/ReadDr2.asm
+++ b/MdePkg/Library/BaseLib/Ia32/ReadDr2.asm
@@ -22,7 +22,7 @@
;------------------------------------------------------------------------------
.586p
- .model flat
+ .model flat,C
.code
;------------------------------------------------------------------------------
@@ -32,9 +32,9 @@
; VOID
; );
;------------------------------------------------------------------------------
-_AsmReadDr2 PROC
+AsmReadDr2 PROC
mov eax, dr2
ret
-_AsmReadDr2 ENDP
+AsmReadDr2 ENDP
END
diff --git a/MdePkg/Library/BaseLib/Ia32/ReadDr3.S b/MdePkg/Library/BaseLib/Ia32/ReadDr3.S
index e99391d..705c5c6 100644
--- a/MdePkg/Library/BaseLib/Ia32/ReadDr3.S
+++ b/MdePkg/Library/BaseLib/Ia32/ReadDr3.S
@@ -21,9 +21,7 @@
#
#------------------------------------------------------------------------------
-
-
-
+.global _AsmReadDr3
#------------------------------------------------------------------------------
# UINTN
@@ -32,10 +30,6 @@
# VOID
# );
#------------------------------------------------------------------------------
-.global _AsmReadDr3
-_AsmReadDr3:
+_AsmReadDr3:
movl %dr3, %eax
ret
-
-
-
diff --git a/MdePkg/Library/BaseLib/Ia32/ReadDr3.asm b/MdePkg/Library/BaseLib/Ia32/ReadDr3.asm
index 7c1ee98..af2e7a2 100644
--- a/MdePkg/Library/BaseLib/Ia32/ReadDr3.asm
+++ b/MdePkg/Library/BaseLib/Ia32/ReadDr3.asm
@@ -22,7 +22,7 @@
;------------------------------------------------------------------------------
.586p
- .model flat
+ .model flat,C
.code
;------------------------------------------------------------------------------
@@ -32,9 +32,9 @@
; VOID
; );
;------------------------------------------------------------------------------
-_AsmReadDr3 PROC
+AsmReadDr3 PROC
mov eax, dr3
ret
-_AsmReadDr3 ENDP
+AsmReadDr3 ENDP
END
diff --git a/MdePkg/Library/BaseLib/Ia32/ReadDr4.S b/MdePkg/Library/BaseLib/Ia32/ReadDr4.S
index 7bff676..4e7d3d1 100644
--- a/MdePkg/Library/BaseLib/Ia32/ReadDr4.S
+++ b/MdePkg/Library/BaseLib/Ia32/ReadDr4.S
@@ -21,9 +21,7 @@
#
#------------------------------------------------------------------------------
-
-
-
+.global _AsmReadDr4
#------------------------------------------------------------------------------
# UINTN
@@ -32,10 +30,6 @@
# VOID
# );
#------------------------------------------------------------------------------
-.global _AsmReadDr4
-_AsmReadDr4:
+_AsmReadDr4:
movl %dr4, %eax
ret
-
-
-
diff --git a/MdePkg/Library/BaseLib/Ia32/ReadDr4.asm b/MdePkg/Library/BaseLib/Ia32/ReadDr4.asm
index 0172455..d1fffe4 100644
--- a/MdePkg/Library/BaseLib/Ia32/ReadDr4.asm
+++ b/MdePkg/Library/BaseLib/Ia32/ReadDr4.asm
@@ -22,7 +22,7 @@
;------------------------------------------------------------------------------
.586p
- .model flat
+ .model flat,C
.code
;------------------------------------------------------------------------------
@@ -32,9 +32,9 @@
; VOID
; );
;------------------------------------------------------------------------------
-_AsmReadDr4 PROC
+AsmReadDr4 PROC
DB 0fh, 21h, 0e0h
ret
-_AsmReadDr4 ENDP
+AsmReadDr4 ENDP
END
diff --git a/MdePkg/Library/BaseLib/Ia32/ReadDr5.S b/MdePkg/Library/BaseLib/Ia32/ReadDr5.S
index df409e3..09ae385 100644
--- a/MdePkg/Library/BaseLib/Ia32/ReadDr5.S
+++ b/MdePkg/Library/BaseLib/Ia32/ReadDr5.S
@@ -21,9 +21,7 @@
#
#------------------------------------------------------------------------------
-
-
-
+.global _AsmReadDr5
#------------------------------------------------------------------------------
# UINTN
@@ -32,10 +30,6 @@
# VOID
# );
#------------------------------------------------------------------------------
-.global _AsmReadDr5
-_AsmReadDr5:
+_AsmReadDr5:
movl %dr5, %eax
ret
-
-
-
diff --git a/MdePkg/Library/BaseLib/Ia32/ReadDr5.asm b/MdePkg/Library/BaseLib/Ia32/ReadDr5.asm
index a95527e..bba8b60 100644
--- a/MdePkg/Library/BaseLib/Ia32/ReadDr5.asm
+++ b/MdePkg/Library/BaseLib/Ia32/ReadDr5.asm
@@ -22,7 +22,7 @@
;------------------------------------------------------------------------------
.586p
- .model flat
+ .model flat,C
.code
;------------------------------------------------------------------------------
@@ -32,9 +32,9 @@
; VOID
; );
;------------------------------------------------------------------------------
-_AsmReadDr5 PROC
+AsmReadDr5 PROC
DB 0fh, 21h, 0e8h
ret
-_AsmReadDr5 ENDP
+AsmReadDr5 ENDP
END
diff --git a/MdePkg/Library/BaseLib/Ia32/ReadDr6.S b/MdePkg/Library/BaseLib/Ia32/ReadDr6.S
index bdadd80..c514a76 100644
--- a/MdePkg/Library/BaseLib/Ia32/ReadDr6.S
+++ b/MdePkg/Library/BaseLib/Ia32/ReadDr6.S
@@ -21,9 +21,7 @@
#
#------------------------------------------------------------------------------
-
-
-
+.global _AsmReadDr6
#------------------------------------------------------------------------------
# UINTN
@@ -32,10 +30,6 @@
# VOID
# );
#------------------------------------------------------------------------------
-.global _AsmReadDr6
-_AsmReadDr6:
+_AsmReadDr6:
movl %dr6, %eax
ret
-
-
-
diff --git a/MdePkg/Library/BaseLib/Ia32/ReadDr6.asm b/MdePkg/Library/BaseLib/Ia32/ReadDr6.asm
index b2d9a3d..479414b 100644
--- a/MdePkg/Library/BaseLib/Ia32/ReadDr6.asm
+++ b/MdePkg/Library/BaseLib/Ia32/ReadDr6.asm
@@ -22,7 +22,7 @@
;------------------------------------------------------------------------------
.586p
- .model flat
+ .model flat,C
.code
;------------------------------------------------------------------------------
@@ -32,9 +32,9 @@
; VOID
; );
;------------------------------------------------------------------------------
-_AsmReadDr6 PROC
+AsmReadDr6 PROC
mov eax, dr6
ret
-_AsmReadDr6 ENDP
+AsmReadDr6 ENDP
END
diff --git a/MdePkg/Library/BaseLib/Ia32/ReadDr7.S b/MdePkg/Library/BaseLib/Ia32/ReadDr7.S
index cf213ca..638daea 100644
--- a/MdePkg/Library/BaseLib/Ia32/ReadDr7.S
+++ b/MdePkg/Library/BaseLib/Ia32/ReadDr7.S
@@ -21,9 +21,7 @@
#
#------------------------------------------------------------------------------
-
-
-
+.global _AsmReadDr7
#------------------------------------------------------------------------------
# UINTN
@@ -32,10 +30,6 @@
# VOID
# );
#------------------------------------------------------------------------------
-.global _AsmReadDr7
-_AsmReadDr7:
+_AsmReadDr7:
movl %dr7, %eax
ret
-
-
-
diff --git a/MdePkg/Library/BaseLib/Ia32/ReadDr7.asm b/MdePkg/Library/BaseLib/Ia32/ReadDr7.asm
index 23924b1..7dee981 100644
--- a/MdePkg/Library/BaseLib/Ia32/ReadDr7.asm
+++ b/MdePkg/Library/BaseLib/Ia32/ReadDr7.asm
@@ -22,7 +22,7 @@
;------------------------------------------------------------------------------
.586p
- .model flat
+ .model flat,C
.code
;------------------------------------------------------------------------------
@@ -32,9 +32,9 @@
; VOID
; );
;------------------------------------------------------------------------------
-_AsmReadDr7 PROC
+AsmReadDr7 PROC
mov eax, dr7
ret
-_AsmReadDr7 ENDP
+AsmReadDr7 ENDP
END
diff --git a/MdePkg/Library/BaseLib/Ia32/ReadDs.S b/MdePkg/Library/BaseLib/Ia32/ReadDs.S
index ca1e379..7364c70 100644
--- a/MdePkg/Library/BaseLib/Ia32/ReadDs.S
+++ b/MdePkg/Library/BaseLib/Ia32/ReadDs.S
@@ -21,9 +21,7 @@
#
#------------------------------------------------------------------------------
-
-
-
+.global _AsmReadEflags
#------------------------------------------------------------------------------
# UINT16
@@ -32,10 +30,6 @@
# VOID
# );
#------------------------------------------------------------------------------
-.global _AsmReadDs
-_AsmReadDs:
- movw %ds,%ax
+_AsmReadDs:
+ movl %ds, %eax
ret
-
-
-
diff --git a/MdePkg/Library/BaseLib/Ia32/ReadDs.asm b/MdePkg/Library/BaseLib/Ia32/ReadDs.asm
index 6992766..b8edcb6 100644
--- a/MdePkg/Library/BaseLib/Ia32/ReadDs.asm
+++ b/MdePkg/Library/BaseLib/Ia32/ReadDs.asm
@@ -22,7 +22,7 @@
;------------------------------------------------------------------------------
.386
- .model flat
+ .model flat,C
.code
;------------------------------------------------------------------------------
@@ -32,9 +32,9 @@
; VOID
; );
;------------------------------------------------------------------------------
-_AsmReadDs PROC
- mov ax, ds
+AsmReadDs PROC
+ mov eax, ds
ret
-_AsmReadDs ENDP
+AsmReadDs ENDP
END
diff --git a/MdePkg/Library/BaseLib/Ia32/ReadEflags.S b/MdePkg/Library/BaseLib/Ia32/ReadEflags.S
index a70a209..3e40756 100644
--- a/MdePkg/Library/BaseLib/Ia32/ReadEflags.S
+++ b/MdePkg/Library/BaseLib/Ia32/ReadEflags.S
@@ -21,9 +21,7 @@
#
#------------------------------------------------------------------------------
-
-
-
+.global _AsmReadEflags
#------------------------------------------------------------------------------
# UINTN
@@ -32,11 +30,7 @@
# VOID
# );
#------------------------------------------------------------------------------
-.global _AsmReadEflags
-_AsmReadEflags:
+_AsmReadEflags:
pushfl
- popl %eax
+ pop %eax
ret
-
-
-
diff --git a/MdePkg/Library/BaseLib/Ia32/ReadEflags.asm b/MdePkg/Library/BaseLib/Ia32/ReadEflags.asm
index 365b1de..32d55b3 100644
--- a/MdePkg/Library/BaseLib/Ia32/ReadEflags.asm
+++ b/MdePkg/Library/BaseLib/Ia32/ReadEflags.asm
@@ -22,7 +22,7 @@
;------------------------------------------------------------------------------
.386
- .model flat
+ .model flat,C
.code
;------------------------------------------------------------------------------
@@ -32,10 +32,10 @@
; VOID
; );
;------------------------------------------------------------------------------
-_AsmReadEflags PROC
+AsmReadEflags PROC
pushfd
pop eax
ret
-_AsmReadEflags ENDP
+AsmReadEflags ENDP
END
diff --git a/MdePkg/Library/BaseLib/Ia32/ReadEs.S b/MdePkg/Library/BaseLib/Ia32/ReadEs.S
index 69727b5..87a5bac 100644
--- a/MdePkg/Library/BaseLib/Ia32/ReadEs.S
+++ b/MdePkg/Library/BaseLib/Ia32/ReadEs.S
@@ -21,9 +21,7 @@
#
#------------------------------------------------------------------------------
-
-
-
+.global _AsmReadEs
#------------------------------------------------------------------------------
# UINT16
@@ -32,10 +30,6 @@
# VOID
# );
#------------------------------------------------------------------------------
-.global _AsmReadEs
-_AsmReadEs:
- movw %es,%ax
+_AsmReadEs:
+ movl %es, %eax
ret
-
-
-
diff --git a/MdePkg/Library/BaseLib/Ia32/ReadEs.asm b/MdePkg/Library/BaseLib/Ia32/ReadEs.asm
index 0ced46a..48f1417 100644
--- a/MdePkg/Library/BaseLib/Ia32/ReadEs.asm
+++ b/MdePkg/Library/BaseLib/Ia32/ReadEs.asm
@@ -22,7 +22,7 @@
;------------------------------------------------------------------------------
.386
- .model flat
+ .model flat,C
.code
;------------------------------------------------------------------------------
@@ -32,9 +32,9 @@
; VOID
; );
;------------------------------------------------------------------------------
-_AsmReadEs PROC
- mov ax, es
+AsmReadEs PROC
+ mov eax, es
ret
-_AsmReadEs ENDP
+AsmReadEs ENDP
END
diff --git a/MdePkg/Library/BaseLib/Ia32/ReadFs.S b/MdePkg/Library/BaseLib/Ia32/ReadFs.S
index 7f4fdfa..3bf19f2 100644
--- a/MdePkg/Library/BaseLib/Ia32/ReadFs.S
+++ b/MdePkg/Library/BaseLib/Ia32/ReadFs.S
@@ -21,9 +21,7 @@
#
#------------------------------------------------------------------------------
-
-
-
+.global _AsmReadFs
#------------------------------------------------------------------------------
# UINT16
@@ -32,10 +30,6 @@
# VOID
# );
#------------------------------------------------------------------------------
-.global _AsmReadFs
-_AsmReadFs:
- movw %fs,%ax
+_AsmReadFs:
+ movl %fs, %eax
ret
-
-
-
diff --git a/MdePkg/Library/BaseLib/Ia32/ReadFs.asm b/MdePkg/Library/BaseLib/Ia32/ReadFs.asm
index f1790c6..ae87107 100644
--- a/MdePkg/Library/BaseLib/Ia32/ReadFs.asm
+++ b/MdePkg/Library/BaseLib/Ia32/ReadFs.asm
@@ -22,7 +22,7 @@
;------------------------------------------------------------------------------
.386
- .model flat
+ .model flat,C
.code
;------------------------------------------------------------------------------
@@ -32,9 +32,9 @@
; VOID
; );
;------------------------------------------------------------------------------
-_AsmReadFs PROC
- mov ax, fs
+AsmReadFs PROC
+ mov eax, fs
ret
-_AsmReadFs ENDP
+AsmReadFs ENDP
END
diff --git a/MdePkg/Library/BaseLib/Ia32/ReadGdtr.S b/MdePkg/Library/BaseLib/Ia32/ReadGdtr.S
index ebfe800..ec15046 100644
--- a/MdePkg/Library/BaseLib/Ia32/ReadGdtr.S
+++ b/MdePkg/Library/BaseLib/Ia32/ReadGdtr.S
@@ -21,9 +21,7 @@
#
#------------------------------------------------------------------------------
-
-
-
+.global _InternalX86ReadGdtr
#------------------------------------------------------------------------------
# VOID
@@ -32,11 +30,7 @@
# OUT IA32_DESCRIPTOR *Gdtr
# );
#------------------------------------------------------------------------------
-.global _InternalX86ReadGdtr
-_InternalX86ReadGdtr:
- movl 4(%esp),%eax
+_InternalX86ReadGdtr:
+ movl 4(%esp), %eax
sgdt (%eax)
ret
-
-
-
diff --git a/MdePkg/Library/BaseLib/Ia32/ReadGs.S b/MdePkg/Library/BaseLib/Ia32/ReadGs.S
index 0d88a60..8e0a9d2 100644
--- a/MdePkg/Library/BaseLib/Ia32/ReadGs.S
+++ b/MdePkg/Library/BaseLib/Ia32/ReadGs.S
@@ -21,9 +21,7 @@
#
#------------------------------------------------------------------------------
-
-
-
+.global _AsmReadGs
#------------------------------------------------------------------------------
# UINT16
@@ -32,10 +30,6 @@
# VOID
# );
#------------------------------------------------------------------------------
-.global _AsmReadGs
-_AsmReadGs:
- movw %gs,%ax
+_AsmReadGs:
+ movl %gs, %eax
ret
-
-
-
diff --git a/MdePkg/Library/BaseLib/Ia32/ReadGs.asm b/MdePkg/Library/BaseLib/Ia32/ReadGs.asm
index 1de0ebf..93313b8 100644
--- a/MdePkg/Library/BaseLib/Ia32/ReadGs.asm
+++ b/MdePkg/Library/BaseLib/Ia32/ReadGs.asm
@@ -22,7 +22,7 @@
;------------------------------------------------------------------------------
.386
- .model flat
+ .model flat,C
.code
;------------------------------------------------------------------------------
@@ -32,9 +32,9 @@
; VOID
; );
;------------------------------------------------------------------------------
-_AsmReadGs PROC
- mov ax, gs
+AsmReadGs PROC
+ mov eax, gs
ret
-_AsmReadGs ENDP
+AsmReadGs ENDP
END
diff --git a/MdePkg/Library/BaseLib/Ia32/ReadIdtr.S b/MdePkg/Library/BaseLib/Ia32/ReadIdtr.S
index 052c745..cafc0ac 100644
--- a/MdePkg/Library/BaseLib/Ia32/ReadIdtr.S
+++ b/MdePkg/Library/BaseLib/Ia32/ReadIdtr.S
@@ -21,9 +21,7 @@
#
#------------------------------------------------------------------------------
-
-
-
+.global _InternalX86ReadIdtr
#------------------------------------------------------------------------------
# VOID
@@ -32,11 +30,7 @@
# OUT IA32_DESCRIPTOR *Idtr
# );
#------------------------------------------------------------------------------
-.global _InternalX86ReadIdtr
-_InternalX86ReadIdtr:
- movl 4(%esp),%eax
+_InternalX86ReadIdtr:
+ movl 4(%esp), %eax
sidt (%eax)
ret
-
-
-
diff --git a/MdePkg/Library/BaseLib/Ia32/ReadIdtr.asm b/MdePkg/Library/BaseLib/Ia32/ReadIdtr.asm
index 95158be..dc7d473 100644
--- a/MdePkg/Library/BaseLib/Ia32/ReadIdtr.asm
+++ b/MdePkg/Library/BaseLib/Ia32/ReadIdtr.asm
@@ -25,10 +25,17 @@
.model flat,C
.code
-InternalX86ReadIdtr PROC
+;------------------------------------------------------------------------------
+; VOID
+; EFIAPI
+; InternalX86ReadIdtr (
+; OUT IA32_DESCRIPTOR *Idtr
+; );
+;------------------------------------------------------------------------------
+InternalX86ReadIdtr PROC
mov eax, [esp + 4]
sidt fword ptr [eax]
ret
-InternalX86ReadIdtr ENDP
+InternalX86ReadIdtr ENDP
END
diff --git a/MdePkg/Library/BaseLib/Ia32/ReadLdtr.S b/MdePkg/Library/BaseLib/Ia32/ReadLdtr.S
index aea1d92..39c3558 100644
--- a/MdePkg/Library/BaseLib/Ia32/ReadLdtr.S
+++ b/MdePkg/Library/BaseLib/Ia32/ReadLdtr.S
@@ -21,9 +21,7 @@
#
#------------------------------------------------------------------------------
-
-
-
+.global _AsmReadLdtr
#------------------------------------------------------------------------------
# UINT16
@@ -32,10 +30,6 @@
# VOID
# );
#------------------------------------------------------------------------------
-.global _AsmReadLdtr
-_AsmReadLdtr:
+_AsmReadLdtr:
sldt %eax
ret
-
-
-
diff --git a/MdePkg/Library/BaseLib/Ia32/ReadLdtr.asm b/MdePkg/Library/BaseLib/Ia32/ReadLdtr.asm
index a859a0e..449b7cf 100644
--- a/MdePkg/Library/BaseLib/Ia32/ReadLdtr.asm
+++ b/MdePkg/Library/BaseLib/Ia32/ReadLdtr.asm
@@ -22,7 +22,7 @@
;------------------------------------------------------------------------------
.386
- .model flat
+ .model flat,C
.code
;------------------------------------------------------------------------------
@@ -32,9 +32,9 @@
; VOID
; );
;------------------------------------------------------------------------------
-_AsmReadLdtr PROC
+AsmReadLdtr PROC
sldt ax
ret
-_AsmReadLdtr ENDP
+AsmReadLdtr ENDP
END
diff --git a/MdePkg/Library/BaseLib/Ia32/ReadMm0.S b/MdePkg/Library/BaseLib/Ia32/ReadMm0.S
index dd6b846..380b2f2 100644
--- a/MdePkg/Library/BaseLib/Ia32/ReadMm0.S
+++ b/MdePkg/Library/BaseLib/Ia32/ReadMm0.S
@@ -21,10 +21,7 @@
#
#------------------------------------------------------------------------------
-
-
-
-
+.global _AsmReadMm0
#------------------------------------------------------------------------------
# UINTN
@@ -33,14 +30,10 @@
# VOID
# );
#------------------------------------------------------------------------------
-.global _AsmReadMm0
-_AsmReadMm0:
- pushl %eax
- pushl %eax
- movq %mm0,(%esp)
- popl %eax
- popl %edx
+_AsmReadMm0:
+ push %eax
+ push %eax
+ movq %mm0, (%esp)
+ pop %eax
+ pop %edx
ret
-
-
-
diff --git a/MdePkg/Library/BaseLib/Ia32/ReadMm0.asm b/MdePkg/Library/BaseLib/Ia32/ReadMm0.asm
index c45895b..e43c45f 100644
--- a/MdePkg/Library/BaseLib/Ia32/ReadMm0.asm
+++ b/MdePkg/Library/BaseLib/Ia32/ReadMm0.asm
@@ -21,25 +21,25 @@
;
;------------------------------------------------------------------------------
- .586P
- .model flat
- .xmm
+ .586
+ .model flat,C
+ .mmx
.code
;------------------------------------------------------------------------------
-; UINTN
+; UINT64
; EFIAPI
; AsmReadMm0 (
; VOID
; );
;------------------------------------------------------------------------------
-_AsmReadMm0 PROC
+AsmReadMm0 PROC
push eax
push eax
movq [esp], mm0
pop eax
pop edx
ret
-_AsmReadMm0 ENDP
+AsmReadMm0 ENDP
END
diff --git a/MdePkg/Library/BaseLib/Ia32/ReadMm1.S b/MdePkg/Library/BaseLib/Ia32/ReadMm1.S
index cbaafff..a893ff7 100644
--- a/MdePkg/Library/BaseLib/Ia32/ReadMm1.S
+++ b/MdePkg/Library/BaseLib/Ia32/ReadMm1.S
@@ -21,10 +21,7 @@
#
#------------------------------------------------------------------------------
-
-
-
-
+.global _AsmReadMm1
#------------------------------------------------------------------------------
# UINTN
@@ -33,14 +30,10 @@
# VOID
# );
#------------------------------------------------------------------------------
-.global _AsmReadMm1
-_AsmReadMm1:
- pushl %eax
- pushl %eax
- movq %mm1,(%esp)
- popl %eax
- popl %edx
+_AsmReadMm1:
+ push %eax
+ push %eax
+ movq %mm1, (%esp)
+ pop %eax
+ pop %edx
ret
-
-
-
diff --git a/MdePkg/Library/BaseLib/Ia32/ReadMm1.asm b/MdePkg/Library/BaseLib/Ia32/ReadMm1.asm
index ea748cb..9f92a44 100644
--- a/MdePkg/Library/BaseLib/Ia32/ReadMm1.asm
+++ b/MdePkg/Library/BaseLib/Ia32/ReadMm1.asm
@@ -21,25 +21,25 @@
;
;------------------------------------------------------------------------------
- .586P
- .model flat
- .xmm
+ .586
+ .model flat,C
+ .mmx
.code
;------------------------------------------------------------------------------
-; UINTN
+; UINT64
; EFIAPI
; AsmReadMm1 (
; VOID
; );
;------------------------------------------------------------------------------
-_AsmReadMm1 PROC
+AsmReadMm1 PROC
push eax
push eax
movq [esp], mm1
pop eax
pop edx
ret
-_AsmReadMm1 ENDP
+AsmReadMm1 ENDP
END
diff --git a/MdePkg/Library/BaseLib/Ia32/ReadMm2.S b/MdePkg/Library/BaseLib/Ia32/ReadMm2.S
index 22a5d71..9dbc9e2 100644
--- a/MdePkg/Library/BaseLib/Ia32/ReadMm2.S
+++ b/MdePkg/Library/BaseLib/Ia32/ReadMm2.S
@@ -21,10 +21,7 @@
#
#------------------------------------------------------------------------------
-
-
-
-
+.global _AsmReadMm2
#------------------------------------------------------------------------------
# UINTN
@@ -33,14 +30,10 @@
# VOID
# );
#------------------------------------------------------------------------------
-.global _AsmReadMm2
-_AsmReadMm2:
- pushl %eax
- pushl %eax
- movq %mm2,(%esp)
- popl %eax
- popl %edx
+_AsmReadMm2:
+ push %eax
+ push %eax
+ movq %mm2, (%esp)
+ pop %eax
+ pop %edx
ret
-
-
-
diff --git a/MdePkg/Library/BaseLib/Ia32/ReadMm2.asm b/MdePkg/Library/BaseLib/Ia32/ReadMm2.asm
index ab16c51..38e4cb0 100644
--- a/MdePkg/Library/BaseLib/Ia32/ReadMm2.asm
+++ b/MdePkg/Library/BaseLib/Ia32/ReadMm2.asm
@@ -21,25 +21,25 @@
;
;------------------------------------------------------------------------------
- .586P
- .model flat
- .xmm
+ .586
+ .model flat,C
+ .mmx
.code
;------------------------------------------------------------------------------
-; UINTN
+; UINT64
; EFIAPI
; AsmReadMm2 (
; VOID
; );
;------------------------------------------------------------------------------
-_AsmReadMm2 PROC
+AsmReadMm2 PROC
push eax
push eax
movq [esp], mm2
pop eax
pop edx
ret
-_AsmReadMm2 ENDP
+AsmReadMm2 ENDP
END
diff --git a/MdePkg/Library/BaseLib/Ia32/ReadMm3.S b/MdePkg/Library/BaseLib/Ia32/ReadMm3.S
index dae267a..04d5707 100644
--- a/MdePkg/Library/BaseLib/Ia32/ReadMm3.S
+++ b/MdePkg/Library/BaseLib/Ia32/ReadMm3.S
@@ -21,10 +21,7 @@
#
#------------------------------------------------------------------------------
-
-
-
-
+.global _AsmReadMm3
#------------------------------------------------------------------------------
# UINTN
@@ -33,14 +30,10 @@
# VOID
# );
#------------------------------------------------------------------------------
-.global _AsmReadMm3
-_AsmReadMm3:
- pushl %eax
- pushl %eax
- movq %mm3,(%esp)
- popl %eax
- popl %edx
+_AsmReadMm3:
+ push %eax
+ push %eax
+ movq %mm3, (%esp)
+ pop %eax
+ pop %edx
ret
-
-
-
diff --git a/MdePkg/Library/BaseLib/Ia32/ReadMm3.asm b/MdePkg/Library/BaseLib/Ia32/ReadMm3.asm
index 3c4bf34..e646762 100644
--- a/MdePkg/Library/BaseLib/Ia32/ReadMm3.asm
+++ b/MdePkg/Library/BaseLib/Ia32/ReadMm3.asm
@@ -21,25 +21,25 @@
;
;------------------------------------------------------------------------------
- .586P
- .model flat
- .xmm
+ .586
+ .model flat,C
+ .mmx
.code
;------------------------------------------------------------------------------
-; UINTN
+; UINT64
; EFIAPI
; AsmReadMm3 (
; VOID
; );
;------------------------------------------------------------------------------
-_AsmReadMm3 PROC
+AsmReadMm3 PROC
push eax
push eax
movq [esp], mm3
pop eax
pop edx
ret
-_AsmReadMm3 ENDP
+AsmReadMm3 ENDP
END
diff --git a/MdePkg/Library/BaseLib/Ia32/ReadMm4.S b/MdePkg/Library/BaseLib/Ia32/ReadMm4.S
index 0ae1afc..4bd8122 100644
--- a/MdePkg/Library/BaseLib/Ia32/ReadMm4.S
+++ b/MdePkg/Library/BaseLib/Ia32/ReadMm4.S
@@ -21,10 +21,7 @@
#
#------------------------------------------------------------------------------
-
-
-
-
+.global _AsmReadMm4
#------------------------------------------------------------------------------
# UINTN
@@ -33,14 +30,10 @@
# VOID
# );
#------------------------------------------------------------------------------
-.global _AsmReadMm4
-_AsmReadMm4:
- pushl %eax
- pushl %eax
- movq %mm4,(%esp)
- popl %eax
- popl %edx
+_AsmReadMm4:
+ push %eax
+ push %eax
+ movq %mm4, (%esp)
+ pop %eax
+ pop %edx
ret
-
-
-
diff --git a/MdePkg/Library/BaseLib/Ia32/ReadMm4.asm b/MdePkg/Library/BaseLib/Ia32/ReadMm4.asm
index 4c2beb8..8da079d 100644
--- a/MdePkg/Library/BaseLib/Ia32/ReadMm4.asm
+++ b/MdePkg/Library/BaseLib/Ia32/ReadMm4.asm
@@ -21,25 +21,25 @@
;
;------------------------------------------------------------------------------
- .586P
- .model flat
- .xmm
+ .586
+ .model flat,C
+ .mmx
.code
;------------------------------------------------------------------------------
-; UINTN
+; UINT64
; EFIAPI
; AsmReadMm4 (
; VOID
; );
;------------------------------------------------------------------------------
-_AsmReadMm4 PROC
+AsmReadMm4 PROC
push eax
push eax
movq [esp], mm4
pop eax
pop edx
ret
-_AsmReadMm4 ENDP
+AsmReadMm4 ENDP
END
diff --git a/MdePkg/Library/BaseLib/Ia32/ReadMm5.S b/MdePkg/Library/BaseLib/Ia32/ReadMm5.S
index 2fad14a..d2b0498 100644
--- a/MdePkg/Library/BaseLib/Ia32/ReadMm5.S
+++ b/MdePkg/Library/BaseLib/Ia32/ReadMm5.S
@@ -21,10 +21,7 @@
#
#------------------------------------------------------------------------------
-
-
-
-
+.global _AsmReadMm5
#------------------------------------------------------------------------------
# UINTN
@@ -33,14 +30,10 @@
# VOID
# );
#------------------------------------------------------------------------------
-.global _AsmReadMm5
-_AsmReadMm5:
- pushl %eax
- pushl %eax
- movq %mm5,(%esp)
- popl %eax
- popl %edx
+_AsmReadMm5:
+ push %eax
+ push %eax
+ movq %mm5, (%esp)
+ pop %eax
+ pop %edx
ret
-
-
-
diff --git a/MdePkg/Library/BaseLib/Ia32/ReadMm5.asm b/MdePkg/Library/BaseLib/Ia32/ReadMm5.asm
index 66e3826..9d6b474 100644
--- a/MdePkg/Library/BaseLib/Ia32/ReadMm5.asm
+++ b/MdePkg/Library/BaseLib/Ia32/ReadMm5.asm
@@ -21,25 +21,25 @@
;
;------------------------------------------------------------------------------
- .586P
- .model flat
- .xmm
+ .586
+ .model flat,C
+ .mmx
.code
;------------------------------------------------------------------------------
-; UINTN
+; UINT64
; EFIAPI
; AsmReadMm5 (
; VOID
; );
;------------------------------------------------------------------------------
-_AsmReadMm5 PROC
+AsmReadMm5 PROC
push eax
push eax
movq [esp], mm5
pop eax
pop edx
ret
-_AsmReadMm5 ENDP
+AsmReadMm5 ENDP
END
diff --git a/MdePkg/Library/BaseLib/Ia32/ReadMm6.S b/MdePkg/Library/BaseLib/Ia32/ReadMm6.S
index 22cddfa..875295f 100644
--- a/MdePkg/Library/BaseLib/Ia32/ReadMm6.S
+++ b/MdePkg/Library/BaseLib/Ia32/ReadMm6.S
@@ -21,10 +21,7 @@
#
#------------------------------------------------------------------------------
-
-
-
-
+.global _AsmReadMm6
#------------------------------------------------------------------------------
# UINTN
@@ -33,14 +30,10 @@
# VOID
# );
#------------------------------------------------------------------------------
-.global _AsmReadMm6
-_AsmReadMm6:
- pushl %eax
- pushl %eax
- movq %mm6,(%esp)
- popl %eax
- popl %edx
+_AsmReadMm6:
+ push %eax
+ push %eax
+ movq %mm6, (%esp)
+ pop %eax
+ pop %edx
ret
-
-
-
diff --git a/MdePkg/Library/BaseLib/Ia32/ReadMm6.asm b/MdePkg/Library/BaseLib/Ia32/ReadMm6.asm
index 69d9e13..95c73f6 100644
--- a/MdePkg/Library/BaseLib/Ia32/ReadMm6.asm
+++ b/MdePkg/Library/BaseLib/Ia32/ReadMm6.asm
@@ -21,25 +21,25 @@
;
;------------------------------------------------------------------------------
- .586P
- .model flat
- .xmm
+ .586
+ .model flat,C
+ .mmx
.code
;------------------------------------------------------------------------------
-; UINTN
+; UINT64
; EFIAPI
; AsmReadMm6 (
; VOID
; );
;------------------------------------------------------------------------------
-_AsmReadMm6 PROC
+AsmReadMm6 PROC
push eax
push eax
movq [esp], mm6
pop eax
pop edx
ret
-_AsmReadMm6 ENDP
+AsmReadMm6 ENDP
END
diff --git a/MdePkg/Library/BaseLib/Ia32/ReadMm7.S b/MdePkg/Library/BaseLib/Ia32/ReadMm7.S
index fb485a0..fb12a65 100644
--- a/MdePkg/Library/BaseLib/Ia32/ReadMm7.S
+++ b/MdePkg/Library/BaseLib/Ia32/ReadMm7.S
@@ -21,10 +21,7 @@
#
#------------------------------------------------------------------------------
-
-
-
-
+.global _AsmReadMm7
#------------------------------------------------------------------------------
# UINTN
@@ -33,14 +30,10 @@
# VOID
# );
#------------------------------------------------------------------------------
-.global _AsmReadMm7
-_AsmReadMm7:
- pushl %eax
- pushl %eax
- movq %mm7,(%esp)
- popl %eax
- popl %edx
+_AsmReadMm7:
+ push %eax
+ push %eax
+ movq %mm7, (%esp)
+ pop %eax
+ pop %edx
ret
-
-
-
diff --git a/MdePkg/Library/BaseLib/Ia32/ReadMm7.asm b/MdePkg/Library/BaseLib/Ia32/ReadMm7.asm
index a8788cb..0bd3b9b 100644
--- a/MdePkg/Library/BaseLib/Ia32/ReadMm7.asm
+++ b/MdePkg/Library/BaseLib/Ia32/ReadMm7.asm
@@ -21,25 +21,25 @@
;
;------------------------------------------------------------------------------
- .586P
- .model flat
- .xmm
+ .586
+ .model flat,C
+ .mmx
.code
;------------------------------------------------------------------------------
-; UINTN
+; UINT64
; EFIAPI
; AsmReadMm7 (
; VOID
; );
;------------------------------------------------------------------------------
-_AsmReadMm7 PROC
+AsmReadMm7 PROC
push eax
push eax
movq [esp], mm7
pop eax
pop edx
ret
-_AsmReadMm7 ENDP
+AsmReadMm7 ENDP
END
diff --git a/MdePkg/Library/BaseLib/Ia32/ReadMsr64.S b/MdePkg/Library/BaseLib/Ia32/ReadMsr64.S
index 6a2c9c6..be3c44e 100644
--- a/MdePkg/Library/BaseLib/Ia32/ReadMsr64.S
+++ b/MdePkg/Library/BaseLib/Ia32/ReadMsr64.S
@@ -21,37 +21,16 @@
#
#------------------------------------------------------------------------------
-
-
-
-
-#------------------------------------------------------------------------------
-# UINT32
-# EFIAPI
-# AsmReadMsr32 (
-# IN UINT32 Index
-# );
-#------------------------------------------------------------------------------
-.global _AsmReadMsr32
-_AsmReadMsr32:
- #
- # AsmReadMsr32 shares the same implementation with AsmReadMsr64 and thus no
- # code inside this function
- #
-
+.global _AsmReadMsr64
#------------------------------------------------------------------------------
# UINT64
# EFIAPI
# AsmReadMsr64 (
-# IN UINT64 Index
+# IN UINT32 Index
# );
#------------------------------------------------------------------------------
-.global _AsmReadMsr64
-_AsmReadMsr64:
- movl 4(%esp),%ecx
+_AsmReadMsr64:
+ movl 4(%esp), %ecx
rdmsr
ret
-
-
-
diff --git a/MdePkg/Library/BaseLib/Ia32/ReadMsr64.asm b/MdePkg/Library/BaseLib/Ia32/ReadMsr64.asm
index 6c9fe00..9a3e11c 100644
--- a/MdePkg/Library/BaseLib/Ia32/ReadMsr64.asm
+++ b/MdePkg/Library/BaseLib/Ia32/ReadMsr64.asm
@@ -21,35 +21,21 @@
;
;------------------------------------------------------------------------------
- .586P
- .model flat
+ .586p
+ .model flat,C
.code
;------------------------------------------------------------------------------
-; UINT32
-; EFIAPI
-; AsmReadMsr32 (
-; IN UINT32 Index
-; );
-;------------------------------------------------------------------------------
-_AsmReadMsr32 PROC
- ;
- ; AsmReadMsr32 shares the same implementation with AsmReadMsr64 and thus no
- ; code inside this function
- ;
-_AsmReadMsr32 ENDP
-
-;------------------------------------------------------------------------------
; UINT64
; EFIAPI
; AsmReadMsr64 (
; IN UINT64 Index
; );
;------------------------------------------------------------------------------
-_AsmReadMsr64 PROC
+AsmReadMsr64 PROC
mov ecx, [esp + 4]
rdmsr
ret
-_AsmReadMsr64 ENDP
+AsmReadMsr64 ENDP
END
diff --git a/MdePkg/Library/BaseLib/Ia32/ReadPmc.S b/MdePkg/Library/BaseLib/Ia32/ReadPmc.S
index 868e85c..a6c4e6e 100644
--- a/MdePkg/Library/BaseLib/Ia32/ReadPmc.S
+++ b/MdePkg/Library/BaseLib/Ia32/ReadPmc.S
@@ -21,9 +21,7 @@
#
#------------------------------------------------------------------------------
-
-
-
+.global _AsmReadPmc
#------------------------------------------------------------------------------
# UINT64
@@ -32,11 +30,7 @@
# IN UINT32 PmcIndex
# );
#------------------------------------------------------------------------------
-.global _AsmReadPmc
-_AsmReadPmc:
- movl 4(%esp),%ecx
+_AsmReadPmc:
+ movl 4(%esp), %ecx
rdpmc
ret
-
-
-
diff --git a/MdePkg/Library/BaseLib/Ia32/ReadPmc.asm b/MdePkg/Library/BaseLib/Ia32/ReadPmc.asm
index 1fe5981..17156d4 100644
--- a/MdePkg/Library/BaseLib/Ia32/ReadPmc.asm
+++ b/MdePkg/Library/BaseLib/Ia32/ReadPmc.asm
@@ -21,8 +21,8 @@
;
;------------------------------------------------------------------------------
- .586P
- .model flat
+ .586p
+ .model flat,C
.code
;------------------------------------------------------------------------------
@@ -32,10 +32,10 @@
; IN UINT32 PmcIndex
; );
;------------------------------------------------------------------------------
-_AsmReadPmc PROC
+AsmReadPmc PROC
mov ecx, [esp + 4]
rdpmc
ret
-_AsmReadPmc ENDP
+AsmReadPmc ENDP
END
diff --git a/MdePkg/Library/BaseLib/Ia32/ReadSs.S b/MdePkg/Library/BaseLib/Ia32/ReadSs.S
index 7db65c1..f0a6fe8 100644
--- a/MdePkg/Library/BaseLib/Ia32/ReadSs.S
+++ b/MdePkg/Library/BaseLib/Ia32/ReadSs.S
@@ -21,9 +21,7 @@
#
#------------------------------------------------------------------------------
-
-
-
+.global _AsmReadSs
#------------------------------------------------------------------------------
# UINT16
@@ -32,10 +30,6 @@
# VOID
# );
#------------------------------------------------------------------------------
-.global _AsmReadSs
-_AsmReadSs:
- movw %ss,%ax
+_AsmReadSs:
+ movl %ss, %eax
ret
-
-
-
diff --git a/MdePkg/Library/BaseLib/Ia32/ReadSs.asm b/MdePkg/Library/BaseLib/Ia32/ReadSs.asm
index 6d0cd9f..4143537 100644
--- a/MdePkg/Library/BaseLib/Ia32/ReadSs.asm
+++ b/MdePkg/Library/BaseLib/Ia32/ReadSs.asm
@@ -22,7 +22,7 @@
;------------------------------------------------------------------------------
.386
- .model flat
+ .model flat,C
.code
;------------------------------------------------------------------------------
@@ -32,9 +32,9 @@
; VOID
; );
;------------------------------------------------------------------------------
-_AsmReadSs PROC
- mov ax, ss
+AsmReadSs PROC
+ mov eax, ss
ret
-_AsmReadSs ENDP
+AsmReadSs ENDP
END
diff --git a/MdePkg/Library/BaseLib/Ia32/ReadTr.S b/MdePkg/Library/BaseLib/Ia32/ReadTr.S
index 8c31e9d..92e0ce6 100644
--- a/MdePkg/Library/BaseLib/Ia32/ReadTr.S
+++ b/MdePkg/Library/BaseLib/Ia32/ReadTr.S
@@ -21,9 +21,7 @@
#
#------------------------------------------------------------------------------
-
-
-
+.global _AsmReadTr
#------------------------------------------------------------------------------
# UINT16
@@ -32,10 +30,6 @@
# VOID
# );
#------------------------------------------------------------------------------
-.global _AsmReadTr
-_AsmReadTr:
+_AsmReadTr:
str %eax
ret
-
-
-
diff --git a/MdePkg/Library/BaseLib/Ia32/ReadTr.asm b/MdePkg/Library/BaseLib/Ia32/ReadTr.asm
index d77ee89..4f4e64b 100644
--- a/MdePkg/Library/BaseLib/Ia32/ReadTr.asm
+++ b/MdePkg/Library/BaseLib/Ia32/ReadTr.asm
@@ -22,7 +22,7 @@
;------------------------------------------------------------------------------
.386
- .model flat
+ .model flat,C
.code
;------------------------------------------------------------------------------
@@ -32,9 +32,9 @@
; VOID
; );
;------------------------------------------------------------------------------
-_AsmReadTr PROC
+AsmReadTr PROC
str ax
ret
-_AsmReadTr ENDP
+AsmReadTr ENDP
END
diff --git a/MdePkg/Library/BaseLib/Ia32/ReadTsc.S b/MdePkg/Library/BaseLib/Ia32/ReadTsc.S
index e7981c0..c615ac7 100644
--- a/MdePkg/Library/BaseLib/Ia32/ReadTsc.S
+++ b/MdePkg/Library/BaseLib/Ia32/ReadTsc.S
@@ -21,9 +21,7 @@
#
#------------------------------------------------------------------------------
-
-
-
+.global _AsmReadTsc
#------------------------------------------------------------------------------
# UINT64
@@ -32,10 +30,6 @@
# VOID
# );
#------------------------------------------------------------------------------
-.global _AsmReadTsc
-_AsmReadTsc:
+_AsmReadTsc:
rdtsc
ret
-
-
-
diff --git a/MdePkg/Library/BaseLib/Ia32/ReadTsc.asm b/MdePkg/Library/BaseLib/Ia32/ReadTsc.asm
index ea3c164..fff3829 100644
--- a/MdePkg/Library/BaseLib/Ia32/ReadTsc.asm
+++ b/MdePkg/Library/BaseLib/Ia32/ReadTsc.asm
@@ -21,8 +21,8 @@
;
;------------------------------------------------------------------------------
- .586P
- .model flat
+ .586p
+ .model flat,C
.code
;------------------------------------------------------------------------------
@@ -32,9 +32,9 @@
; VOID
; );
;------------------------------------------------------------------------------
-_AsmReadTsc PROC
+AsmReadTsc PROC
rdtsc
ret
-_AsmReadTsc ENDP
+AsmReadTsc ENDP
END
diff --git a/MdePkg/Library/BaseLib/Ia32/SetJump.S b/MdePkg/Library/BaseLib/Ia32/SetJump.S
index 05acc4a..c600b7f 100644
--- a/MdePkg/Library/BaseLib/Ia32/SetJump.S
+++ b/MdePkg/Library/BaseLib/Ia32/SetJump.S
@@ -19,25 +19,26 @@
#
#------------------------------------------------------------------------------
-
-
-
-
.global _SetJump, _InternalAssertJumpBuffer
-_SetJump:
+
+#------------------------------------------------------------------------------
+# UINTN
+# EFIAPI
+# SetJump (
+# OUT BASE_LIBRARY_JUMP_BUFFER *JumpBuffer
+# );
+#------------------------------------------------------------------------------
+_SetJump:
pushl 0x4(%esp)
call _InternalAssertJumpBuffer
- popl %ecx
- popl %ecx
- movl (%esp),%edx
- movl %ebx,(%edx)
- movl %esi,4(%edx)
- movl %edi,8(%edx)
- movl %ebp,12(%edx)
- movl %esp,16(%edx)
- movl %ecx,20(%edx)
- xorl %eax,%eax
+ pop %ecx
+ pop %ecx
+ movl (%esp), %edx
+ movl %ebx, (%edx)
+ movl %esi, 4(%edx)
+ movl %edi, 8(%edx)
+ movl %ebp, 12(%edx)
+ movl %esp, 16(%edx)
+ movl %ecx, 20(%edx)
+ xorl %eax, %eax
jmp *%ecx
-
-
-
diff --git a/MdePkg/Library/BaseLib/Ia32/SetJump.asm b/MdePkg/Library/BaseLib/Ia32/SetJump.asm
index 7d8579c..4d745e2 100644
--- a/MdePkg/Library/BaseLib/Ia32/SetJump.asm
+++ b/MdePkg/Library/BaseLib/Ia32/SetJump.asm
@@ -25,6 +25,13 @@
InternalAssertJumpBuffer PROTO C
+;------------------------------------------------------------------------------
+; UINTN
+; EFIAPI
+; SetJump (
+; OUT BASE_LIBRARY_JUMP_BUFFER *JumpBuffer
+; );
+;------------------------------------------------------------------------------
SetJump PROC
push [esp + 4]
call InternalAssertJumpBuffer
diff --git a/MdePkg/Library/BaseLib/Ia32/SwapBytes64.S b/MdePkg/Library/BaseLib/Ia32/SwapBytes64.S
index 01af949..f763342 100644
--- a/MdePkg/Library/BaseLib/Ia32/SwapBytes64.S
+++ b/MdePkg/Library/BaseLib/Ia32/SwapBytes64.S
@@ -22,13 +22,17 @@
#------------------------------------------------------------------------------
+#------------------------------------------------------------------------------
+# UINT64
+# EFIAPI
+# InternalMathSwapBytes64 (
+# IN UINT64 Operand
+# );
+#------------------------------------------------------------------------------
.global _InternalMathSwapBytes64
_InternalMathSwapBytes64:
-
movl 8(%esp), %eax
movl 4(%esp), %edx
bswapl %eax
bswapl %edx
ret
-
-
diff --git a/MdePkg/Library/BaseLib/Ia32/SwapBytes64.asm b/MdePkg/Library/BaseLib/Ia32/SwapBytes64.asm
index 72e366b..186d094 100644
--- a/MdePkg/Library/BaseLib/Ia32/SwapBytes64.asm
+++ b/MdePkg/Library/BaseLib/Ia32/SwapBytes64.asm
@@ -21,10 +21,17 @@
;
;------------------------------------------------------------------------------
- .586P
+ .586
.model flat,C
.code
+;------------------------------------------------------------------------------
+; UINT64
+; EFIAPI
+; InternalMathSwapBytes64 (
+; IN UINT64 Operand
+; );
+;------------------------------------------------------------------------------
InternalMathSwapBytes64 PROC
mov eax, [esp + 8]
mov edx, [esp + 4]
diff --git a/MdePkg/Library/BaseLib/Ia32/Thunk16.S b/MdePkg/Library/BaseLib/Ia32/Thunk16.S
index 97b49f5..aad6bbe 100644
--- a/MdePkg/Library/BaseLib/Ia32/Thunk16.S
+++ b/MdePkg/Library/BaseLib/Ia32/Thunk16.S
@@ -19,16 +19,10 @@
#
#------------------------------------------------------------------------------
-.global _m16Start, _m16Size, _mThunk16Attr, _m16GdtrBase, _m16Gdt, _m16GdtrBase, _mTransition
+.global _m16Start, _m16Size, _mThunk16Attr, _m16Gdt, _m16GdtrBase, _mTransition
.global _InternalAsmThunk16
-#THUNK_ATTRIBUTE_BIG_REAL_MODE EQU 1
-#THUNK_ATTRIBUTE_DISABLE_A20_MASK_INT_15 EQU 2
-#THUNK_ATTRIBUTE_DISABLE_A20_MASK_KBD_CTRL EQU 4
-
- .code:
-
-_m16Start:
+_m16Start:
SavedGdt: .space 6
@@ -37,7 +31,7 @@ _BackFromUserCode:
push %cs
.byte 0x66
call @Base1 # push eip
-@Base1:
+@Base1:
pushfw # pushfd actually
cli # disable interrupts
push %gs
@@ -45,37 +39,37 @@ _BackFromUserCode:
push %es
push %ds
pushaw # pushad actually
- .byte 0x66,0xba # mov edx, imm32
+ .byte 0x66, 0xba # mov edx, imm32
_ThunkAttr: .space 4
testb $THUNK_ATTRIBUTE_DISABLE_A20_MASK_INT_15, %dl
jz @1
movl $0x15cd2401, %eax # mov ax, 2401h & int 15h
cli # disable interrupts
jnc @2
-@1:
+@1:
testb $THUNK_ATTRIBUTE_DISABLE_A20_MASK_KBD_CTRL, %dl
jz @2
inb $0x92, %al
orb $2, %al
outb %al, $0x92 # deactivate A20M#
-@2:
+@2:
movl %ss, %eax
.byte 0x67, 0x66, 0x8d, 0x6c, 0x24, 0x34, 0x66
- mov %ebp,0xffffffd8(%esi)
- mov 0xfffffff8(%esi),%ebx
+ mov %ebp, 0xffffffd8(%esi)
+ mov 0xfffffff8(%esi), %ebx
shlw $4, %ax # shl eax, 4
addw %ax, %bp # add ebp, eax
- .byte 0x66,0xb8 # mov eax, imm32
+ .byte 0x66, 0xb8 # mov eax, imm32
SavedCr4: .space 4
movl %eax, %cr4
- lgdtw %cs:0xfffffff2(%edi)
- .byte 0x66,0xb8 # mov eax, imm32
+ lgdtw %cs:0xfffffff2(%edi)
+ .byte 0x66, 0xb8 # mov eax, imm32
SavedCr0: .space 4
movl %eax, %cr0
.byte 0xb8 # mov ax, imm16
SavedSs: .space 2
movl %eax, %ss
- .byte 0x66,0xbc # mov esp, imm32
+ .byte 0x66, 0xbc # mov esp, imm32
SavedEsp: .space 4
.byte 0x66
lret # return to protected mode
@@ -100,23 +94,23 @@ _ToUserCode:
xchgw %bx, %sp # set up 16-bit stack pointer
.byte 0x66
call @Base # push eip
-@Base:
+@Base:
popw %bp # ebp <- offset @Base
addr16 pushl 36(%si)
.byte 0x36
- lea 0xc(%esi),%eax
- pushl %eax
+ lea 0xc(%esi), %eax
+ push %eax
lret
-@RealMode:
- mov %edx,%cs:0xffffffc5(%esi)
- mov %bx,%cs:0xffffffcb(%esi)
+@RealMode:
+ mov %edx, %cs:0xffffffc5(%esi)
+ mov %bx, %cs:0xffffffcb(%esi)
lidtw %cs:0xffffffd7(%esi)
popaw # popad actually
- popl %ds
- popl %es
- popl %fs
- popl %gs
+ pop %ds
+ pop %es
+ pop %fs
+ pop %gs
popfw # popfd
lretw # transfer control to user code
@@ -152,41 +146,41 @@ _InternalAsmThunk16:
push %fs
push %gs
movl 36(%esp), %esi # esi <- RegSet
- movzwl 0x32(%esi),%edx
- mov 0xc(%esi),%edi
- add $0xffffffc8,%edi
+ movzwl 0x32(%esi), %edx
+ mov 0xc(%esi), %edi
+ add $0xffffffc8, %edi
movl %edi, %ebx # ebx <- stack offset
- imul $0x10,%edx,%eax
+ imul $0x10, %edx, %eax
push $0xd
addl %eax, %edi # edi <- linear address of 16-bit stack
- popl %ecx
+ pop %ecx
rep
movsl # copy RegSet
movl 40(%esp), %eax # eax <- address of transition code
movl %edx, %esi # esi <- 16-bit stack segment
- lea 0x5e(%eax),%edx
+ lea 0x5e(%eax), %edx
movl %eax, %ecx
andl $0xf, %ecx
shll $12, %eax
- lea 0x6(%ecx),%ecx
+ lea 0x6(%ecx), %ecx
movw %cx, %ax
stosl # [edi] <- return address of user code
- sgdtl 0xffffffa2(%edx)
+ sgdtl 0xffffffa2(%edx)
sidtl 0x24(%esp)
movl %cr0, %eax
movl %eax, (%edx) # save CR0 in SavedCr0
andl $0x7ffffffe, %eax # clear PE, PG bits
movl %cr4, %ebp
- mov %ebp,0xfffffff1(%edx)
+ mov %ebp, 0xfffffff1(%edx)
andl $0x300, %ebp # clear all but PCE and OSFXSR bits
pushl $0x10
- popl %ecx # ecx <- selector for data segments
+ pop %ecx # ecx <- selector for data segments
lgdtl 0x20(%edx)
pushfl
lcall *0x14(%edx)
popfl
lidtl 0x24(%esp)
- lea 0xffffffcc(%ebp),%eax
+ lea 0xffffffcc(%ebp), %eax
pop %gs
pop %fs
pop %es
@@ -197,11 +191,10 @@ _InternalAsmThunk16:
pop %ebp
ret
- .const:
+ .const:
_m16Size: .word _InternalAsmThunk16 - _m16Start
_mThunk16Attr: .word _ThunkAttr - _m16Start
_m16Gdt: .word _NullSegDesc - _m16Start
_m16GdtrBase: .word _16GdtrBase - _m16Start
_mTransition: .word _EntryPoint - _m16Start
-
diff --git a/MdePkg/Library/BaseLib/Ia32/Thunk16.asm b/MdePkg/Library/BaseLib/Ia32/Thunk16.asm
index 9fba03a..5e35799 100644
--- a/MdePkg/Library/BaseLib/Ia32/Thunk16.asm
+++ b/MdePkg/Library/BaseLib/Ia32/Thunk16.asm
@@ -29,6 +29,10 @@ EXTERNDEF C m16Gdt:WORD
EXTERNDEF C m16GdtrBase:WORD
EXTERNDEF C mTransition:WORD
+;
+; Here is the layout of the real mode stack. _ToUserCode() is responsible for
+; loading all these registers from real mode stack.
+;
IA32_REGS STRUC 4t
_EDI DD ?
_ESI DD ?
@@ -50,6 +54,9 @@ IA32_REGS ENDS
.const
+;
+; These are global constant to convey information to C code.
+;
m16Size DW InternalAsmThunk16 - m16Start
mThunk16Attr DW _ThunkAttr - m16Start
m16Gdt DW _NullSegDesc - m16Start
@@ -63,7 +70,10 @@ m16Start LABEL BYTE
SavedGdt LABEL FWORD
DW ?
DD ?
-
+;------------------------------------------------------------------------------
+; _BackFromUserCode() takes control in real mode after 'retf' has been executed
+; by user code. It will be shadowed to somewhere in memory below 1MB.
+;------------------------------------------------------------------------------
_BackFromUserCode PROC
push ss
push cs
@@ -122,6 +132,10 @@ _16Gdtr LABEL FWORD
DW GdtEnd - _NullSegDesc - 1
_16GdtrBase DD _NullSegDesc
+;------------------------------------------------------------------------------
+; _ToUserCode() takes control in real mode before passing control to user code.
+; It will be shadowed to somewhere in memory below 1MB.
+;------------------------------------------------------------------------------
_ToUserCode PROC
mov edx, ss
mov ss, ecx ; set new segment selectors
@@ -174,11 +188,14 @@ _16DsDesc LABEL QWORD
DB 0
GdtEnd LABEL QWORD
-;
-; @param RegSet Pointer to a IA32_DWORD_REGS structure
-; @param Transition Pointer to the transition code
-; @return The address of the 16-bit stack after returning from user code
-;
+;------------------------------------------------------------------------------
+; IA32_REGISTER_SET *
+; EFIAPI
+; InternalAsmThunk16 (
+; IN IA32_REGISTER_SET *RegisterSet,
+; IN OUT VOID *Transition
+; );
+;------------------------------------------------------------------------------
InternalAsmThunk16 PROC USES ebp ebx esi edi ds es fs gs
mov esi, [esp + 36] ; esi <- RegSet
movzx edx, (IA32_REGS ptr [esi])._SS
diff --git a/MdePkg/Library/BaseLib/Ia32/Wbinvd.S b/MdePkg/Library/BaseLib/Ia32/Wbinvd.S
index e9f6c0c..7a4b8cc 100644
--- a/MdePkg/Library/BaseLib/Ia32/Wbinvd.S
+++ b/MdePkg/Library/BaseLib/Ia32/Wbinvd.S
@@ -21,10 +21,6 @@
#
#------------------------------------------------------------------------------
-
-
-
-
#------------------------------------------------------------------------------
# VOID
# EFIAPI
@@ -33,9 +29,6 @@
# );
#------------------------------------------------------------------------------
.global _AsmWbinvd
-_AsmWbinvd:
+_AsmWbinvd:
wbinvd
ret
-
-
-
diff --git a/MdePkg/Library/BaseLib/Ia32/Wbinvd.asm b/MdePkg/Library/BaseLib/Ia32/Wbinvd.asm
index 07258fb..1230c89 100644
--- a/MdePkg/Library/BaseLib/Ia32/Wbinvd.asm
+++ b/MdePkg/Library/BaseLib/Ia32/Wbinvd.asm
@@ -22,7 +22,7 @@
;------------------------------------------------------------------------------
.486p
- .model flat
+ .model flat,C
.code
;------------------------------------------------------------------------------
@@ -32,9 +32,9 @@
; VOID
; );
;------------------------------------------------------------------------------
-_AsmWbinvd PROC
+AsmWbinvd PROC
wbinvd
ret
-_AsmWbinvd ENDP
+AsmWbinvd ENDP
END
diff --git a/MdePkg/Library/BaseLib/Ia32/WriteCr0.S b/MdePkg/Library/BaseLib/Ia32/WriteCr0.S
index 6e3ad50..192ed4f 100644
--- a/MdePkg/Library/BaseLib/Ia32/WriteCr0.S
+++ b/MdePkg/Library/BaseLib/Ia32/WriteCr0.S
@@ -21,22 +21,15 @@
#
#------------------------------------------------------------------------------
-
-
-
-
#------------------------------------------------------------------------------
# UINTN
# EFIAPI
# AsmWriteCr0 (
-# VOID
+# IN UINTN Cr0
# );
#------------------------------------------------------------------------------
.global _AsmWriteCr0
-_AsmWriteCr0:
- movl 4(%esp),%eax
+_AsmWriteCr0:
+ movl 4(%esp), %eax
movl %eax, %cr0
ret
-
-
-
diff --git a/MdePkg/Library/BaseLib/Ia32/WriteCr0.asm b/MdePkg/Library/BaseLib/Ia32/WriteCr0.asm
index d64d621..5eab67f 100644
--- a/MdePkg/Library/BaseLib/Ia32/WriteCr0.asm
+++ b/MdePkg/Library/BaseLib/Ia32/WriteCr0.asm
@@ -22,20 +22,20 @@
;------------------------------------------------------------------------------
.386p
- .model flat
+ .model flat,C
.code
;------------------------------------------------------------------------------
; UINTN
; EFIAPI
; AsmWriteCr0 (
-; VOID
+; UINTN Cr0
; );
;------------------------------------------------------------------------------
-_AsmWriteCr0 PROC
+AsmWriteCr0 PROC
mov eax, [esp + 4]
mov cr0, eax
ret
-_AsmWriteCr0 ENDP
+AsmWriteCr0 ENDP
END
diff --git a/MdePkg/Library/BaseLib/Ia32/WriteCr2.S b/MdePkg/Library/BaseLib/Ia32/WriteCr2.S
index cf45e01..223dbb9 100644
--- a/MdePkg/Library/BaseLib/Ia32/WriteCr2.S
+++ b/MdePkg/Library/BaseLib/Ia32/WriteCr2.S
@@ -21,22 +21,15 @@
#
#------------------------------------------------------------------------------
-
-
-
-
#------------------------------------------------------------------------------
# UINTN
# EFIAPI
# AsmWriteCr2 (
-# VOID
+# IN UINTN Cr2
# );
#------------------------------------------------------------------------------
.global _AsmWriteCr2
-_AsmWriteCr2:
- movl 4(%esp),%eax
+_AsmWriteCr2:
+ movl 4(%esp), %eax
movl %eax, %cr2
ret
-
-
-
diff --git a/MdePkg/Library/BaseLib/Ia32/WriteCr2.asm b/MdePkg/Library/BaseLib/Ia32/WriteCr2.asm
index 7ab5b0f..0df8441 100644
--- a/MdePkg/Library/BaseLib/Ia32/WriteCr2.asm
+++ b/MdePkg/Library/BaseLib/Ia32/WriteCr2.asm
@@ -22,20 +22,20 @@
;------------------------------------------------------------------------------
.386p
- .model flat
+ .model flat,C
.code
;------------------------------------------------------------------------------
; UINTN
; EFIAPI
; AsmWriteCr2 (
-; VOID
+; UINTN Cr2
; );
;------------------------------------------------------------------------------
-_AsmWriteCr2 PROC
+AsmWriteCr2 PROC
mov eax, [esp + 4]
mov cr2, eax
ret
-_AsmWriteCr2 ENDP
+AsmWriteCr2 ENDP
END
diff --git a/MdePkg/Library/BaseLib/Ia32/WriteCr3.S b/MdePkg/Library/BaseLib/Ia32/WriteCr3.S
index 1c55581..3a12755 100644
--- a/MdePkg/Library/BaseLib/Ia32/WriteCr3.S
+++ b/MdePkg/Library/BaseLib/Ia32/WriteCr3.S
@@ -21,22 +21,15 @@
#
#------------------------------------------------------------------------------
-
-
-
-
#------------------------------------------------------------------------------
# UINTN
# EFIAPI
# AsmWriteCr3 (
-# VOID
+# IN UINTN Cr3
# );
#------------------------------------------------------------------------------
.global _AsmWriteCr3
-_AsmWriteCr3:
- movl 4(%esp),%eax
+_AsmWriteCr3:
+ movl 4(%esp), %eax
movl %eax, %cr3
ret
-
-
-
diff --git a/MdePkg/Library/BaseLib/Ia32/WriteCr3.asm b/MdePkg/Library/BaseLib/Ia32/WriteCr3.asm
index 9753de1..32b05fd 100644
--- a/MdePkg/Library/BaseLib/Ia32/WriteCr3.asm
+++ b/MdePkg/Library/BaseLib/Ia32/WriteCr3.asm
@@ -22,20 +22,20 @@
;------------------------------------------------------------------------------
.386p
- .model flat
+ .model flat,C
.code
;------------------------------------------------------------------------------
; UINTN
; EFIAPI
; AsmWriteCr3 (
-; VOID
+; UINTN Cr3
; );
;------------------------------------------------------------------------------
-_AsmWriteCr3 PROC
+AsmWriteCr3 PROC
mov eax, [esp + 4]
mov cr3, eax
ret
-_AsmWriteCr3 ENDP
+AsmWriteCr3 ENDP
END
diff --git a/MdePkg/Library/BaseLib/Ia32/WriteCr4.S b/MdePkg/Library/BaseLib/Ia32/WriteCr4.S
index fbe48c1..4b65a26 100644
--- a/MdePkg/Library/BaseLib/Ia32/WriteCr4.S
+++ b/MdePkg/Library/BaseLib/Ia32/WriteCr4.S
@@ -21,22 +21,15 @@
#
#------------------------------------------------------------------------------
-
-
-
-
#------------------------------------------------------------------------------
# UINTN
# EFIAPI
# AsmWriteCr4 (
-# VOID
+# IN UINTN Cr4
# );
#------------------------------------------------------------------------------
.global _AsmWriteCr4
-_AsmWriteCr4:
- movl 4(%esp),%eax
+_AsmWriteCr4:
+ movl 4(%esp), %eax
movl %eax, %cr4
ret
-
-
-
diff --git a/MdePkg/Library/BaseLib/Ia32/WriteCr4.asm b/MdePkg/Library/BaseLib/Ia32/WriteCr4.asm
index 60bfe78..4ed7f61 100644
--- a/MdePkg/Library/BaseLib/Ia32/WriteCr4.asm
+++ b/MdePkg/Library/BaseLib/Ia32/WriteCr4.asm
@@ -22,20 +22,20 @@
;------------------------------------------------------------------------------
.586p
- .model flat
+ .model flat,C
.code
;------------------------------------------------------------------------------
; UINTN
; EFIAPI
; AsmWriteCr4 (
-; VOID
+; UINTN Cr4
; );
;------------------------------------------------------------------------------
-_AsmWriteCr4 PROC
+AsmWriteCr4 PROC
mov eax, [esp + 4]
mov cr4, eax
ret
-_AsmWriteCr4 ENDP
+AsmWriteCr4 ENDP
END
diff --git a/MdePkg/Library/BaseLib/Ia32/WriteDr0.S b/MdePkg/Library/BaseLib/Ia32/WriteDr0.S
index a5a84de..9faa5a5 100644
--- a/MdePkg/Library/BaseLib/Ia32/WriteDr0.S
+++ b/MdePkg/Library/BaseLib/Ia32/WriteDr0.S
@@ -21,22 +21,15 @@
#
#------------------------------------------------------------------------------
-
-
-
-
#------------------------------------------------------------------------------
-# VOID
+# UINTN
# EFIAPI
# AsmWriteDr0 (
# IN UINTN Value
# );
#------------------------------------------------------------------------------
.global _AsmWriteDr0
-_AsmWriteDr0:
- movl 4(%esp),%eax
+_AsmWriteDr0:
+ movl 4(%esp), %eax
movl %eax, %dr0
ret
-
-
-
diff --git a/MdePkg/Library/BaseLib/Ia32/WriteDr0.asm b/MdePkg/Library/BaseLib/Ia32/WriteDr0.asm
index 3dab544..1bd39d5 100644
--- a/MdePkg/Library/BaseLib/Ia32/WriteDr0.asm
+++ b/MdePkg/Library/BaseLib/Ia32/WriteDr0.asm
@@ -22,20 +22,20 @@
;------------------------------------------------------------------------------
.586p
- .model flat
+ .model flat,C
.code
;------------------------------------------------------------------------------
-; VOID
+; UINTN
; EFIAPI
; AsmWriteDr0 (
; IN UINTN Value
; );
;------------------------------------------------------------------------------
-_AsmWriteDr0 PROC
+AsmWriteDr0 PROC
mov eax, [esp + 4]
mov dr0, eax
ret
-_AsmWriteDr0 ENDP
+AsmWriteDr0 ENDP
END
diff --git a/MdePkg/Library/BaseLib/Ia32/WriteDr1.S b/MdePkg/Library/BaseLib/Ia32/WriteDr1.S
index 66fc2c7..1038cf7 100644
--- a/MdePkg/Library/BaseLib/Ia32/WriteDr1.S
+++ b/MdePkg/Library/BaseLib/Ia32/WriteDr1.S
@@ -21,22 +21,15 @@
#
#------------------------------------------------------------------------------
-
-
-
-
#------------------------------------------------------------------------------
-# VOID
+# UINTN
# EFIAPI
# AsmWriteDr1 (
# IN UINTN Value
# );
#------------------------------------------------------------------------------
.global _AsmWriteDr1
-_AsmWriteDr1:
- movl 4(%esp),%eax
+_AsmWriteDr1:
+ movl 4(%esp), %eax
movl %eax, %dr1
ret
-
-
-
diff --git a/MdePkg/Library/BaseLib/Ia32/WriteDr1.asm b/MdePkg/Library/BaseLib/Ia32/WriteDr1.asm
index 5898206..542125b 100644
--- a/MdePkg/Library/BaseLib/Ia32/WriteDr1.asm
+++ b/MdePkg/Library/BaseLib/Ia32/WriteDr1.asm
@@ -22,20 +22,20 @@
;------------------------------------------------------------------------------
.586p
- .model flat
+ .model flat,C
.code
;------------------------------------------------------------------------------
-; VOID
+; UINTN
; EFIAPI
; AsmWriteDr1 (
; IN UINTN Value
; );
;------------------------------------------------------------------------------
-_AsmWriteDr1 PROC
+AsmWriteDr1 PROC
mov eax, [esp + 4]
mov dr1, eax
ret
-_AsmWriteDr1 ENDP
+AsmWriteDr1 ENDP
END
diff --git a/MdePkg/Library/BaseLib/Ia32/WriteDr2.S b/MdePkg/Library/BaseLib/Ia32/WriteDr2.S
index 7b3f780..4afee11 100644
--- a/MdePkg/Library/BaseLib/Ia32/WriteDr2.S
+++ b/MdePkg/Library/BaseLib/Ia32/WriteDr2.S
@@ -21,22 +21,15 @@
#
#------------------------------------------------------------------------------
-
-
-
-
#------------------------------------------------------------------------------
-# VOID
+# UINTN
# EFIAPI
# AsmWriteDr2 (
# IN UINTN Value
# );
#------------------------------------------------------------------------------
.global _AsmWriteDr2
-_AsmWriteDr2:
- movl 4(%esp),%eax
+_AsmWriteDr2:
+ movl 4(%esp), %eax
movl %eax, %dr2
ret
-
-
-
diff --git a/MdePkg/Library/BaseLib/Ia32/WriteDr2.asm b/MdePkg/Library/BaseLib/Ia32/WriteDr2.asm
index 3ed25fc..7638bab 100644
--- a/MdePkg/Library/BaseLib/Ia32/WriteDr2.asm
+++ b/MdePkg/Library/BaseLib/Ia32/WriteDr2.asm
@@ -22,20 +22,20 @@
;------------------------------------------------------------------------------
.586p
- .model flat
+ .model flat,C
.code
;------------------------------------------------------------------------------
-; VOID
+; UINTN
; EFIAPI
; AsmWriteDr2 (
; IN UINTN Value
; );
;------------------------------------------------------------------------------
-_AsmWriteDr2 PROC
+AsmWriteDr2 PROC
mov eax, [esp + 4]
mov dr2, eax
ret
-_AsmWriteDr2 ENDP
+AsmWriteDr2 ENDP
END
diff --git a/MdePkg/Library/BaseLib/Ia32/WriteDr3.S b/MdePkg/Library/BaseLib/Ia32/WriteDr3.S
index 34d3e4f..3d46fc1 100644
--- a/MdePkg/Library/BaseLib/Ia32/WriteDr3.S
+++ b/MdePkg/Library/BaseLib/Ia32/WriteDr3.S
@@ -21,22 +21,15 @@
#
#------------------------------------------------------------------------------
-
-
-
-
#------------------------------------------------------------------------------
-# VOID
+# UINTN
# EFIAPI
# AsmWriteDr3 (
# IN UINTN Value
# );
#------------------------------------------------------------------------------
.global _AsmWriteDr3
-_AsmWriteDr3:
- movl 4(%esp),%eax
+_AsmWriteDr3:
+ movl 4(%esp), %eax
movl %eax, %dr3
ret
-
-
-
diff --git a/MdePkg/Library/BaseLib/Ia32/WriteDr3.asm b/MdePkg/Library/BaseLib/Ia32/WriteDr3.asm
index c1dbc82..69a17b4 100644
--- a/MdePkg/Library/BaseLib/Ia32/WriteDr3.asm
+++ b/MdePkg/Library/BaseLib/Ia32/WriteDr3.asm
@@ -22,20 +22,20 @@
;------------------------------------------------------------------------------
.586p
- .model flat
+ .model flat,C
.code
;------------------------------------------------------------------------------
-; VOID
+; UINTN
; EFIAPI
; AsmWriteDr3 (
; IN UINTN Value
; );
;------------------------------------------------------------------------------
-_AsmWriteDr3 PROC
+AsmWriteDr3 PROC
mov eax, [esp + 4]
mov dr3, eax
ret
-_AsmWriteDr3 ENDP
+AsmWriteDr3 ENDP
END
diff --git a/MdePkg/Library/BaseLib/Ia32/WriteDr4.S b/MdePkg/Library/BaseLib/Ia32/WriteDr4.S
index 20ddbd2..3c37554 100644
--- a/MdePkg/Library/BaseLib/Ia32/WriteDr4.S
+++ b/MdePkg/Library/BaseLib/Ia32/WriteDr4.S
@@ -21,22 +21,15 @@
#
#------------------------------------------------------------------------------
-
-
-
-
#------------------------------------------------------------------------------
-# VOID
+# UINTN
# EFIAPI
# AsmWriteDr4 (
# IN UINTN Value
# );
#------------------------------------------------------------------------------
.global _AsmWriteDr4
-_AsmWriteDr4:
- movl 4(%esp),%eax
+_AsmWriteDr4:
+ movl 4(%esp), %eax
movl %eax, %dr4
ret
-
-
-
diff --git a/MdePkg/Library/BaseLib/Ia32/WriteDr4.asm b/MdePkg/Library/BaseLib/Ia32/WriteDr4.asm
index 2c82512..ca9a839 100644
--- a/MdePkg/Library/BaseLib/Ia32/WriteDr4.asm
+++ b/MdePkg/Library/BaseLib/Ia32/WriteDr4.asm
@@ -22,20 +22,20 @@
;------------------------------------------------------------------------------
.586p
- .model flat
+ .model flat,C
.code
;------------------------------------------------------------------------------
-; VOID
+; UINTN
; EFIAPI
; AsmWriteDr4 (
; IN UINTN Value
; );
;------------------------------------------------------------------------------
-_AsmWriteDr4 PROC
+AsmWriteDr4 PROC
mov eax, [esp + 4]
DB 0fh, 23h, 0e0h
ret
-_AsmWriteDr4 ENDP
+AsmWriteDr4 ENDP
END
diff --git a/MdePkg/Library/BaseLib/Ia32/WriteDr5.S b/MdePkg/Library/BaseLib/Ia32/WriteDr5.S
index 057928a..4ab45d1 100644
--- a/MdePkg/Library/BaseLib/Ia32/WriteDr5.S
+++ b/MdePkg/Library/BaseLib/Ia32/WriteDr5.S
@@ -21,22 +21,15 @@
#
#------------------------------------------------------------------------------
-
-
-
-
#------------------------------------------------------------------------------
-# VOID
+# UINTN
# EFIAPI
# AsmWriteDr5 (
# IN UINTN Value
# );
#------------------------------------------------------------------------------
.global _AsmWriteDr5
-_AsmWriteDr5:
- movl 4(%esp),%eax
+_AsmWriteDr5:
+ movl 4(%esp), %eax
movl %eax, %dr5
ret
-
-
-
diff --git a/MdePkg/Library/BaseLib/Ia32/WriteDr5.asm b/MdePkg/Library/BaseLib/Ia32/WriteDr5.asm
index dc07424..c6def68 100644
--- a/MdePkg/Library/BaseLib/Ia32/WriteDr5.asm
+++ b/MdePkg/Library/BaseLib/Ia32/WriteDr5.asm
@@ -22,20 +22,20 @@
;------------------------------------------------------------------------------
.586p
- .model flat
+ .model flat,C
.code
;------------------------------------------------------------------------------
-; VOID
+; UINTN
; EFIAPI
; AsmWriteDr5 (
; IN UINTN Value
; );
;------------------------------------------------------------------------------
-_AsmWriteDr5 PROC
+AsmWriteDr5 PROC
mov eax, [esp + 4]
DB 0fh, 23h, 0e8h
ret
-_AsmWriteDr5 ENDP
+AsmWriteDr5 ENDP
END
diff --git a/MdePkg/Library/BaseLib/Ia32/WriteDr6.S b/MdePkg/Library/BaseLib/Ia32/WriteDr6.S
index 7d7726b..be3156a 100644
--- a/MdePkg/Library/BaseLib/Ia32/WriteDr6.S
+++ b/MdePkg/Library/BaseLib/Ia32/WriteDr6.S
@@ -21,22 +21,15 @@
#
#------------------------------------------------------------------------------
-
-
-
-
#------------------------------------------------------------------------------
-# VOID
+# UINTN
# EFIAPI
# AsmWriteDr6 (
# IN UINTN Value
# );
#------------------------------------------------------------------------------
.global _AsmWriteDr6
-_AsmWriteDr6:
- movl 4(%esp),%eax
+_AsmWriteDr6:
+ movl 4(%esp), %eax
movl %eax, %dr6
ret
-
-
-
diff --git a/MdePkg/Library/BaseLib/Ia32/WriteDr6.asm b/MdePkg/Library/BaseLib/Ia32/WriteDr6.asm
index e307e82..4e5acf5 100644
--- a/MdePkg/Library/BaseLib/Ia32/WriteDr6.asm
+++ b/MdePkg/Library/BaseLib/Ia32/WriteDr6.asm
@@ -22,20 +22,20 @@
;------------------------------------------------------------------------------
.586p
- .model flat
+ .model flat,C
.code
;------------------------------------------------------------------------------
-; VOID
+; UINTN
; EFIAPI
; AsmWriteDr6 (
; IN UINTN Value
; );
;------------------------------------------------------------------------------
-_AsmWriteDr6 PROC
+AsmWriteDr6 PROC
mov eax, [esp + 4]
mov dr6, eax
ret
-_AsmWriteDr6 ENDP
+AsmWriteDr6 ENDP
END
diff --git a/MdePkg/Library/BaseLib/Ia32/WriteDr7.S b/MdePkg/Library/BaseLib/Ia32/WriteDr7.S
index a96f445..d38fd98 100644
--- a/MdePkg/Library/BaseLib/Ia32/WriteDr7.S
+++ b/MdePkg/Library/BaseLib/Ia32/WriteDr7.S
@@ -21,22 +21,15 @@
#
#------------------------------------------------------------------------------
-
-
-
-
#------------------------------------------------------------------------------
-# VOID
+# UINTN
# EFIAPI
# AsmWriteDr7 (
# IN UINTN Value
# );
#------------------------------------------------------------------------------
.global _AsmWriteDr7
-_AsmWriteDr7:
- movl 4(%esp),%eax
+_AsmWriteDr7:
+ movl 4(%esp), %eax
movl %eax, %dr7
ret
-
-
-
diff --git a/MdePkg/Library/BaseLib/Ia32/WriteDr7.asm b/MdePkg/Library/BaseLib/Ia32/WriteDr7.asm
index 55dbdc9..10e83d6 100644
--- a/MdePkg/Library/BaseLib/Ia32/WriteDr7.asm
+++ b/MdePkg/Library/BaseLib/Ia32/WriteDr7.asm
@@ -22,20 +22,20 @@
;------------------------------------------------------------------------------
.586p
- .model flat
+ .model flat,C
.code
;------------------------------------------------------------------------------
-; VOID
+; UINTN
; EFIAPI
; AsmWriteDr7 (
; IN UINTN Value
; );
;------------------------------------------------------------------------------
-_AsmWriteDr7 PROC
+AsmWriteDr7 PROC
mov eax, [esp + 4]
mov dr7, eax
ret
-_AsmWriteDr7 ENDP
+AsmWriteDr7 ENDP
END
diff --git a/MdePkg/Library/BaseLib/Ia32/WriteGdtr.S b/MdePkg/Library/BaseLib/Ia32/WriteGdtr.S
index 5060071..f8f700f 100644
--- a/MdePkg/Library/BaseLib/Ia32/WriteGdtr.S
+++ b/MdePkg/Library/BaseLib/Ia32/WriteGdtr.S
@@ -21,10 +21,6 @@
#
#------------------------------------------------------------------------------
-
-
-
-
#------------------------------------------------------------------------------
# VOID
# EFIAPI
@@ -33,10 +29,7 @@
# );
#------------------------------------------------------------------------------
.global _InternalX86WriteGdtr
-_InternalX86WriteGdtr:
- movl 4(%esp),%eax
+_InternalX86WriteGdtr:
+ movl 4(%esp), %eax
lgdt (%eax)
ret
-
-
-
diff --git a/MdePkg/Library/BaseLib/Ia32/WriteGdtr.asm b/MdePkg/Library/BaseLib/Ia32/WriteGdtr.asm
index a317e75..f1c7a92 100644
--- a/MdePkg/Library/BaseLib/Ia32/WriteGdtr.asm
+++ b/MdePkg/Library/BaseLib/Ia32/WriteGdtr.asm
@@ -21,10 +21,17 @@
;
;------------------------------------------------------------------------------
- .686P
+ .386p
.model flat,C
.code
+;------------------------------------------------------------------------------
+; VOID
+; EFIAPI
+; InternalX86WriteGdtr (
+; IN CONST IA32_DESCRIPTOR *Idtr
+; );
+;------------------------------------------------------------------------------
InternalX86WriteGdtr PROC
mov eax, [esp + 4]
lgdt fword ptr [eax]
diff --git a/MdePkg/Library/BaseLib/Ia32/WriteIdtr.S b/MdePkg/Library/BaseLib/Ia32/WriteIdtr.S
index 3e6da5c..fc5e6cd 100644
--- a/MdePkg/Library/BaseLib/Ia32/WriteIdtr.S
+++ b/MdePkg/Library/BaseLib/Ia32/WriteIdtr.S
@@ -21,10 +21,6 @@
#
#------------------------------------------------------------------------------
-
-
-
-
#------------------------------------------------------------------------------
# VOID
# EFIAPI
@@ -33,10 +29,7 @@
# );
#------------------------------------------------------------------------------
.global _InternalX86WriteIdtr
-_InternalX86WriteIdtr:
- movl 4(%esp),%eax
+_InternalX86WriteIdtr:
+ movl 4(%esp), %eax
lidt (%eax)
ret
-
-
-
diff --git a/MdePkg/Library/BaseLib/Ia32/WriteIdtr.asm b/MdePkg/Library/BaseLib/Ia32/WriteIdtr.asm
index d4b3b51..65fca40 100644
--- a/MdePkg/Library/BaseLib/Ia32/WriteIdtr.asm
+++ b/MdePkg/Library/BaseLib/Ia32/WriteIdtr.asm
@@ -21,10 +21,17 @@
;
;------------------------------------------------------------------------------
- .686P
+ .386p
.model flat,C
.code
+;------------------------------------------------------------------------------
+; VOID
+; EFIAPI
+; InternalX86WriteIdtr (
+; IN CONST IA32_DESCRIPTOR *Idtr
+; );
+;------------------------------------------------------------------------------
InternalX86WriteIdtr PROC
mov eax, [esp + 4]
lidt fword ptr [eax]
diff --git a/MdePkg/Library/BaseLib/Ia32/WriteLdtr.S b/MdePkg/Library/BaseLib/Ia32/WriteLdtr.S
index 3797bd5..2be1e9d 100644
--- a/MdePkg/Library/BaseLib/Ia32/WriteLdtr.S
+++ b/MdePkg/Library/BaseLib/Ia32/WriteLdtr.S
@@ -21,10 +21,6 @@
#
#------------------------------------------------------------------------------
-
-
-
-
#------------------------------------------------------------------------------
# VOID
# EFIAPI
@@ -33,10 +29,7 @@
# );
#------------------------------------------------------------------------------
.global _AsmWriteLdtr
-_AsmWriteLdtr:
- movl 4(%esp),%eax
+_AsmWriteLdtr:
+ movl 4(%esp), %eax
lldtw %ax
ret
-
-
-
diff --git a/MdePkg/Library/BaseLib/Ia32/WriteMm0.S b/MdePkg/Library/BaseLib/Ia32/WriteMm0.S
index c444421..a3dca7d 100644
--- a/MdePkg/Library/BaseLib/Ia32/WriteMm0.S
+++ b/MdePkg/Library/BaseLib/Ia32/WriteMm0.S
@@ -21,22 +21,14 @@
#
#------------------------------------------------------------------------------
-
-
-
-
-
#------------------------------------------------------------------------------
-# UINT64
+# VOID
# EFIAPI
# AsmWriteMm0 (
# IN UINT64 Value
# );
#------------------------------------------------------------------------------
.global _AsmWriteMm0
-_AsmWriteMm0:
- movq 4(%esp),%mm0
+_AsmWriteMm0:
+ movq 4(%esp), %mm0
ret
-
-
-
diff --git a/MdePkg/Library/BaseLib/Ia32/WriteMm0.asm b/MdePkg/Library/BaseLib/Ia32/WriteMm0.asm
index e924dbd..15912f6 100644
--- a/MdePkg/Library/BaseLib/Ia32/WriteMm0.asm
+++ b/MdePkg/Library/BaseLib/Ia32/WriteMm0.asm
@@ -21,21 +21,21 @@
;
;------------------------------------------------------------------------------
- .586P
- .model flat
- .xmm
+ .586
+ .model flat,C
+ .mmx
.code
;------------------------------------------------------------------------------
-; UINT64
+; VOID
; EFIAPI
; AsmWriteMm0 (
; IN UINT64 Value
; );
;------------------------------------------------------------------------------
-_AsmWriteMm0 PROC
+AsmWriteMm0 PROC
movq mm0, [esp + 4]
ret
-_AsmWriteMm0 ENDP
+AsmWriteMm0 ENDP
END
diff --git a/MdePkg/Library/BaseLib/Ia32/WriteMm1.S b/MdePkg/Library/BaseLib/Ia32/WriteMm1.S
index e3a492f..62ef07d 100644
--- a/MdePkg/Library/BaseLib/Ia32/WriteMm1.S
+++ b/MdePkg/Library/BaseLib/Ia32/WriteMm1.S
@@ -21,22 +21,14 @@
#
#------------------------------------------------------------------------------
-
-
-
-
-
#------------------------------------------------------------------------------
-# UINT64
+# VOID
# EFIAPI
# AsmWriteMm1 (
# IN UINT64 Value
# );
#------------------------------------------------------------------------------
.global _AsmWriteMm1
-_AsmWriteMm1:
- movq 4(%esp),%mm1
+_AsmWriteMm1:
+ movq 4(%esp), %mm1
ret
-
-
-
diff --git a/MdePkg/Library/BaseLib/Ia32/WriteMm1.asm b/MdePkg/Library/BaseLib/Ia32/WriteMm1.asm
index 1f1d8ce..097e760 100644
--- a/MdePkg/Library/BaseLib/Ia32/WriteMm1.asm
+++ b/MdePkg/Library/BaseLib/Ia32/WriteMm1.asm
@@ -21,21 +21,21 @@
;
;------------------------------------------------------------------------------
- .586P
- .model flat
- .xmm
+ .586
+ .model flat,C
+ .mmx
.code
;------------------------------------------------------------------------------
-; UINT64
+; VOID
; EFIAPI
; AsmWriteMm1 (
; IN UINT64 Value
; );
;------------------------------------------------------------------------------
-_AsmWriteMm1 PROC
+AsmWriteMm1 PROC
movq mm1, [esp + 4]
ret
-_AsmWriteMm1 ENDP
+AsmWriteMm1 ENDP
END
diff --git a/MdePkg/Library/BaseLib/Ia32/WriteMm2.S b/MdePkg/Library/BaseLib/Ia32/WriteMm2.S
index eaebb37..b43d455 100644
--- a/MdePkg/Library/BaseLib/Ia32/WriteMm2.S
+++ b/MdePkg/Library/BaseLib/Ia32/WriteMm2.S
@@ -21,22 +21,14 @@
#
#------------------------------------------------------------------------------
-
-
-
-
-
#------------------------------------------------------------------------------
-# UINT64
+# VOID
# EFIAPI
# AsmWriteMm2 (
# IN UINT64 Value
# );
#------------------------------------------------------------------------------
.global _AsmWriteMm2
-_AsmWriteMm2:
- movq 4(%esp),%mm2
+_AsmWriteMm2:
+ movq 4(%esp), %mm2
ret
-
-
-
diff --git a/MdePkg/Library/BaseLib/Ia32/WriteMm2.asm b/MdePkg/Library/BaseLib/Ia32/WriteMm2.asm
index a18417a..fea7081 100644
--- a/MdePkg/Library/BaseLib/Ia32/WriteMm2.asm
+++ b/MdePkg/Library/BaseLib/Ia32/WriteMm2.asm
@@ -21,21 +21,21 @@
;
;------------------------------------------------------------------------------
- .586P
- .model flat
- .xmm
+ .586
+ .model flat,C
+ .mmx
.code
;------------------------------------------------------------------------------
-; UINT64
+; VOID
; EFIAPI
; AsmWriteMm2 (
; IN UINT64 Value
; );
;------------------------------------------------------------------------------
-_AsmWriteMm2 PROC
+AsmWriteMm2 PROC
movq mm2, [esp + 4]
ret
-_AsmWriteMm2 ENDP
+AsmWriteMm2 ENDP
END
diff --git a/MdePkg/Library/BaseLib/Ia32/WriteMm3.S b/MdePkg/Library/BaseLib/Ia32/WriteMm3.S
index a514091..ffc5c35 100644
--- a/MdePkg/Library/BaseLib/Ia32/WriteMm3.S
+++ b/MdePkg/Library/BaseLib/Ia32/WriteMm3.S
@@ -21,22 +21,14 @@
#
#------------------------------------------------------------------------------
-
-
-
-
-
#------------------------------------------------------------------------------
-# UINT64
+# VOID
# EFIAPI
# AsmWriteMm3 (
# IN UINT64 Value
# );
#------------------------------------------------------------------------------
.global _AsmWriteMm3
-_AsmWriteMm3:
- movq 4(%esp),%mm3
+_AsmWriteMm3:
+ movq 4(%esp), %mm3
ret
-
-
-
diff --git a/MdePkg/Library/BaseLib/Ia32/WriteMm3.asm b/MdePkg/Library/BaseLib/Ia32/WriteMm3.asm
index 7aad49f..1af2490 100644
--- a/MdePkg/Library/BaseLib/Ia32/WriteMm3.asm
+++ b/MdePkg/Library/BaseLib/Ia32/WriteMm3.asm
@@ -21,21 +21,21 @@
;
;------------------------------------------------------------------------------
- .586P
- .model flat
- .xmm
+ .586
+ .model flat,C
+ .mmx
.code
;------------------------------------------------------------------------------
-; UINT64
+; VOID
; EFIAPI
; AsmWriteMm3 (
; IN UINT64 Value
; );
;------------------------------------------------------------------------------
-_AsmWriteMm3 PROC
+AsmWriteMm3 PROC
movq mm3, [esp + 4]
ret
-_AsmWriteMm3 ENDP
+AsmWriteMm3 ENDP
END
diff --git a/MdePkg/Library/BaseLib/Ia32/WriteMm4.S b/MdePkg/Library/BaseLib/Ia32/WriteMm4.S
index 6d4a6cd..01fde70 100644
--- a/MdePkg/Library/BaseLib/Ia32/WriteMm4.S
+++ b/MdePkg/Library/BaseLib/Ia32/WriteMm4.S
@@ -21,22 +21,14 @@
#
#------------------------------------------------------------------------------
-
-
-
-
-
#------------------------------------------------------------------------------
-# UINT64
+# VOID
# EFIAPI
# AsmWriteMm4 (
# IN UINT64 Value
# );
#------------------------------------------------------------------------------
.global _AsmWriteMm4
-_AsmWriteMm4:
- movq 4(%esp),%mm4
+_AsmWriteMm4:
+ movq 4(%esp), %mm4
ret
-
-
-
diff --git a/MdePkg/Library/BaseLib/Ia32/WriteMm4.asm b/MdePkg/Library/BaseLib/Ia32/WriteMm4.asm
index 8be9c4b..2cf9da0 100644
--- a/MdePkg/Library/BaseLib/Ia32/WriteMm4.asm
+++ b/MdePkg/Library/BaseLib/Ia32/WriteMm4.asm
@@ -21,21 +21,21 @@
;
;------------------------------------------------------------------------------
- .586P
- .model flat
- .xmm
+ .586
+ .model flat,C
+ .mmx
.code
;------------------------------------------------------------------------------
-; UINT64
+; VOID
; EFIAPI
; AsmWriteMm4 (
; IN UINT64 Value
; );
;------------------------------------------------------------------------------
-_AsmWriteMm4 PROC
+AsmWriteMm4 PROC
movq mm4, [esp + 4]
ret
-_AsmWriteMm4 ENDP
+AsmWriteMm4 ENDP
END
diff --git a/MdePkg/Library/BaseLib/Ia32/WriteMm5.S b/MdePkg/Library/BaseLib/Ia32/WriteMm5.S
index 15d4332..9effef0 100644
--- a/MdePkg/Library/BaseLib/Ia32/WriteMm5.S
+++ b/MdePkg/Library/BaseLib/Ia32/WriteMm5.S
@@ -21,22 +21,14 @@
#
#------------------------------------------------------------------------------
-
-
-
-
-
#------------------------------------------------------------------------------
-# UINT64
+# VOID
# EFIAPI
# AsmWriteMm5 (
# IN UINT64 Value
# );
#------------------------------------------------------------------------------
.global _AsmWriteMm5
-_AsmWriteMm5:
- movq 4(%esp),%mm5
+_AsmWriteMm5:
+ movq 4(%esp), %mm5
ret
-
-
-
diff --git a/MdePkg/Library/BaseLib/Ia32/WriteMm5.asm b/MdePkg/Library/BaseLib/Ia32/WriteMm5.asm
index bc501b3..9c9882e 100644
--- a/MdePkg/Library/BaseLib/Ia32/WriteMm5.asm
+++ b/MdePkg/Library/BaseLib/Ia32/WriteMm5.asm
@@ -21,21 +21,21 @@
;
;------------------------------------------------------------------------------
- .586P
- .model flat
- .xmm
+ .586
+ .model flat,C
+ .mmx
.code
;------------------------------------------------------------------------------
-; UINT64
+; VOID
; EFIAPI
; AsmWriteMm5 (
; IN UINT64 Value
; );
;------------------------------------------------------------------------------
-_AsmWriteMm5 PROC
+AsmWriteMm5 PROC
movq mm5, [esp + 4]
ret
-_AsmWriteMm5 ENDP
+AsmWriteMm5 ENDP
END
diff --git a/MdePkg/Library/BaseLib/Ia32/WriteMm6.S b/MdePkg/Library/BaseLib/Ia32/WriteMm6.S
index 6b1361e..c1ecd9e 100644
--- a/MdePkg/Library/BaseLib/Ia32/WriteMm6.S
+++ b/MdePkg/Library/BaseLib/Ia32/WriteMm6.S
@@ -21,22 +21,14 @@
#
#------------------------------------------------------------------------------
-
-
-
-
-
#------------------------------------------------------------------------------
-# UINT64
+# VOID
# EFIAPI
# AsmWriteMm6 (
# IN UINT64 Value
# );
#------------------------------------------------------------------------------
.global _AsmWriteMm6
-_AsmWriteMm6:
- movq 4(%esp),%mm6
+_AsmWriteMm6:
+ movq 4(%esp), %mm6
ret
-
-
-
diff --git a/MdePkg/Library/BaseLib/Ia32/WriteMm6.asm b/MdePkg/Library/BaseLib/Ia32/WriteMm6.asm
index 4a6445c..5e0cfad 100644
--- a/MdePkg/Library/BaseLib/Ia32/WriteMm6.asm
+++ b/MdePkg/Library/BaseLib/Ia32/WriteMm6.asm
@@ -21,21 +21,21 @@
;
;------------------------------------------------------------------------------
- .586P
- .model flat
- .xmm
+ .586
+ .model flat,C
+ .mmx
.code
;------------------------------------------------------------------------------
-; UINT64
+; VOID
; EFIAPI
; AsmWriteMm6 (
; IN UINT64 Value
; );
;------------------------------------------------------------------------------
-_AsmWriteMm6 PROC
+AsmWriteMm6 PROC
movq mm6, [esp + 4]
ret
-_AsmWriteMm6 ENDP
+AsmWriteMm6 ENDP
END
diff --git a/MdePkg/Library/BaseLib/Ia32/WriteMm7.S b/MdePkg/Library/BaseLib/Ia32/WriteMm7.S
index d702fbb..c7cb088 100644
--- a/MdePkg/Library/BaseLib/Ia32/WriteMm7.S
+++ b/MdePkg/Library/BaseLib/Ia32/WriteMm7.S
@@ -21,22 +21,14 @@
#
#------------------------------------------------------------------------------
-
-
-
-
-
#------------------------------------------------------------------------------
-# UINT64
+# VOID
# EFIAPI
# AsmWriteMm7 (
# IN UINT64 Value
# );
#------------------------------------------------------------------------------
.global _AsmWriteMm7
-_AsmWriteMm7:
- movq 4(%esp),%mm7
+_AsmWriteMm7:
+ movq 4(%esp), %mm7
ret
-
-
-
diff --git a/MdePkg/Library/BaseLib/Ia32/WriteMm7.asm b/MdePkg/Library/BaseLib/Ia32/WriteMm7.asm
index 3bc73fe..faaa23b 100644
--- a/MdePkg/Library/BaseLib/Ia32/WriteMm7.asm
+++ b/MdePkg/Library/BaseLib/Ia32/WriteMm7.asm
@@ -21,21 +21,21 @@
;
;------------------------------------------------------------------------------
- .586P
- .model flat
- .xmm
+ .586
+ .model flat,C
+ .mmx
.code
;------------------------------------------------------------------------------
-; UINT64
+; VOID
; EFIAPI
; AsmWriteMm7 (
; IN UINT64 Value
; );
;------------------------------------------------------------------------------
-_AsmWriteMm7 PROC
+AsmWriteMm7 PROC
movq mm7, [esp + 4]
ret
-_AsmWriteMm7 ENDP
+AsmWriteMm7 ENDP
END
diff --git a/MdePkg/Library/BaseLib/Ia32/WriteMsr32.S b/MdePkg/Library/BaseLib/Ia32/WriteMsr32.S
deleted file mode 100644
index 450b3b7..0000000
--- a/MdePkg/Library/BaseLib/Ia32/WriteMsr32.S
+++ /dev/null
@@ -1,45 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006, Intel Corporation
-# All rights reserved. This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# WriteMsr32.Asm
-#
-# Abstract:
-#
-# AsmWriteMsr32 function
-#
-# Notes:
-#
-#------------------------------------------------------------------------------
-
-
-
-
-
-#------------------------------------------------------------------------------
-# UINT32
-# EFIAPI
-# AsmWriteMsr32 (
-# IN UINT32 Index,
-# IN UINT32 Value
-# );
-#------------------------------------------------------------------------------
-.global _AsmWriteMsr32
-_AsmWriteMsr32:
- movl 8(%esp),%eax
- xorl %edx,%edx
- movl 4(%esp),%ecx
- wrmsr
- ret
-
-
-
diff --git a/MdePkg/Library/BaseLib/Ia32/WriteMsr32.asm b/MdePkg/Library/BaseLib/Ia32/WriteMsr32.asm
deleted file mode 100644
index ba14514..0000000
--- a/MdePkg/Library/BaseLib/Ia32/WriteMsr32.asm
+++ /dev/null
@@ -1,44 +0,0 @@
-;------------------------------------------------------------------------------
-;
-; Copyright (c) 2006, Intel Corporation
-; All rights reserved. This program and the accompanying materials
-; are licensed and made available under the terms and conditions of the BSD License
-; which accompanies this distribution. The full text of the license may be found at
-; http://opensource.org/licenses/bsd-license.php
-;
-; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-;
-; Module Name:
-;
-; WriteMsr32.Asm
-;
-; Abstract:
-;
-; AsmWriteMsr32 function
-;
-; Notes:
-;
-;------------------------------------------------------------------------------
-
- .586P
- .model flat
- .code
-
-;------------------------------------------------------------------------------
-; UINT32
-; EFIAPI
-; AsmWriteMsr32 (
-; IN UINT32 Index,
-; IN UINT32 Value
-; );
-;------------------------------------------------------------------------------
-_AsmWriteMsr32 PROC
- mov eax, [esp + 8]
- xor edx, edx
- mov ecx, [esp + 4]
- wrmsr
- ret
-_AsmWriteMsr32 ENDP
-
- END
diff --git a/MdePkg/Library/BaseLib/Ia32/WriteMsr64.S b/MdePkg/Library/BaseLib/Ia32/WriteMsr64.S
index 802aad7..8af2147 100644
--- a/MdePkg/Library/BaseLib/Ia32/WriteMsr64.S
+++ b/MdePkg/Library/BaseLib/Ia32/WriteMsr64.S
@@ -21,10 +21,6 @@
#
#------------------------------------------------------------------------------
-
-
-
-
#------------------------------------------------------------------------------
# UINT64
# EFIAPI
@@ -34,12 +30,9 @@
# );
#------------------------------------------------------------------------------
.global _AsmWriteMsr64
-_AsmWriteMsr64:
- movl 12(%esp),%edx
- movl 8(%esp),%eax
- movl 4(%esp),%ecx
+_AsmWriteMsr64:
+ movl 12(%esp), %edx
+ movl 8(%esp), %eax
+ movl 4(%esp), %ecx
wrmsr
ret
-
-
-
diff --git a/MdePkg/Library/BaseLib/Ia32/WriteMsr64.asm b/MdePkg/Library/BaseLib/Ia32/WriteMsr64.asm
index 5afc074..14edba6 100644
--- a/MdePkg/Library/BaseLib/Ia32/WriteMsr64.asm
+++ b/MdePkg/Library/BaseLib/Ia32/WriteMsr64.asm
@@ -21,8 +21,8 @@
;
;------------------------------------------------------------------------------
- .586P
- .model flat
+ .586p
+ .model flat,C
.code
;------------------------------------------------------------------------------
@@ -33,12 +33,12 @@
; IN UINT64 Value
; );
;------------------------------------------------------------------------------
-_AsmWriteMsr64 PROC
+AsmWriteMsr64 PROC
mov edx, [esp + 12]
mov eax, [esp + 8]
mov ecx, [esp + 4]
wrmsr
ret
-_AsmWriteMsr64 ENDP
+AsmWriteMsr64 ENDP
END
diff --git a/MdePkg/Library/BaseLib/SetJump.c b/MdePkg/Library/BaseLib/SetJump.c
index 8bac97a..f03479a 100644
--- a/MdePkg/Library/BaseLib/SetJump.c
+++ b/MdePkg/Library/BaseLib/SetJump.c
@@ -26,6 +26,7 @@
**/
VOID
+EFIAPI
InternalAssertJumpBuffer (
IN BASE_LIBRARY_JUMP_BUFFER *JumpBuffer
)
diff --git a/MdePkg/Library/BaseLib/X64/DisablePaging64.asm b/MdePkg/Library/BaseLib/X64/DisablePaging64.asm
index 7b1e1b8..2609c94 100644
--- a/MdePkg/Library/BaseLib/X64/DisablePaging64.asm
+++ b/MdePkg/Library/BaseLib/X64/DisablePaging64.asm
@@ -23,6 +23,17 @@
.code
+;------------------------------------------------------------------------------
+; VOID
+; EFIAPI
+; InternalX86DisablePaging64 (
+; IN UINT16 Cs,
+; IN UINT32 EntryPoint,
+; IN UINT32 Context1, OPTIONAL
+; IN UINT32 Context2, OPTIONAL
+; IN UINT32 NewStack
+; );
+;------------------------------------------------------------------------------
InternalX86DisablePaging64 PROC
cli
shl rcx, 32
diff --git a/MdePkg/Library/BaseLib/X64/FxRestore.asm b/MdePkg/Library/BaseLib/X64/FxRestore.asm
index 8acfc2f..7e7037e 100644
--- a/MdePkg/Library/BaseLib/X64/FxRestore.asm
+++ b/MdePkg/Library/BaseLib/X64/FxRestore.asm
@@ -23,6 +23,13 @@
.code
+;------------------------------------------------------------------------------
+; VOID
+; EFIAPI
+; InternalX86FxRestore (
+; IN CONST IA32_FX_BUFFER *Buffer
+; );
+;------------------------------------------------------------------------------
InternalX86FxRestore PROC
fxrstor [rcx]
ret
diff --git a/MdePkg/Library/BaseLib/X64/FxSave.asm b/MdePkg/Library/BaseLib/X64/FxSave.asm
index cacb1f5..ea19cd1 100644
--- a/MdePkg/Library/BaseLib/X64/FxSave.asm
+++ b/MdePkg/Library/BaseLib/X64/FxSave.asm
@@ -23,6 +23,13 @@
.code
+;------------------------------------------------------------------------------
+; VOID
+; EFIAPI
+; InternalX86FxSave (
+; OUT IA32_FX_BUFFER *Buffer
+; );
+;------------------------------------------------------------------------------
InternalX86FxSave PROC
fxsave [rcx]
ret
diff --git a/MdePkg/Library/BaseLib/X64/LongJump.asm b/MdePkg/Library/BaseLib/X64/LongJump.asm
index fb6378d..6ef5f96 100644
--- a/MdePkg/Library/BaseLib/X64/LongJump.asm
+++ b/MdePkg/Library/BaseLib/X64/LongJump.asm
@@ -21,6 +21,14 @@
.code
+;------------------------------------------------------------------------------
+; VOID
+; EFIAPI
+; InternalLongJump (
+; IN BASE_LIBRARY_JUMP_BUFFER *JumpBuffer,
+; IN UINTN Value
+; );
+;------------------------------------------------------------------------------
InternalLongJump PROC
mov rbx, [rcx]
mov rsp, [rcx + 8]
diff --git a/MdePkg/Library/BaseLib/X64/ReadCs.asm b/MdePkg/Library/BaseLib/X64/ReadCs.asm
index 126149a..642ce5b 100644
--- a/MdePkg/Library/BaseLib/X64/ReadCs.asm
+++ b/MdePkg/Library/BaseLib/X64/ReadCs.asm
@@ -31,7 +31,7 @@
; );
;------------------------------------------------------------------------------
AsmReadCs PROC
- mov ax, cs
+ mov eax, cs
ret
AsmReadCs ENDP
diff --git a/MdePkg/Library/BaseLib/X64/ReadDs.asm b/MdePkg/Library/BaseLib/X64/ReadDs.asm
index bdcddb6..6f26298 100644
--- a/MdePkg/Library/BaseLib/X64/ReadDs.asm
+++ b/MdePkg/Library/BaseLib/X64/ReadDs.asm
@@ -31,9 +31,8 @@
; );
;------------------------------------------------------------------------------
AsmReadDs PROC
- mov ax, ds
+ mov eax, ds
ret
AsmReadDs ENDP
END
-
diff --git a/MdePkg/Library/BaseLib/X64/ReadEs.asm b/MdePkg/Library/BaseLib/X64/ReadEs.asm
index 40384bc..d5fe84d 100644
--- a/MdePkg/Library/BaseLib/X64/ReadEs.asm
+++ b/MdePkg/Library/BaseLib/X64/ReadEs.asm
@@ -31,7 +31,7 @@
; );
;------------------------------------------------------------------------------
AsmReadEs PROC
- mov ax, es
+ mov eax, es
ret
AsmReadEs ENDP
diff --git a/MdePkg/Library/BaseLib/X64/ReadFs.asm b/MdePkg/Library/BaseLib/X64/ReadFs.asm
index b63e474..d44ee54 100644
--- a/MdePkg/Library/BaseLib/X64/ReadFs.asm
+++ b/MdePkg/Library/BaseLib/X64/ReadFs.asm
@@ -31,7 +31,7 @@
; );
;------------------------------------------------------------------------------
AsmReadFs PROC
- mov ax, fs
+ mov eax, fs
ret
AsmReadFs ENDP
diff --git a/MdePkg/Library/BaseLib/X64/ReadGdtr.asm b/MdePkg/Library/BaseLib/X64/ReadGdtr.asm
index 2d40599..0bc2949 100644
--- a/MdePkg/Library/BaseLib/X64/ReadGdtr.asm
+++ b/MdePkg/Library/BaseLib/X64/ReadGdtr.asm
@@ -23,6 +23,13 @@
.code
+;------------------------------------------------------------------------------
+; VOID
+; EFIAPI
+; InternalX86ReadGdtr (
+; OUT IA32_DESCRIPTOR *Gdtr
+; );
+;------------------------------------------------------------------------------
InternalX86ReadGdtr PROC
sgdt fword ptr [rcx]
ret
diff --git a/MdePkg/Library/BaseLib/X64/ReadGs.asm b/MdePkg/Library/BaseLib/X64/ReadGs.asm
index 02d140e..bc5de76 100644
--- a/MdePkg/Library/BaseLib/X64/ReadGs.asm
+++ b/MdePkg/Library/BaseLib/X64/ReadGs.asm
@@ -31,7 +31,7 @@
; );
;------------------------------------------------------------------------------
AsmReadGs PROC
- mov ax, gs
+ mov eax, gs
ret
AsmReadGs ENDP
diff --git a/MdePkg/Library/BaseLib/X64/ReadIdtr.asm b/MdePkg/Library/BaseLib/X64/ReadIdtr.asm
index 260f697..db684f3 100644
--- a/MdePkg/Library/BaseLib/X64/ReadIdtr.asm
+++ b/MdePkg/Library/BaseLib/X64/ReadIdtr.asm
@@ -23,6 +23,13 @@
.code
+;------------------------------------------------------------------------------
+; VOID
+; EFIAPI
+; InternalX86ReadIdtr (
+; OUT IA32_DESCRIPTOR *Idtr
+; );
+;------------------------------------------------------------------------------
InternalX86ReadIdtr PROC
sidt fword ptr [rcx]
ret
diff --git a/MdePkg/Library/BaseLib/X64/ReadMm0.asm b/MdePkg/Library/BaseLib/X64/ReadMm0.asm
index 1239bca..a81d208 100644
--- a/MdePkg/Library/BaseLib/X64/ReadMm0.asm
+++ b/MdePkg/Library/BaseLib/X64/ReadMm0.asm
@@ -24,7 +24,7 @@
.code
;------------------------------------------------------------------------------
-; UINTN
+; UINT64
; EFIAPI
; AsmReadMm0 (
; VOID
diff --git a/MdePkg/Library/BaseLib/X64/ReadMm1.asm b/MdePkg/Library/BaseLib/X64/ReadMm1.asm
index b42bd7f..5da8c4f 100644
--- a/MdePkg/Library/BaseLib/X64/ReadMm1.asm
+++ b/MdePkg/Library/BaseLib/X64/ReadMm1.asm
@@ -24,7 +24,7 @@
.code
;------------------------------------------------------------------------------
-; UINTN
+; UINT64
; EFIAPI
; AsmReadMm1 (
; VOID
diff --git a/MdePkg/Library/BaseLib/X64/ReadMm2.asm b/MdePkg/Library/BaseLib/X64/ReadMm2.asm
index b10782e..3b2b1e3 100644
--- a/MdePkg/Library/BaseLib/X64/ReadMm2.asm
+++ b/MdePkg/Library/BaseLib/X64/ReadMm2.asm
@@ -24,7 +24,7 @@
.code
;------------------------------------------------------------------------------
-; UINTN
+; UINT64
; EFIAPI
; AsmReadMm2 (
; VOID
diff --git a/MdePkg/Library/BaseLib/X64/ReadMm3.asm b/MdePkg/Library/BaseLib/X64/ReadMm3.asm
index 15a9647..6283c30 100644
--- a/MdePkg/Library/BaseLib/X64/ReadMm3.asm
+++ b/MdePkg/Library/BaseLib/X64/ReadMm3.asm
@@ -24,7 +24,7 @@
.code
;------------------------------------------------------------------------------
-; UINTN
+; UINT64
; EFIAPI
; AsmReadMm3 (
; VOID
diff --git a/MdePkg/Library/BaseLib/X64/ReadMm4.asm b/MdePkg/Library/BaseLib/X64/ReadMm4.asm
index 73f5283..a65f130 100644
--- a/MdePkg/Library/BaseLib/X64/ReadMm4.asm
+++ b/MdePkg/Library/BaseLib/X64/ReadMm4.asm
@@ -24,7 +24,7 @@
.code
;------------------------------------------------------------------------------
-; UINTN
+; UINT64
; EFIAPI
; AsmReadMm4 (
; VOID
diff --git a/MdePkg/Library/BaseLib/X64/ReadMm5.asm b/MdePkg/Library/BaseLib/X64/ReadMm5.asm
index a487889..5295c38 100644
--- a/MdePkg/Library/BaseLib/X64/ReadMm5.asm
+++ b/MdePkg/Library/BaseLib/X64/ReadMm5.asm
@@ -24,7 +24,7 @@
.code
;------------------------------------------------------------------------------
-; UINTN
+; UINT64
; EFIAPI
; AsmReadMm5 (
; VOID
diff --git a/MdePkg/Library/BaseLib/X64/ReadMm6.asm b/MdePkg/Library/BaseLib/X64/ReadMm6.asm
index 56f81bf..acdc99b 100644
--- a/MdePkg/Library/BaseLib/X64/ReadMm6.asm
+++ b/MdePkg/Library/BaseLib/X64/ReadMm6.asm
@@ -24,7 +24,7 @@
.code
;------------------------------------------------------------------------------
-; UINTN
+; UINT64
; EFIAPI
; AsmReadMm6 (
; VOID
diff --git a/MdePkg/Library/BaseLib/X64/ReadMm7.asm b/MdePkg/Library/BaseLib/X64/ReadMm7.asm
index e3ad6bb..7a1b4e6 100644
--- a/MdePkg/Library/BaseLib/X64/ReadMm7.asm
+++ b/MdePkg/Library/BaseLib/X64/ReadMm7.asm
@@ -24,7 +24,7 @@
.code
;------------------------------------------------------------------------------
-; UINTN
+; UINT64
; EFIAPI
; AsmReadMm7 (
; VOID
diff --git a/MdePkg/Library/BaseLib/X64/ReadMsr32.asm b/MdePkg/Library/BaseLib/X64/ReadMsr32.asm
deleted file mode 100644
index 271eabb..0000000
--- a/MdePkg/Library/BaseLib/X64/ReadMsr32.asm
+++ /dev/null
@@ -1,38 +0,0 @@
-;------------------------------------------------------------------------------
-;
-; Copyright (c) 2006, Intel Corporation
-; All rights reserved. This program and the accompanying materials
-; are licensed and made available under the terms and conditions of the BSD License
-; which accompanies this distribution. The full text of the license may be found at
-; http://opensource.org/licenses/bsd-license.php
-;
-; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-;
-; Module Name:
-;
-; ReadMsr32.Asm
-;
-; Abstract:
-;
-; AsmReadMsr32 function
-;
-; Notes:
-;
-;------------------------------------------------------------------------------
-
- .code
-
-;------------------------------------------------------------------------------
-; UINT32
-; EFIAPI
-; AsmReadMsr32 (
-; IN UINT32 Index
-; );
-;------------------------------------------------------------------------------
-AsmReadMsr32 PROC
- rdmsr
- ret
-AsmReadMsr32 ENDP
-
- END
diff --git a/MdePkg/Library/BaseLib/X64/ReadMsr64.asm b/MdePkg/Library/BaseLib/X64/ReadMsr64.asm
index 4444c18..580c076 100644
--- a/MdePkg/Library/BaseLib/X64/ReadMsr64.asm
+++ b/MdePkg/Library/BaseLib/X64/ReadMsr64.asm
@@ -31,9 +31,9 @@
; );
;------------------------------------------------------------------------------
AsmReadMsr64 PROC
- rdmsr
- shl rax, 20h
- shrd rax, rdx, 20h
+ rdmsr ; edx & eax are zero extended
+ shl rdx, 20h
+ or rax, rdx
ret
AsmReadMsr64 ENDP
diff --git a/MdePkg/Library/BaseLib/X64/ReadPmc.asm b/MdePkg/Library/BaseLib/X64/ReadPmc.asm
index b5004d6..5ca60fa 100644
--- a/MdePkg/Library/BaseLib/X64/ReadPmc.asm
+++ b/MdePkg/Library/BaseLib/X64/ReadPmc.asm
@@ -32,11 +32,8 @@
;------------------------------------------------------------------------------
AsmReadPmc PROC
rdpmc
- shl ecx, 1
- jnc @F
- shl rax, 20h
- shrd rax, rdx, 20h
-@@:
+ shl rdx, 20h
+ or rax, rdx
ret
AsmReadPmc ENDP
diff --git a/MdePkg/Library/BaseLib/X64/ReadSs.asm b/MdePkg/Library/BaseLib/X64/ReadSs.asm
index 4aa480d..2c2be56 100644
--- a/MdePkg/Library/BaseLib/X64/ReadSs.asm
+++ b/MdePkg/Library/BaseLib/X64/ReadSs.asm
@@ -31,7 +31,7 @@
; );
;------------------------------------------------------------------------------
AsmReadSs PROC
- mov ax, ss
+ mov eax, ss
ret
AsmReadSs ENDP
diff --git a/MdePkg/Library/BaseLib/X64/ReadTsc.asm b/MdePkg/Library/BaseLib/X64/ReadTsc.asm
index 25fa2cc..7c45eeb 100644
--- a/MdePkg/Library/BaseLib/X64/ReadTsc.asm
+++ b/MdePkg/Library/BaseLib/X64/ReadTsc.asm
@@ -32,8 +32,8 @@
;------------------------------------------------------------------------------
AsmReadTsc PROC
rdtsc
- shl rax, 20h
- shrd rax, rdx, 20h
+ shl rdx, 20h
+ or rax, rdx
ret
AsmReadTsc ENDP
diff --git a/MdePkg/Library/BaseLib/X64/SetJump.asm b/MdePkg/Library/BaseLib/X64/SetJump.asm
index 148b0cb..2ed581e 100644
--- a/MdePkg/Library/BaseLib/X64/SetJump.asm
+++ b/MdePkg/Library/BaseLib/X64/SetJump.asm
@@ -23,6 +23,13 @@
EXTERNDEF InternalAssertJumpBuffer:PROC
+;------------------------------------------------------------------------------
+; UINTN
+; EFIAPI
+; SetJump (
+; OUT BASE_LIBRARY_JUMP_BUFFER *JumpBuffer
+; );
+;------------------------------------------------------------------------------
SetJump PROC
push rcx
add rsp, -20h
diff --git a/MdePkg/Library/BaseLib/X64/Thunk16.asm b/MdePkg/Library/BaseLib/X64/Thunk16.asm
index b120434..2c35c72 100644
--- a/MdePkg/Library/BaseLib/X64/Thunk16.asm
+++ b/MdePkg/Library/BaseLib/X64/Thunk16.asm
@@ -61,6 +61,10 @@ SavedGdt LABEL FWORD
DW ?
DQ ?
+;------------------------------------------------------------------------------
+; _BackFromUserCode() takes control in real mode after 'retf' has been executed
+; by user code. It will be shadowed to somewhere in memory below 1MB.
+;------------------------------------------------------------------------------
_BackFromUserCode PROC
DB 16h ; push ss
DB 0eh ; push cs
@@ -125,6 +129,10 @@ _16Gdtr LABEL FWORD
_16GdtrBase DQ _NullSegDesc
_16Idtr FWORD (1 SHL 10) - 1
+;------------------------------------------------------------------------------
+; _ToUserCode() takes control in real mode before passing control to user code.
+; It will be shadowed to somewhere in memory below 1MB.
+;------------------------------------------------------------------------------
_ToUserCode PROC
mov edi, ss
mov ss, edx ; set new segment selectors
@@ -184,11 +192,14 @@ _16DsDesc LABEL QWORD
DB 0
GdtEnd LABEL QWORD
-;
-; @param RegSet Pointer to a IA32_DWORD_REGS structure
-; @param Transition Pointer to the transition code
-; @return The address of the 16-bit stack after returning from user code
-;
+;------------------------------------------------------------------------------
+; IA32_REGISTER_SET *
+; EFIAPI
+; InternalAsmThunk16 (
+; IN IA32_REGISTER_SET *RegisterSet,
+; IN OUT VOID *Transition
+; );
+;------------------------------------------------------------------------------
InternalAsmThunk16 PROC USES rbp rbx rsi rdi
mov r10d, ds
mov r11d, es
diff --git a/MdePkg/Library/BaseLib/X64/WriteCr0.asm b/MdePkg/Library/BaseLib/X64/WriteCr0.asm
index defc7e7..caf1904 100644
--- a/MdePkg/Library/BaseLib/X64/WriteCr0.asm
+++ b/MdePkg/Library/BaseLib/X64/WriteCr0.asm
@@ -27,11 +27,12 @@
; UINTN
; EFIAPI
; AsmWriteCr0 (
-; VOID
+; UINTN Cr0
; );
;------------------------------------------------------------------------------
AsmWriteCr0 PROC
mov cr0, rcx
+ mov rax, rcx
ret
AsmWriteCr0 ENDP
diff --git a/MdePkg/Library/BaseLib/X64/WriteCr2.asm b/MdePkg/Library/BaseLib/X64/WriteCr2.asm
index ebe6f89..ee5b546 100644
--- a/MdePkg/Library/BaseLib/X64/WriteCr2.asm
+++ b/MdePkg/Library/BaseLib/X64/WriteCr2.asm
@@ -27,11 +27,12 @@
; UINTN
; EFIAPI
; AsmWriteCr2 (
-; VOID
+; UINTN Cr2
; );
;------------------------------------------------------------------------------
AsmWriteCr2 PROC
mov cr2, rcx
+ mov rax, rcx
ret
AsmWriteCr2 ENDP
diff --git a/MdePkg/Library/BaseLib/X64/WriteCr3.asm b/MdePkg/Library/BaseLib/X64/WriteCr3.asm
index 5715dea..e632298 100644
--- a/MdePkg/Library/BaseLib/X64/WriteCr3.asm
+++ b/MdePkg/Library/BaseLib/X64/WriteCr3.asm
@@ -27,11 +27,12 @@
; UINTN
; EFIAPI
; AsmWriteCr3 (
-; VOID
+; UINTN Cr3
; );
;------------------------------------------------------------------------------
AsmWriteCr3 PROC
mov cr3, rcx
+ mov rax, rcx
ret
AsmWriteCr3 ENDP
diff --git a/MdePkg/Library/BaseLib/X64/WriteCr4.asm b/MdePkg/Library/BaseLib/X64/WriteCr4.asm
index 210744e..3e79fe2 100644
--- a/MdePkg/Library/BaseLib/X64/WriteCr4.asm
+++ b/MdePkg/Library/BaseLib/X64/WriteCr4.asm
@@ -27,11 +27,12 @@
; UINTN
; EFIAPI
; AsmWriteCr4 (
-; VOID
+; UINTN Cr4
; );
;------------------------------------------------------------------------------
AsmWriteCr4 PROC
mov cr4, rcx
+ mov rax, rcx
ret
AsmWriteCr4 ENDP
diff --git a/MdePkg/Library/BaseLib/X64/WriteDr0.asm b/MdePkg/Library/BaseLib/X64/WriteDr0.asm
index 2515a20..a1131fe 100644
--- a/MdePkg/Library/BaseLib/X64/WriteDr0.asm
+++ b/MdePkg/Library/BaseLib/X64/WriteDr0.asm
@@ -27,11 +27,12 @@
; UINTN
; EFIAPI
; AsmWriteDr0 (
-; VOID
+; IN UINTN Value
; );
;------------------------------------------------------------------------------
AsmWriteDr0 PROC
mov dr0, rcx
+ mov rax, rcx
ret
AsmWriteDr0 ENDP
diff --git a/MdePkg/Library/BaseLib/X64/WriteDr1.asm b/MdePkg/Library/BaseLib/X64/WriteDr1.asm
index 89f36ac..366edb6 100644
--- a/MdePkg/Library/BaseLib/X64/WriteDr1.asm
+++ b/MdePkg/Library/BaseLib/X64/WriteDr1.asm
@@ -27,11 +27,12 @@
; UINTN
; EFIAPI
; AsmWriteDr1 (
-; VOID
+; IN UINTN Value
; );
;------------------------------------------------------------------------------
AsmWriteDr1 PROC
mov dr1, rcx
+ mov rax, rcx
ret
AsmWriteDr1 ENDP
diff --git a/MdePkg/Library/BaseLib/X64/WriteDr2.asm b/MdePkg/Library/BaseLib/X64/WriteDr2.asm
index 820977c..bde8e3d 100644
--- a/MdePkg/Library/BaseLib/X64/WriteDr2.asm
+++ b/MdePkg/Library/BaseLib/X64/WriteDr2.asm
@@ -27,11 +27,12 @@
; UINTN
; EFIAPI
; AsmWriteDr2 (
-; VOID
+; IN UINTN Value
; );
;------------------------------------------------------------------------------
AsmWriteDr2 PROC
mov dr2, rcx
+ mov rax, rcx
ret
AsmWriteDr2 ENDP
diff --git a/MdePkg/Library/BaseLib/X64/WriteDr3.asm b/MdePkg/Library/BaseLib/X64/WriteDr3.asm
index 51c1407..65180a2 100644
--- a/MdePkg/Library/BaseLib/X64/WriteDr3.asm
+++ b/MdePkg/Library/BaseLib/X64/WriteDr3.asm
@@ -27,11 +27,12 @@
; UINTN
; EFIAPI
; AsmWriteDr3 (
-; VOID
+; IN UINTN Value
; );
;------------------------------------------------------------------------------
AsmWriteDr3 PROC
mov dr3, rcx
+ mov rax, rcx
ret
AsmWriteDr3 ENDP
diff --git a/MdePkg/Library/BaseLib/X64/WriteDr4.asm b/MdePkg/Library/BaseLib/X64/WriteDr4.asm
index 12b6438..ad618f1 100644
--- a/MdePkg/Library/BaseLib/X64/WriteDr4.asm
+++ b/MdePkg/Library/BaseLib/X64/WriteDr4.asm
@@ -27,11 +27,12 @@
; UINTN
; EFIAPI
; AsmWriteDr4 (
-; VOID
+; IN UINTN Value
; );
;------------------------------------------------------------------------------
AsmWriteDr4 PROC
DB 0fh, 23h, 0e1h
+ mov rax, rcx
ret
AsmWriteDr4 ENDP
diff --git a/MdePkg/Library/BaseLib/X64/WriteDr5.asm b/MdePkg/Library/BaseLib/X64/WriteDr5.asm
index 6d454d5..91eeef2 100644
--- a/MdePkg/Library/BaseLib/X64/WriteDr5.asm
+++ b/MdePkg/Library/BaseLib/X64/WriteDr5.asm
@@ -26,12 +26,13 @@
;------------------------------------------------------------------------------
; UINTN
; EFIAPI
-; AsmWriteDr5 (
-; VOID
+; AsmWriteDr6 (
+; IN UINTN Value
; );
;------------------------------------------------------------------------------
AsmWriteDr5 PROC
DB 0fh, 23h, 0e9h
+ mov rax, rcx
ret
AsmWriteDr5 ENDP
diff --git a/MdePkg/Library/BaseLib/X64/WriteDr6.asm b/MdePkg/Library/BaseLib/X64/WriteDr6.asm
index b7b9f25..f1ddae8 100644
--- a/MdePkg/Library/BaseLib/X64/WriteDr6.asm
+++ b/MdePkg/Library/BaseLib/X64/WriteDr6.asm
@@ -27,11 +27,12 @@
; UINTN
; EFIAPI
; AsmWriteDr6 (
-; VOID
+; IN UINTN Value
; );
;------------------------------------------------------------------------------
AsmWriteDr6 PROC
mov dr6, rcx
+ mov rax, rcx
ret
AsmWriteDr6 ENDP
diff --git a/MdePkg/Library/BaseLib/X64/WriteDr7.asm b/MdePkg/Library/BaseLib/X64/WriteDr7.asm
index de2237b..6a0cbfa 100644
--- a/MdePkg/Library/BaseLib/X64/WriteDr7.asm
+++ b/MdePkg/Library/BaseLib/X64/WriteDr7.asm
@@ -27,11 +27,12 @@
; UINTN
; EFIAPI
; AsmWriteDr7 (
-; VOID
+; IN UINTN Value
; );
;------------------------------------------------------------------------------
AsmWriteDr7 PROC
mov dr7, rcx
+ mov rax, rcx
ret
AsmWriteDr7 ENDP
diff --git a/MdePkg/Library/BaseLib/X64/WriteGdtr.asm b/MdePkg/Library/BaseLib/X64/WriteGdtr.asm
index 1757e3d..fa99a49 100644
--- a/MdePkg/Library/BaseLib/X64/WriteGdtr.asm
+++ b/MdePkg/Library/BaseLib/X64/WriteGdtr.asm
@@ -23,6 +23,13 @@
.code
+;------------------------------------------------------------------------------
+; VOID
+; EFIAPI
+; InternalX86WriteGdtr (
+; IN CONST IA32_DESCRIPTOR *Idtr
+; );
+;------------------------------------------------------------------------------
InternalX86WriteGdtr PROC
lgdt fword ptr [rcx]
ret
diff --git a/MdePkg/Library/BaseLib/X64/WriteIdtr.asm b/MdePkg/Library/BaseLib/X64/WriteIdtr.asm
index 09fcb9e..2f6c081 100644
--- a/MdePkg/Library/BaseLib/X64/WriteIdtr.asm
+++ b/MdePkg/Library/BaseLib/X64/WriteIdtr.asm
@@ -23,6 +23,13 @@
.code
+;------------------------------------------------------------------------------
+; VOID
+; EFIAPI
+; InternalX86WriteIdtr (
+; IN CONST IA32_DESCRIPTOR *Idtr
+; );
+;------------------------------------------------------------------------------
InternalX86WriteIdtr PROC
lidt fword ptr [rcx]
ret
diff --git a/MdePkg/Library/BaseLib/X64/WriteMm0.asm b/MdePkg/Library/BaseLib/X64/WriteMm0.asm
index bb9a576..0ad65e3 100644
--- a/MdePkg/Library/BaseLib/X64/WriteMm0.asm
+++ b/MdePkg/Library/BaseLib/X64/WriteMm0.asm
@@ -24,10 +24,10 @@
.code
;------------------------------------------------------------------------------
-; UINTN
+; VOID
; EFIAPI
; AsmWriteMm0 (
-; VOID
+; IN UINT64 Value
; );
;------------------------------------------------------------------------------
AsmWriteMm0 PROC
diff --git a/MdePkg/Library/BaseLib/X64/WriteMm1.asm b/MdePkg/Library/BaseLib/X64/WriteMm1.asm
index 1bab3bc..66425a4 100644
--- a/MdePkg/Library/BaseLib/X64/WriteMm1.asm
+++ b/MdePkg/Library/BaseLib/X64/WriteMm1.asm
@@ -24,10 +24,10 @@
.code
;------------------------------------------------------------------------------
-; UINTN
+; VOID
; EFIAPI
; AsmWriteMm1 (
-; VOID
+; IN UINT64 Value
; );
;------------------------------------------------------------------------------
AsmWriteMm1 PROC
diff --git a/MdePkg/Library/BaseLib/X64/WriteMm2.asm b/MdePkg/Library/BaseLib/X64/WriteMm2.asm
index 97e8a6a..bd0f0a0 100644
--- a/MdePkg/Library/BaseLib/X64/WriteMm2.asm
+++ b/MdePkg/Library/BaseLib/X64/WriteMm2.asm
@@ -24,10 +24,10 @@
.code
;------------------------------------------------------------------------------
-; UINTN
+; VOID
; EFIAPI
; AsmWriteMm2 (
-; VOID
+; IN UINT64 Value
; );
;------------------------------------------------------------------------------
AsmWriteMm2 PROC
diff --git a/MdePkg/Library/BaseLib/X64/WriteMm3.asm b/MdePkg/Library/BaseLib/X64/WriteMm3.asm
index d55e19a..fa36ea6 100644
--- a/MdePkg/Library/BaseLib/X64/WriteMm3.asm
+++ b/MdePkg/Library/BaseLib/X64/WriteMm3.asm
@@ -24,10 +24,10 @@
.code
;------------------------------------------------------------------------------
-; UINTN
+; VOID
; EFIAPI
; AsmWriteMm3 (
-; VOID
+; IN UINT64 Value
; );
;------------------------------------------------------------------------------
AsmWriteMm3 PROC
diff --git a/MdePkg/Library/BaseLib/X64/WriteMm4.asm b/MdePkg/Library/BaseLib/X64/WriteMm4.asm
index 2a69b93..d9bc46e 100644
--- a/MdePkg/Library/BaseLib/X64/WriteMm4.asm
+++ b/MdePkg/Library/BaseLib/X64/WriteMm4.asm
@@ -24,10 +24,10 @@
.code
;------------------------------------------------------------------------------
-; UINTN
+; VOID
; EFIAPI
; AsmWriteMm4 (
-; VOID
+; IN UINT64 Value
; );
;------------------------------------------------------------------------------
AsmWriteMm4 PROC
diff --git a/MdePkg/Library/BaseLib/X64/WriteMm5.asm b/MdePkg/Library/BaseLib/X64/WriteMm5.asm
index c4d798b..f268bea 100644
--- a/MdePkg/Library/BaseLib/X64/WriteMm5.asm
+++ b/MdePkg/Library/BaseLib/X64/WriteMm5.asm
@@ -24,10 +24,10 @@
.code
;------------------------------------------------------------------------------
-; UINTN
+; VOID
; EFIAPI
; AsmWriteMm5 (
-; VOID
+; IN UINT64 Value
; );
;------------------------------------------------------------------------------
AsmWriteMm5 PROC
diff --git a/MdePkg/Library/BaseLib/X64/WriteMm6.asm b/MdePkg/Library/BaseLib/X64/WriteMm6.asm
index c0164f6..cb32ea6 100644
--- a/MdePkg/Library/BaseLib/X64/WriteMm6.asm
+++ b/MdePkg/Library/BaseLib/X64/WriteMm6.asm
@@ -24,10 +24,10 @@
.code
;------------------------------------------------------------------------------
-; UINTN
+; VOID
; EFIAPI
; AsmWriteMm6 (
-; VOID
+; IN UINT64 Value
; );
;------------------------------------------------------------------------------
AsmWriteMm6 PROC
diff --git a/MdePkg/Library/BaseLib/X64/WriteMm7.asm b/MdePkg/Library/BaseLib/X64/WriteMm7.asm
index 20768e2..f571382 100644
--- a/MdePkg/Library/BaseLib/X64/WriteMm7.asm
+++ b/MdePkg/Library/BaseLib/X64/WriteMm7.asm
@@ -24,10 +24,10 @@
.code
;------------------------------------------------------------------------------
-; UINTN
+; VOID
; EFIAPI
; AsmWriteMm7 (
-; VOID
+; IN UINT64 Value
; );
;------------------------------------------------------------------------------
AsmWriteMm7 PROC
diff --git a/MdePkg/Library/BaseLib/X64/WriteMsr32.asm b/MdePkg/Library/BaseLib/X64/WriteMsr32.asm
deleted file mode 100644
index 0a74403..0000000
--- a/MdePkg/Library/BaseLib/X64/WriteMsr32.asm
+++ /dev/null
@@ -1,41 +0,0 @@
-;------------------------------------------------------------------------------
-;
-; Copyright (c) 2006, Intel Corporation
-; All rights reserved. This program and the accompanying materials
-; are licensed and made available under the terms and conditions of the BSD License
-; which accompanies this distribution. The full text of the license may be found at
-; http://opensource.org/licenses/bsd-license.php
-;
-; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-;
-; Module Name:
-;
-; WriteMsr32.Asm
-;
-; Abstract:
-;
-; AsmWriteMsr32 function
-;
-; Notes:
-;
-;------------------------------------------------------------------------------
-
- .code
-
-;------------------------------------------------------------------------------
-; UINT32
-; EFIAPI
-; AsmWriteMsr32 (
-; IN UINT32 Index,
-; IN UINT32 Value
-; );
-;------------------------------------------------------------------------------
-AsmWriteMsr32 PROC
- mov eax, edx
- xor edx, edx
- wrmsr
- ret
-AsmWriteMsr32 ENDP
-
- END
diff --git a/MdePkg/Library/BaseLib/X64/WriteMsr64.asm b/MdePkg/Library/BaseLib/X64/WriteMsr64.asm
index 3337f45..6b8066f 100644
--- a/MdePkg/Library/BaseLib/X64/WriteMsr64.asm
+++ b/MdePkg/Library/BaseLib/X64/WriteMsr64.asm
@@ -32,11 +32,9 @@
; );
;------------------------------------------------------------------------------
AsmWriteMsr64 PROC
- push rdx
- mov eax, edx
+ mov rax, rdx
shr rdx, 20h
wrmsr
- pop rax
ret
AsmWriteMsr64 ENDP
diff --git a/MdePkg/Library/BaseLib/x86DisablePaging32.c b/MdePkg/Library/BaseLib/x86DisablePaging32.c
new file mode 100644
index 0000000..417a779
--- /dev/null
+++ b/MdePkg/Library/BaseLib/x86DisablePaging32.c
@@ -0,0 +1,65 @@
+/** @file
+ IA-32/x64 AsmDisablePaging32()
+
+ Copyright (c) 2006, Intel Corporation<BR>
+ All rights reserved. This program and the accompanying materials
+ are licensed and made available under the terms and conditions of the BSD License
+ which accompanies this distribution. The full text of the license may be found at
+ http://opensource.org/licenses/bsd-license.php
+
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+ Module Name: x86DisablePaging32.c
+
+**/
+
+#include "BaseLibInternals.h"
+
+/**
+ Disables the 32-bit paging mode on the CPU.
+
+ Disables the 32-bit paging mode on the CPU and returns to 32-bit protected
+ mode. This function assumes the current execution mode is 32-paged protected
+ mode. This function is only available on IA-32. After the 32-bit paging mode
+ is disabled, control is transferred to the function specified by EntryPoint
+ using the new stack specified by NewStack and passing in the parameters
+ specified by Context1 and Context2. Context1 and Context2 are optional and
+ may be NULL. The function EntryPoint must never return.
+
+ If the current execution mode is not 32-bit paged mode, then ASSERT().
+ If EntryPoint is NULL, then ASSERT().
+ If NewStack is NULL, then ASSERT().
+
+ There are a number of constraints that must be followed before calling this
+ function:
+ 1) Interrupts must be disabled.
+ 2) The caller must be in 32-bit paged mode.
+ 3) CR0, CR3, and CR4 must be compatible with 32-bit paged mode.
+ 4) CR3 must point to valid page tables that guarantee that the pages for
+ this function and the stack are identity mapped.
+
+ @param EntryPoint A pointer to function to call with the new stack after
+ paging is disabled.
+ @param Context1 A pointer to the context to pass into the EntryPoint
+ function as the first parameter after paging is disabled.
+ @param Context2 A pointer to the context to pass into the EntryPoint
+ function as the second parameter after paging is
+ disabled.
+ @param NewStack A pointer to the new stack to use for the EntryPoint
+ function after paging is disabled.
+
+**/
+VOID
+EFIAPI
+AsmDisablePaging32 (
+ IN SWITCH_STACK_ENTRY_POINT EntryPoint,
+ IN VOID *Context1, OPTIONAL
+ IN VOID *Context2, OPTIONAL
+ IN VOID *NewStack
+ )
+{
+ ASSERT (EntryPoint != NULL);
+ ASSERT (NewStack != NULL);
+ InternalX86DisablePaging32 (EntryPoint, Context1, Context2, NewStack);
+}
diff --git a/MdePkg/Library/BaseLib/x86DisablePaging64.c b/MdePkg/Library/BaseLib/x86DisablePaging64.c
new file mode 100644
index 0000000..1849652
--- /dev/null
+++ b/MdePkg/Library/BaseLib/x86DisablePaging64.c
@@ -0,0 +1,62 @@
+/** @file
+ IA-32/x64 AsmDisablePaging64()
+
+ Copyright (c) 2006, Intel Corporation<BR>
+ All rights reserved. This program and the accompanying materials
+ are licensed and made available under the terms and conditions of the BSD License
+ which accompanies this distribution. The full text of the license may be found at
+ http://opensource.org/licenses/bsd-license.php
+
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+ Module Name: x86DisablePaging64.c
+
+**/
+
+#include "BaseLibInternals.h"
+
+/**
+ Disables the 64-bit paging mode on the CPU.
+
+ Disables the 64-bit paging mode on the CPU and returns to 32-bit protected
+ mode. This function assumes the current execution mode is 64-paging mode.
+ This function is only available on X64. After the 64-bit paging mode is
+ disabled, control is transferred to the function specified by EntryPoint
+ using the new stack specified by NewStack and passing in the parameters
+ specified by Context1 and Context2. Context1 and Context2 are optional and
+ may be 0. The function EntryPoint must never return.
+
+ If the current execution mode is not 64-bit paged mode, then ASSERT().
+ If EntryPoint is 0, then ASSERT().
+ If NewStack is 0, then ASSERT().
+
+ @param Cs The 16-bit selector to load in the CS before EntryPoint
+ is called. The descriptor in the GDT that this selector
+ references must be setup for 32-bit protected mode.
+ @param EntryPoint The 64-bit virtual address of the function to call with
+ the new stack after paging is disabled.
+ @param Context1 The 64-bit virtual address of the context to pass into
+ the EntryPoint function as the first parameter after
+ paging is disabled.
+ @param Context2 The 64-bit virtual address of the context to pass into
+ the EntryPoint function as the second parameter after
+ paging is disabled.
+ @param NewStack The 64-bit virtual address of the new stack to use for
+ the EntryPoint function after paging is disabled.
+
+**/
+VOID
+EFIAPI
+AsmDisablePaging64 (
+ IN UINT16 Cs,
+ IN UINT32 EntryPoint,
+ IN UINT32 Context1, OPTIONAL
+ IN UINT32 Context2, OPTIONAL
+ IN UINT32 NewStack
+ )
+{
+ ASSERT (EntryPoint != 0);
+ ASSERT (NewStack != 0);
+ InternalX86DisablePaging64 (Cs, EntryPoint, Context1, Context2, NewStack);
+}
diff --git a/MdePkg/Library/BaseLib/x86EnablePaging32.c b/MdePkg/Library/BaseLib/x86EnablePaging32.c
new file mode 100644
index 0000000..f186146
--- /dev/null
+++ b/MdePkg/Library/BaseLib/x86EnablePaging32.c
@@ -0,0 +1,68 @@
+/** @file
+ IA-32/x64 AsmEnablePaging32()
+
+ Copyright (c) 2006, Intel Corporation<BR>
+ All rights reserved. This program and the accompanying materials
+ are licensed and made available under the terms and conditions of the BSD License
+ which accompanies this distribution. The full text of the license may be found at
+ http://opensource.org/licenses/bsd-license.php
+
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+ Module Name: x86EnablePaging32.c
+
+**/
+
+#include "BaseLibInternals.h"
+
+/**
+ Enables the 32-bit paging mode on the CPU.
+
+ Enables the 32-bit paging mode on the CPU. CR0, CR3, CR4, and the page tables
+ must be properly initialized prior to calling this service. This function
+ assumes the current execution mode is 32-bit protected mode. This function is
+ only available on IA-32. After the 32-bit paging mode is enabled, control is
+ transferred to the function specified by EntryPoint using the new stack
+ specified by NewStack and passing in the parameters specified by Context1 and
+ Context2. Context1 and Context2 are optional and may be NULL. The function
+ EntryPoint must never return.
+
+ If the current execution mode is not 32-bit protected mode, then ASSERT().
+ If EntryPoint is NULL, then ASSERT().
+ If NewStack is NULL, then ASSERT().
+
+ There are a number of constraints that must be followed before calling this
+ function:
+ 1) Interrupts must be disabled.
+ 2) The caller must be in 32-bit protected mode with flat descriptors. This
+ means all descriptors must have a base of 0 and a limit of 4GB.
+ 3) CR0 and CR4 must be compatible with 32-bit protected mode with flat
+ descriptors.
+ 4) CR3 must point to valid page tables that will be used once the transition
+ is complete, and those page tables must guarantee that the pages for this
+ function and the stack are identity mapped.
+
+ @param EntryPoint A pointer to function to call with the new stack after
+ paging is enabled.
+ @param Context1 A pointer to the context to pass into the EntryPoint
+ function as the first parameter after paging is enabled.
+ @param Context2 A pointer to the context to pass into the EntryPoint
+ function as the second parameter after paging is enabled.
+ @param NewStack A pointer to the new stack to use for the EntryPoint
+ function after paging is enabled.
+
+**/
+VOID
+EFIAPI
+AsmEnablePaging32 (
+ IN SWITCH_STACK_ENTRY_POINT EntryPoint,
+ IN VOID *Context1, OPTIONAL
+ IN VOID *Context2, OPTIONAL
+ IN VOID *NewStack
+ )
+{
+ ASSERT (EntryPoint != NULL);
+ ASSERT (NewStack != NULL);
+ InternalX86EnablePaging32 (EntryPoint, Context1, Context2, NewStack);
+}
diff --git a/MdePkg/Library/BaseLib/x86EnablePaging64.c b/MdePkg/Library/BaseLib/x86EnablePaging64.c
new file mode 100644
index 0000000..424568d
--- /dev/null
+++ b/MdePkg/Library/BaseLib/x86EnablePaging64.c
@@ -0,0 +1,64 @@
+/** @file
+ IA-32/x64 AsmEnablePaging64()
+
+ Copyright (c) 2006, Intel Corporation<BR>
+ All rights reserved. This program and the accompanying materials
+ are licensed and made available under the terms and conditions of the BSD License
+ which accompanies this distribution. The full text of the license may be found at
+ http://opensource.org/licenses/bsd-license.php
+
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+ Module Name: x86EnablePaging64.c
+
+**/
+
+#include "BaseLibInternals.h"
+
+/**
+ Enables the 64-bit paging mode on the CPU.
+
+ Enables the 64-bit paging mode on the CPU. CR0, CR3, CR4, and the page tables
+ must be properly initialized prior to calling this service. This function
+ assumes the current execution mode is 32-bit protected mode with flat
+ descriptors. This function is only available on IA-32. After the 64-bit
+ paging mode is enabled, control is transferred to the function specified by
+ EntryPoint using the new stack specified by NewStack and passing in the
+ parameters specified by Context1 and Context2. Context1 and Context2 are
+ optional and may be 0. The function EntryPoint must never return.
+
+ If the current execution mode is not 32-bit protected mode with flat
+ descriptors, then ASSERT().
+ If EntryPoint is 0, then ASSERT().
+ If NewStack is 0, then ASSERT().
+
+ @param Cs The 16-bit selector to load in the CS before EntryPoint
+ is called. The descriptor in the GDT that this selector
+ references must be setup for long mode.
+ @param EntryPoint The 64-bit virtual address of the function to call with
+ the new stack after paging is enabled.
+ @param Context1 The 64-bit virtual address of the context to pass into
+ the EntryPoint function as the first parameter after
+ paging is enabled.
+ @param Context2 The 64-bit virtual address of the context to pass into
+ the EntryPoint function as the second parameter after
+ paging is enabled.
+ @param NewStack The 64-bit virtual address of the new stack to use for
+ the EntryPoint function after paging is enabled.
+
+**/
+VOID
+EFIAPI
+AsmEnablePaging64 (
+ IN UINT16 Cs,
+ IN UINT64 EntryPoint,
+ IN UINT64 Context1, OPTIONAL
+ IN UINT64 Context2, OPTIONAL
+ IN UINT64 NewStack
+ )
+{
+ ASSERT (EntryPoint != 0);
+ ASSERT (NewStack != 0);
+ InternalX86EnablePaging64 (Cs, EntryPoint, Context1, Context2, NewStack);
+}
diff --git a/MdePkg/Library/BaseLib/x86FxRestore.c b/MdePkg/Library/BaseLib/x86FxRestore.c
new file mode 100644
index 0000000..70a0c24
--- /dev/null
+++ b/MdePkg/Library/BaseLib/x86FxRestore.c
@@ -0,0 +1,48 @@
+/** @file
+ IA-32/x64 AsmFxRestore()
+
+ Copyright (c) 2006, Intel Corporation<BR>
+ All rights reserved. This program and the accompanying materials
+ are licensed and made available under the terms and conditions of the BSD License
+ which accompanies this distribution. The full text of the license may be found at
+ http://opensource.org/licenses/bsd-license.php
+
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+ Module Name: x86FxRestore.c
+
+**/
+
+#include "BaseLibInternals.h"
+
+/**
+ Restores the current floating point/SSE/SSE2 context from a buffer.
+
+ Restores the current floating point/SSE/SSE2 state from the buffer specified
+ by Buffer. Buffer must be aligned on a 16-byte boundary. This function is
+ only available on IA-32 and X64.
+
+ If Buffer is NULL, then ASSERT().
+ If Buffer is not aligned on a 16-byte boundary, then ASSERT().
+ If Buffer was not saved with AsmFxSave(), then ASSERT().
+
+ @param Buffer Pointer to a buffer to save the floating point/SSE/SSE2 context.
+
+**/
+VOID
+EFIAPI
+AsmFxRestore (
+ IN CONST IA32_FX_BUFFER *Buffer
+ )
+{
+ ASSERT (Buffer != NULL);
+ ASSERT (((UINTN)Buffer & 0xf) == 0);
+
+ //
+ // Check the flag recorded by AsmFxSave()
+ //
+ ASSERT (*(UINT32 *) (&Buffer[sizeof (IA32_FX_BUFFER) - 4]) == 0xAA5555AA);
+
+ InternalX86FxRestore (Buffer);
+}
diff --git a/MdePkg/Library/BaseLib/x86FxSave.c b/MdePkg/Library/BaseLib/x86FxSave.c
new file mode 100644
index 0000000..18c3291
--- /dev/null
+++ b/MdePkg/Library/BaseLib/x86FxSave.c
@@ -0,0 +1,47 @@
+/** @file
+ IA-32/x64 AsmFxSave()
+
+ Copyright (c) 2006, Intel Corporation<BR>
+ All rights reserved. This program and the accompanying materials
+ are licensed and made available under the terms and conditions of the BSD License
+ which accompanies this distribution. The full text of the license may be found at
+ http://opensource.org/licenses/bsd-license.php
+
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+ Module Name: x86FxSave.c
+
+**/
+
+#include "BaseLibInternals.h"
+
+/**
+ Save the current floating point/SSE/SSE2 context to a buffer.
+
+ Saves the current floating point/SSE/SSE2 state to the buffer specified by
+ Buffer. Buffer must be aligned on a 16-byte boundary. This function is only
+ available on IA-32 and X64.
+
+ If Buffer is NULL, then ASSERT().
+ If Buffer is not aligned on a 16-byte boundary, then ASSERT().
+
+ @param Buffer Pointer to a buffer to save the floating point/SSE/SSE2 context.
+
+**/
+VOID
+EFIAPI
+AsmFxSave (
+ OUT IA32_FX_BUFFER *Buffer
+ )
+{
+ ASSERT (Buffer != NULL);
+ ASSERT (((UINTN)Buffer & 0xf) == 0);
+
+ InternalX86FxSave (Buffer);
+
+ //
+ // Mark one flag at end of Buffer, it will be check by AsmFxRestor()
+ //
+ *(UINT32 *) (&Buffer[sizeof (IA32_FX_BUFFER) - 4]) = 0xAA5555AA;
+}
diff --git a/MdePkg/Library/BaseLib/x86GetInterruptState.c b/MdePkg/Library/BaseLib/x86GetInterruptState.c
new file mode 100644
index 0000000..2e06efb
--- /dev/null
+++ b/MdePkg/Library/BaseLib/x86GetInterruptState.c
@@ -0,0 +1,39 @@
+/** @file
+ IA-32/x64 GetInterruptState()
+
+ Copyright (c) 2006, Intel Corporation<BR>
+ All rights reserved. This program and the accompanying materials
+ are licensed and made available under the terms and conditions of the BSD License
+ which accompanies this distribution. The full text of the license may be found at
+ http://opensource.org/licenses/bsd-license.php
+
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+ Module Name: x86GetInterruptState.c
+
+**/
+
+/**
+ Retrieves the current CPU interrupt state.
+
+ Retrieves the current CPU interrupt state. Returns TRUE is interrupts are
+ currently enabled. Otherwise returns FALSE.
+
+ @retval TRUE CPU interrupts are enabled.
+ @retval FALSE CPU interrupts are disabled.
+
+**/
+BOOLEAN
+EFIAPI
+GetInterruptState (
+ VOID
+ )
+{
+ IA32_EFLAGS32 EFlags;
+
+ EFlags.UintN = AsmReadEflags ();
+ return (BOOLEAN)(EFlags.Bits.IF == 1);
+}
+
+
diff --git a/MdePkg/Library/BaseLib/x86MemoryFence.c b/MdePkg/Library/BaseLib/x86MemoryFence.c
new file mode 100644
index 0000000..96b1bf2
--- /dev/null
+++ b/MdePkg/Library/BaseLib/x86MemoryFence.c
@@ -0,0 +1,31 @@
+/** @file
+ IA-32/x64 MemoryFence().
+
+ Copyright (c) 2006, Intel Corporation<BR>
+ All rights reserved. This program and the accompanying materials
+ are licensed and made available under the terms and conditions of the BSD License
+ which accompanies this distribution. The full text of the license may be found at
+ http://opensource.org/licenses/bsd-license.php
+
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+ Module Name: x86MemoryFence.c
+
+**/
+
+/**
+ Used to serialize load and store operations.
+
+ All loads and stores that proceed calls to this function are guaranteed to be
+ globally visible when this function returns.
+
+**/
+VOID
+EFIAPI
+MemoryFence (
+ VOID
+ )
+{
+ return;
+}
diff --git a/MdePkg/Library/BaseLib/x86LowLevel.c b/MdePkg/Library/BaseLib/x86Msr.c
index 2819304..aa8e25b 100644
--- a/MdePkg/Library/BaseLib/x86LowLevel.c
+++ b/MdePkg/Library/BaseLib/x86Msr.c
@@ -1,5 +1,5 @@
/** @file
- IA-32/x64 specific functions.
+ IA-32/x64 MSR functions.
Copyright (c) 2006, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials
@@ -10,15 +10,58 @@
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
- Module Name: x86LowLevel.c
+ Module Name: x86Msr.c
**/
-#include "BaseLibInternals.h"
+/**
+ Returns the lower 32-bits of a Machine Specific Register(MSR).
+
+ Reads and returns the lower 32-bits of the MSR specified by Index.
+ No parameter checking is performed on Index, and some Index values may cause
+ CPU exceptions. The caller must either guarantee that Index is valid, or the
+ caller must set up exception handlers to catch the exceptions. This function
+ is only available on IA-32 and X64.
+
+ @param Index The 32-bit MSR index to read.
-//
-// Bit-wise MSR operations
-//
+ @return The lower 32 bits of the MSR identified by Index.
+
+**/
+UINT32
+EFIAPI
+AsmReadMsr32 (
+ IN UINT32 Index
+ )
+{
+ return (UINT32)AsmReadMsr64 (Index);
+}
+
+/**
+ Zero-extend a 32-bit value and writes it to a Machine Specific Register(MSR).
+
+ Writes the 32-bit value specified by Value to the MSR specified by Index. The
+ upper 32-bits of the MSR write are set to zero. The 32-bit value written to
+ the MSR is returned. No parameter checking is performed on Index or Value,
+ and some of these may cause CPU exceptions. The caller must either guarantee
+ that Index and Value are valid, or the caller must establish proper exception
+ handlers. This function is only available on IA-32 and X64.
+
+ @param Index The 32-bit MSR index to write.
+ @param Value The 32-bit value to write to the MSR.
+
+ @return Value
+
+**/
+UINT32
+EFIAPI
+AsmWriteMsr32 (
+ IN UINT32 Index,
+ IN UINT32 Value
+ )
+{
+ return (UINT32)AsmWriteMsr64 (Index, Value);
+}
/**
Reads a 64-bit MSR, performs a bitwise inclusive OR on the lower 32-bits, and
@@ -604,389 +647,3 @@ AsmMsrBitFieldAndThenOr64 (
)
);
}
-
-//
-// Base Library CPU Functions
-//
-
-/**
- Retrieves the current CPU interrupt state.
-
- Retrieves the current CPU interrupt state. Returns TRUE is interrupts are
- currently enabled. Otherwise returns FALSE.
-
- @retval TRUE CPU interrupts are enabled.
- @retval FALSE CPU interrupts are disabled.
-
-**/
-BOOLEAN
-EFIAPI
-GetInterruptState (
- VOID
- )
-{
- IA32_EFLAGS32 EFlags;
-
- EFlags.UintN = AsmReadEflags ();
- return (BOOLEAN)(EFlags.Bits.IF == 1);
-}
-
-//
-// Ia32 and x64 specific functions
-//
-
-/**
- Reads the current Global Descriptor Table Register(GDTR) descriptor.
-
- Reads and returns the current GDTR descriptor and returns it in Gdtr. This
- function is only available on IA-32 and X64.
-
- If Gdtr is NULL, then ASSERT().
-
- @param Gdtr Pointer to a GDTR descriptor.
-
-**/
-VOID
-EFIAPI
-AsmReadGdtr (
- OUT IA32_DESCRIPTOR *Gdtr
- )
-{
- ASSERT (Gdtr != NULL);
- InternalX86ReadGdtr (Gdtr);
-}
-
-/**
- Writes the current Global Descriptor Table Register (GDTR) descriptor.
-
- Writes and the current GDTR descriptor specified by Gdtr. This function is
- only available on IA-32 and X64.
-
- If Gdtr is NULL, then ASSERT().
-
- @param Gdtr Pointer to a GDTR descriptor.
-
-**/
-VOID
-EFIAPI
-AsmWriteGdtr (
- IN CONST IA32_DESCRIPTOR *Gdtr
- )
-{
- ASSERT (Gdtr != NULL);
- InternalX86WriteGdtr (Gdtr);
-}
-
-/**
- Reads the current Interrupt Descriptor Table Register(GDTR) descriptor.
-
- Reads and returns the current IDTR descriptor and returns it in Idtr. This
- function is only available on IA-32 and X64.
-
- If Idtr is NULL, then ASSERT().
-
- @param Idtr Pointer to a IDTR descriptor.
-
-**/
-VOID
-EFIAPI
-AsmReadIdtr (
- OUT IA32_DESCRIPTOR *Idtr
- )
-{
- ASSERT (Idtr != NULL);
- InternalX86ReadIdtr (Idtr);
-}
-
-/**
- Writes the current Interrupt Descriptor Table Register(GDTR) descriptor.
-
- Writes the current IDTR descriptor and returns it in Idtr. This function is
- only available on IA-32 and X64.
-
- If Idtr is NULL, then ASSERT().
-
- @param Idtr Pointer to a IDTR descriptor.
-
-**/
-VOID
-EFIAPI
-AsmWriteIdtr (
- IN CONST IA32_DESCRIPTOR *Idtr
- )
-{
- ASSERT (Idtr != NULL);
- InternalX86WriteIdtr (Idtr);
-}
-
-/**
- Save the current floating point/SSE/SSE2 context to a buffer.
-
- Saves the current floating point/SSE/SSE2 state to the buffer specified by
- Buffer. Buffer must be aligned on a 16-byte boundary. This function is only
- available on IA-32 and X64.
-
- If Buffer is NULL, then ASSERT().
- If Buffer is not aligned on a 16-byte boundary, then ASSERT().
-
- @param Buffer Pointer to a buffer to save the floating point/SSE/SSE2 context.
-
-**/
-VOID
-EFIAPI
-AsmFxSave (
- OUT IA32_FX_BUFFER *Buffer
- )
-{
- ASSERT (Buffer != NULL);
- ASSERT (((UINTN)Buffer & 0xf) == 0);
-
- InternalX86FxSave (Buffer);
-
- //
- // Mark one flag at end of Buffer, it will be check by AsmFxRestor()
- //
- *(UINT32 *) (&Buffer[sizeof (IA32_FX_BUFFER) - 4]) = 0xAA5555AA;
-}
-
-/**
- Restores the current floating point/SSE/SSE2 context from a buffer.
-
- Restores the current floating point/SSE/SSE2 state from the buffer specified
- by Buffer. Buffer must be aligned on a 16-byte boundary. This function is
- only available on IA-32 and X64.
-
- If Buffer is NULL, then ASSERT().
- If Buffer is not aligned on a 16-byte boundary, then ASSERT().
- If Buffer was not saved with AsmFxSave(), then ASSERT().
-
- @param Buffer Pointer to a buffer to save the floating point/SSE/SSE2 context.
-
-**/
-VOID
-EFIAPI
-AsmFxRestore (
- IN CONST IA32_FX_BUFFER *Buffer
- )
-{
- ASSERT (Buffer != NULL);
- ASSERT (((UINTN)Buffer & 0xf) == 0);
-
- //
- // Check the flag recorded by AsmFxSave()
- //
- ASSERT (*(UINT32 *) (&Buffer[sizeof (IA32_FX_BUFFER) - 4]) == 0xAA5555AA);
-
- InternalX86FxRestore (Buffer);
-}
-
-/**
- Enables the 32-bit paging mode on the CPU.
-
- Enables the 32-bit paging mode on the CPU. CR0, CR3, CR4, and the page tables
- must be properly initialized prior to calling this service. This function
- assumes the current execution mode is 32-bit protected mode. This function is
- only available on IA-32. After the 32-bit paging mode is enabled, control is
- transferred to the function specified by EntryPoint using the new stack
- specified by NewStack and passing in the parameters specified by Context1 and
- Context2. Context1 and Context2 are optional and may be NULL. The function
- EntryPoint must never return.
-
- If the current execution mode is not 32-bit protected mode, then ASSERT().
- If EntryPoint is NULL, then ASSERT().
- If NewStack is NULL, then ASSERT().
-
- There are a number of constraints that must be followed before calling this
- function:
- 1) Interrupts must be disabled.
- 2) The caller must be in 32-bit protected mode with flat descriptors. This
- means all descriptors must have a base of 0 and a limit of 4GB.
- 3) CR0 and CR4 must be compatible with 32-bit protected mode with flat
- descriptors.
- 4) CR3 must point to valid page tables that will be used once the transition
- is complete, and those page tables must guarantee that the pages for this
- function and the stack are identity mapped.
-
- @param EntryPoint A pointer to function to call with the new stack after
- paging is enabled.
- @param Context1 A pointer to the context to pass into the EntryPoint
- function as the first parameter after paging is enabled.
- @param Context2 A pointer to the context to pass into the EntryPoint
- function as the second parameter after paging is enabled.
- @param NewStack A pointer to the new stack to use for the EntryPoint
- function after paging is enabled.
-
-**/
-VOID
-EFIAPI
-AsmEnablePaging32 (
- IN SWITCH_STACK_ENTRY_POINT EntryPoint,
- IN VOID *Context1, OPTIONAL
- IN VOID *Context2, OPTIONAL
- IN VOID *NewStack
- )
-{
- ASSERT (EntryPoint != NULL);
- ASSERT (NewStack != NULL);
- InternalX86EnablePaging32 (EntryPoint, Context1, Context2, NewStack);
-}
-
-/**
- Disables the 32-bit paging mode on the CPU.
-
- Disables the 32-bit paging mode on the CPU and returns to 32-bit protected
- mode. This function assumes the current execution mode is 32-paged protected
- mode. This function is only available on IA-32. After the 32-bit paging mode
- is disabled, control is transferred to the function specified by EntryPoint
- using the new stack specified by NewStack and passing in the parameters
- specified by Context1 and Context2. Context1 and Context2 are optional and
- may be NULL. The function EntryPoint must never return.
-
- If the current execution mode is not 32-bit paged mode, then ASSERT().
- If EntryPoint is NULL, then ASSERT().
- If NewStack is NULL, then ASSERT().
-
- There are a number of constraints that must be followed before calling this
- function:
- 1) Interrupts must be disabled.
- 2) The caller must be in 32-bit paged mode.
- 3) CR0, CR3, and CR4 must be compatible with 32-bit paged mode.
- 4) CR3 must point to valid page tables that guarantee that the pages for
- this function and the stack are identity mapped.
-
- @param EntryPoint A pointer to function to call with the new stack after
- paging is disabled.
- @param Context1 A pointer to the context to pass into the EntryPoint
- function as the first parameter after paging is disabled.
- @param Context2 A pointer to the context to pass into the EntryPoint
- function as the second parameter after paging is
- disabled.
- @param NewStack A pointer to the new stack to use for the EntryPoint
- function after paging is disabled.
-
-**/
-VOID
-EFIAPI
-AsmDisablePaging32 (
- IN SWITCH_STACK_ENTRY_POINT EntryPoint,
- IN VOID *Context1, OPTIONAL
- IN VOID *Context2, OPTIONAL
- IN VOID *NewStack
- )
-{
- ASSERT (EntryPoint != NULL);
- ASSERT (NewStack != NULL);
- InternalX86DisablePaging32 (EntryPoint, Context1, Context2, NewStack);
-}
-
-/**
- Enables the 64-bit paging mode on the CPU.
-
- Enables the 64-bit paging mode on the CPU. CR0, CR3, CR4, and the page tables
- must be properly initialized prior to calling this service. This function
- assumes the current execution mode is 32-bit protected mode with flat
- descriptors. This function is only available on IA-32. After the 64-bit
- paging mode is enabled, control is transferred to the function specified by
- EntryPoint using the new stack specified by NewStack and passing in the
- parameters specified by Context1 and Context2. Context1 and Context2 are
- optional and may be 0. The function EntryPoint must never return.
-
- If the current execution mode is not 32-bit protected mode with flat
- descriptors, then ASSERT().
- If EntryPoint is 0, then ASSERT().
- If NewStack is 0, then ASSERT().
-
- @param Cs The 16-bit selector to load in the CS before EntryPoint
- is called. The descriptor in the GDT that this selector
- references must be setup for long mode.
- @param EntryPoint The 64-bit virtual address of the function to call with
- the new stack after paging is enabled.
- @param Context1 The 64-bit virtual address of the context to pass into
- the EntryPoint function as the first parameter after
- paging is enabled.
- @param Context2 The 64-bit virtual address of the context to pass into
- the EntryPoint function as the second parameter after
- paging is enabled.
- @param NewStack The 64-bit virtual address of the new stack to use for
- the EntryPoint function after paging is enabled.
-
-**/
-VOID
-EFIAPI
-AsmEnablePaging64 (
- IN UINT16 Cs,
- IN UINT64 EntryPoint,
- IN UINT64 Context1, OPTIONAL
- IN UINT64 Context2, OPTIONAL
- IN UINT64 NewStack
- )
-{
- ASSERT (EntryPoint != 0);
- ASSERT (NewStack != 0);
- InternalX86EnablePaging64 (Cs, EntryPoint, Context1, Context2, NewStack);
-}
-
-/**
- Disables the 64-bit paging mode on the CPU.
-
- Disables the 64-bit paging mode on the CPU and returns to 32-bit protected
- mode. This function assumes the current execution mode is 64-paging mode.
- This function is only available on X64. After the 64-bit paging mode is
- disabled, control is transferred to the function specified by EntryPoint
- using the new stack specified by NewStack and passing in the parameters
- specified by Context1 and Context2. Context1 and Context2 are optional and
- may be 0. The function EntryPoint must never return.
-
- If the current execution mode is not 64-bit paged mode, then ASSERT().
- If EntryPoint is 0, then ASSERT().
- If NewStack is 0, then ASSERT().
-
- @param Cs The 16-bit selector to load in the CS before EntryPoint
- is called. The descriptor in the GDT that this selector
- references must be setup for 32-bit protected mode.
- @param EntryPoint The 64-bit virtual address of the function to call with
- the new stack after paging is disabled.
- @param Context1 The 64-bit virtual address of the context to pass into
- the EntryPoint function as the first parameter after
- paging is disabled.
- @param Context2 The 64-bit virtual address of the context to pass into
- the EntryPoint function as the second parameter after
- paging is disabled.
- @param NewStack The 64-bit virtual address of the new stack to use for
- the EntryPoint function after paging is disabled.
-
-**/
-VOID
-EFIAPI
-AsmDisablePaging64 (
- IN UINT16 Cs,
- IN UINT32 EntryPoint,
- IN UINT32 Context1, OPTIONAL
- IN UINT32 Context2, OPTIONAL
- IN UINT32 NewStack
- )
-{
- ASSERT (EntryPoint != 0);
- ASSERT (NewStack != 0);
- InternalX86DisablePaging64 (Cs, EntryPoint, Context1, Context2, NewStack);
-}
-
-//
-// x86 version of MemoryFence()
-//
-
-/**
- Used to serialize load and store operations.
-
- All loads and stores that proceed calls to this function are guaranteed to be
- globally visible when this function returns.
-
-**/
-VOID
-EFIAPI
-MemoryFence (
- VOID
- )
-{
- return;
-}
diff --git a/MdePkg/Library/BaseLib/x86ReadGdtr.c b/MdePkg/Library/BaseLib/x86ReadGdtr.c
new file mode 100644
index 0000000..20d41c0
--- /dev/null
+++ b/MdePkg/Library/BaseLib/x86ReadGdtr.c
@@ -0,0 +1,38 @@
+/** @file
+ IA-32/x64 AsmReadGdtr()
+
+ Copyright (c) 2006, Intel Corporation<BR>
+ All rights reserved. This program and the accompanying materials
+ are licensed and made available under the terms and conditions of the BSD License
+ which accompanies this distribution. The full text of the license may be found at
+ http://opensource.org/licenses/bsd-license.php
+
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+ Module Name: x86ReadGdtr.c
+
+**/
+
+#include "BaseLibInternals.h"
+
+/**
+ Reads the current Global Descriptor Table Register(GDTR) descriptor.
+
+ Reads and returns the current GDTR descriptor and returns it in Gdtr. This
+ function is only available on IA-32 and X64.
+
+ If Gdtr is NULL, then ASSERT().
+
+ @param Gdtr Pointer to a GDTR descriptor.
+
+**/
+VOID
+EFIAPI
+AsmReadGdtr (
+ OUT IA32_DESCRIPTOR *Gdtr
+ )
+{
+ ASSERT (Gdtr != NULL);
+ InternalX86ReadGdtr (Gdtr);
+}
diff --git a/MdePkg/Library/BaseLib/x86ReadIdtr.c b/MdePkg/Library/BaseLib/x86ReadIdtr.c
new file mode 100644
index 0000000..f902b0c
--- /dev/null
+++ b/MdePkg/Library/BaseLib/x86ReadIdtr.c
@@ -0,0 +1,38 @@
+/** @file
+ IA-32/x64 AsmReadIdtr()
+
+ Copyright (c) 2006, Intel Corporation<BR>
+ All rights reserved. This program and the accompanying materials
+ are licensed and made available under the terms and conditions of the BSD License
+ which accompanies this distribution. The full text of the license may be found at
+ http://opensource.org/licenses/bsd-license.php
+
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+ Module Name: x86ReadIdtr.c
+
+**/
+
+#include "BaseLibInternals.h"
+
+/**
+ Reads the current Interrupt Descriptor Table Register(GDTR) descriptor.
+
+ Reads and returns the current IDTR descriptor and returns it in Idtr. This
+ function is only available on IA-32 and X64.
+
+ If Idtr is NULL, then ASSERT().
+
+ @param Idtr Pointer to a IDTR descriptor.
+
+**/
+VOID
+EFIAPI
+AsmReadIdtr (
+ OUT IA32_DESCRIPTOR *Idtr
+ )
+{
+ ASSERT (Idtr != NULL);
+ InternalX86ReadIdtr (Idtr);
+}
diff --git a/MdePkg/Library/BaseLib/x86Thunk.c b/MdePkg/Library/BaseLib/x86Thunk.c
index 9e69255..c74962a 100644
--- a/MdePkg/Library/BaseLib/x86Thunk.c
+++ b/MdePkg/Library/BaseLib/x86Thunk.c
@@ -58,6 +58,7 @@ extern CONST UINT16 mTransition;
**/
IA32_REGISTER_SET *
+EFIAPI
InternalAsmThunk16 (
IN IA32_REGISTER_SET *RegisterSet,
IN OUT VOID *Transition
diff --git a/MdePkg/Library/BaseLib/x86WriteGdtr.c b/MdePkg/Library/BaseLib/x86WriteGdtr.c
new file mode 100644
index 0000000..c3df563
--- /dev/null
+++ b/MdePkg/Library/BaseLib/x86WriteGdtr.c
@@ -0,0 +1,38 @@
+/** @file
+ IA-32/x64 AsmWriteGdtr()
+
+ Copyright (c) 2006, Intel Corporation<BR>
+ All rights reserved. This program and the accompanying materials
+ are licensed and made available under the terms and conditions of the BSD License
+ which accompanies this distribution. The full text of the license may be found at
+ http://opensource.org/licenses/bsd-license.php
+
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+ Module Name: x86GetInterruptState.c
+
+**/
+
+#include "BaseLibInternals.h"
+
+/**
+ Writes the current Global Descriptor Table Register (GDTR) descriptor.
+
+ Writes and the current GDTR descriptor specified by Gdtr. This function is
+ only available on IA-32 and X64.
+
+ If Gdtr is NULL, then ASSERT().
+
+ @param Gdtr Pointer to a GDTR descriptor.
+
+**/
+VOID
+EFIAPI
+AsmWriteGdtr (
+ IN CONST IA32_DESCRIPTOR *Gdtr
+ )
+{
+ ASSERT (Gdtr != NULL);
+ InternalX86WriteGdtr (Gdtr);
+}
diff --git a/MdePkg/Library/BaseLib/x86WriteIdtr.c b/MdePkg/Library/BaseLib/x86WriteIdtr.c
new file mode 100644
index 0000000..cfe6758
--- /dev/null
+++ b/MdePkg/Library/BaseLib/x86WriteIdtr.c
@@ -0,0 +1,38 @@
+/** @file
+ IA-32/x64 AsmWriteIdtr()
+
+ Copyright (c) 2006, Intel Corporation<BR>
+ All rights reserved. This program and the accompanying materials
+ are licensed and made available under the terms and conditions of the BSD License
+ which accompanies this distribution. The full text of the license may be found at
+ http://opensource.org/licenses/bsd-license.php
+
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+ Module Name: x86WriteIdtr.c
+
+**/
+
+#include "BaseLibInternals.h"
+
+/**
+ Writes the current Interrupt Descriptor Table Register(GDTR) descriptor.
+
+ Writes the current IDTR descriptor and returns it in Idtr. This function is
+ only available on IA-32 and X64.
+
+ If Idtr is NULL, then ASSERT().
+
+ @param Idtr Pointer to a IDTR descriptor.
+
+**/
+VOID
+EFIAPI
+AsmWriteIdtr (
+ IN CONST IA32_DESCRIPTOR *Idtr
+ )
+{
+ ASSERT (Idtr != NULL);
+ InternalX86WriteIdtr (Idtr);
+}