]> git.proxmox.com Git - mirror_edk2.git/commitdiff
1. Updated function headers in all assembly files.
authorbxing <bxing@6f19259b-4bc3-4df7-8a09-765794883524>
Fri, 21 Jul 2006 08:47:38 +0000 (08:47 +0000)
committerbxing <bxing@6f19259b-4bc3-4df7-8a09-765794883524>
Fri, 21 Jul 2006 08:47:38 +0000 (08:47 +0000)
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

253 files changed:
MdePkg/Library/BaseLib/BaseLib.msa
MdePkg/Library/BaseLib/Ia32/ARShiftU64.S
MdePkg/Library/BaseLib/Ia32/ARShiftU64.asm
MdePkg/Library/BaseLib/Ia32/CpuBreakpoint.S
MdePkg/Library/BaseLib/Ia32/CpuFlushTlb.S
MdePkg/Library/BaseLib/Ia32/CpuFlushTlb.asm
MdePkg/Library/BaseLib/Ia32/CpuId.S
MdePkg/Library/BaseLib/Ia32/CpuId.asm
MdePkg/Library/BaseLib/Ia32/CpuIdEx.S
MdePkg/Library/BaseLib/Ia32/CpuPause.S
MdePkg/Library/BaseLib/Ia32/CpuPause.asm
MdePkg/Library/BaseLib/Ia32/CpuSleep.S
MdePkg/Library/BaseLib/Ia32/CpuSleep.asm
MdePkg/Library/BaseLib/Ia32/DisableInterrupts.S
MdePkg/Library/BaseLib/Ia32/DisableInterrupts.asm
MdePkg/Library/BaseLib/Ia32/DisablePaging32.S
MdePkg/Library/BaseLib/Ia32/DisablePaging32.asm
MdePkg/Library/BaseLib/Ia32/DivU64x32.S
MdePkg/Library/BaseLib/Ia32/DivU64x32.asm
MdePkg/Library/BaseLib/Ia32/DivU64x32Remainder.S
MdePkg/Library/BaseLib/Ia32/DivU64x32Remainder.asm
MdePkg/Library/BaseLib/Ia32/DivU64x64Remainder.S
MdePkg/Library/BaseLib/Ia32/DivU64x64Remainder.asm
MdePkg/Library/BaseLib/Ia32/EnableDisableInterrupts.S
MdePkg/Library/BaseLib/Ia32/EnableInterrupts.S
MdePkg/Library/BaseLib/Ia32/EnablePaging32.S
MdePkg/Library/BaseLib/Ia32/EnablePaging64.S
MdePkg/Library/BaseLib/Ia32/EnablePaging64.asm
MdePkg/Library/BaseLib/Ia32/FlushCacheLine.S
MdePkg/Library/BaseLib/Ia32/FlushCacheLine.asm
MdePkg/Library/BaseLib/Ia32/FxRestore.S
MdePkg/Library/BaseLib/Ia32/FxRestore.asm
MdePkg/Library/BaseLib/Ia32/FxSave.S
MdePkg/Library/BaseLib/Ia32/FxSave.asm
MdePkg/Library/BaseLib/Ia32/InterlockedCompareExchange32.S
MdePkg/Library/BaseLib/Ia32/InterlockedCompareExchange32.asm
MdePkg/Library/BaseLib/Ia32/InterlockedCompareExchange64.S
MdePkg/Library/BaseLib/Ia32/InterlockedCompareExchange64.asm
MdePkg/Library/BaseLib/Ia32/InterlockedDecrement.S
MdePkg/Library/BaseLib/Ia32/InterlockedDecrement.asm
MdePkg/Library/BaseLib/Ia32/InterlockedIncrement.S
MdePkg/Library/BaseLib/Ia32/InterlockedIncrement.asm
MdePkg/Library/BaseLib/Ia32/Invd.S
MdePkg/Library/BaseLib/Ia32/LRotU64.S
MdePkg/Library/BaseLib/Ia32/LRotU64.asm
MdePkg/Library/BaseLib/Ia32/LShiftU64.S
MdePkg/Library/BaseLib/Ia32/LShiftU64.asm
MdePkg/Library/BaseLib/Ia32/LongJump.S
MdePkg/Library/BaseLib/Ia32/LongJump.asm
MdePkg/Library/BaseLib/Ia32/ModU64x32.S
MdePkg/Library/BaseLib/Ia32/ModU64x32.asm
MdePkg/Library/BaseLib/Ia32/Monitor.S
MdePkg/Library/BaseLib/Ia32/Monitor.asm
MdePkg/Library/BaseLib/Ia32/MultU64x32.S
MdePkg/Library/BaseLib/Ia32/MultU64x32.asm
MdePkg/Library/BaseLib/Ia32/MultU64x64.S
MdePkg/Library/BaseLib/Ia32/MultU64x64.asm
MdePkg/Library/BaseLib/Ia32/Mwait.S
MdePkg/Library/BaseLib/Ia32/Mwait.asm
MdePkg/Library/BaseLib/Ia32/RRotU64.S
MdePkg/Library/BaseLib/Ia32/RRotU64.asm
MdePkg/Library/BaseLib/Ia32/RShiftU64.S
MdePkg/Library/BaseLib/Ia32/RShiftU64.asm
MdePkg/Library/BaseLib/Ia32/ReadCr0.S
MdePkg/Library/BaseLib/Ia32/ReadCr0.asm
MdePkg/Library/BaseLib/Ia32/ReadCr2.S
MdePkg/Library/BaseLib/Ia32/ReadCr2.asm
MdePkg/Library/BaseLib/Ia32/ReadCr3.S
MdePkg/Library/BaseLib/Ia32/ReadCr3.asm
MdePkg/Library/BaseLib/Ia32/ReadCr4.S
MdePkg/Library/BaseLib/Ia32/ReadCr4.asm
MdePkg/Library/BaseLib/Ia32/ReadCs.S
MdePkg/Library/BaseLib/Ia32/ReadCs.asm
MdePkg/Library/BaseLib/Ia32/ReadDr0.S
MdePkg/Library/BaseLib/Ia32/ReadDr0.asm
MdePkg/Library/BaseLib/Ia32/ReadDr1.S
MdePkg/Library/BaseLib/Ia32/ReadDr1.asm
MdePkg/Library/BaseLib/Ia32/ReadDr2.S
MdePkg/Library/BaseLib/Ia32/ReadDr2.asm
MdePkg/Library/BaseLib/Ia32/ReadDr3.S
MdePkg/Library/BaseLib/Ia32/ReadDr3.asm
MdePkg/Library/BaseLib/Ia32/ReadDr4.S
MdePkg/Library/BaseLib/Ia32/ReadDr4.asm
MdePkg/Library/BaseLib/Ia32/ReadDr5.S
MdePkg/Library/BaseLib/Ia32/ReadDr5.asm
MdePkg/Library/BaseLib/Ia32/ReadDr6.S
MdePkg/Library/BaseLib/Ia32/ReadDr6.asm
MdePkg/Library/BaseLib/Ia32/ReadDr7.S
MdePkg/Library/BaseLib/Ia32/ReadDr7.asm
MdePkg/Library/BaseLib/Ia32/ReadDs.S
MdePkg/Library/BaseLib/Ia32/ReadDs.asm
MdePkg/Library/BaseLib/Ia32/ReadEflags.S
MdePkg/Library/BaseLib/Ia32/ReadEflags.asm
MdePkg/Library/BaseLib/Ia32/ReadEs.S
MdePkg/Library/BaseLib/Ia32/ReadEs.asm
MdePkg/Library/BaseLib/Ia32/ReadFs.S
MdePkg/Library/BaseLib/Ia32/ReadFs.asm
MdePkg/Library/BaseLib/Ia32/ReadGdtr.S
MdePkg/Library/BaseLib/Ia32/ReadGs.S
MdePkg/Library/BaseLib/Ia32/ReadGs.asm
MdePkg/Library/BaseLib/Ia32/ReadIdtr.S
MdePkg/Library/BaseLib/Ia32/ReadIdtr.asm
MdePkg/Library/BaseLib/Ia32/ReadLdtr.S
MdePkg/Library/BaseLib/Ia32/ReadLdtr.asm
MdePkg/Library/BaseLib/Ia32/ReadMm0.S
MdePkg/Library/BaseLib/Ia32/ReadMm0.asm
MdePkg/Library/BaseLib/Ia32/ReadMm1.S
MdePkg/Library/BaseLib/Ia32/ReadMm1.asm
MdePkg/Library/BaseLib/Ia32/ReadMm2.S
MdePkg/Library/BaseLib/Ia32/ReadMm2.asm
MdePkg/Library/BaseLib/Ia32/ReadMm3.S
MdePkg/Library/BaseLib/Ia32/ReadMm3.asm
MdePkg/Library/BaseLib/Ia32/ReadMm4.S
MdePkg/Library/BaseLib/Ia32/ReadMm4.asm
MdePkg/Library/BaseLib/Ia32/ReadMm5.S
MdePkg/Library/BaseLib/Ia32/ReadMm5.asm
MdePkg/Library/BaseLib/Ia32/ReadMm6.S
MdePkg/Library/BaseLib/Ia32/ReadMm6.asm
MdePkg/Library/BaseLib/Ia32/ReadMm7.S
MdePkg/Library/BaseLib/Ia32/ReadMm7.asm
MdePkg/Library/BaseLib/Ia32/ReadMsr64.S
MdePkg/Library/BaseLib/Ia32/ReadMsr64.asm
MdePkg/Library/BaseLib/Ia32/ReadPmc.S
MdePkg/Library/BaseLib/Ia32/ReadPmc.asm
MdePkg/Library/BaseLib/Ia32/ReadSs.S
MdePkg/Library/BaseLib/Ia32/ReadSs.asm
MdePkg/Library/BaseLib/Ia32/ReadTr.S
MdePkg/Library/BaseLib/Ia32/ReadTr.asm
MdePkg/Library/BaseLib/Ia32/ReadTsc.S
MdePkg/Library/BaseLib/Ia32/ReadTsc.asm
MdePkg/Library/BaseLib/Ia32/SetJump.S
MdePkg/Library/BaseLib/Ia32/SetJump.asm
MdePkg/Library/BaseLib/Ia32/SwapBytes64.S
MdePkg/Library/BaseLib/Ia32/SwapBytes64.asm
MdePkg/Library/BaseLib/Ia32/Thunk16.S
MdePkg/Library/BaseLib/Ia32/Thunk16.asm
MdePkg/Library/BaseLib/Ia32/Wbinvd.S
MdePkg/Library/BaseLib/Ia32/Wbinvd.asm
MdePkg/Library/BaseLib/Ia32/WriteCr0.S
MdePkg/Library/BaseLib/Ia32/WriteCr0.asm
MdePkg/Library/BaseLib/Ia32/WriteCr2.S
MdePkg/Library/BaseLib/Ia32/WriteCr2.asm
MdePkg/Library/BaseLib/Ia32/WriteCr3.S
MdePkg/Library/BaseLib/Ia32/WriteCr3.asm
MdePkg/Library/BaseLib/Ia32/WriteCr4.S
MdePkg/Library/BaseLib/Ia32/WriteCr4.asm
MdePkg/Library/BaseLib/Ia32/WriteDr0.S
MdePkg/Library/BaseLib/Ia32/WriteDr0.asm
MdePkg/Library/BaseLib/Ia32/WriteDr1.S
MdePkg/Library/BaseLib/Ia32/WriteDr1.asm
MdePkg/Library/BaseLib/Ia32/WriteDr2.S
MdePkg/Library/BaseLib/Ia32/WriteDr2.asm
MdePkg/Library/BaseLib/Ia32/WriteDr3.S
MdePkg/Library/BaseLib/Ia32/WriteDr3.asm
MdePkg/Library/BaseLib/Ia32/WriteDr4.S
MdePkg/Library/BaseLib/Ia32/WriteDr4.asm
MdePkg/Library/BaseLib/Ia32/WriteDr5.S
MdePkg/Library/BaseLib/Ia32/WriteDr5.asm
MdePkg/Library/BaseLib/Ia32/WriteDr6.S
MdePkg/Library/BaseLib/Ia32/WriteDr6.asm
MdePkg/Library/BaseLib/Ia32/WriteDr7.S
MdePkg/Library/BaseLib/Ia32/WriteDr7.asm
MdePkg/Library/BaseLib/Ia32/WriteGdtr.S
MdePkg/Library/BaseLib/Ia32/WriteGdtr.asm
MdePkg/Library/BaseLib/Ia32/WriteIdtr.S
MdePkg/Library/BaseLib/Ia32/WriteIdtr.asm
MdePkg/Library/BaseLib/Ia32/WriteLdtr.S
MdePkg/Library/BaseLib/Ia32/WriteMm0.S
MdePkg/Library/BaseLib/Ia32/WriteMm0.asm
MdePkg/Library/BaseLib/Ia32/WriteMm1.S
MdePkg/Library/BaseLib/Ia32/WriteMm1.asm
MdePkg/Library/BaseLib/Ia32/WriteMm2.S
MdePkg/Library/BaseLib/Ia32/WriteMm2.asm
MdePkg/Library/BaseLib/Ia32/WriteMm3.S
MdePkg/Library/BaseLib/Ia32/WriteMm3.asm
MdePkg/Library/BaseLib/Ia32/WriteMm4.S
MdePkg/Library/BaseLib/Ia32/WriteMm4.asm
MdePkg/Library/BaseLib/Ia32/WriteMm5.S
MdePkg/Library/BaseLib/Ia32/WriteMm5.asm
MdePkg/Library/BaseLib/Ia32/WriteMm6.S
MdePkg/Library/BaseLib/Ia32/WriteMm6.asm
MdePkg/Library/BaseLib/Ia32/WriteMm7.S
MdePkg/Library/BaseLib/Ia32/WriteMm7.asm
MdePkg/Library/BaseLib/Ia32/WriteMsr32.S [deleted file]
MdePkg/Library/BaseLib/Ia32/WriteMsr32.asm [deleted file]
MdePkg/Library/BaseLib/Ia32/WriteMsr64.S
MdePkg/Library/BaseLib/Ia32/WriteMsr64.asm
MdePkg/Library/BaseLib/SetJump.c
MdePkg/Library/BaseLib/X64/DisablePaging64.asm
MdePkg/Library/BaseLib/X64/FxRestore.asm
MdePkg/Library/BaseLib/X64/FxSave.asm
MdePkg/Library/BaseLib/X64/LongJump.asm
MdePkg/Library/BaseLib/X64/ReadCs.asm
MdePkg/Library/BaseLib/X64/ReadDs.asm
MdePkg/Library/BaseLib/X64/ReadEs.asm
MdePkg/Library/BaseLib/X64/ReadFs.asm
MdePkg/Library/BaseLib/X64/ReadGdtr.asm
MdePkg/Library/BaseLib/X64/ReadGs.asm
MdePkg/Library/BaseLib/X64/ReadIdtr.asm
MdePkg/Library/BaseLib/X64/ReadMm0.asm
MdePkg/Library/BaseLib/X64/ReadMm1.asm
MdePkg/Library/BaseLib/X64/ReadMm2.asm
MdePkg/Library/BaseLib/X64/ReadMm3.asm
MdePkg/Library/BaseLib/X64/ReadMm4.asm
MdePkg/Library/BaseLib/X64/ReadMm5.asm
MdePkg/Library/BaseLib/X64/ReadMm6.asm
MdePkg/Library/BaseLib/X64/ReadMm7.asm
MdePkg/Library/BaseLib/X64/ReadMsr32.asm [deleted file]
MdePkg/Library/BaseLib/X64/ReadMsr64.asm
MdePkg/Library/BaseLib/X64/ReadPmc.asm
MdePkg/Library/BaseLib/X64/ReadSs.asm
MdePkg/Library/BaseLib/X64/ReadTsc.asm
MdePkg/Library/BaseLib/X64/SetJump.asm
MdePkg/Library/BaseLib/X64/Thunk16.asm
MdePkg/Library/BaseLib/X64/WriteCr0.asm
MdePkg/Library/BaseLib/X64/WriteCr2.asm
MdePkg/Library/BaseLib/X64/WriteCr3.asm
MdePkg/Library/BaseLib/X64/WriteCr4.asm
MdePkg/Library/BaseLib/X64/WriteDr0.asm
MdePkg/Library/BaseLib/X64/WriteDr1.asm
MdePkg/Library/BaseLib/X64/WriteDr2.asm
MdePkg/Library/BaseLib/X64/WriteDr3.asm
MdePkg/Library/BaseLib/X64/WriteDr4.asm
MdePkg/Library/BaseLib/X64/WriteDr5.asm
MdePkg/Library/BaseLib/X64/WriteDr6.asm
MdePkg/Library/BaseLib/X64/WriteDr7.asm
MdePkg/Library/BaseLib/X64/WriteGdtr.asm
MdePkg/Library/BaseLib/X64/WriteIdtr.asm
MdePkg/Library/BaseLib/X64/WriteMm0.asm
MdePkg/Library/BaseLib/X64/WriteMm1.asm
MdePkg/Library/BaseLib/X64/WriteMm2.asm
MdePkg/Library/BaseLib/X64/WriteMm3.asm
MdePkg/Library/BaseLib/X64/WriteMm4.asm
MdePkg/Library/BaseLib/X64/WriteMm5.asm
MdePkg/Library/BaseLib/X64/WriteMm6.asm
MdePkg/Library/BaseLib/X64/WriteMm7.asm
MdePkg/Library/BaseLib/X64/WriteMsr32.asm [deleted file]
MdePkg/Library/BaseLib/X64/WriteMsr64.asm
MdePkg/Library/BaseLib/x86DisablePaging32.c [new file with mode: 0644]
MdePkg/Library/BaseLib/x86DisablePaging64.c [new file with mode: 0644]
MdePkg/Library/BaseLib/x86EnablePaging32.c [new file with mode: 0644]
MdePkg/Library/BaseLib/x86EnablePaging64.c [new file with mode: 0644]
MdePkg/Library/BaseLib/x86FxRestore.c [new file with mode: 0644]
MdePkg/Library/BaseLib/x86FxSave.c [new file with mode: 0644]
MdePkg/Library/BaseLib/x86GetInterruptState.c [new file with mode: 0644]
MdePkg/Library/BaseLib/x86LowLevel.c [deleted file]
MdePkg/Library/BaseLib/x86MemoryFence.c [new file with mode: 0644]
MdePkg/Library/BaseLib/x86Msr.c [new file with mode: 0644]
MdePkg/Library/BaseLib/x86ReadGdtr.c [new file with mode: 0644]
MdePkg/Library/BaseLib/x86ReadIdtr.c [new file with mode: 0644]
MdePkg/Library/BaseLib/x86Thunk.c
MdePkg/Library/BaseLib/x86WriteGdtr.c [new file with mode: 0644]
MdePkg/Library/BaseLib/x86WriteIdtr.c [new file with mode: 0644]

index cb5359a14f0522fe2027acd44823f4930e8acbe9..3f0224ba3b5be258c9c3ad5d12e2b7a2cfde1cc3 100644 (file)
@@ -83,8 +83,20 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
     <Filename>SwapBytes32.c</Filename>\r
     <Filename>SwapBytes64.c</Filename>\r
     <Filename>SwitchStack.c</Filename>\r
-    <Filename SupArchList="IA32">x86LowLevel.c</Filename>\r
+    <Filename SupArchList="IA32">x86DisablePaging32.c</Filename>\r
+    <Filename SupArchList="IA32">x86DisablePaging64.c</Filename>\r
+    <Filename SupArchList="IA32">x86EnablePaging32.c</Filename>\r
+    <Filename SupArchList="IA32">x86EnablePaging64.c</Filename>\r
+    <Filename SupArchList="IA32">x86FxRestore.c</Filename>\r
+    <Filename SupArchList="IA32">x86FxSave.c</Filename>\r
+    <Filename SupArchList="IA32">x86GetInterruptState.c</Filename>\r
+    <Filename SupArchList="IA32">x86MemoryFence.c</Filename>\r
+    <Filename SupArchList="IA32">x86Msr.c</Filename>\r
+    <Filename SupArchList="IA32">x86ReadGdtr.c</Filename>\r
+    <Filename SupArchList="IA32">x86ReadIdtr.c</Filename>\r
     <Filename SupArchList="IA32">x86Thunk.c</Filename>\r
+    <Filename SupArchList="IA32">x86WriteGdtr.c</Filename>\r
+    <Filename SupArchList="IA32">x86WriteIdtr.c</Filename>\r
     <Filename SupArchList="IA32">Unaligned.c</Filename>\r
     <Filename SupArchList="IA32">Ia32/Non-existing.c</Filename>\r
     <Filename SupArchList="IA32">Ia32/InternalSwitchStack.c</Filename>\r
@@ -107,7 +119,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
     <Filename SupArchList="IA32">Ia32/CpuIdEx.asm</Filename>\r
     <Filename SupArchList="IA32">Ia32/ReadEflags.asm</Filename>\r
     <Filename SupArchList="IA32">Ia32/ReadMsr64.asm</Filename>\r
-    <Filename SupArchList="IA32">Ia32/WriteMsr32.asm</Filename>\r
     <Filename SupArchList="IA32">Ia32/WriteMsr64.asm</Filename>\r
     <Filename SupArchList="IA32">Ia32/ReadCr0.asm</Filename>\r
     <Filename SupArchList="IA32">Ia32/ReadCr2.asm</Filename>\r
@@ -205,7 +216,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
     <Filename SupArchList="IA32">Ia32/CpuIdEx.S</Filename>\r
     <Filename SupArchList="IA32">Ia32/ReadEflags.S</Filename>\r
     <Filename SupArchList="IA32">Ia32/ReadMsr64.S</Filename>\r
-    <Filename SupArchList="IA32">Ia32/WriteMsr32.S</Filename>\r
     <Filename SupArchList="IA32">Ia32/WriteMsr64.S</Filename>\r
     <Filename SupArchList="IA32">Ia32/ReadCr0.S</Filename>\r
     <Filename SupArchList="IA32">Ia32/ReadCr2.S</Filename>\r
@@ -284,8 +294,20 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
     <Filename SupArchList="IA32">Ia32/CpuBreakpoint.S</Filename>\r
     <Filename SupArchList="IA32">Ia32/CpuFlushTlb.S</Filename>\r
     <Filename SupArchList="IA32">Ia32/Thunk16.S</Filename>\r
-    <Filename SupArchList="X64">x86LowLevel.c</Filename>\r
+    <Filename SupArchList="X64">x86DisablePaging32.c</Filename>\r
+    <Filename SupArchList="X64">x86DisablePaging64.c</Filename>\r
+    <Filename SupArchList="X64">x86EnablePaging32.c</Filename>\r
+    <Filename SupArchList="X64">x86EnablePaging64.c</Filename>\r
+    <Filename SupArchList="X64">x86FxRestore.c</Filename>\r
+    <Filename SupArchList="X64">x86FxSave.c</Filename>\r
+    <Filename SupArchList="X64">x86GetInterruptState.c</Filename>\r
+    <Filename SupArchList="X64">x86MemoryFence.c</Filename>\r
+    <Filename SupArchList="X64">x86Msr.c</Filename>\r
+    <Filename SupArchList="X64">x86ReadGdtr.c</Filename>\r
+    <Filename SupArchList="X64">x86ReadIdtr.c</Filename>\r
     <Filename SupArchList="X64">x86Thunk.c</Filename>\r
+    <Filename SupArchList="X64">x86WriteGdtr.c</Filename>\r
+    <Filename SupArchList="X64">x86WriteIdtr.c</Filename>\r
     <Filename SupArchList="X64">Unaligned.c</Filename>\r
     <Filename SupArchList="X64">Math64.c</Filename>\r
     <Filename SupArchList="X64">X64/Non-existing.c</Filename>\r
@@ -295,9 +317,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
     <Filename SupArchList="X64">X64/CpuId.asm</Filename>\r
     <Filename SupArchList="X64">X64/CpuIdEx.asm</Filename>\r
     <Filename SupArchList="X64">X64/ReadEflags.asm</Filename>\r
-    <Filename SupArchList="X64">X64/ReadMsr32.asm</Filename>\r
     <Filename SupArchList="X64">X64/ReadMsr64.asm</Filename>\r
-    <Filename SupArchList="X64">X64/WriteMsr32.asm</Filename>\r
     <Filename SupArchList="X64">X64/WriteMsr64.asm</Filename>\r
     <Filename SupArchList="X64">X64/ReadCr0.asm</Filename>\r
     <Filename SupArchList="X64">X64/ReadCr2.asm</Filename>\r
index 426ce5bd264039cce520f712d762db56972239bd..a41cfdb65c8c2c1d60f11e972067b3d3704b24bc 100644 (file)
 #\r
 #------------------------------------------------------------------------------\r
 \r
-\r
-\r
-     \r
-\r
 .global _InternalMathARShiftU64\r
-_InternalMathARShiftU64: \r
-    movb    12(%esp),%cl\r
-    movl    8(%esp),%eax\r
+\r
+#------------------------------------------------------------------------------\r
+# UINT64\r
+# EFIAPI\r
+# InternalMathARShiftU64 (\r
+#   IN      UINT64                    Operand,\r
+#   IN      UINTN                     Count\r
+#   );\r
+#------------------------------------------------------------------------------\r
+_InternalMathARShiftU64:\r
+    movb    12(%esp), %cl\r
+    movl    8(%esp), %eax\r
     cltd\r
-    testb   $32,%cl\r
+    testb   $32, %cl\r
     cmovz   %eax, %edx\r
     cmovz   4(%esp), %eax\r
-    shrdl   %cl,%edx,%eax\r
-    sar     %cl,%edx\r
+    shrdl   %cl, %edx, %eax\r
+    sar     %cl, %edx\r
     ret\r
-\r
-\r
-\r
index 6b9cfa18a80e3ab7e8508259b7f7c329ad564a3e..17f07bb66c61ac16dd4705a217b9241fca066b63 100644 (file)
     .model  flat,C\r
     .code\r
 \r
+;------------------------------------------------------------------------------\r
+; UINT64\r
+; EFIAPI\r
+; InternalMathARShiftU64 (\r
+;   IN      UINT64                    Operand,\r
+;   IN      UINTN                     Count\r
+;   );\r
+;------------------------------------------------------------------------------\r
 InternalMathARShiftU64  PROC\r
     mov     cl, [esp + 12]\r
     mov     eax, [esp + 8]\r
@@ -35,4 +43,4 @@ InternalMathARShiftU64  PROC
     ret\r
 InternalMathARShiftU64  ENDP\r
 \r
-    END
\ No newline at end of file
+    END\r
index 859369e50f38b2b1b940f4e8b16ea598f0f097c6..f88dc6846db70953571160bdb0b69793ecbfc285 100644 (file)
 #\r
 #------------------------------------------------------------------------------\r
 \r
-\r
-\r
-     \r
-     \r
+.global _CpuBreakpoint\r
 \r
 #------------------------------------------------------------------------------\r
 # VOID\r
 #   VOID\r
 #   );\r
 #------------------------------------------------------------------------------\r
-.global _CpuBreakpoint\r
-_CpuBreakpoint: \r
+_CpuBreakpoint:\r
     int  $3\r
     ret\r
-\r
-\r
-\r
index 1d85fa77da28f53cbbf3885731329e6fa30ae43b..c9d6194cdc3f23b0a471d4606e94b797d5924be4 100644 (file)
@@ -20,9 +20,7 @@
 #\r
 #------------------------------------------------------------------------------\r
 \r
-\r
-\r
-     \r
+.global _CpuFlushTlb\r
 \r
 #------------------------------------------------------------------------------\r
 # VOID\r
 #   VOID\r
 #   );\r
 #------------------------------------------------------------------------------\r
-.global _CpuFlushTlb\r
-_CpuFlushTlb: \r
+_CpuFlushTlb:\r
     movl    %cr3, %eax\r
     movl    %eax, %cr3\r
     ret\r
-\r
-\r
-\r
index de87ad75e9f55946f85d6a812eccdfe3f25bfd7c..367412403e1bdb3c448ade927854e55dfe32561f 100644 (file)
@@ -21,7 +21,7 @@
 ;------------------------------------------------------------------------------\r
 \r
     .386p\r
-    .model  flat\r
+    .model  flat,C\r
     .code\r
 \r
 ;------------------------------------------------------------------------------\r
 ;   VOID\r
 ;   );\r
 ;------------------------------------------------------------------------------\r
-_CpuFlushTlb    PROC\r
+CpuFlushTlb PROC\r
     mov     eax, cr3\r
     mov     cr3, eax\r
     ret\r
-_CpuFlushTlb    ENDP\r
+CpuFlushTlb ENDP\r
 \r
     END\r
index c394de926d4602a03c306aaa42bced356209bcdb..592ade651a6a32829a768d37abc4608526ae59bf 100644 (file)
@@ -21,6 +21,7 @@
 #\r
 #------------------------------------------------------------------------------\r
 \r
+.globl  _AsmCpuid\r
 \r
 #------------------------------------------------------------------------------\r
 #  VOID\r
 #    OUT  UINT32  *RegisterOutEdx  OPTIONAL\r
 #    )\r
 #------------------------------------------------------------------------------\r
-.globl  _AsmCpuid\r
 _AsmCpuid:\r
-    pushl   %ebx\r
-    pushl   %ebp\r
+    push    %ebx\r
+    push    %ebp\r
     movl    %esp, %ebp\r
     movl    12(%ebp), %eax\r
     cpuid\r
-    pushl   %ecx\r
+    push    %ecx\r
     movl    16(%ebp), %ecx\r
     jecxz   L1\r
     movl    %eax, (%ecx)\r
-L1: \r
+L1:\r
     movl    20(%ebp), %ecx\r
     jecxz   L2\r
     movl    %ebx, (%ecx)\r
-L2: \r
+L2:\r
     movl    24(%ebp), %ecx\r
     jecxz   L3\r
     popl    (%ecx)\r
-L3: \r
+L3:\r
     movl    28(%ebp), %ecx\r
     jecxz   L4\r
     movl    %edx, (%ecx)\r
-L4: \r
+L4:\r
     movl    12(%ebp), %eax\r
     leave\r
-    popl    %ebx\r
+    pop     %ebx\r
     ret\r
-\r
-\r
index 2c94e3a1aee2fa6bad64350b879c34b52458c268..5c0eb1ffc81e72e33e1086fbefcbcc6338032380 100644 (file)
@@ -34,7 +34,7 @@
 ;    OUT  UINT32  *RegisterOutEbx  OPTIONAL,\r
 ;    OUT  UINT32  *RegisterOutEcx  OPTIONAL,\r
 ;    OUT  UINT32  *RegisterOutEdx  OPTIONAL\r
-;    )\r
+;    );\r
 ;------------------------------------------------------------------------------\r
 AsmCpuid    PROC    USES    ebx\r
     push    ebp\r
index e5255fb1a3fe342c10f94bcf17727f2a60068c43..ab66fe75b20bbe7a6835c41e8b06d018fcd7d127 100644 (file)
@@ -21,8 +21,8 @@
 #
 #------------------------------------------------------------------------------
 
-    .686: 
-    .code: 
+    .686:
+    .code:
 
 #------------------------------------------------------------------------------
 #  UINT32
 .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
index ace2c6764ac1a6a82da5ec26dcf780dbc0b63131..7df74327e5c483cfb3bd88b4dd2bd83c8453d009 100644 (file)
 #\r
 #------------------------------------------------------------------------------\r
 \r
-\r
-\r
-     \r
-     \r
+.global _CpuPause\r
 \r
 #------------------------------------------------------------------------------\r
 # VOID\r
 #   VOID\r
 #   );\r
 #------------------------------------------------------------------------------\r
-.global _CpuPause\r
-_CpuPause: \r
+_CpuPause:\r
     pause\r
     ret\r
-\r
-\r
-\r
index 79a4f2f67bc369330fe59d122d02ae5b0e04e689..4c7135fc9ca35afeb8a37a6e59b522a50c622a08 100644 (file)
@@ -21,7 +21,7 @@
 ;------------------------------------------------------------------------------\r
 \r
     .686\r
-    .model  flat\r
+    .model  flat,C\r
     .xmm\r
     .code\r
 \r
@@ -32,9 +32,9 @@
 ;   VOID\r
 ;   );\r
 ;------------------------------------------------------------------------------\r
-_CpuPause   PROC\r
+CpuPause    PROC\r
     pause\r
     ret\r
-_CpuPause   ENDP\r
+CpuPause    ENDP\r
 \r
     END\r
index 9b7713128fdf84aa7034ede8d15454fe4581edd7..93106df0f7c25f2ee93dc6730250995166a28a64 100644 (file)
@@ -20,9 +20,7 @@
 #\r
 #------------------------------------------------------------------------------\r
 \r
-\r
-\r
-     \r
+.global _CpuSleep\r
 \r
 #------------------------------------------------------------------------------\r
 # VOID\r
 #   VOID\r
 #   );\r
 #------------------------------------------------------------------------------\r
-.global _CpuSleep\r
-_CpuSleep: \r
+_CpuSleep:\r
     hlt\r
     ret\r
-\r
-\r
-\r
index 66fb90e903c1f98a133606bc22586d754cb395e1..8a779f7017fafaa2322eb0068eb8f4affbedf2f7 100644 (file)
@@ -21,7 +21,7 @@
 ;------------------------------------------------------------------------------\r
 \r
     .386\r
-    .model  flat\r
+    .model  flat,C\r
     .code\r
 \r
 ;------------------------------------------------------------------------------\r
@@ -31,9 +31,9 @@
 ;   VOID\r
 ;   );\r
 ;------------------------------------------------------------------------------\r
-_CpuSleep   PROC\r
+CpuSleep    PROC\r
     hlt\r
     ret\r
-_CpuSleep   ENDP\r
+CpuSleep    ENDP\r
 \r
     END\r
index cc9c95c30f657d9a4ccb9122ddcbcb28d282911a..a222d7a700c461b996c9668daf5fcfd96024073f 100644 (file)
@@ -21,9 +21,7 @@
 #\r
 #------------------------------------------------------------------------------\r
 \r
-\r
-\r
-     \r
+.global _DisableInterrupts\r
 \r
 #------------------------------------------------------------------------------\r
 # VOID\r
 #   VOID\r
 #   );\r
 #------------------------------------------------------------------------------\r
-.global _DisableInterrupts\r
-_DisableInterrupts: \r
+_DisableInterrupts:\r
     cli\r
     ret\r
-\r
-\r
-\r
index 74bdd0bd9833164dd700d81b0d1a0bfef1d83f2c..35209ff0d46395894f7449e9e96bcb1fc4def1bd 100644 (file)
@@ -22,7 +22,7 @@
 ;------------------------------------------------------------------------------\r
 \r
     .386p\r
-    .model  flat\r
+    .model  flat,C\r
     .code\r
 \r
 ;------------------------------------------------------------------------------\r
@@ -32,9 +32,9 @@
 ;   VOID\r
 ;   );\r
 ;------------------------------------------------------------------------------\r
-_DisableInterrupts  PROC\r
+DisableInterrupts   PROC\r
     cli\r
     ret\r
-_DisableInterrupts  ENDP\r
+DisableInterrupts   ENDP\r
 \r
     END\r
index b4e488ffe64929917c094c515b23697f35dbe3ad..5ade180009fc4d3c5eeecf347f49ff0e7e134d5a 100644 (file)
@@ -21,9 +21,7 @@
 #\r
 #------------------------------------------------------------------------------\r
 \r
-\r
-\r
-     \r
+.global _InternalX86DisablePaging32\r
 \r
 #------------------------------------------------------------------------------\r
 # VOID\r
 #   IN      VOID                      *NewStack\r
 #   );\r
 #------------------------------------------------------------------------------\r
-.global _InternalX86DisablePaging32\r
-_InternalX86DisablePaging32: \r
-    movl    4(%esp),%ebx\r
-    movl    8(%esp),%ecx\r
-    movl    12(%esp),%edx\r
+_InternalX86DisablePaging32:\r
+    movl    4(%esp), %ebx\r
+    movl    8(%esp), %ecx\r
+    movl    12(%esp), %edx\r
     pushfl\r
-    popl    %edi\r
+    pop     %edi\r
     cli\r
     movl    %cr0, %eax\r
-    btrl    $31,%eax\r
-    movl    16(%esp),%esp\r
+    btrl    $31, %eax\r
+    movl    16(%esp), %esp\r
     movl    %eax, %cr0\r
-    pushl   %edi\r
+    push    %edi\r
     popfl\r
-    pushl   %edx\r
-    pushl   %ecx\r
+    push    %edx\r
+    push    %ecx\r
     call    *%ebx\r
     jmp     .\r
-\r
-\r
-\r
index 04ae8cf51463cb5976d44584d5254d4efcc74405..d2949773b32c37a9df59dda558531345a6442dc8 100644 (file)
@@ -40,18 +40,18 @@ InternalX86DisablePaging32    PROC
     mov     ecx, [esp + 8]\r
     mov     edx, [esp + 12]\r
     pushfd\r
-    pop     edi\r
+    pop     edi                         ; save EFLAGS to edi\r
     cli\r
     mov     eax, cr0\r
     btr     eax, 31\r
     mov     esp, [esp + 16]\r
     mov     cr0, eax\r
     push    edi\r
-    popfd\r
+    popfd                               ; restore EFLAGS from edi\r
     push    edx\r
     push    ecx\r
     call    ebx\r
-    jmp     $\r
+    jmp     $                           ; EntryPoint() should not return\r
 InternalX86DisablePaging32    ENDP\r
 \r
     END\r
index 89d754614afd81759222eb273c7e51b843cd741d..0c7829f23eab32035d91cadeb82f39900c6ce619 100644 (file)
 #
 #------------------------------------------------------------------------------
 
-    .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
index 1ad54745864b6aa5a891f8798d254388adf2dc28..25ca074ad95718dbcee8fc2bc2d35940a5b1e182 100644 (file)
     .model  flat,C\r
     .code\r
 \r
+;------------------------------------------------------------------------------\r
+; UINT64\r
+; EFIAPI\r
+; InternalMathDivU64x32 (\r
+;   IN      UINT64                    Dividend,\r
+;   IN      UINT32                    Divisor\r
+;   );\r
+;------------------------------------------------------------------------------\r
 InternalMathDivU64x32   PROC\r
     mov     eax, [esp + 8]\r
     mov     ecx, [esp + 12]\r
     xor     edx, edx\r
     div     ecx\r
-    push    eax\r
+    push    eax                     ; save quotient on stack\r
     mov     eax, [esp + 8]\r
     div     ecx\r
-    pop     edx\r
+    pop     edx                     ; restore high-order dword of the quotient\r
     ret\r
 InternalMathDivU64x32   ENDP\r
 \r
index 1f34f1825583757c9fb809bf4c3fe94b8facfe55..41537b05ec3b04aafbbda0433cd39e37a84170e8 100644 (file)
 #\r
 #------------------------------------------------------------------------------\r
 \r
-\r
-\r
-     \r
-\r
 .global _InternalMathDivRemU64x32\r
-_InternalMathDivRemU64x32: \r
-    movl    12(%esp),%ecx\r
-    movl    8(%esp),%eax\r
-    xorl    %edx,%edx\r
+\r
+#------------------------------------------------------------------------------\r
+# UINT64\r
+# EFIAPI\r
+# InternalMathDivRemU64x32 (\r
+#   IN      UINT64                    Dividend,\r
+#   IN      UINT32                    Divisor,\r
+#   OUT     UINT32                    *Remainder\r
+#   );\r
+#------------------------------------------------------------------------------\r
+_InternalMathDivRemU64x32:\r
+    movl    12(%esp), %ecx\r
+    movl    8(%esp), %eax\r
+    xorl    %edx, %edx\r
     divl    %ecx\r
-    pushl   %eax\r
-    movl    8(%esp),%eax\r
+    push    %eax\r
+    movl    8(%esp), %eax\r
     divl    %ecx\r
-    movl    20(%esp),%ecx\r
+    movl    20(%esp), %ecx\r
     jecxz   L1\r
-    movl    %edx,(%ecx)\r
-L1: \r
-    popl    %edx\r
+    movl    %edx, (%ecx)\r
+L1:\r
+    pop     %edx\r
     ret\r
-\r
-\r
-\r
index f1c6c1f4acd1535295ba7f21b8707a8cf6aacab8..a836e22d0db671c83f9fae605fe4570c06b2e918 100644 (file)
     .model  flat,C\r
     .code\r
 \r
+;------------------------------------------------------------------------------\r
+; UINT64\r
+; EFIAPI\r
+; InternalMathDivRemU64x32 (\r
+;   IN      UINT64                    Dividend,\r
+;   IN      UINT32                    Divisor,\r
+;   OUT     UINT32                    *Remainder\r
+;   );\r
+;------------------------------------------------------------------------------\r
 InternalMathDivRemU64x32    PROC\r
     mov     ecx, [esp + 12]\r
     mov     eax, [esp + 8]\r
@@ -32,7 +41,7 @@ InternalMathDivRemU64x32    PROC
     mov     eax, [esp + 8]\r
     div     ecx\r
     mov     ecx, [esp + 20]\r
-    jecxz   @F\r
+    jecxz   @F                      ; abandon remainder if Remainder == NULL\r
     mov     [ecx], edx\r
 @@:\r
     pop     edx\r
index df1e6ad495c4028ca19482fdce6dfa96d6d3384a..90ccc56a7011f689529d4d85f2ea516556762e47 100644 (file)
 #\r
 #------------------------------------------------------------------------------\r
 \r
+.global _InternalMathDivRemU64x32, _InternalMathDivRemU64x64\r
 \r
-\r
-     \r
-\r
-.extern _InternalMathDivRemU64x32\r
-\r
-.global _InternalMathDivRemU64x64\r
-_InternalMathDivRemU64x64: \r
-    movl    16(%esp),%ecx\r
-    testl   %ecx,%ecx\r
-    jnz     _DivRemU64x64\r
-    movl    20(%esp),%ecx\r
+#------------------------------------------------------------------------------\r
+# UINT64\r
+# EFIAPI\r
+# InternalMathDivRemU64x64 (\r
+#   IN      UINT64                    Dividend,\r
+#   IN      UINT64                    Divisor,\r
+#   OUT     UINT64                    *Remainder    OPTIONAL\r
+#   );\r
+#------------------------------------------------------------------------------\r
+_InternalMathDivRemU64x64:\r
+    movl    16(%esp), %ecx\r
+    testl   %ecx, %ecx\r
+    jnz     Hard\r
+    movl    20(%esp), %ecx\r
     jecxz   L1\r
-    and     $0,4(%ecx)\r
-    movl    %ecx,16(%esp)\r
-L1: \r
+    and     $0, 4(%ecx)\r
+    movl    %ecx, 16(%esp)\r
+L1:\r
     jmp     _InternalMathDivRemU64x32\r
-\r
-\r
-.global _DivRemU64x64\r
-_DivRemU64x64:\r
-    push   %ebx                                                                             \r
-    push   %esi                                                                             \r
-    push   %edi                                        \r
+Hard:\r
+    push    %ebx\r
+    push    %esi\r
+    push    %edi\r
     mov     20(%esp), %edx\r
     mov     16(%esp), %eax\r
-    movl    %edx,%edi\r
-    movl    %eax,%esi\r
+    movl    %edx, %edi\r
+    movl    %eax, %esi\r
     mov     24(%esp), %ebx\r
-L2: \r
+L2:\r
     shrl    %edx\r
-    rcrl    $1,%eax\r
-    shrdl   $1,%ecx,%ebx\r
+    rcrl    $1, %eax\r
+    shrdl   $1, %ecx, %ebx\r
     shrl    %ecx\r
     jnz     L2\r
     divl    %ebx\r
-    movl    %eax,%ebx\r
-    movl    28(%esp),%ecx\r
+    movl    %eax, %ebx\r
+    movl    28(%esp), %ecx\r
     mull    24(%esp)\r
-    imull   %ebx,%ecx\r
-    addl    %ecx,%edx\r
+    imull   %ebx, %ecx\r
+    addl    %ecx, %edx\r
     mov     32(%esp), %ecx\r
     jc      TooLarge\r
-    cmpl    %edx,%edi\r
+    cmpl    %edx, %edi\r
     ja      Correct\r
     jb      TooLarge\r
-    cmpl    %eax,%esi\r
+    cmpl    %eax, %esi\r
     jae     Correct\r
-TooLarge: \r
+TooLarge:\r
     decl    %ebx\r
     jecxz   Return\r
     sub     24(%esp), %eax\r
     sbb     28(%esp), %edx\r
-Correct: \r
+Correct:\r
     jecxz   Return\r
-    subl    %eax,%esi\r
-    sbbl    %edx,%edi\r
-    movl    %esi,(%ecx)\r
-    movl    %edi,4(%ecx)\r
-Return: \r
-    movl    %ebx,%eax\r
-    xorl    %edx,%edx\r
-    push   %edi                                        \r
-    push   %esi                                                                             \r
-    push   %ebx                                                                             \r
+    subl    %eax, %esi\r
+    sbbl    %edx, %edi\r
+    movl    %esi, (%ecx)\r
+    movl    %edi, 4(%ecx)\r
+Return:\r
+    movl    %ebx, %eax\r
+    xorl    %edx, %edx\r
+    pop     %edi\r
+    pop     %esi\r
+    pop     %ebx\r
     ret\r
index 261211b946f4aec191987ec9d3c3c7b138bde9b8..61a53d1e3a42f7d1d115322d910347ec41598e18 100644 (file)
 \r
 EXTERN  InternalMathDivRemU64x32:PROC\r
 \r
+;------------------------------------------------------------------------------\r
+; UINT64\r
+; EFIAPI\r
+; InternalMathDivRemU64x64 (\r
+;   IN      UINT64                    Dividend,\r
+;   IN      UINT64                    Divisor,\r
+;   OUT     UINT64                    *Remainder    OPTIONAL\r
+;   );\r
+;------------------------------------------------------------------------------\r
 InternalMathDivRemU64x64    PROC\r
     mov     ecx, [esp + 16]\r
     test    ecx, ecx\r
-    jnz     _@DivRemU64x64\r
+    jnz     _@DivRemU64x64              ; call _@DivRemU64x64 if Divisor > 2^32\r
     mov     ecx, [esp + 20]\r
     jecxz   @F\r
     and     dword ptr [ecx + 4], 0\r
@@ -40,10 +49,10 @@ InternalMathDivRemU64x64    ENDP
 \r
 _@DivRemU64x64  PROC    USES    ebx esi edi\r
     mov     edx, dword ptr [esp + 20]\r
-    mov     eax, dword ptr [esp + 16]\r
+    mov     eax, dword ptr [esp + 16]   ; edx:eax <- dividend\r
     mov     edi, edx\r
-    mov     esi, eax\r
-    mov     ebx, dword ptr [esp + 24]\r
+    mov     esi, eax                    ; edi:esi <- dividend\r
+    mov     ebx, dword ptr [esp + 24]   ; ecx:ebx <- divisor\r
 @@:\r
     shr     edx, 1\r
     rcr     eax, 1\r
@@ -51,31 +60,31 @@ _@DivRemU64x64  PROC    USES    ebx esi edi
     shr     ecx, 1\r
     jnz     @B\r
     div     ebx\r
-    mov     ebx, eax\r
+    mov     ebx, eax                    ; ebx <- quotient\r
     mov     ecx, [esp + 28]\r
     mul     dword ptr [esp + 24]\r
     imul    ecx, ebx\r
     add     edx, ecx\r
     mov     ecx, dword ptr [esp + 32]\r
-    jc      @TooLarge\r
-    cmp     edi, edx\r
+    jc      @TooLarge                   ; product > 2^64\r
+    cmp     edi, edx                    ; compare high 32 bits\r
     ja      @Correct\r
-    jb      @TooLarge\r
+    jb      @TooLarge                   ; product > dividend\r
     cmp     esi, eax\r
-    jae     @Correct\r
+    jae     @Correct                    ; product <= dividend\r
 @TooLarge:\r
-    dec     ebx\r
-    jecxz   @Return\r
+    dec     ebx                         ; adjust quotient by -1\r
+    jecxz   @Return                     ; return if Remainder == NULL\r
     sub     eax, dword ptr [esp + 24]\r
     sbb     edx, dword ptr [esp + 28]\r
 @Correct:\r
     jecxz   @Return\r
     sub     esi, eax\r
-    sbb     edi, edx\r
+    sbb     edi, edx                    ; edi:esi <- remainder\r
     mov     [ecx], esi\r
     mov     [ecx + 4], edi\r
 @Return:\r
-    mov     eax, ebx\r
+    mov     eax, ebx                    ; eax <- quotient\r
     xor     edx, edx\r
     ret\r
 _@DivRemU64x64  ENDP\r
index 80362a95b28bb0d6e753125b95bde866e32ff10c..c082561f66588ee0e2c42c4a83aebc89476ffff3 100644 (file)
@@ -21,9 +21,7 @@
 #\r
 #------------------------------------------------------------------------------\r
 \r
-\r
-\r
-     \r
+.global _EnableDisableInterrupts\r
 \r
 #------------------------------------------------------------------------------\r
 # VOID\r
 #   VOID\r
 #   );\r
 #------------------------------------------------------------------------------\r
-.global _EnableDisableInterrupts\r
-_EnableDisableInterrupts: \r
+_EnableDisableInterrupts:\r
     sti\r
     cli\r
     ret\r
-\r
-\r
-\r
index 74413d83b63afcf01354318c5e7530f40f89eefe..075b85e2602f45efe6975ae65c8b0020c10b2164 100644 (file)
@@ -21,9 +21,7 @@
 #\r
 #------------------------------------------------------------------------------\r
 \r
-\r
-\r
-     \r
+.global _EnableInterrupts\r
 \r
 #------------------------------------------------------------------------------\r
 # VOID\r
 #   VOID\r
 #   );\r
 #------------------------------------------------------------------------------\r
-.global _EnableInterrupts\r
-_EnableInterrupts: \r
+_EnableInterrupts:\r
     sti\r
     ret\r
-\r
-\r
-\r
index 7c97a502daab03cd79b2c88ea431aa80d3a6a7ec..7335e628f95e076e2c25bd36fd37d71a1cadce40 100644 (file)
@@ -21,9 +21,7 @@
 #\r
 #------------------------------------------------------------------------------\r
 \r
-\r
-\r
-     \r
+.global _InternalX86EnablePaging32\r
 \r
 #------------------------------------------------------------------------------\r
 # VOID\r
 #   IN      VOID                      *NewStack\r
 #   );\r
 #------------------------------------------------------------------------------\r
-.global _InternalX86EnablePaging32\r
-_InternalX86EnablePaging32: \r
-    movl    4(%esp),%ebx\r
-    movl    8(%esp),%ecx\r
-    movl    12(%esp),%edx\r
+_InternalX86EnablePaging32:\r
+    movl    4(%esp), %ebx\r
+    movl    8(%esp), %ecx\r
+    movl    12(%esp), %edx\r
     pushfl\r
-    popl    %edi\r
+    pop     %edi\r
     cli\r
     movl    %cr0, %eax\r
-    btsl    $31,%eax\r
-    movl    16(%esp),%esp\r
+    btsl    $31, %eax\r
+    movl    16(%esp), %esp\r
     movl    %eax, %cr0\r
-    pushl   %edi\r
+    push    %edi\r
     popfl\r
-    pushl   %edx\r
-    pushl   %ecx\r
+    push    %edx\r
+    push    %ecx\r
     call    *%ebx\r
     jmp     .\r
-\r
-\r
-\r
index 37584799803e8e9301578f03338a3d6f1d1fd52e..61525b840311729c583fc493caff933d25f939fd 100644 (file)
@@ -21,9 +21,7 @@
 #\r
 #------------------------------------------------------------------------------\r
 \r
-     \r
-    #.MODEL flat\r
-     \r
+.global _InternalX86EnablePaging64\r
 \r
 #------------------------------------------------------------------------------\r
 # VOID\r
@@ -36,7 +34,6 @@
 #   IN      UINT64                    NewStack\r
 #   );\r
 #------------------------------------------------------------------------------\r
-.global _InternalX86EnablePaging64\r
 _InternalX86EnablePaging64:\r
     cli\r
     movl    $LongStart, (%esp)\r
@@ -52,13 +49,13 @@ _InternalX86EnablePaging64:
     movl    %eax, %cr0                  # enable paging\r
     lret\r
 LongStart:                              # long mode starts here\r
-    .byte   0x67,0x48\r
+    .byte   0x67, 0x48\r
     movl    (%esp), %ebx                # mov rbx, [esp]\r
-    .byte   0x67,0x48\r
+    .byte   0x67, 0x48\r
     movl    8(%esp), %ecx               # mov rcx, [esp + 8]\r
-    .byte   0x67,0x48\r
+    .byte   0x67, 0x48\r
     movl    0x10(%esp), %edx            # mov rdx, [esp + 10h]\r
-    .byte   0x67,0x48\r
+    .byte   0x67, 0x48\r
     movl    0x18(%esp), %esp            # mov rsp, [esp + 18h]\r
     .byte   0x48\r
     addl    $0x-20, %esp                # add rsp, -20h\r
index 6c9b0ea76bca8a44de6914f218b73ca1b13c4975..354d1fe60340c1a707adb6cfa689327f3dceafa5 100644 (file)
     .model  flat,C\r
     .code\r
 \r
+;------------------------------------------------------------------------------\r
+; VOID\r
+; EFIAPI\r
+; InternalX86EnablePaging64 (\r
+;   IN      UINT16                    Cs,\r
+;   IN      UINT64                    EntryPoint,\r
+;   IN      UINT64                    Context1,  OPTIONAL\r
+;   IN      UINT64                    Context2,  OPTIONAL\r
+;   IN      UINT64                    NewStack\r
+;   );\r
+;------------------------------------------------------------------------------\r
 InternalX86EnablePaging64 PROC\r
     cli\r
-    mov     [esp], @F                   ; offset for far retf\r
+    mov     [esp], @F                   ; offset for far retf, seg is the 1st arg\r
     mov     eax, cr4\r
     or      al, (1 SHL 5)\r
     mov     cr4, eax                    ; enable PAE\r
index c14bd11d68b10402c0fc7bda39dac0a336abdfef..a1c62755f4c3faf7b23c9d33f2bacb68b0776980 100644 (file)
 #\r
 #------------------------------------------------------------------------------\r
 \r
-\r
-\r
-     \r
-     \r
+.global _AsmFlushCacheLine\r
 \r
 #------------------------------------------------------------------------------\r
 # VOID\r
 #   IN      VOID                      *LinearAddress\r
 #   );\r
 #------------------------------------------------------------------------------\r
-.global _AsmFlushCacheLine\r
-_AsmFlushCacheLine: \r
-    movl    4(%esp),%eax\r
+_AsmFlushCacheLine:\r
+    movl    4(%esp), %eax\r
     clflush (%eax)\r
     ret\r
-\r
-\r
-\r
index c1e6466d04a8312a336d91e454b5d3d0537f9bce..f4ad87de7bd5dddfb67711560287ce923c860b8b 100644 (file)
@@ -22,7 +22,7 @@
 ;------------------------------------------------------------------------------\r
 \r
     .586P\r
-    .model  flat\r
+    .model  flat,C\r
     .xmm\r
     .code\r
 \r
 ;   IN      VOID                      *LinearAddress\r
 ;   );\r
 ;------------------------------------------------------------------------------\r
-_AsmFlushCacheLine  PROC\r
+AsmFlushCacheLine   PROC\r
     mov     eax, [esp + 4]\r
     clflush [eax]\r
     ret\r
-_AsmFlushCacheLine  ENDP\r
+AsmFlushCacheLine   ENDP\r
 \r
     END\r
index cc840de464547e5abf7ee8c72a5460a7438245fc..fa1922308f97b988667fe9e1d66fc461166087a2 100644 (file)
 #\r
 #------------------------------------------------------------------------------\r
 \r
-\r
-\r
-     \r
-     \r
+.global _InternalX86FxRestore\r
 \r
 #------------------------------------------------------------------------------\r
 # VOID\r
 #   IN CONST IA32_FX_BUFFER *Buffer\r
 #   );\r
 #------------------------------------------------------------------------------\r
-.global _InternalX86FxRestore\r
-_InternalX86FxRestore: \r
-    movl    4(%esp),%eax\r
+_InternalX86FxRestore:\r
+    movl    4(%esp), %eax\r
     fxrstor (%eax)\r
     ret\r
-\r
-\r
-\r
index e9e37d1384f670ee0fd570ddf32bdba980b4d3b6..9bcc6ac885c1abf281931b2aa7ae8155c20ad79b 100644 (file)
@@ -21,7 +21,7 @@
 ;\r
 ;------------------------------------------------------------------------------\r
 \r
-    .586P\r
+    .586\r
     .model  flat,C\r
     .xmm\r
     .code\r
index a558816e1dc391bd766ddb9b35eeb71ce2877079..7bca947ceaccb2b4cd321131094a6f3b44d8a9ec 100644 (file)
 #\r
 #------------------------------------------------------------------------------\r
 \r
-\r
-\r
-     \r
-     \r
+.global _InternalX86FxSave\r
 \r
 #------------------------------------------------------------------------------\r
 # VOID\r
 #   OUT IA32_FX_BUFFER *Buffer\r
 #   );\r
 #------------------------------------------------------------------------------\r
-.global _InternalX86FxSave\r
-_InternalX86FxSave: \r
-    movl    4(%esp),%eax\r
+_InternalX86FxSave:\r
+    movl    4(%esp), %eax\r
     fxsave  (%eax)\r
     ret\r
-\r
-\r
-\r
index 22496c5e57e57d62537afbf6d445202940de6bbe..7d5ea45ffb79ea0897c6170eef2026d5ebd7f634 100644 (file)
@@ -21,7 +21,7 @@
 ;\r
 ;------------------------------------------------------------------------------\r
 \r
-    .586P\r
+    .586\r
     .model  flat,C\r
     .xmm\r
     .code\r
index b53ca0fb93e07c6b994c22c3147c015c9c6e923d..ec0eec1928ac77db4c415f4114297e26c1a2fdaa 100644 (file)
@@ -21,9 +21,7 @@
 #\r
 #------------------------------------------------------------------------------\r
 \r
-\r
-\r
-     \r
+.global _InternalSyncCompareExchange32\r
 \r
 #------------------------------------------------------------------------------\r
 # UINT32\r
 #   IN      UINT32                    ExchangeValue\r
 #   );\r
 #------------------------------------------------------------------------------\r
-.global _InternalSyncCompareExchange32\r
-_InternalSyncCompareExchange32: \r
-    movl    4(%esp),%ecx\r
-    movl    8(%esp),%eax\r
-    movl    12(%esp),%edx\r
-    lock    cmpxchgl %edx,(%ecx)\r
+_InternalSyncCompareExchange32:\r
+    movl    4(%esp), %ecx\r
+    movl    8(%esp), %eax\r
+    movl    12(%esp), %edx\r
+    lock\r
+    cmpxchgl    %edx, (%ecx)\r
     ret\r
-\r
-\r
-\r
index c8c20fbc922bd51e6f62b97011fb41f4eac2452e..47d959fa6afd58188dbffbd18ea62a372a7a15b6 100644 (file)
@@ -28,7 +28,7 @@
 ;------------------------------------------------------------------------------\r
 ; UINT32\r
 ; EFIAPI\r
-; InterlockedCompareExchange32 (\r
+; InternalSyncCompareExchange32 (\r
 ;   IN      UINT32                    *Value,\r
 ;   IN      UINT32                    CompareValue,\r
 ;   IN      UINT32                    ExchangeValue\r
index 383503fbfe985aacf22b46d33eca103e35bff2d6..5c964b9e6268fe69eb71d9ace7bc1cdf41a347e9 100644 (file)
@@ -21,9 +21,7 @@
 #\r
 #------------------------------------------------------------------------------\r
 \r
-\r
-\r
-     \r
+.global _InternalSyncCompareExchange64\r
 \r
 #------------------------------------------------------------------------------\r
 # UINT64\r
 #   IN      UINT64                    ExchangeValue\r
 #   );\r
 #------------------------------------------------------------------------------\r
-.global _InternalSyncCompareExchange64\r
 _InternalSyncCompareExchange64:\r
     push    %esi\r
     push    %ebx\r
-    movl    12(%esp),%esi\r
-    movl    16(%esp),%eax\r
-    movl    20(%esp),%edx\r
-    movl    24(%esp),%ebx\r
-    movl    28(%esp),%ecx\r
-    lock    \r
+    movl    12(%esp), %esi\r
+    movl    16(%esp), %eax\r
+    movl    20(%esp), %edx\r
+    movl    24(%esp), %ebx\r
+    movl    28(%esp), %ecx\r
+    lock\r
     cmpxchg8b   (%esi)\r
     pop     %ebx\r
     pop     %esi\r
     ret\r
-\r
-\r
-\r
index cded9206b84bb1343bee0df603edaa63a5ff5d8e..18311e77d36a49854c0bc7ef565a90aff1aae36f 100644 (file)
@@ -28,7 +28,7 @@
 ;------------------------------------------------------------------------------\r
 ; UINT64\r
 ; EFIAPI\r
-; InterlockedCompareExchange64 (\r
+; InternalSyncCompareExchange64 (\r
 ;   IN      UINT64                    *Value,\r
 ;   IN      UINT64                    CompareValue,\r
 ;   IN      UINT64                    ExchangeValue\r
index 4256b60ee96115cfd801bbe4dec52321de9abc86..72765031d28c23c813534dee61c1aceacd5d94e6 100644 (file)
@@ -21,9 +21,7 @@
 #\r
 #------------------------------------------------------------------------------\r
 \r
-\r
-\r
-     \r
+.global _InternalSyncDecrement\r
 \r
 #------------------------------------------------------------------------------\r
 # UINT32\r
 #   IN      UINT32                    *Value\r
 #   );\r
 #------------------------------------------------------------------------------\r
-.global _InternalSyncDecrement\r
-_InternalSyncDecrement: \r
-    movl    4(%esp),%eax\r
-    lock    \r
-    decl     (%eax)\r
-    movl    (%eax),%eax\r
+_InternalSyncDecrement:\r
+    movl    4(%esp), %eax\r
+    lock\r
+    decl    (%eax)\r
+    movl    (%eax), %eax\r
     ret\r
-\r
-\r
-\r
index d8495405c0ced2df61e55cd00335fe656cb6f775..082429e5205713b332ac77b5d9965dcadbaff0d5 100644 (file)
@@ -28,7 +28,7 @@
 ;------------------------------------------------------------------------------\r
 ; UINT32\r
 ; EFIAPI\r
-; InterlockedDecrement (\r
+; InternalSyncDecrement (\r
 ;   IN      UINT32                    *Value\r
 ;   );\r
 ;------------------------------------------------------------------------------\r
index 02cb33b29bac735ca0d6acc49aa9d5b16de1a62f..69f604cac59b6778d39f64eaad443ea20b63eca8 100644 (file)
@@ -21,9 +21,7 @@
 #\r
 #------------------------------------------------------------------------------\r
 \r
-\r
-\r
-     \r
+.global _InternalSyncIncrement\r
 \r
 #------------------------------------------------------------------------------\r
 # UINT32\r
 #   IN      UINT32                    *Value\r
 #   );\r
 #------------------------------------------------------------------------------\r
-.global _InternalSyncIncrement\r
-_InternalSyncIncrement: \r
-    movl    4(%esp),%eax\r
-    lock    \r
-    incl     (%eax)\r
-    movl    (%eax),%eax\r
+_InternalSyncIncrement:\r
+    movl    4(%esp), %eax\r
+    lock\r
+    incl    (%eax)\r
+    movl    (%eax), %eax\r
     ret\r
-\r
-\r
-\r
index a7bfb6fccd9db6742264b13be59856c09ebc0f2f..ea27e666cae97512b5df7657e7e404ee8f958e01 100644 (file)
@@ -28,7 +28,7 @@
 ;------------------------------------------------------------------------------\r
 ; UINT32\r
 ; EFIAPI\r
-; InterlockedIncrement (\r
+; InternalSyncIncrement (\r
 ;   IN      UINT32                    *Value\r
 ;   );\r
 ;------------------------------------------------------------------------------\r
index 6d6c8d46cdeaaacc38d40a75bfc8946981460856..f87aa08a6c0626d631d1065a77d8afa474afa7b0 100644 (file)
@@ -21,9 +21,7 @@
 #\r
 #------------------------------------------------------------------------------\r
 \r
-\r
-\r
-     \r
+.global _AsmInvd\r
 \r
 #------------------------------------------------------------------------------\r
 # VOID\r
 #   VOID\r
 #   );\r
 #------------------------------------------------------------------------------\r
-.global _AsmInvd\r
-_AsmInvd: \r
+_AsmInvd:\r
     invd\r
     ret\r
-\r
-\r
-\r
index 54cdfadcc8f4a2234048071c7473dc9b5647ce72..a9f72d8505533119cc679875817c90288fe4ec18 100644 (file)
 #\r
 #------------------------------------------------------------------------------\r
 \r
-\r
-\r
-     \r
-\r
 .global _InternalMathLRotU64\r
+\r
+#------------------------------------------------------------------------------\r
+# UINT64\r
+# EFIAPI\r
+# InternalMathLRotU64 (\r
+#   IN      UINT64                    Operand,\r
+#   IN      UINTN                     Count\r
+#   );\r
+#------------------------------------------------------------------------------\r
 _InternalMathLRotU64:\r
     push    %ebx\r
-    movb    16(%esp),%cl\r
-    movl    12(%esp),%edx\r
-    movl    8(%esp),%eax\r
-    shldl   %cl,%edx,%ebx\r
-    shldl   %cl,%eax,%edx\r
-    rorl    %cl,%ebx\r
-    shldl   %cl,%ebx,%eax\r
-    testb   $32,%cl\r
+    movb    16(%esp), %cl\r
+    movl    12(%esp), %edx\r
+    movl    8(%esp), %eax\r
+    shldl   %cl, %edx, %ebx\r
+    shldl   %cl, %eax, %edx\r
+    rorl    %cl, %ebx\r
+    shldl   %cl, %ebx, %eax\r
+    testb   $32, %cl\r
     cmovnz  %eax, %ecx\r
-    cmovnz  %edx, %eax \r
+    cmovnz  %edx, %eax\r
     cmovnz  %ecx, %edx\r
     pop     %ebx\r
     ret\r
-\r
-\r
-\r
index 1d5562a799c7d1d93336907da0c37d65ed86fd7a..a6437d868f80fcb34e20d04dc7a6bdbac411989b 100644 (file)
     .model  flat,C\r
     .code\r
 \r
+;------------------------------------------------------------------------------\r
+; UINT64\r
+; EFIAPI\r
+; InternalMathLRotU64 (\r
+;   IN      UINT64                    Operand,\r
+;   IN      UINTN                     Count\r
+;   );\r
+;------------------------------------------------------------------------------\r
 InternalMathLRotU64 PROC    USES    ebx\r
     mov     cl, [esp + 16]\r
     mov     edx, [esp + 12]\r
@@ -31,7 +39,7 @@ InternalMathLRotU64 PROC    USES    ebx
     shld    edx, eax, cl\r
     ror     ebx, cl\r
     shld    eax, ebx, cl\r
-    test    cl, 32\r
+    test    cl, 32                      ; Count >= 32?\r
     cmovnz  ecx, eax\r
     cmovnz  eax, edx\r
     cmovnz  edx, ecx\r
index 4aa17c637dfdbafca4e9b85777719f9d4b4a22de..6912b86fc3c0c74f237afa3627dfa03c6987f839 100644 (file)
 #
 #------------------------------------------------------------------------------
 
-    .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
index 9ce946ddd13302e9dc71843b4ce05d48442adc78..6c3d9a4ee6b1a077faebde354b022a7d89614c94 100644 (file)
     .model  flat,C\r
     .code\r
 \r
+;------------------------------------------------------------------------------\r
+; UINT64\r
+; EFIAPI\r
+; InternalMathLShiftU64 (\r
+;   IN      UINT64                    Operand,\r
+;   IN      UINTN                     Count\r
+;   );\r
+;------------------------------------------------------------------------------\r
 InternalMathLShiftU64   PROC\r
     mov     cl, [esp + 12]\r
     xor     eax, eax\r
     mov     edx, [esp + 4]\r
-    test    cl, 32\r
+    test    cl, 32                      ; Count >= 32?\r
     cmovz   eax, edx\r
     cmovz   edx, [esp + 8]\r
     shld    edx, eax, cl\r
index 5fa1521226231c6fd4a71b4bda4e42194426655b..fa17dddff9cadc961ad305e69ac27e91903e1389 100644 (file)
 #
 #------------------------------------------------------------------------------
 
-    .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
-
-
index b419215237840f263b0378c6180bf9e0d188cd16..a634c4599c41cfa16d1d774021f5fa74fc05a5be 100644 (file)
     .model  flat,C\r
     .code\r
 \r
+;------------------------------------------------------------------------------\r
+; VOID\r
+; EFIAPI\r
+; InternalLongJump (\r
+;   IN      BASE_LIBRARY_JUMP_BUFFER  *JumpBuffer,\r
+;   IN      UINTN                     Value\r
+;   );\r
+;------------------------------------------------------------------------------\r
 InternalLongJump    PROC\r
-    pop     eax\r
-    pop     edx\r
-    pop     eax\r
+    pop     eax                         ; skip return address\r
+    pop     edx                         ; edx <- JumpBuffer\r
+    pop     eax                         ; eax <- Value\r
     mov     ebx, [edx]\r
     mov     esi, [edx + 4]\r
     mov     edi, [edx + 8]\r
index a8e9574b2dabb921d7917004a068bc7579648a33..f2d6cfddf7412860e5c218fec1b2fa0f3d7bf4bf 100644 (file)
 #\r
 #------------------------------------------------------------------------------\r
 \r
-\r
-\r
-     \r
-\r
 .global _InternalMathModU64x32\r
-_InternalMathModU64x32: \r
-    movl    8(%esp),%eax\r
-    movl    12(%esp),%ecx\r
-    xorl    %edx,%edx\r
+\r
+#------------------------------------------------------------------------------\r
+# UINT32\r
+# EFIAPI\r
+# InternalMathModU64x32 (\r
+#   IN      UINT64                    Dividend,\r
+#   IN      UINT32                    Divisor\r
+#   );\r
+#------------------------------------------------------------------------------\r
+_InternalMathModU64x32:\r
+    movl    8(%esp), %eax\r
+    movl    12(%esp), %ecx\r
+    xorl    %edx, %edx\r
     divl    %ecx\r
-    movl    4(%esp),%eax\r
+    movl    4(%esp), %eax\r
     divl    %ecx\r
-    movl    %edx,%eax\r
+    movl    %edx, %eax\r
     ret\r
-\r
-\r
-\r
index 62481ce98ab0d1e0a988cb29a356d140bce861d7..9e5f9aeda96baa9dd0e3c37099a4d75236b1000b 100644 (file)
     .model  flat,C\r
     .code\r
 \r
+;------------------------------------------------------------------------------\r
+; UINT32\r
+; EFIAPI\r
+; InternalMathModU64x32 (\r
+;   IN      UINT64                    Dividend,\r
+;   IN      UINT32                    Divisor\r
+;   );\r
+;------------------------------------------------------------------------------\r
 InternalMathModU64x32   PROC\r
     mov     eax, [esp + 8]\r
     mov     ecx, [esp + 12]\r
index 8da0e341ed35e8e137e21fc8ba798f3e55f4465d..371e1839fce534de8cb410dd7a3918380322bc86 100644 (file)
@@ -21,9 +21,7 @@
 #\r
 #------------------------------------------------------------------------------\r
 \r
-\r
-\r
-     \r
+.global _AsmMonitor\r
 \r
 #------------------------------------------------------------------------------\r
 # UINT64\r
 #   IN      UINTN                     Edx\r
 #   );\r
 #------------------------------------------------------------------------------\r
-.global _AsmMonitor\r
-_AsmMonitor: \r
-    movl    4(%esp),%eax\r
-    movl    8(%esp),%ecx\r
-    movl    12(%esp),%edx\r
-    monitor %eax,%ecx,%edx\r
+_AsmMonitor:\r
+    movl    4(%esp), %eax\r
+    movl    8(%esp), %ecx\r
+    movl    12(%esp), %edx\r
+    monitor %eax, %ecx, %edx\r
     ret\r
-\r
-\r
-\r
index 5d92d266730e81fdb972e4b297435ccb7205e5e4..174bd7665fdc511b29db102399d1ffb0ecc2e516 100644 (file)
 ;------------------------------------------------------------------------------\r
 \r
     .686\r
-    .model  flat\r
+    .model  flat,C\r
     .code\r
 \r
 ;------------------------------------------------------------------------------\r
-; UINT64\r
+; UINTN\r
 ; EFIAPI\r
 ; AsmMonitor (\r
 ;   IN      UINTN                     Eax,\r
 ;   IN      UINTN                     Edx\r
 ;   );\r
 ;------------------------------------------------------------------------------\r
-_AsmMonitor PROC\r
+AsmMonitor  PROC\r
     mov     eax, [esp + 4]\r
     mov     ecx, [esp + 8]\r
     mov     edx, [esp + 12]\r
-    DB      0fh, 1, 0c8h\r
+    DB      0fh, 1, 0c8h                ; monitor\r
     ret\r
-_AsmMonitor ENDP\r
+AsmMonitor  ENDP\r
 \r
     END\r
index 572a312de8f4ad2341c7438b19e3f9cf4969ac56..0b017330760c24d360262f25a7bc72605e4037b5 100644 (file)
 #
 #------------------------------------------------------------------------------
 
-    .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
index e2806e3082e59cccfee12d2c4cb6464037e6ea39..9c9ef069964dc009fe32f9e5f0df4052975ec7b9 100644 (file)
     .model  flat,C\r
     .code\r
 \r
+;------------------------------------------------------------------------------\r
+; UINT64\r
+; EFIAPI\r
+; InternalMathMultU64x32 (\r
+;   IN      UINT64                    Multiplicand,\r
+;   IN      UINT32                    Multiplier\r
+;   );\r
+;------------------------------------------------------------------------------\r
 InternalMathMultU64x32  PROC\r
     mov     ecx, [esp + 12]\r
     mov     eax, ecx\r
-    imul    ecx, [esp + 8]\r
+    imul    ecx, [esp + 8]              ; overflow not detectable\r
     mul     dword ptr [esp + 4]\r
     add     edx, ecx\r
     ret\r
index 641b0d652ca664260d373239611ff7908a648677..f2e55ad6cc9ea2885c644b0af082d3c1dc026f51 100644 (file)
 #\r
 #------------------------------------------------------------------------------\r
 \r
-\r
-\r
-     \r
-\r
 .global _InternalMathMultU64x64\r
-_InternalMathMultU64x64: \r
+\r
+#------------------------------------------------------------------------------\r
+# UINT64\r
+# EFIAPI\r
+# InternalMathMultU64x64 (\r
+#   IN      UINT64                    Multiplicand,\r
+#   IN      UINT64                    Multiplier\r
+#   );\r
+#------------------------------------------------------------------------------\r
+_InternalMathMultU64x64:\r
     push    %ebx\r
-    movl    8(%esp),%ebx\r
-    movl    16(%esp),%edx\r
-    movl    %ebx,%ecx\r
-    movl    %edx,%eax\r
-    imull   20(%esp),%ebx\r
-    imull   12(%esp),%edx\r
-    addl    %edx,%ebx\r
+    movl    8(%esp), %ebx\r
+    movl    16(%esp), %edx\r
+    movl    %ebx, %ecx\r
+    movl    %edx, %eax\r
+    imull   20(%esp), %ebx\r
+    imull   12(%esp), %edx\r
+    addl    %edx, %ebx\r
     mull    %ecx\r
-    addl    %ebx,%edx\r
+    addl    %ebx, %edx\r
     pop     %ebx\r
     ret\r
-\r
-\r
-\r
index 24c6a7daa36b572191e990bccc2c3c457357a899..377aa5197227fc6a335fb46273e51bfa098ace26 100644 (file)
     .model  flat,C\r
     .code\r
 \r
+;------------------------------------------------------------------------------\r
+; UINT64\r
+; EFIAPI\r
+; InternalMathMultU64x64 (\r
+;   IN      UINT64                    Multiplicand,\r
+;   IN      UINT64                    Multiplier\r
+;   );\r
+;------------------------------------------------------------------------------\r
 InternalMathMultU64x64  PROC    USES    ebx\r
     mov     ebx, [esp + 8]\r
     mov     edx, [esp + 16]\r
index 7e044533520955cff5db2a364be8eaa8ccdc754d..1aad7cb357bccc7b342a01f1094a56269070ec71 100644 (file)
@@ -21,9 +21,7 @@
 #\r
 #------------------------------------------------------------------------------\r
 \r
-\r
-\r
-     \r
+.global _AsmMwait\r
 \r
 #------------------------------------------------------------------------------\r
 # UINT64\r
 #   IN      UINTN                     Ecx\r
 #   );\r
 #------------------------------------------------------------------------------\r
-.global _AsmMwait\r
-_AsmMwait: \r
-    movl    4(%esp),%eax\r
-    movl    8(%esp),%ecx\r
-    mwait   %eax,%ecx\r
+_AsmMwait:\r
+    movl    4(%esp), %eax\r
+    movl    8(%esp), %ecx\r
+    mwait   %eax, %ecx\r
     ret\r
-\r
-\r
-\r
index 91d505b4e2d739f7047630a6544a6678a125de9f..3e5f48c28078e4a882823e9b778832ab48416721 100644 (file)
 ;------------------------------------------------------------------------------\r
 \r
     .686\r
-    .model  flat\r
+    .model  flat,C\r
     .code\r
 \r
 ;------------------------------------------------------------------------------\r
-; UINT64\r
+; UINTN\r
 ; EFIAPI\r
 ; AsmMwait (\r
 ;   IN      UINTN                     Eax,\r
 ;   IN      UINTN                     Ecx\r
 ;   );\r
 ;------------------------------------------------------------------------------\r
-_AsmMwait   PROC\r
+AsmMwait    PROC\r
     mov     eax, [esp + 4]\r
     mov     ecx, [esp + 8]\r
-    DB      0fh, 1, 0c9h\r
+    DB      0fh, 1, 0c9h                ; mwait\r
     ret\r
-_AsmMwait   ENDP\r
+AsmMwait    ENDP\r
 \r
     END\r
index 2d4f42fe36063125fe34e866ec7296d3f69d3683..4b89a4eaa7aaf587a62c685e8cdc7d02be5dcbe6 100644 (file)
 #\r
 #------------------------------------------------------------------------------\r
 \r
-\r
-\r
-     \r
-\r
 .global _InternalMathRRotU64\r
+\r
+#------------------------------------------------------------------------------\r
+# UINT64\r
+# EFIAPI\r
+# InternalMathRRotU64 (\r
+#   IN      UINT64                    Operand,\r
+#   IN      UINTN                     Count\r
+#   );\r
+#------------------------------------------------------------------------------\r
 _InternalMathRRotU64:\r
     push    %ebx\r
-    movb    16(%esp),%cl\r
-    movl    8(%esp),%eax\r
-    movl    12(%esp),%edx\r
-    shrdl   %cl,%eax,%ebx\r
-    shrdl   %cl,%edx,%eax\r
-    roll    %cl,%ebx\r
-    shrdl   %cl,%ebx,%edx\r
-    testb   $32,%cl\r
+    movb    16(%esp), %cl\r
+    movl    8(%esp), %eax\r
+    movl    12(%esp), %edx\r
+    shrdl   %cl, %eax, %ebx\r
+    shrdl   %cl, %edx, %eax\r
+    roll    %cl, %ebx\r
+    shrdl   %cl, %ebx, %edx\r
+    testb   $32, %cl\r
     cmovnz  %eax, %ecx\r
     cmovnz  %edx, %eax\r
     cmovnz  %ecx, %edx\r
     pop     %ebx\r
     ret\r
-\r
-\r
-\r
index 062e201e8dfebb69a2ab310b4b174e5fea161e60..4c58878ace0d11f6f81fc53843378d3e2287b176 100644 (file)
     .model  flat,C\r
     .code\r
 \r
+;------------------------------------------------------------------------------\r
+; UINT64\r
+; EFIAPI\r
+; InternalMathRRotU64 (\r
+;   IN      UINT64                    Operand,\r
+;   IN      UINTN                     Count\r
+;   );\r
+;------------------------------------------------------------------------------\r
 InternalMathRRotU64 PROC    USES    ebx\r
     mov     cl, [esp + 16]\r
     mov     eax, [esp + 8]\r
@@ -31,7 +39,7 @@ InternalMathRRotU64 PROC    USES    ebx
     shrd    eax, edx, cl\r
     rol     ebx, cl\r
     shrd    edx, ebx, cl\r
-    test    cl, 32\r
+    test    cl, 32                      ; Count >= 32?\r
     cmovnz  ecx, eax\r
     cmovnz  eax, edx\r
     cmovnz  edx, ecx\r
index f6c28dee965b60fd605a33d20e7f2bf28876e760..3aea31b7ef1fc657a2c32df1995682780dab50e4 100644 (file)
 #
 #------------------------------------------------------------------------------
 
-    .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
index effbc55e1cab7a90eeea75bd090bd61db3f7aa6a..793a8f988fdf28a7996ade12fc18ef24b38d4d87 100644 (file)
     .model  flat,C\r
     .code\r
 \r
+;------------------------------------------------------------------------------\r
+; UINT64\r
+; EFIAPI\r
+; InternalMathRShiftU64 (\r
+;   IN      UINT64                    Operand,\r
+;   IN      UINTN                     Count\r
+;   );\r
+;------------------------------------------------------------------------------\r
 InternalMathRShiftU64   PROC\r
     mov     cl, [esp + 12]\r
     xor     edx, edx\r
@@ -35,4 +43,4 @@ InternalMathRShiftU64   PROC
     ret\r
 InternalMathRShiftU64   ENDP\r
 \r
-    END
\ No newline at end of file
+    END\r
index 3108b71eeb93a74c746c3d53f3a6fbd7672d1b07..4ebb51cab1bd63ab14d3c1064c1dd582e313d723 100644 (file)
@@ -21,9 +21,7 @@
 #\r
 #------------------------------------------------------------------------------\r
 \r
-\r
-\r
-     \r
+.global _AsmReadCr0\r
 \r
 #------------------------------------------------------------------------------\r
 # UINTN\r
 #   VOID\r
 #   );\r
 #------------------------------------------------------------------------------\r
-.global _AsmReadCr0\r
-_AsmReadCr0: \r
+_AsmReadCr0:\r
     movl    %cr0, %eax\r
     ret\r
-\r
-\r
-\r
index 579cee2377553b762e293901442dbeba71b71297..a8fe4a7e891a14df61160e3e4851700c8b72e588 100644 (file)
@@ -22,7 +22,7 @@
 ;------------------------------------------------------------------------------\r
 \r
     .386p\r
-    .model  flat\r
+    .model  flat,C\r
     .code\r
 \r
 ;------------------------------------------------------------------------------\r
@@ -32,9 +32,9 @@
 ;   VOID\r
 ;   );\r
 ;------------------------------------------------------------------------------\r
-_AsmReadCr0 PROC\r
+AsmReadCr0  PROC\r
     mov     eax, cr0\r
     ret\r
-_AsmReadCr0 ENDP\r
+AsmReadCr0  ENDP\r
 \r
     END\r
index 3ce287a2524790a0061c0e06a2a04b5ac8ff31f6..3080ae9aafb956ac2db95e0f8336972d08f3a2f1 100644 (file)
@@ -21,9 +21,7 @@
 #\r
 #------------------------------------------------------------------------------\r
 \r
-\r
-\r
-     \r
+.global _AsmReadCr2\r
 \r
 #------------------------------------------------------------------------------\r
 # UINTN\r
 #   VOID\r
 #   );\r
 #------------------------------------------------------------------------------\r
-.global _AsmReadCr2\r
-_AsmReadCr2: \r
+_AsmReadCr2:\r
     movl    %cr2, %eax\r
     ret\r
-\r
-\r
-\r
index 3e4a926abd227ffd38943e4783a269ac6bc864c2..a6a9b8c08f3be488f8ea13fc9400c727aaf42d19 100644 (file)
@@ -22,7 +22,7 @@
 ;------------------------------------------------------------------------------\r
 \r
     .386p\r
-    .model  flat\r
+    .model  flat,C\r
     .code\r
 \r
 ;------------------------------------------------------------------------------\r
@@ -32,9 +32,9 @@
 ;   VOID\r
 ;   );\r
 ;------------------------------------------------------------------------------\r
-_AsmReadCr2 PROC\r
+AsmReadCr2  PROC\r
     mov     eax, cr2\r
     ret\r
-_AsmReadCr2 ENDP\r
+AsmReadCr2  ENDP\r
 \r
     END\r
index 2bd63c725a26ad11d1931718996fa83ea41b2071..b714801b0a85325971deef54d3b5ab6dae3dbe39 100644 (file)
@@ -21,9 +21,7 @@
 #\r
 #------------------------------------------------------------------------------\r
 \r
-\r
-\r
-     \r
+.global _AsmReadCr3\r
 \r
 #------------------------------------------------------------------------------\r
 # UINTN\r
 #   VOID\r
 #   );\r
 #------------------------------------------------------------------------------\r
-.global _AsmReadCr3\r
-_AsmReadCr3: \r
+_AsmReadCr3:\r
     movl    %cr3, %eax\r
     ret\r
-\r
-\r
-\r
index c24ded8051c64d893f8e04d07cb3ee53a73dead8..97b9ee4b9900fd9a9a51525c1d9a41f16473f7c0 100644 (file)
@@ -22,7 +22,7 @@
 ;------------------------------------------------------------------------------\r
 \r
     .386p\r
-    .model  flat\r
+    .model  flat,C\r
     .code\r
 \r
 ;------------------------------------------------------------------------------\r
@@ -32,9 +32,9 @@
 ;   VOID\r
 ;   );\r
 ;------------------------------------------------------------------------------\r
-_AsmReadCr3 PROC\r
+AsmReadCr3  PROC\r
     mov     eax, cr3\r
     ret\r
-_AsmReadCr3 ENDP\r
+AsmReadCr3  ENDP\r
 \r
     END\r
index 4d746d807ba236d0c3561bfd8d296d258c07c604..212976119a844f33a3faa0aec1ccdcc52e6ff145 100644 (file)
@@ -21,9 +21,7 @@
 #\r
 #------------------------------------------------------------------------------\r
 \r
-\r
-\r
-     \r
+.global _AsmReadCr4\r
 \r
 #------------------------------------------------------------------------------\r
 # UINTN\r
 #   VOID\r
 #   );\r
 #------------------------------------------------------------------------------\r
-.global _AsmReadCr4\r
-_AsmReadCr4: \r
+_AsmReadCr4:\r
     movl    %cr4, %eax\r
     ret\r
-\r
-\r
-\r
index 258f37a97f76b925fc2fc7d9768c5baa8a72399d..a4549033879989fd19a6ccf7c43795e127c4cfee 100644 (file)
@@ -22,7 +22,7 @@
 ;------------------------------------------------------------------------------\r
 \r
     .586p\r
-    .model  flat\r
+    .model  flat,C\r
     .code\r
 \r
 ;------------------------------------------------------------------------------\r
@@ -32,9 +32,9 @@
 ;   VOID\r
 ;   );\r
 ;------------------------------------------------------------------------------\r
-_AsmReadCr4 PROC\r
+AsmReadCr4  PROC\r
     mov     eax, cr4\r
     ret\r
-_AsmReadCr4 ENDP\r
+AsmReadCr4  ENDP\r
 \r
     END\r
index 66bf4b9eebef88c07dc078dc05ca407371202deb..97d76066b00ed46344486b265c6612b2b7beca2f 100644 (file)
@@ -21,9 +21,7 @@
 #\r
 #------------------------------------------------------------------------------\r
 \r
-\r
-\r
-     \r
+.global _AsmReadCs\r
 \r
 #------------------------------------------------------------------------------\r
 # UINT16\r
 #   VOID\r
 #   );\r
 #------------------------------------------------------------------------------\r
-.global _AsmReadCs\r
-_AsmReadCs: \r
-    movw    %cs,%ax\r
+_AsmReadCs:\r
+    movl    %cs, %eax\r
     ret\r
-\r
-\r
-\r
index 5972d66754221265e2725ea7b1d8334e29e346fa..68497e21fec7dcdc0f25b21f454d032e362faa11 100644 (file)
@@ -22,7 +22,7 @@
 ;------------------------------------------------------------------------------\r
 \r
     .386\r
-    .model  flat\r
+    .model  flat,C\r
     .code\r
 \r
 ;------------------------------------------------------------------------------\r
@@ -32,9 +32,9 @@
 ;   VOID\r
 ;   );\r
 ;------------------------------------------------------------------------------\r
-_AsmReadCs  PROC\r
-    mov     ax, cs\r
+AsmReadCs   PROC\r
+    mov     eax, cs\r
     ret\r
-_AsmReadCs  ENDP\r
+AsmReadCs   ENDP\r
 \r
     END\r
index 00c521b51daa0fa60a997162b7b6edad5f5a66b2..8ad15ea5c1c36d71eca55d5ef162cffe729d38f6 100644 (file)
@@ -21,8 +21,7 @@
 #\r
 #------------------------------------------------------------------------------\r
 \r
-\r
-     \r
+.global _AsmReadDr0\r
 \r
 #------------------------------------------------------------------------------\r
 # UINTN\r
 #   VOID\r
 #   );\r
 #------------------------------------------------------------------------------\r
-.global _AsmReadDr0\r
-_AsmReadDr0: \r
+_AsmReadDr0:\r
     movl    %dr0, %eax\r
     ret\r
-\r
-\r
-\r
index 4da1dd8d0d75bfedc91eedaab818e71cf5197dcc..8792ce40b910ef7cb9f8f67c8318b1f36a85da9e 100644 (file)
@@ -22,7 +22,7 @@
 ;------------------------------------------------------------------------------\r
 \r
     .586p\r
-    .model  flat\r
+    .model  flat,C\r
     .code\r
 \r
 ;------------------------------------------------------------------------------\r
@@ -32,9 +32,9 @@
 ;   VOID\r
 ;   );\r
 ;------------------------------------------------------------------------------\r
-_AsmReadDr0 PROC\r
+AsmReadDr0  PROC\r
     mov     eax, dr0\r
     ret\r
-_AsmReadDr0 ENDP\r
+AsmReadDr0  ENDP\r
 \r
     END\r
index 81d0e54919242434004cf321c4f7a022ffff7001..e1d7dab4978a42f5c322a53a37f1410cdb818e4c 100644 (file)
@@ -21,9 +21,7 @@
 #\r
 #------------------------------------------------------------------------------\r
 \r
-\r
-\r
-     \r
+.global _AsmReadDr1\r
 \r
 #------------------------------------------------------------------------------\r
 # UINTN\r
 #   VOID\r
 #   );\r
 #------------------------------------------------------------------------------\r
-.global _AsmReadDr1\r
-_AsmReadDr1: \r
+_AsmReadDr1:\r
     movl    %dr1, %eax\r
     ret\r
-\r
-\r
-\r
index 8724dd228b99bcb913f3ef118ad666489dc7603b..e924407d57c729c6e720af98b27d888aa1464a28 100644 (file)
@@ -22,7 +22,7 @@
 ;------------------------------------------------------------------------------\r
 \r
     .586p\r
-    .model  flat\r
+    .model  flat,C\r
     .code\r
 \r
 ;------------------------------------------------------------------------------\r
@@ -32,9 +32,9 @@
 ;   VOID\r
 ;   );\r
 ;------------------------------------------------------------------------------\r
-_AsmReadDr1 PROC\r
+AsmReadDr1  PROC\r
     mov     eax, dr1\r
     ret\r
-_AsmReadDr1 ENDP\r
+AsmReadDr1  ENDP\r
 \r
     END\r
index 296fff699edf939eb792110f36b2bb6d7d0895bf..1c0ea04a8b04890141bf0c3ed0842647f549fd56 100644 (file)
@@ -21,9 +21,7 @@
 #\r
 #------------------------------------------------------------------------------\r
 \r
-\r
-\r
-     \r
+.global _AsmReadDr2\r
 \r
 #------------------------------------------------------------------------------\r
 # UINTN\r
 #   VOID\r
 #   );\r
 #------------------------------------------------------------------------------\r
-.global _AsmReadDr2\r
-_AsmReadDr2: \r
+_AsmReadDr2:\r
     movl    %dr2, %eax\r
     ret\r
-\r
-\r
-\r
index 9122d42545b7b60e915cd75fe5084a1b46f7ba4f..bbbef7e2fa9865e174d5cfa87e0203fafadeb7b4 100644 (file)
@@ -22,7 +22,7 @@
 ;------------------------------------------------------------------------------\r
 \r
     .586p\r
-    .model  flat\r
+    .model  flat,C\r
     .code\r
 \r
 ;------------------------------------------------------------------------------\r
@@ -32,9 +32,9 @@
 ;   VOID\r
 ;   );\r
 ;------------------------------------------------------------------------------\r
-_AsmReadDr2 PROC\r
+AsmReadDr2  PROC\r
     mov     eax, dr2\r
     ret\r
-_AsmReadDr2 ENDP\r
+AsmReadDr2  ENDP\r
 \r
     END\r
index e99391de819a857aab5a15a7ee375a77eda8ef22..705c5c649a63ef87b69e52ff79ff2d6cc27a7990 100644 (file)
@@ -21,9 +21,7 @@
 #\r
 #------------------------------------------------------------------------------\r
 \r
-\r
-\r
-     \r
+.global _AsmReadDr3\r
 \r
 #------------------------------------------------------------------------------\r
 # UINTN\r
 #   VOID\r
 #   );\r
 #------------------------------------------------------------------------------\r
-.global _AsmReadDr3\r
-_AsmReadDr3: \r
+_AsmReadDr3:\r
     movl    %dr3, %eax\r
     ret\r
-\r
-\r
-\r
index 7c1ee9826d233724b50950ccdd04bbd2e9637a02..af2e7a26895ec4460fe3e923eff44775bc437951 100644 (file)
@@ -22,7 +22,7 @@
 ;------------------------------------------------------------------------------\r
 \r
     .586p\r
-    .model  flat\r
+    .model  flat,C\r
     .code\r
 \r
 ;------------------------------------------------------------------------------\r
@@ -32,9 +32,9 @@
 ;   VOID\r
 ;   );\r
 ;------------------------------------------------------------------------------\r
-_AsmReadDr3 PROC\r
+AsmReadDr3  PROC\r
     mov     eax, dr3\r
     ret\r
-_AsmReadDr3 ENDP\r
+AsmReadDr3  ENDP\r
 \r
     END\r
index 7bff6766a4f97c80e102090dfec790d57550653d..4e7d3d1c1e83edac48a5dd8de4228504e018c2d9 100644 (file)
@@ -21,9 +21,7 @@
 #\r
 #------------------------------------------------------------------------------\r
 \r
-\r
-\r
-     \r
+.global _AsmReadDr4\r
 \r
 #------------------------------------------------------------------------------\r
 # UINTN\r
 #   VOID\r
 #   );\r
 #------------------------------------------------------------------------------\r
-.global _AsmReadDr4\r
-_AsmReadDr4: \r
+_AsmReadDr4:\r
     movl    %dr4, %eax\r
     ret\r
-\r
-\r
-\r
index 01724555d2724ae625594c8e33591c5524a0f364..d1fffe4ec0792aa46e898e74fc66e41c023f60a1 100644 (file)
@@ -22,7 +22,7 @@
 ;------------------------------------------------------------------------------\r
 \r
     .586p\r
-    .model  flat\r
+    .model  flat,C\r
     .code\r
 \r
 ;------------------------------------------------------------------------------\r
@@ -32,9 +32,9 @@
 ;   VOID\r
 ;   );\r
 ;------------------------------------------------------------------------------\r
-_AsmReadDr4 PROC\r
+AsmReadDr4  PROC\r
     DB      0fh, 21h, 0e0h\r
     ret\r
-_AsmReadDr4 ENDP\r
+AsmReadDr4  ENDP\r
 \r
     END\r
index df409e33047bb3d55fb5d709b7950db10801baba..09ae3857f26d7d56df198e3d4d3e8374e1f1b1a4 100644 (file)
@@ -21,9 +21,7 @@
 #\r
 #------------------------------------------------------------------------------\r
 \r
-\r
-\r
-     \r
+.global _AsmReadDr5\r
 \r
 #------------------------------------------------------------------------------\r
 # UINTN\r
 #   VOID\r
 #   );\r
 #------------------------------------------------------------------------------\r
-.global _AsmReadDr5\r
-_AsmReadDr5: \r
+_AsmReadDr5:\r
     movl    %dr5, %eax\r
     ret\r
-\r
-\r
-\r
index a95527e44c9be30a1d74fe99eccf4b47aa2fe94e..bba8b602ba196abead08448782f6b1c50564b3ec 100644 (file)
@@ -22,7 +22,7 @@
 ;------------------------------------------------------------------------------\r
 \r
     .586p\r
-    .model  flat\r
+    .model  flat,C\r
     .code\r
 \r
 ;------------------------------------------------------------------------------\r
@@ -32,9 +32,9 @@
 ;   VOID\r
 ;   );\r
 ;------------------------------------------------------------------------------\r
-_AsmReadDr5 PROC\r
+AsmReadDr5  PROC\r
     DB      0fh, 21h, 0e8h\r
     ret\r
-_AsmReadDr5 ENDP\r
+AsmReadDr5  ENDP\r
 \r
     END\r
index bdadd80672e0751a8d399cb3e8d28ce162c654ea..c514a7680f99dcba5dd497a4642bbb16fa1c6c92 100644 (file)
@@ -21,9 +21,7 @@
 #\r
 #------------------------------------------------------------------------------\r
 \r
-\r
-\r
-     \r
+.global _AsmReadDr6\r
 \r
 #------------------------------------------------------------------------------\r
 # UINTN\r
 #   VOID\r
 #   );\r
 #------------------------------------------------------------------------------\r
-.global _AsmReadDr6\r
-_AsmReadDr6: \r
+_AsmReadDr6:\r
     movl    %dr6, %eax\r
     ret\r
-\r
-\r
-\r
index b2d9a3d25227fa72f38cc2270ba801fb743d1cd0..479414b3e61ad548eb8604f953e1569475774845 100644 (file)
@@ -22,7 +22,7 @@
 ;------------------------------------------------------------------------------\r
 \r
     .586p\r
-    .model  flat\r
+    .model  flat,C\r
     .code\r
 \r
 ;------------------------------------------------------------------------------\r
@@ -32,9 +32,9 @@
 ;   VOID\r
 ;   );\r
 ;------------------------------------------------------------------------------\r
-_AsmReadDr6 PROC\r
+AsmReadDr6  PROC\r
     mov     eax, dr6\r
     ret\r
-_AsmReadDr6 ENDP\r
+AsmReadDr6  ENDP\r
 \r
     END\r
index cf213caac90096f261d4633c15638cb85d75ad4c..638daea15d7f230c53ae1d70f789455be6b2a60e 100644 (file)
@@ -21,9 +21,7 @@
 #\r
 #------------------------------------------------------------------------------\r
 \r
-\r
-\r
-     \r
+.global _AsmReadDr7\r
 \r
 #------------------------------------------------------------------------------\r
 # UINTN\r
 #   VOID\r
 #   );\r
 #------------------------------------------------------------------------------\r
-.global _AsmReadDr7\r
-_AsmReadDr7: \r
+_AsmReadDr7:\r
     movl    %dr7, %eax\r
     ret\r
-\r
-\r
-\r
index 23924b1184cf554873df15f586d6d3510d64b383..7dee98121c1415b00cdc0d1245ee7f418fcbaae9 100644 (file)
@@ -22,7 +22,7 @@
 ;------------------------------------------------------------------------------\r
 \r
     .586p\r
-    .model  flat\r
+    .model  flat,C\r
     .code\r
 \r
 ;------------------------------------------------------------------------------\r
@@ -32,9 +32,9 @@
 ;   VOID\r
 ;   );\r
 ;------------------------------------------------------------------------------\r
-_AsmReadDr7 PROC\r
+AsmReadDr7  PROC\r
     mov     eax, dr7\r
     ret\r
-_AsmReadDr7 ENDP\r
+AsmReadDr7  ENDP\r
 \r
     END\r
index ca1e37937a5f331b76eb6f8ce16c3b71a3b40b6c..7364c70994474e47e79e9dced76a453c5a6afc1d 100644 (file)
@@ -21,9 +21,7 @@
 #\r
 #------------------------------------------------------------------------------\r
 \r
-\r
-\r
-     \r
+.global _AsmReadEflags\r
 \r
 #------------------------------------------------------------------------------\r
 # UINT16\r
 #   VOID\r
 #   );\r
 #------------------------------------------------------------------------------\r
-.global _AsmReadDs\r
-_AsmReadDs: \r
-    movw    %ds,%ax\r
+_AsmReadDs:\r
+    movl    %ds, %eax\r
     ret\r
-\r
-\r
-\r
index 6992766e58c5e3b8e05ee3b57129a2fe37cd6b9d..b8edcb69966e82103d0249fecdf9a719c21dd8a2 100644 (file)
@@ -22,7 +22,7 @@
 ;------------------------------------------------------------------------------\r
 \r
     .386\r
-    .model  flat\r
+    .model  flat,C\r
     .code\r
 \r
 ;------------------------------------------------------------------------------\r
@@ -32,9 +32,9 @@
 ;   VOID\r
 ;   );\r
 ;------------------------------------------------------------------------------\r
-_AsmReadDs  PROC\r
-    mov     ax, ds\r
+AsmReadDs   PROC\r
+    mov     eax, ds\r
     ret\r
-_AsmReadDs  ENDP\r
+AsmReadDs   ENDP\r
 \r
     END\r
index a70a209ffba9fc2bb68c70e09ccd56ac98113a45..3e40756fc444f7263546e25fa0d43a5b38abfeef 100644 (file)
@@ -21,9 +21,7 @@
 #\r
 #------------------------------------------------------------------------------\r
 \r
-\r
-\r
-     \r
+.global _AsmReadEflags\r
 \r
 #------------------------------------------------------------------------------\r
 # UINTN\r
 #   VOID\r
 #   );\r
 #------------------------------------------------------------------------------\r
-.global _AsmReadEflags\r
-_AsmReadEflags: \r
+_AsmReadEflags:\r
     pushfl\r
-    popl    %eax\r
+    pop     %eax\r
     ret\r
-\r
-\r
-\r
index 365b1dee879194a6acb6cb4d5c0a68546ce8d4d2..32d55b35b9a2dc7147dcc41011114a06c64bf034 100644 (file)
@@ -22,7 +22,7 @@
 ;------------------------------------------------------------------------------\r
 \r
     .386\r
-    .model  flat\r
+    .model  flat,C\r
     .code\r
 \r
 ;------------------------------------------------------------------------------\r
 ;   VOID\r
 ;   );\r
 ;------------------------------------------------------------------------------\r
-_AsmReadEflags  PROC\r
+AsmReadEflags   PROC\r
     pushfd\r
     pop     eax\r
     ret\r
-_AsmReadEflags  ENDP\r
+AsmReadEflags   ENDP\r
 \r
     END\r
index 69727b5afc1c60aa64c7aade0994816a41ea13e9..87a5bacf643c33c0dc4931ae678cde6a99abf33f 100644 (file)
@@ -21,9 +21,7 @@
 #\r
 #------------------------------------------------------------------------------\r
 \r
-\r
-\r
-     \r
+.global _AsmReadEs\r
 \r
 #------------------------------------------------------------------------------\r
 # UINT16\r
 #   VOID\r
 #   );\r
 #------------------------------------------------------------------------------\r
-.global _AsmReadEs\r
-_AsmReadEs: \r
-    movw    %es,%ax\r
+_AsmReadEs:\r
+    movl    %es, %eax\r
     ret\r
-\r
-\r
-\r
index 0ced46aa62ecb8cdb367dbb7b60dffe044dee04f..48f141748e68d9566d8ac392be4107b414a7f8b3 100644 (file)
@@ -22,7 +22,7 @@
 ;------------------------------------------------------------------------------\r
 \r
     .386\r
-    .model  flat\r
+    .model  flat,C\r
     .code\r
 \r
 ;------------------------------------------------------------------------------\r
@@ -32,9 +32,9 @@
 ;   VOID\r
 ;   );\r
 ;------------------------------------------------------------------------------\r
-_AsmReadEs  PROC\r
-    mov     ax, es\r
+AsmReadEs   PROC\r
+    mov     eax, es\r
     ret\r
-_AsmReadEs  ENDP\r
+AsmReadEs   ENDP\r
 \r
     END\r
index 7f4fdfa77ca28676bc00ad1b2172b2e9835ff71e..3bf19f23ed5f2538b5b1ee013f8da83078c84d28 100644 (file)
@@ -21,9 +21,7 @@
 #\r
 #------------------------------------------------------------------------------\r
 \r
-\r
-\r
-     \r
+.global _AsmReadFs\r
 \r
 #------------------------------------------------------------------------------\r
 # UINT16\r
 #   VOID\r
 #   );\r
 #------------------------------------------------------------------------------\r
-.global _AsmReadFs\r
-_AsmReadFs: \r
-    movw    %fs,%ax\r
+_AsmReadFs:\r
+    movl    %fs, %eax\r
     ret\r
-\r
-\r
-\r
index f1790c6e9e1193ad37b881981e7d6bc283e4daa8..ae87107599222ea25a91ba676b64237be29b17ac 100644 (file)
@@ -22,7 +22,7 @@
 ;------------------------------------------------------------------------------\r
 \r
     .386\r
-    .model  flat\r
+    .model  flat,C\r
     .code\r
 \r
 ;------------------------------------------------------------------------------\r
@@ -32,9 +32,9 @@
 ;   VOID\r
 ;   );\r
 ;------------------------------------------------------------------------------\r
-_AsmReadFs  PROC\r
-    mov     ax, fs\r
+AsmReadFs   PROC\r
+    mov     eax, fs\r
     ret\r
-_AsmReadFs  ENDP\r
+AsmReadFs   ENDP\r
 \r
     END\r
index ebfe800e686b621e1d1b1d9f9427e8d217fb0871..ec1504601e1a3287757cc300776f14ae7dd26840 100644 (file)
@@ -21,9 +21,7 @@
 #\r
 #------------------------------------------------------------------------------\r
 \r
-\r
-\r
-     \r
+.global _InternalX86ReadGdtr\r
 \r
 #------------------------------------------------------------------------------\r
 # VOID\r
 #   OUT IA32_DESCRIPTOR  *Gdtr\r
 #   );\r
 #------------------------------------------------------------------------------\r
-.global _InternalX86ReadGdtr\r
-_InternalX86ReadGdtr: \r
-    movl    4(%esp),%eax\r
+_InternalX86ReadGdtr:\r
+    movl    4(%esp), %eax\r
     sgdt    (%eax)\r
     ret\r
-\r
-\r
-\r
index 0d88a60a52319c9158e5169a566a532c9651aa94..8e0a9d279b337721cd9b2993509bdd1be016c45c 100644 (file)
@@ -21,9 +21,7 @@
 #\r
 #------------------------------------------------------------------------------\r
 \r
-\r
-\r
-     \r
+.global _AsmReadGs\r
 \r
 #------------------------------------------------------------------------------\r
 # UINT16\r
 #   VOID\r
 #   );\r
 #------------------------------------------------------------------------------\r
-.global _AsmReadGs\r
-_AsmReadGs: \r
-    movw    %gs,%ax\r
+_AsmReadGs:\r
+    movl    %gs, %eax\r
     ret\r
-\r
-\r
-\r
index 1de0ebfc882371cbac3f118910633d73ecc5e9c3..93313b8998c9ffb68597e89d92884aabd5837ebd 100644 (file)
@@ -22,7 +22,7 @@
 ;------------------------------------------------------------------------------\r
 \r
     .386\r
-    .model  flat\r
+    .model  flat,C\r
     .code\r
 \r
 ;------------------------------------------------------------------------------\r
@@ -32,9 +32,9 @@
 ;   VOID\r
 ;   );\r
 ;------------------------------------------------------------------------------\r
-_AsmReadGs  PROC\r
-    mov     ax, gs\r
+AsmReadGs   PROC\r
+    mov     eax, gs\r
     ret\r
-_AsmReadGs  ENDP\r
+AsmReadGs   ENDP\r
 \r
     END\r
index 052c74553482ef0fed837f8248d5711e05201533..cafc0ac45b61c7d30d254176098d3b9caabcf44b 100644 (file)
@@ -21,9 +21,7 @@
 #\r
 #------------------------------------------------------------------------------\r
 \r
-\r
-\r
-     \r
+.global _InternalX86ReadIdtr\r
 \r
 #------------------------------------------------------------------------------\r
 # VOID\r
 #   OUT IA32_DESCRIPTOR  *Idtr\r
 #   );\r
 #------------------------------------------------------------------------------\r
-.global _InternalX86ReadIdtr\r
-_InternalX86ReadIdtr: \r
-    movl    4(%esp),%eax\r
+_InternalX86ReadIdtr:\r
+    movl    4(%esp), %eax\r
     sidt    (%eax)\r
     ret\r
-\r
-\r
-\r
index 95158be9037ca94f97f6a78226a2a6a3fe231543..dc7d4735072548d63b996947ce64ceb85abe021d 100644 (file)
     .model  flat,C\r
     .code\r
 \r
-InternalX86ReadIdtr   PROC\r
+;------------------------------------------------------------------------------\r
+; VOID\r
+; EFIAPI\r
+; InternalX86ReadIdtr (\r
+;   OUT     IA32_DESCRIPTOR           *Idtr\r
+;   );\r
+;------------------------------------------------------------------------------\r
+InternalX86ReadIdtr PROC\r
     mov     eax, [esp + 4]\r
     sidt    fword ptr [eax]\r
     ret\r
-InternalX86ReadIdtr   ENDP\r
+InternalX86ReadIdtr ENDP\r
 \r
     END\r
index aea1d9265c3d0ebab737d87fdddd2822df3a95ea..39c35582bca2cb110963ab6a97806ee9675a7031 100644 (file)
@@ -21,9 +21,7 @@
 #\r
 #------------------------------------------------------------------------------\r
 \r
-\r
-\r
-     \r
+.global _AsmReadLdtr\r
 \r
 #------------------------------------------------------------------------------\r
 # UINT16\r
 #   VOID\r
 #   );\r
 #------------------------------------------------------------------------------\r
-.global _AsmReadLdtr\r
-_AsmReadLdtr: \r
+_AsmReadLdtr:\r
     sldt   %eax\r
     ret\r
-\r
-\r
-\r
index a859a0e553ed456251a7d06057cf10e47328be53..449b7cfe99a710bd7a79f7f8ca2b839c1f2fe7a2 100644 (file)
@@ -22,7 +22,7 @@
 ;------------------------------------------------------------------------------\r
 \r
     .386\r
-    .model  flat\r
+    .model  flat,C\r
     .code\r
 \r
 ;------------------------------------------------------------------------------\r
@@ -32,9 +32,9 @@
 ;   VOID\r
 ;   );\r
 ;------------------------------------------------------------------------------\r
-_AsmReadLdtr    PROC\r
+AsmReadLdtr PROC\r
     sldt    ax\r
     ret\r
-_AsmReadLdtr    ENDP\r
+AsmReadLdtr ENDP\r
 \r
     END\r
index dd6b84683684368ceb8a61714eaacacd87cd321d..380b2f2806aea78b3a128e9bd59aef450518a90e 100644 (file)
 #\r
 #------------------------------------------------------------------------------\r
 \r
-\r
-\r
-     \r
-     \r
+.global _AsmReadMm0\r
 \r
 #------------------------------------------------------------------------------\r
 # UINTN\r
 #   VOID\r
 #   );\r
 #------------------------------------------------------------------------------\r
-.global _AsmReadMm0\r
-_AsmReadMm0: \r
-    pushl   %eax\r
-    pushl   %eax\r
-    movq    %mm0,(%esp)\r
-    popl    %eax\r
-    popl    %edx\r
+_AsmReadMm0:\r
+    push    %eax\r
+    push    %eax\r
+    movq    %mm0, (%esp)\r
+    pop     %eax\r
+    pop     %edx\r
     ret\r
-\r
-\r
-\r
index c45895b2a869c48e798708c5e449a552ef9d5b04..e43c45fab4331ece1442d0304a649d18776f5d62 100644 (file)
 ;\r
 ;------------------------------------------------------------------------------\r
 \r
-    .586P\r
-    .model  flat\r
-    .xmm\r
+    .586\r
+    .model  flat,C\r
+    .mmx\r
     .code\r
 \r
 ;------------------------------------------------------------------------------\r
-; UINTN\r
+; UINT64\r
 ; EFIAPI\r
 ; AsmReadMm0 (\r
 ;   VOID\r
 ;   );\r
 ;------------------------------------------------------------------------------\r
-_AsmReadMm0 PROC\r
+AsmReadMm0  PROC\r
     push    eax\r
     push    eax\r
     movq    [esp], mm0\r
     pop     eax\r
     pop     edx\r
     ret\r
-_AsmReadMm0 ENDP\r
+AsmReadMm0  ENDP\r
 \r
     END\r
index cbaafff0f34cd6b1eecccadbbc0636fc69041eb4..a893ff7c3866f94413c7d6723533ab9463d56a7e 100644 (file)
 #\r
 #------------------------------------------------------------------------------\r
 \r
-\r
-\r
-     \r
-     \r
+.global _AsmReadMm1\r
 \r
 #------------------------------------------------------------------------------\r
 # UINTN\r
 #   VOID\r
 #   );\r
 #------------------------------------------------------------------------------\r
-.global _AsmReadMm1\r
-_AsmReadMm1: \r
-    pushl   %eax\r
-    pushl   %eax\r
-    movq    %mm1,(%esp)\r
-    popl    %eax\r
-    popl    %edx\r
+_AsmReadMm1:\r
+    push    %eax\r
+    push    %eax\r
+    movq    %mm1, (%esp)\r
+    pop     %eax\r
+    pop     %edx\r
     ret\r
-\r
-\r
-\r
index ea748cbd7e1585c42566f585df236f87487dfa35..9f92a44aa0763a75d832d3aa5e61582c05854251 100644 (file)
 ;\r
 ;------------------------------------------------------------------------------\r
 \r
-    .586P\r
-    .model  flat\r
-    .xmm\r
+    .586\r
+    .model  flat,C\r
+    .mmx\r
     .code\r
 \r
 ;------------------------------------------------------------------------------\r
-; UINTN\r
+; UINT64\r
 ; EFIAPI\r
 ; AsmReadMm1 (\r
 ;   VOID\r
 ;   );\r
 ;------------------------------------------------------------------------------\r
-_AsmReadMm1 PROC\r
+AsmReadMm1  PROC\r
     push    eax\r
     push    eax\r
     movq    [esp], mm1\r
     pop     eax\r
     pop     edx\r
     ret\r
-_AsmReadMm1 ENDP\r
+AsmReadMm1  ENDP\r
 \r
     END\r
index 22a5d71ebc47e31108b8a3acd546884a0967540a..9dbc9e218005e7d95824690aaa26d8fa439f2c42 100644 (file)
 #\r
 #------------------------------------------------------------------------------\r
 \r
-\r
-\r
-     \r
-     \r
+.global _AsmReadMm2\r
 \r
 #------------------------------------------------------------------------------\r
 # UINTN\r
 #   VOID\r
 #   );\r
 #------------------------------------------------------------------------------\r
-.global _AsmReadMm2\r
-_AsmReadMm2: \r
-    pushl   %eax\r
-    pushl   %eax\r
-    movq    %mm2,(%esp)\r
-    popl    %eax\r
-    popl    %edx\r
+_AsmReadMm2:\r
+    push    %eax\r
+    push    %eax\r
+    movq    %mm2, (%esp)\r
+    pop     %eax\r
+    pop     %edx\r
     ret\r
-\r
-\r
-\r
index ab16c513f34c5bcff8699fadc6c91c3e3cc55308..38e4cb00478a7b3c7a9389fc90ec56e59d748e10 100644 (file)
 ;\r
 ;------------------------------------------------------------------------------\r
 \r
-    .586P\r
-    .model  flat\r
-    .xmm\r
+    .586\r
+    .model  flat,C\r
+    .mmx\r
     .code\r
 \r
 ;------------------------------------------------------------------------------\r
-; UINTN\r
+; UINT64\r
 ; EFIAPI\r
 ; AsmReadMm2 (\r
 ;   VOID\r
 ;   );\r
 ;------------------------------------------------------------------------------\r
-_AsmReadMm2 PROC\r
+AsmReadMm2  PROC\r
     push    eax\r
     push    eax\r
     movq    [esp], mm2\r
     pop     eax\r
     pop     edx\r
     ret\r
-_AsmReadMm2 ENDP\r
+AsmReadMm2  ENDP\r
 \r
     END\r
index dae267af7a776eb06c57000f5664dafc67870de9..04d57078bb7a43642e63af84c35d05e08ed03008 100644 (file)
 #\r
 #------------------------------------------------------------------------------\r
 \r
-\r
-\r
-     \r
-     \r
+.global _AsmReadMm3\r
 \r
 #------------------------------------------------------------------------------\r
 # UINTN\r
 #   VOID\r
 #   );\r
 #------------------------------------------------------------------------------\r
-.global _AsmReadMm3\r
-_AsmReadMm3: \r
-    pushl   %eax\r
-    pushl   %eax\r
-    movq    %mm3,(%esp)\r
-    popl    %eax\r
-    popl    %edx\r
+_AsmReadMm3:\r
+    push    %eax\r
+    push    %eax\r
+    movq    %mm3, (%esp)\r
+    pop     %eax\r
+    pop     %edx\r
     ret\r
-\r
-\r
-\r
index 3c4bf344923b13d5d217616190aba5555ae4e0a4..e646762bf339971e26aa6f9b369c0f313e1323d5 100644 (file)
 ;\r
 ;------------------------------------------------------------------------------\r
 \r
-    .586P\r
-    .model  flat\r
-    .xmm\r
+    .586\r
+    .model  flat,C\r
+    .mmx\r
     .code\r
 \r
 ;------------------------------------------------------------------------------\r
-; UINTN\r
+; UINT64\r
 ; EFIAPI\r
 ; AsmReadMm3 (\r
 ;   VOID\r
 ;   );\r
 ;------------------------------------------------------------------------------\r
-_AsmReadMm3 PROC\r
+AsmReadMm3  PROC\r
     push    eax\r
     push    eax\r
     movq    [esp], mm3\r
     pop     eax\r
     pop     edx\r
     ret\r
-_AsmReadMm3 ENDP\r
+AsmReadMm3  ENDP\r
 \r
     END\r
index 0ae1afceddb0d91a0ba8fc09794799293f1141db..4bd812230b7a23f224a2825ea2c26bd982cf2877 100644 (file)
 #\r
 #------------------------------------------------------------------------------\r
 \r
-\r
-\r
-     \r
-     \r
+.global _AsmReadMm4\r
 \r
 #------------------------------------------------------------------------------\r
 # UINTN\r
 #   VOID\r
 #   );\r
 #------------------------------------------------------------------------------\r
-.global _AsmReadMm4\r
-_AsmReadMm4: \r
-    pushl   %eax\r
-    pushl   %eax\r
-    movq    %mm4,(%esp)\r
-    popl    %eax\r
-    popl    %edx\r
+_AsmReadMm4:\r
+    push    %eax\r
+    push    %eax\r
+    movq    %mm4, (%esp)\r
+    pop     %eax\r
+    pop     %edx\r
     ret\r
-\r
-\r
-\r
index 4c2beb885b50dabd150a10b1a1f5a18c7202a33a..8da079d82cd645c3b6813b6d11859b1fb0c9cfbd 100644 (file)
 ;\r
 ;------------------------------------------------------------------------------\r
 \r
-    .586P\r
-    .model  flat\r
-    .xmm\r
+    .586\r
+    .model  flat,C\r
+    .mmx\r
     .code\r
 \r
 ;------------------------------------------------------------------------------\r
-; UINTN\r
+; UINT64\r
 ; EFIAPI\r
 ; AsmReadMm4 (\r
 ;   VOID\r
 ;   );\r
 ;------------------------------------------------------------------------------\r
-_AsmReadMm4 PROC\r
+AsmReadMm4  PROC\r
     push    eax\r
     push    eax\r
     movq    [esp], mm4\r
     pop     eax\r
     pop     edx\r
     ret\r
-_AsmReadMm4 ENDP\r
+AsmReadMm4  ENDP\r
 \r
     END\r
index 2fad14a7e0191226ebfab4570ef6c02200a55061..d2b0498f08eae065ae330470738895f961e7618e 100644 (file)
 #\r
 #------------------------------------------------------------------------------\r
 \r
-\r
-\r
-     \r
-     \r
+.global _AsmReadMm5\r
 \r
 #------------------------------------------------------------------------------\r
 # UINTN\r
 #   VOID\r
 #   );\r
 #------------------------------------------------------------------------------\r
-.global _AsmReadMm5\r
-_AsmReadMm5: \r
-    pushl   %eax\r
-    pushl   %eax\r
-    movq    %mm5,(%esp)\r
-    popl    %eax\r
-    popl    %edx\r
+_AsmReadMm5:\r
+    push    %eax\r
+    push    %eax\r
+    movq    %mm5, (%esp)\r
+    pop     %eax\r
+    pop     %edx\r
     ret\r
-\r
-\r
-\r
index 66e38265c6c47da1dd7e6b0185aaffa7cce8dfc4..9d6b4746a6791e751f41327d80f8cee37ceeaff1 100644 (file)
 ;\r
 ;------------------------------------------------------------------------------\r
 \r
-    .586P\r
-    .model  flat\r
-    .xmm\r
+    .586\r
+    .model  flat,C\r
+    .mmx\r
     .code\r
 \r
 ;------------------------------------------------------------------------------\r
-; UINTN\r
+; UINT64\r
 ; EFIAPI\r
 ; AsmReadMm5 (\r
 ;   VOID\r
 ;   );\r
 ;------------------------------------------------------------------------------\r
-_AsmReadMm5 PROC\r
+AsmReadMm5  PROC\r
     push    eax\r
     push    eax\r
     movq    [esp], mm5\r
     pop     eax\r
     pop     edx\r
     ret\r
-_AsmReadMm5 ENDP\r
+AsmReadMm5  ENDP\r
 \r
     END\r
index 22cddfa486f540cbfe8d81a3e389d515e970c281..875295fb323995ba3cc8c054683bb093e4e53439 100644 (file)
 #\r
 #------------------------------------------------------------------------------\r
 \r
-\r
-\r
-     \r
-     \r
+.global _AsmReadMm6\r
 \r
 #------------------------------------------------------------------------------\r
 # UINTN\r
 #   VOID\r
 #   );\r
 #------------------------------------------------------------------------------\r
-.global _AsmReadMm6\r
-_AsmReadMm6: \r
-    pushl   %eax\r
-    pushl   %eax\r
-    movq    %mm6,(%esp)\r
-    popl    %eax\r
-    popl    %edx\r
+_AsmReadMm6:\r
+    push    %eax\r
+    push    %eax\r
+    movq    %mm6, (%esp)\r
+    pop     %eax\r
+    pop     %edx\r
     ret\r
-\r
-\r
-\r
index 69d9e13f6b41facf0ed840607e5e0516ea435140..95c73f601b79fe8d51855086ef58ca9331abe72c 100644 (file)
 ;\r
 ;------------------------------------------------------------------------------\r
 \r
-    .586P\r
-    .model  flat\r
-    .xmm\r
+    .586\r
+    .model  flat,C\r
+    .mmx\r
     .code\r
 \r
 ;------------------------------------------------------------------------------\r
-; UINTN\r
+; UINT64\r
 ; EFIAPI\r
 ; AsmReadMm6 (\r
 ;   VOID\r
 ;   );\r
 ;------------------------------------------------------------------------------\r
-_AsmReadMm6 PROC\r
+AsmReadMm6  PROC\r
     push    eax\r
     push    eax\r
     movq    [esp], mm6\r
     pop     eax\r
     pop     edx\r
     ret\r
-_AsmReadMm6 ENDP\r
+AsmReadMm6  ENDP\r
 \r
     END\r
index fb485a00c945ccf573362322b583d68732a2e0d6..fb12a655efd0c626710b8be761433948816c79af 100644 (file)
 #\r
 #------------------------------------------------------------------------------\r
 \r
-\r
-\r
-     \r
-     \r
+.global _AsmReadMm7\r
 \r
 #------------------------------------------------------------------------------\r
 # UINTN\r
 #   VOID\r
 #   );\r
 #------------------------------------------------------------------------------\r
-.global _AsmReadMm7\r
-_AsmReadMm7: \r
-    pushl   %eax\r
-    pushl   %eax\r
-    movq    %mm7,(%esp)\r
-    popl    %eax\r
-    popl    %edx\r
+_AsmReadMm7:\r
+    push    %eax\r
+    push    %eax\r
+    movq    %mm7, (%esp)\r
+    pop     %eax\r
+    pop     %edx\r
     ret\r
-\r
-\r
-\r
index a8788cbf7a241947e4c78dffa445894c20e63598..0bd3b9b61f354a3df2b51638a6141c4ab10c3e9f 100644 (file)
 ;\r
 ;------------------------------------------------------------------------------\r
 \r
-    .586P\r
-    .model  flat\r
-    .xmm\r
+    .586\r
+    .model  flat,C\r
+    .mmx\r
     .code\r
 \r
 ;------------------------------------------------------------------------------\r
-; UINTN\r
+; UINT64\r
 ; EFIAPI\r
 ; AsmReadMm7 (\r
 ;   VOID\r
 ;   );\r
 ;------------------------------------------------------------------------------\r
-_AsmReadMm7 PROC\r
+AsmReadMm7  PROC\r
     push    eax\r
     push    eax\r
     movq    [esp], mm7\r
     pop     eax\r
     pop     edx\r
     ret\r
-_AsmReadMm7 ENDP\r
+AsmReadMm7  ENDP\r
 \r
     END\r
index 6a2c9c6688ab36820c8e51c4612977a7306d632f..be3c44e9d0a9111ee8eed48eabb830f507be9e43 100644 (file)
 #\r
 #------------------------------------------------------------------------------\r
 \r
-\r
-\r
-     \r
-\r
-#------------------------------------------------------------------------------\r
-# UINT32\r
-# EFIAPI\r
-# AsmReadMsr32 (\r
-#   IN UINT32  Index\r
-#   );\r
-#------------------------------------------------------------------------------\r
-.global _AsmReadMsr32\r
-_AsmReadMsr32: \r
-    #\r
-    # AsmReadMsr32 shares the same implementation with AsmReadMsr64 and thus no\r
-    # code inside this function\r
-    #\r
-\r
+.global _AsmReadMsr64\r
 \r
 #------------------------------------------------------------------------------\r
 # UINT64\r
 # EFIAPI\r
 # AsmReadMsr64 (\r
-#   IN UINT64  Index\r
+#   IN UINT32  Index\r
 #   );\r
 #------------------------------------------------------------------------------\r
-.global _AsmReadMsr64\r
-_AsmReadMsr64: \r
-    movl    4(%esp),%ecx\r
+_AsmReadMsr64:\r
+    movl    4(%esp), %ecx\r
     rdmsr\r
     ret\r
-\r
-\r
-\r
index 6c9fe000339403286eb19169021dd5cdeac66359..9a3e11ccca908f6c636b8802c215ec415f81fd14 100644 (file)
 ;\r
 ;------------------------------------------------------------------------------\r
 \r
-    .586P\r
-    .model  flat\r
+    .586p\r
+    .model  flat,C\r
     .code\r
 \r
-;------------------------------------------------------------------------------\r
-; UINT32\r
-; EFIAPI\r
-; AsmReadMsr32 (\r
-;   IN UINT32  Index\r
-;   );\r
-;------------------------------------------------------------------------------\r
-_AsmReadMsr32   PROC\r
-    ;\r
-    ; AsmReadMsr32 shares the same implementation with AsmReadMsr64 and thus no\r
-    ; code inside this function\r
-    ;\r
-_AsmReadMsr32   ENDP\r
-\r
 ;------------------------------------------------------------------------------\r
 ; UINT64\r
 ; EFIAPI\r
@@ -46,10 +32,10 @@ _AsmReadMsr32   ENDP
 ;   IN UINT64  Index\r
 ;   );\r
 ;------------------------------------------------------------------------------\r
-_AsmReadMsr64   PROC\r
+AsmReadMsr64    PROC\r
     mov     ecx, [esp + 4]\r
     rdmsr\r
     ret\r
-_AsmReadMsr64   ENDP\r
+AsmReadMsr64    ENDP\r
 \r
     END\r
index 868e85c23d04f361205b7881402eb987771ef0fe..a6c4e6ef0057b08d7790291be3d0828be8be84aa 100644 (file)
@@ -21,9 +21,7 @@
 #\r
 #------------------------------------------------------------------------------\r
 \r
-\r
-\r
-     \r
+.global _AsmReadPmc\r
 \r
 #------------------------------------------------------------------------------\r
 # UINT64\r
 #   IN UINT32   PmcIndex\r
 #   );\r
 #------------------------------------------------------------------------------\r
-.global _AsmReadPmc\r
-_AsmReadPmc: \r
-    movl    4(%esp),%ecx\r
+_AsmReadPmc:\r
+    movl    4(%esp), %ecx\r
     rdpmc\r
     ret\r
-\r
-\r
-\r
index 1fe598158db27a8e8a2b60bb92abe6caf2445113..17156d4652c64b686d551d73615863fb22351bd9 100644 (file)
@@ -21,8 +21,8 @@
 ;\r
 ;------------------------------------------------------------------------------\r
 \r
-    .586P\r
-    .model  flat\r
+    .586p\r
+    .model  flat,C\r
     .code\r
 \r
 ;------------------------------------------------------------------------------\r
 ;   IN UINT32   PmcIndex\r
 ;   );\r
 ;------------------------------------------------------------------------------\r
-_AsmReadPmc PROC\r
+AsmReadPmc  PROC\r
     mov     ecx, [esp + 4]\r
     rdpmc\r
     ret\r
-_AsmReadPmc ENDP\r
+AsmReadPmc  ENDP\r
 \r
     END\r
index 7db65c1490c24dd514fbdf5726271ee6f8cb98da..f0a6fe8c65e12423cfac45af2455e764058f10b3 100644 (file)
@@ -21,9 +21,7 @@
 #\r
 #------------------------------------------------------------------------------\r
 \r
-\r
-\r
-     \r
+.global _AsmReadSs\r
 \r
 #------------------------------------------------------------------------------\r
 # UINT16\r
 #   VOID\r
 #   );\r
 #------------------------------------------------------------------------------\r
-.global _AsmReadSs\r
-_AsmReadSs: \r
-    movw    %ss,%ax\r
+_AsmReadSs:\r
+    movl    %ss, %eax\r
     ret\r
-\r
-\r
-\r
index 6d0cd9f2a07a36ddd2b2cf651a053bf841ab4011..414353755ff09f1e54da7639ffedec95ba49e100 100644 (file)
@@ -22,7 +22,7 @@
 ;------------------------------------------------------------------------------\r
 \r
     .386\r
-    .model  flat\r
+    .model  flat,C\r
     .code\r
 \r
 ;------------------------------------------------------------------------------\r
@@ -32,9 +32,9 @@
 ;   VOID\r
 ;   );\r
 ;------------------------------------------------------------------------------\r
-_AsmReadSs  PROC\r
-    mov     ax, ss\r
+AsmReadSs   PROC\r
+    mov     eax, ss\r
     ret\r
-_AsmReadSs  ENDP\r
+AsmReadSs   ENDP\r
 \r
     END\r
index 8c31e9d9fa92258ae45380ef5eeaa9f202bd5a7c..92e0ce630cad2e8659fcfb0aa10b177a52c0d03d 100644 (file)
@@ -21,9 +21,7 @@
 #\r
 #------------------------------------------------------------------------------\r
 \r
-\r
-\r
-     \r
+.global _AsmReadTr\r
 \r
 #------------------------------------------------------------------------------\r
 # UINT16\r
 #   VOID\r
 #   );\r
 #------------------------------------------------------------------------------\r
-.global _AsmReadTr\r
-_AsmReadTr: \r
+_AsmReadTr:\r
     str     %eax\r
     ret\r
-\r
-\r
-\r
index d77ee89123bea38eec423a2588f973645265b4fe..4f4e64b1864c1f7a027a17f2fb5ae0d0eeb315a7 100644 (file)
@@ -22,7 +22,7 @@
 ;------------------------------------------------------------------------------\r
 \r
     .386\r
-    .model  flat\r
+    .model  flat,C\r
     .code\r
 \r
 ;------------------------------------------------------------------------------\r
@@ -32,9 +32,9 @@
 ;   VOID\r
 ;   );\r
 ;------------------------------------------------------------------------------\r
-_AsmReadTr  PROC\r
+AsmReadTr   PROC\r
     str     ax\r
     ret\r
-_AsmReadTr  ENDP\r
+AsmReadTr   ENDP\r
 \r
     END\r
index e7981c05b07d69885e6dac5798551ab227fad03f..c615ac7b838030858a21760166f23450069785bf 100644 (file)
@@ -21,9 +21,7 @@
 #\r
 #------------------------------------------------------------------------------\r
 \r
-\r
-\r
-     \r
+.global _AsmReadTsc\r
 \r
 #------------------------------------------------------------------------------\r
 # UINT64\r
 #   VOID\r
 #   );\r
 #------------------------------------------------------------------------------\r
-.global _AsmReadTsc\r
-_AsmReadTsc: \r
+_AsmReadTsc:\r
     rdtsc\r
     ret\r
-\r
-\r
-\r
index ea3c164ecd7e7add0863d751f5fa9cd33ac9a3ee..fff38292eff588531a2063743b9589db667de4dd 100644 (file)
@@ -21,8 +21,8 @@
 ;\r
 ;------------------------------------------------------------------------------\r
 \r
-    .586P\r
-    .model  flat\r
+    .586p\r
+    .model  flat,C\r
     .code\r
 \r
 ;------------------------------------------------------------------------------\r
@@ -32,9 +32,9 @@
 ;   VOID\r
 ;   );\r
 ;------------------------------------------------------------------------------\r
-_AsmReadTsc PROC\r
+AsmReadTsc  PROC\r
     rdtsc\r
     ret\r
-_AsmReadTsc ENDP\r
+AsmReadTsc  ENDP\r
 \r
     END\r
index 05acc4ab2620fb7b7cdff8cd7e19e859d695da3c..c600b7f0a8330189f888865848152724f010ad85 100644 (file)
 #\r
 #------------------------------------------------------------------------------\r
 \r
-\r
-\r
-     \r
-\r
 .global _SetJump, _InternalAssertJumpBuffer\r
-_SetJump: \r
+\r
+#------------------------------------------------------------------------------\r
+# UINTN\r
+# EFIAPI\r
+# SetJump (\r
+#   OUT     BASE_LIBRARY_JUMP_BUFFER  *JumpBuffer\r
+#   );\r
+#------------------------------------------------------------------------------\r
+_SetJump:\r
     pushl   0x4(%esp)\r
     call    _InternalAssertJumpBuffer\r
-    popl    %ecx\r
-    popl    %ecx\r
-    movl    (%esp),%edx\r
-    movl    %ebx,(%edx)\r
-    movl    %esi,4(%edx)\r
-    movl    %edi,8(%edx)\r
-    movl    %ebp,12(%edx)\r
-    movl    %esp,16(%edx)\r
-    movl    %ecx,20(%edx)\r
-    xorl    %eax,%eax\r
+    pop     %ecx\r
+    pop     %ecx\r
+    movl    (%esp), %edx\r
+    movl    %ebx, (%edx)\r
+    movl    %esi, 4(%edx)\r
+    movl    %edi, 8(%edx)\r
+    movl    %ebp, 12(%edx)\r
+    movl    %esp, 16(%edx)\r
+    movl    %ecx, 20(%edx)\r
+    xorl    %eax, %eax\r
     jmp     *%ecx\r
-\r
-\r
-\r
index 7d8579c9b9cc20ad955436e1aba067b811a28592..4d745e29ac9898f227b8dbee8e32cb125db6e922 100644 (file)
 \r
 InternalAssertJumpBuffer    PROTO   C\r
 \r
+;------------------------------------------------------------------------------\r
+; UINTN\r
+; EFIAPI\r
+; SetJump (\r
+;   OUT     BASE_LIBRARY_JUMP_BUFFER  *JumpBuffer\r
+;   );\r
+;------------------------------------------------------------------------------\r
 SetJump     PROC\r
     push    [esp + 4]\r
     call    InternalAssertJumpBuffer\r
index 01af949afa50d8eef379ae1d90dca6367adca04f..f7633428bd180de5b3d4d68a4ce55a8c27fd7f7c 100644 (file)
 #------------------------------------------------------------------------------
 
 
+#------------------------------------------------------------------------------
+# UINT64
+# EFIAPI
+# InternalMathSwapBytes64 (
+#   IN      UINT64                    Operand
+#   );
+#------------------------------------------------------------------------------
 .global _InternalMathSwapBytes64
 _InternalMathSwapBytes64:
-
     movl    8(%esp), %eax
     movl    4(%esp), %edx
     bswapl  %eax
     bswapl  %edx
     ret
-
-
index 72e366bd4d05c3a06ecca93abb44e385b218cdad..186d094eee0fad84bc2d351ff4a2a2d5611acc7d 100644 (file)
 ;\r
 ;------------------------------------------------------------------------------\r
 \r
-    .586P\r
+    .586\r
     .model  flat,C\r
     .code\r
 \r
+;------------------------------------------------------------------------------\r
+; UINT64\r
+; EFIAPI\r
+; InternalMathSwapBytes64 (\r
+;   IN      UINT64                    Operand\r
+;   );\r
+;------------------------------------------------------------------------------\r
 InternalMathSwapBytes64 PROC\r
     mov     eax, [esp + 8]\r
     mov     edx, [esp + 4]\r
index 97b49f5a38a7db2403b3f3d15ed618e072cd390a..aad6bbe26ba6ced59f5c41f289d9e20425ae9bae 100644 (file)
 #\r
 #------------------------------------------------------------------------------\r
 \r
-.global _m16Start, _m16Size, _mThunk16Attr, _m16GdtrBase, _m16Gdt, _m16GdtrBase, _mTransition\r
+.global _m16Start, _m16Size, _mThunk16Attr, _m16Gdt, _m16GdtrBase, _mTransition\r
 .global _InternalAsmThunk16\r
 \r
-#THUNK_ATTRIBUTE_BIG_REAL_MODE               EQU 1\r
-#THUNK_ATTRIBUTE_DISABLE_A20_MASK_INT_15     EQU 2\r
-#THUNK_ATTRIBUTE_DISABLE_A20_MASK_KBD_CTRL   EQU 4\r
-\r
-   .code: \r
-\r
-_m16Start: \r
+_m16Start:\r
 \r
 SavedGdt:     .space  6\r
 \r
@@ -37,7 +31,7 @@ _BackFromUserCode:
     push    %cs\r
     .byte   0x66\r
     call    @Base1                      # push eip\r
-@Base1: \r
+@Base1:\r
     pushfw                              # pushfd actually\r
     cli                                 # disable interrupts\r
     push    %gs\r
@@ -45,37 +39,37 @@ _BackFromUserCode:
     push    %es\r
     push    %ds\r
     pushaw                              # pushad actually\r
-    .byte   0x66,0xba                   # mov edx, imm32\r
+    .byte   0x66, 0xba                   # mov edx, imm32\r
 _ThunkAttr: .space  4\r
     testb   $THUNK_ATTRIBUTE_DISABLE_A20_MASK_INT_15, %dl\r
     jz      @1\r
     movl    $0x15cd2401, %eax           # mov ax, 2401h & int 15h\r
     cli                                 # disable interrupts\r
     jnc     @2\r
-@1: \r
+@1:\r
     testb   $THUNK_ATTRIBUTE_DISABLE_A20_MASK_KBD_CTRL, %dl\r
     jz      @2\r
     inb     $0x92, %al\r
     orb     $2, %al\r
     outb    %al, $0x92                  # deactivate A20M#\r
-@2: \r
+@2:\r
     movl    %ss, %eax\r
     .byte   0x67, 0x66, 0x8d, 0x6c, 0x24, 0x34, 0x66\r
-    mov    %ebp,0xffffffd8(%esi)\r
-    mov     0xfffffff8(%esi),%ebx\r
+    mov     %ebp, 0xffffffd8(%esi)\r
+    mov     0xfffffff8(%esi), %ebx\r
     shlw    $4, %ax                     # shl eax, 4\r
     addw    %ax, %bp                    # add ebp, eax\r
-    .byte   0x66,0xb8                   # mov eax, imm32\r
+    .byte   0x66, 0xb8                   # mov eax, imm32\r
 SavedCr4:   .space  4\r
     movl    %eax, %cr4\r
-    lgdtw  %cs:0xfffffff2(%edi)\r
-    .byte   0x66,0xb8                   # mov eax, imm32\r
+    lgdtw   %cs:0xfffffff2(%edi)\r
+    .byte   0x66, 0xb8                   # mov eax, imm32\r
 SavedCr0:   .space  4\r
     movl    %eax, %cr0\r
     .byte   0xb8                        # mov ax, imm16\r
 SavedSs:    .space  2\r
     movl    %eax, %ss\r
-    .byte   0x66,0xbc                   # mov esp, imm32\r
+    .byte   0x66, 0xbc                   # mov esp, imm32\r
 SavedEsp:   .space  4\r
     .byte   0x66\r
     lret                                # return to protected mode\r
@@ -100,23 +94,23 @@ _ToUserCode:
     xchgw   %bx, %sp                    # set up 16-bit stack pointer\r
     .byte   0x66\r
     call    @Base                       # push eip\r
-@Base: \r
+@Base:\r
     popw    %bp                         # ebp <- offset @Base\r
     addr16  pushl 36(%si)\r
     .byte   0x36\r
-    lea     0xc(%esi),%eax\r
-    pushl   %eax\r
+    lea     0xc(%esi), %eax\r
+    push    %eax\r
     lret\r
 \r
-@RealMode: \r
-    mov     %edx,%cs:0xffffffc5(%esi)\r
-    mov     %bx,%cs:0xffffffcb(%esi)\r
+@RealMode:\r
+    mov     %edx, %cs:0xffffffc5(%esi)\r
+    mov     %bx, %cs:0xffffffcb(%esi)\r
     lidtw   %cs:0xffffffd7(%esi)\r
     popaw                               # popad actually\r
-    popl    %ds\r
-    popl    %es\r
-    popl    %fs\r
-    popl    %gs\r
+    pop     %ds\r
+    pop     %es\r
+    pop     %fs\r
+    pop     %gs\r
     popfw                               # popfd\r
     lretw                               # transfer control to user code\r
 \r
@@ -152,41 +146,41 @@ _InternalAsmThunk16:
     push    %fs\r
     push    %gs\r
     movl    36(%esp), %esi              # esi <- RegSet\r
-    movzwl  0x32(%esi),%edx\r
-    mov     0xc(%esi),%edi\r
-    add     $0xffffffc8,%edi\r
+    movzwl  0x32(%esi), %edx\r
+    mov     0xc(%esi), %edi\r
+    add     $0xffffffc8, %edi\r
     movl    %edi, %ebx                  # ebx <- stack offset\r
-    imul    $0x10,%edx,%eax\r
+    imul    $0x10, %edx, %eax\r
     push    $0xd\r
     addl    %eax, %edi                  # edi <- linear address of 16-bit stack\r
-    popl    %ecx\r
+    pop     %ecx\r
     rep\r
     movsl                               # copy RegSet\r
     movl    40(%esp), %eax              # eax <- address of transition code\r
     movl    %edx, %esi                  # esi <- 16-bit stack segment\r
-    lea     0x5e(%eax),%edx\r
+    lea     0x5e(%eax), %edx\r
     movl    %eax, %ecx\r
     andl    $0xf, %ecx\r
     shll    $12, %eax\r
-    lea     0x6(%ecx),%ecx\r
+    lea     0x6(%ecx), %ecx\r
     movw    %cx, %ax\r
     stosl                               # [edi] <- return address of user code\r
-    sgdtl  0xffffffa2(%edx)\r
+    sgdtl   0xffffffa2(%edx)\r
     sidtl   0x24(%esp)\r
     movl    %cr0, %eax\r
     movl    %eax, (%edx)                # save CR0 in SavedCr0\r
     andl    $0x7ffffffe, %eax           # clear PE, PG bits\r
     movl    %cr4, %ebp\r
-    mov     %ebp,0xfffffff1(%edx)\r
+    mov     %ebp, 0xfffffff1(%edx)\r
     andl    $0x300, %ebp                # clear all but PCE and OSFXSR bits\r
     pushl   $0x10\r
-    popl    %ecx                        # ecx <- selector for data segments\r
+    pop     %ecx                        # ecx <- selector for data segments\r
     lgdtl   0x20(%edx)\r
     pushfl\r
     lcall   *0x14(%edx)\r
     popfl\r
     lidtl   0x24(%esp)\r
-    lea     0xffffffcc(%ebp),%eax\r
+    lea     0xffffffcc(%ebp), %eax\r
        pop     %gs\r
        pop     %fs\r
        pop     %es\r
@@ -197,11 +191,10 @@ _InternalAsmThunk16:
        pop     %ebp\r
     ret\r
 \r
-    .const: \r
+    .const:\r
 \r
 _m16Size:        .word      _InternalAsmThunk16 - _m16Start\r
 _mThunk16Attr:   .word      _ThunkAttr          - _m16Start\r
 _m16Gdt:         .word      _NullSegDesc        - _m16Start\r
 _m16GdtrBase:    .word      _16GdtrBase         - _m16Start\r
 _mTransition:    .word      _EntryPoint         - _m16Start\r
-\r
index 9fba03ac05072d7540ef95f7188d2726356fc931..5e357991271d07efb15e95075027833d4075512a 100644 (file)
@@ -29,6 +29,10 @@ EXTERNDEF   C   m16Gdt:WORD
 EXTERNDEF   C   m16GdtrBase:WORD\r
 EXTERNDEF   C   mTransition:WORD\r
 \r
+;\r
+; Here is the layout of the real mode stack. _ToUserCode() is responsible for\r
+; loading all these registers from real mode stack.\r
+;\r
 IA32_REGS   STRUC   4t\r
 _EDI        DD      ?\r
 _ESI        DD      ?\r
@@ -50,6 +54,9 @@ IA32_REGS   ENDS
 \r
     .const\r
 \r
+;\r
+; These are global constant to convey information to C code.\r
+;\r
 m16Size         DW      InternalAsmThunk16 - m16Start\r
 mThunk16Attr    DW      _ThunkAttr - m16Start\r
 m16Gdt          DW      _NullSegDesc - m16Start\r
@@ -63,7 +70,10 @@ m16Start    LABEL   BYTE
 SavedGdt    LABEL   FWORD\r
             DW      ?\r
             DD      ?\r
-\r
+;------------------------------------------------------------------------------\r
+; _BackFromUserCode() takes control in real mode after 'retf' has been executed\r
+; by user code. It will be shadowed to somewhere in memory below 1MB.\r
+;------------------------------------------------------------------------------\r
 _BackFromUserCode   PROC\r
     push    ss\r
     push    cs\r
@@ -122,6 +132,10 @@ _16Gdtr     LABEL   FWORD
             DW      GdtEnd - _NullSegDesc - 1\r
 _16GdtrBase DD      _NullSegDesc\r
 \r
+;------------------------------------------------------------------------------\r
+; _ToUserCode() takes control in real mode before passing control to user code.\r
+; It will be shadowed to somewhere in memory below 1MB.\r
+;------------------------------------------------------------------------------\r
 _ToUserCode PROC\r
     mov     edx, ss\r
     mov     ss, ecx                     ; set new segment selectors\r
@@ -174,11 +188,14 @@ _16DsDesc       LABEL   QWORD
                 DB      0\r
 GdtEnd          LABEL   QWORD\r
 \r
-;\r
-;   @param  RegSet  Pointer to a IA32_DWORD_REGS structure\r
-;   @param  Transition  Pointer to the transition code\r
-;   @return The address of the 16-bit stack after returning from user code\r
-;\r
+;------------------------------------------------------------------------------\r
+; IA32_REGISTER_SET *\r
+; EFIAPI\r
+; InternalAsmThunk16 (\r
+;   IN      IA32_REGISTER_SET         *RegisterSet,\r
+;   IN OUT  VOID                      *Transition\r
+;   );\r
+;------------------------------------------------------------------------------\r
 InternalAsmThunk16  PROC    USES    ebp ebx esi edi ds  es  fs  gs\r
     mov     esi, [esp + 36]             ; esi <- RegSet\r
     movzx   edx, (IA32_REGS ptr [esi])._SS\r
index e9f6c0ce6b7d05166b4e733531ea5ee78b294dcb..7a4b8ccedc74d07a896e701a992cb4da5a744ff9 100644 (file)
 #\r
 #------------------------------------------------------------------------------\r
 \r
-\r
-\r
-     \r
-\r
 #------------------------------------------------------------------------------\r
 # VOID\r
 # EFIAPI\r
@@ -33,9 +29,6 @@
 #   );\r
 #------------------------------------------------------------------------------\r
 .global _AsmWbinvd\r
-_AsmWbinvd: \r
+_AsmWbinvd:\r
     wbinvd\r
     ret\r
-\r
-\r
-\r
index 07258fb9e98119d3934c744d5e7d6c7e75b772d1..1230c89c209a7c1eb655bcd0f058bd5246bc7ce3 100644 (file)
@@ -22,7 +22,7 @@
 ;------------------------------------------------------------------------------\r
 \r
     .486p\r
-    .model  flat\r
+    .model  flat,C\r
     .code\r
 \r
 ;------------------------------------------------------------------------------\r
@@ -32,9 +32,9 @@
 ;   VOID\r
 ;   );\r
 ;------------------------------------------------------------------------------\r
-_AsmWbinvd  PROC\r
+AsmWbinvd   PROC\r
     wbinvd\r
     ret\r
-_AsmWbinvd  ENDP\r
+AsmWbinvd   ENDP\r
 \r
     END\r
index 6e3ad507653cc5e6721a218aca9b4733ce37af89..192ed4fa570377c9a83aa41205822e21351ce685 100644 (file)
 #\r
 #------------------------------------------------------------------------------\r
 \r
-\r
-\r
-     \r
-\r
 #------------------------------------------------------------------------------\r
 # UINTN\r
 # EFIAPI\r
 # AsmWriteCr0 (\r
-#   VOID\r
+#   IN      UINTN                     Cr0\r
 #   );\r
 #------------------------------------------------------------------------------\r
 .global _AsmWriteCr0\r
-_AsmWriteCr0: \r
-    movl    4(%esp),%eax\r
+_AsmWriteCr0:\r
+    movl    4(%esp), %eax\r
     movl    %eax, %cr0\r
     ret\r
-\r
-\r
-\r
index d64d621cd56390b4bf39a8122a7abf71db25ff99..5eab67f8194339be5ad554bbf5bd83fe28086e0a 100644 (file)
 ;------------------------------------------------------------------------------\r
 \r
     .386p\r
-    .model  flat\r
+    .model  flat,C\r
     .code\r
 \r
 ;------------------------------------------------------------------------------\r
 ; UINTN\r
 ; EFIAPI\r
 ; AsmWriteCr0 (\r
-;   VOID\r
+;   UINTN  Cr0\r
 ;   );\r
 ;------------------------------------------------------------------------------\r
-_AsmWriteCr0    PROC\r
+AsmWriteCr0 PROC\r
     mov     eax, [esp + 4]\r
     mov     cr0, eax\r
     ret\r
-_AsmWriteCr0    ENDP\r
+AsmWriteCr0 ENDP\r
 \r
     END\r
index cf45e01a24d65d600f968056032f6c84aa65f0e2..223dbb973ca2bceab04928c70a1c3cb20ee7b0ad 100644 (file)
 #\r
 #------------------------------------------------------------------------------\r
 \r
-\r
-\r
-     \r
-\r
 #------------------------------------------------------------------------------\r
 # UINTN\r
 # EFIAPI\r
 # AsmWriteCr2 (\r
-#   VOID\r
+#   IN      UINTN                     Cr2\r
 #   );\r
 #------------------------------------------------------------------------------\r
 .global _AsmWriteCr2\r
-_AsmWriteCr2: \r
-    movl    4(%esp),%eax\r
+_AsmWriteCr2:\r
+    movl    4(%esp), %eax\r
     movl    %eax, %cr2\r
     ret\r
-\r
-\r
-\r
index 7ab5b0f64f6c1f3cdfb1eb85c28741eadd0ce7f4..0df84412bffd21489c2156ef5e22bbb29c22c37f 100644 (file)
 ;------------------------------------------------------------------------------\r
 \r
     .386p\r
-    .model  flat\r
+    .model  flat,C\r
     .code\r
 \r
 ;------------------------------------------------------------------------------\r
 ; UINTN\r
 ; EFIAPI\r
 ; AsmWriteCr2 (\r
-;   VOID\r
+;   UINTN  Cr2\r
 ;   );\r
 ;------------------------------------------------------------------------------\r
-_AsmWriteCr2    PROC\r
+AsmWriteCr2 PROC\r
     mov     eax, [esp + 4]\r
     mov     cr2, eax\r
     ret\r
-_AsmWriteCr2    ENDP\r
+AsmWriteCr2 ENDP\r
 \r
     END\r
index 1c555819059048e230629d6968ebf38012985fe8..3a127550922fc2eefc1e812ff96aa7a5a0bc57a5 100644 (file)
 #\r
 #------------------------------------------------------------------------------\r
 \r
-\r
-\r
-     \r
-\r
 #------------------------------------------------------------------------------\r
 # UINTN\r
 # EFIAPI\r
 # AsmWriteCr3 (\r
-#   VOID\r
+#   IN      UINTN                     Cr3\r
 #   );\r
 #------------------------------------------------------------------------------\r
 .global _AsmWriteCr3\r
-_AsmWriteCr3: \r
-    movl    4(%esp),%eax\r
+_AsmWriteCr3:\r
+    movl    4(%esp), %eax\r
     movl    %eax, %cr3\r
     ret\r
-\r
-\r
-\r
index 9753de1abeb9e0d15e9afd33b5dca992b95af520..32b05fdf356cf9b7c3ebda52a6acfb43b7f7a28b 100644 (file)
 ;------------------------------------------------------------------------------\r
 \r
     .386p\r
-    .model  flat\r
+    .model  flat,C\r
     .code\r
 \r
 ;------------------------------------------------------------------------------\r
 ; UINTN\r
 ; EFIAPI\r
 ; AsmWriteCr3 (\r
-;   VOID\r
+;   UINTN  Cr3\r
 ;   );\r
 ;------------------------------------------------------------------------------\r
-_AsmWriteCr3    PROC\r
+AsmWriteCr3 PROC\r
     mov     eax, [esp + 4]\r
     mov     cr3, eax\r
     ret\r
-_AsmWriteCr3    ENDP\r
+AsmWriteCr3 ENDP\r
 \r
     END\r
index fbe48c1cd0adee4feb114a25adb65078c7fa0d95..4b65a26f711d28d05c1bad376f20e9128b917a04 100644 (file)
 #\r
 #------------------------------------------------------------------------------\r
 \r
-\r
-\r
-     \r
-\r
 #------------------------------------------------------------------------------\r
 # UINTN\r
 # EFIAPI\r
 # AsmWriteCr4 (\r
-#   VOID\r
+#   IN      UINTN                     Cr4\r
 #   );\r
 #------------------------------------------------------------------------------\r
 .global _AsmWriteCr4\r
-_AsmWriteCr4: \r
-    movl    4(%esp),%eax\r
+_AsmWriteCr4:\r
+    movl    4(%esp), %eax\r
     movl    %eax, %cr4\r
     ret\r
-\r
-\r
-\r
index 60bfe78cb6959a7b703ae2c8798ab90060b98606..4ed7f61030190417c1da6ea73340c49dc00328d1 100644 (file)
 ;------------------------------------------------------------------------------\r
 \r
     .586p\r
-    .model  flat\r
+    .model  flat,C\r
     .code\r
 \r
 ;------------------------------------------------------------------------------\r
 ; UINTN\r
 ; EFIAPI\r
 ; AsmWriteCr4 (\r
-;   VOID\r
+;   UINTN  Cr4\r
 ;   );\r
 ;------------------------------------------------------------------------------\r
-_AsmWriteCr4    PROC\r
+AsmWriteCr4 PROC\r
     mov     eax, [esp + 4]\r
     mov     cr4, eax\r
     ret\r
-_AsmWriteCr4    ENDP\r
+AsmWriteCr4 ENDP\r
 \r
     END\r
index a5a84de6b4cdba30f4529666760e948c38e6156e..9faa5a5694c8f8a730f583d994a93d6f2b525cf8 100644 (file)
 #\r
 #------------------------------------------------------------------------------\r
 \r
-\r
-\r
-     \r
-\r
 #------------------------------------------------------------------------------\r
-# VOID\r
+# UINTN\r
 # EFIAPI\r
 # AsmWriteDr0 (\r
 #   IN UINTN Value\r
 #   );\r
 #------------------------------------------------------------------------------\r
 .global _AsmWriteDr0\r
-_AsmWriteDr0: \r
-    movl    4(%esp),%eax\r
+_AsmWriteDr0:\r
+    movl    4(%esp), %eax\r
     movl    %eax, %dr0\r
     ret\r
-\r
-\r
-\r
index 3dab544c49809ae22c2906b149e5f10bc460d74b..1bd39d50e4f9ce64b92268c49c8d873ab0897dfe 100644 (file)
 ;------------------------------------------------------------------------------\r
 \r
     .586p\r
-    .model  flat\r
+    .model  flat,C\r
     .code\r
 \r
 ;------------------------------------------------------------------------------\r
-; VOID\r
+; UINTN\r
 ; EFIAPI\r
 ; AsmWriteDr0 (\r
 ;   IN UINTN Value\r
 ;   );\r
 ;------------------------------------------------------------------------------\r
-_AsmWriteDr0    PROC\r
+AsmWriteDr0 PROC\r
     mov     eax, [esp + 4]\r
     mov     dr0, eax\r
     ret\r
-_AsmWriteDr0    ENDP\r
+AsmWriteDr0 ENDP\r
 \r
     END\r
index 66fc2c7cf3ded087146a6f40796ef702189084f3..1038cf78e244b8d0af1bba5fa768aa334cf48a86 100644 (file)
 #\r
 #------------------------------------------------------------------------------\r
 \r
-\r
-\r
-     \r
-\r
 #------------------------------------------------------------------------------\r
-# VOID\r
+# UINTN\r
 # EFIAPI\r
 # AsmWriteDr1 (\r
 #   IN UINTN Value\r
 #   );\r
 #------------------------------------------------------------------------------\r
 .global _AsmWriteDr1\r
-_AsmWriteDr1: \r
-    movl    4(%esp),%eax\r
+_AsmWriteDr1:\r
+    movl    4(%esp), %eax\r
     movl    %eax, %dr1\r
     ret\r
-\r
-\r
-\r
index 5898206c53f9d99343932f3e7e8511a3b4f052ca..542125ba558c898bcd85ecc215238b985d965669 100644 (file)
 ;------------------------------------------------------------------------------\r
 \r
     .586p\r
-    .model  flat\r
+    .model  flat,C\r
     .code\r
 \r
 ;------------------------------------------------------------------------------\r
-; VOID\r
+; UINTN\r
 ; EFIAPI\r
 ; AsmWriteDr1 (\r
 ;   IN UINTN Value\r
 ;   );\r
 ;------------------------------------------------------------------------------\r
-_AsmWriteDr1    PROC\r
+AsmWriteDr1 PROC\r
     mov     eax, [esp + 4]\r
     mov     dr1, eax\r
     ret\r
-_AsmWriteDr1    ENDP\r
+AsmWriteDr1 ENDP\r
 \r
     END\r
index 7b3f780510ce46219ac1bc476ec17c2cf73ea662..4afee114562784dc1b267c46c965d169eaf551bc 100644 (file)
 #\r
 #------------------------------------------------------------------------------\r
 \r
-\r
-\r
-     \r
-\r
 #------------------------------------------------------------------------------\r
-# VOID\r
+# UINTN\r
 # EFIAPI\r
 # AsmWriteDr2 (\r
 #   IN UINTN Value\r
 #   );\r
 #------------------------------------------------------------------------------\r
 .global _AsmWriteDr2\r
-_AsmWriteDr2: \r
-    movl    4(%esp),%eax\r
+_AsmWriteDr2:\r
+    movl    4(%esp), %eax\r
     movl    %eax, %dr2\r
     ret\r
-\r
-\r
-\r
index 3ed25fc8efa4b83df02e73ad912241a14c625205..7638babc73b4bc8bb543c9db7c55adbc54ae5ded 100644 (file)
 ;------------------------------------------------------------------------------\r
 \r
     .586p\r
-    .model  flat\r
+    .model  flat,C\r
     .code\r
 \r
 ;------------------------------------------------------------------------------\r
-; VOID\r
+; UINTN\r
 ; EFIAPI\r
 ; AsmWriteDr2 (\r
 ;   IN UINTN Value\r
 ;   );\r
 ;------------------------------------------------------------------------------\r
-_AsmWriteDr2    PROC\r
+AsmWriteDr2 PROC\r
     mov     eax, [esp + 4]\r
     mov     dr2, eax\r
     ret\r
-_AsmWriteDr2    ENDP\r
+AsmWriteDr2 ENDP\r
 \r
     END\r
index 34d3e4f0cba23fd406132371bb0986c57bbf9029..3d46fc1a80b3ec9e14a2a44389c5c6d592d8f7d8 100644 (file)
 #\r
 #------------------------------------------------------------------------------\r
 \r
-\r
-\r
-     \r
-\r
 #------------------------------------------------------------------------------\r
-# VOID\r
+# UINTN\r
 # EFIAPI\r
 # AsmWriteDr3 (\r
 #   IN UINTN Value\r
 #   );\r
 #------------------------------------------------------------------------------\r
 .global _AsmWriteDr3\r
-_AsmWriteDr3: \r
-    movl    4(%esp),%eax\r
+_AsmWriteDr3:\r
+    movl    4(%esp), %eax\r
     movl    %eax, %dr3\r
     ret\r
-\r
-\r
-\r
index c1dbc826b3e8e29f129169195ab963bb0cdddb15..69a17b4ad3fe4f7540f08e4951d6be767f78838c 100644 (file)
 ;------------------------------------------------------------------------------\r
 \r
     .586p\r
-    .model  flat\r
+    .model  flat,C\r
     .code\r
 \r
 ;------------------------------------------------------------------------------\r
-; VOID\r
+; UINTN\r
 ; EFIAPI\r
 ; AsmWriteDr3 (\r
 ;   IN UINTN Value\r
 ;   );\r
 ;------------------------------------------------------------------------------\r
-_AsmWriteDr3    PROC\r
+AsmWriteDr3 PROC\r
     mov     eax, [esp + 4]\r
     mov     dr3, eax\r
     ret\r
-_AsmWriteDr3    ENDP\r
+AsmWriteDr3 ENDP\r
 \r
     END\r
index 20ddbd290379a50d902913bb14f454c4fd4e720a..3c375545bd1705ad0b7f9c5209735ca920375c20 100644 (file)
 #\r
 #------------------------------------------------------------------------------\r
 \r
-\r
-\r
-     \r
-\r
 #------------------------------------------------------------------------------\r
-# VOID\r
+# UINTN\r
 # EFIAPI\r
 # AsmWriteDr4 (\r
 #   IN UINTN Value\r
 #   );\r
 #------------------------------------------------------------------------------\r
 .global _AsmWriteDr4\r
-_AsmWriteDr4: \r
-    movl    4(%esp),%eax\r
+_AsmWriteDr4:\r
+    movl    4(%esp), %eax\r
     movl    %eax, %dr4\r
     ret\r
-\r
-\r
-\r
index 2c82512accdebd5ff17cfede1395aa013b54054a..ca9a839f7028f8a053348640221f8d373e5f89dd 100644 (file)
 ;------------------------------------------------------------------------------\r
 \r
     .586p\r
-    .model  flat\r
+    .model  flat,C\r
     .code\r
 \r
 ;------------------------------------------------------------------------------\r
-; VOID\r
+; UINTN\r
 ; EFIAPI\r
 ; AsmWriteDr4 (\r
 ;   IN UINTN Value\r
 ;   );\r
 ;------------------------------------------------------------------------------\r
-_AsmWriteDr4    PROC\r
+AsmWriteDr4 PROC\r
     mov     eax, [esp + 4]\r
     DB      0fh, 23h, 0e0h\r
     ret\r
-_AsmWriteDr4    ENDP\r
+AsmWriteDr4 ENDP\r
 \r
     END\r
index 057928a3275778ed410755f608fc5c34f1c11dc7..4ab45d1bd73098a3d69cdd1ca38ac5928d4c4bcd 100644 (file)
 #\r
 #------------------------------------------------------------------------------\r
 \r
-\r
-\r
-     \r
-\r
 #------------------------------------------------------------------------------\r
-# VOID\r
+# UINTN\r
 # EFIAPI\r
 # AsmWriteDr5 (\r
 #   IN UINTN Value\r
 #   );\r
 #------------------------------------------------------------------------------\r
 .global _AsmWriteDr5\r
-_AsmWriteDr5: \r
-    movl    4(%esp),%eax\r
+_AsmWriteDr5:\r
+    movl    4(%esp), %eax\r
     movl    %eax, %dr5\r
     ret\r
-\r
-\r
-\r
index dc074244a1d5af53cbbaf4ff46533466a9103b51..c6def6820cde14de5ddfef07199a90ac3bcf217e 100644 (file)
 ;------------------------------------------------------------------------------\r
 \r
     .586p\r
-    .model  flat\r
+    .model  flat,C\r
     .code\r
 \r
 ;------------------------------------------------------------------------------\r
-; VOID\r
+; UINTN\r
 ; EFIAPI\r
 ; AsmWriteDr5 (\r
 ;   IN UINTN Value\r
 ;   );\r
 ;------------------------------------------------------------------------------\r
-_AsmWriteDr5    PROC\r
+AsmWriteDr5 PROC\r
     mov     eax, [esp + 4]\r
     DB      0fh, 23h, 0e8h\r
     ret\r
-_AsmWriteDr5    ENDP\r
+AsmWriteDr5 ENDP\r
 \r
     END\r
index 7d7726be64c639fb46476731d422347f666d3ed6..be3156aba5a1406a19f0533a912a69b66599a126 100644 (file)
 #\r
 #------------------------------------------------------------------------------\r
 \r
-\r
-\r
-     \r
-\r
 #------------------------------------------------------------------------------\r
-# VOID\r
+# UINTN\r
 # EFIAPI\r
 # AsmWriteDr6 (\r
 #   IN UINTN Value\r
 #   );\r
 #------------------------------------------------------------------------------\r
 .global _AsmWriteDr6\r
-_AsmWriteDr6: \r
-    movl    4(%esp),%eax\r
+_AsmWriteDr6:\r
+    movl    4(%esp), %eax\r
     movl    %eax, %dr6\r
     ret\r
-\r
-\r
-\r
index e307e827dd624791bfd36411dfcc1dfad265b044..4e5acf58b09f4c999f30ba29000c968433163c63 100644 (file)
 ;------------------------------------------------------------------------------\r
 \r
     .586p\r
-    .model  flat\r
+    .model  flat,C\r
     .code\r
 \r
 ;------------------------------------------------------------------------------\r
-; VOID\r
+; UINTN\r
 ; EFIAPI\r
 ; AsmWriteDr6 (\r
 ;   IN UINTN Value\r
 ;   );\r
 ;------------------------------------------------------------------------------\r
-_AsmWriteDr6    PROC\r
+AsmWriteDr6 PROC\r
     mov     eax, [esp + 4]\r
     mov     dr6, eax\r
     ret\r
-_AsmWriteDr6    ENDP\r
+AsmWriteDr6 ENDP\r
 \r
     END\r
index a96f44563229fd4f4a6ec06d85a537e7a7319d50..d38fd981319728870fe04b49f1d295ada36706d4 100644 (file)
 #\r
 #------------------------------------------------------------------------------\r
 \r
-\r
-\r
-     \r
-\r
 #------------------------------------------------------------------------------\r
-# VOID\r
+# UINTN\r
 # EFIAPI\r
 # AsmWriteDr7 (\r
 #   IN UINTN Value\r
 #   );\r
 #------------------------------------------------------------------------------\r
 .global _AsmWriteDr7\r
-_AsmWriteDr7: \r
-    movl    4(%esp),%eax\r
+_AsmWriteDr7:\r
+    movl    4(%esp), %eax\r
     movl    %eax, %dr7\r
     ret\r
-\r
-\r
-\r
index 55dbdc9c52ec957c65a26e7bd7ec19bf72cb7464..10e83d6fe7d940b4517e11a6eb99544f9c7a9dfa 100644 (file)
 ;------------------------------------------------------------------------------\r
 \r
     .586p\r
-    .model  flat\r
+    .model  flat,C\r
     .code\r
 \r
 ;------------------------------------------------------------------------------\r
-; VOID\r
+; UINTN\r
 ; EFIAPI\r
 ; AsmWriteDr7 (\r
 ;   IN UINTN Value\r
 ;   );\r
 ;------------------------------------------------------------------------------\r
-_AsmWriteDr7    PROC\r
+AsmWriteDr7 PROC\r
     mov     eax, [esp + 4]\r
     mov     dr7, eax\r
     ret\r
-_AsmWriteDr7    ENDP\r
+AsmWriteDr7 ENDP\r
 \r
     END\r
index 50600717bf1a69a15b37187b1fd7a8e73a17eb44..f8f700f5288a9f197c46799f3f678c39a134f054 100644 (file)
 #\r
 #------------------------------------------------------------------------------\r
 \r
-\r
-\r
-     \r
-\r
 #------------------------------------------------------------------------------\r
 # VOID\r
 # EFIAPI\r
 #   );\r
 #------------------------------------------------------------------------------\r
 .global _InternalX86WriteGdtr\r
-_InternalX86WriteGdtr: \r
-    movl    4(%esp),%eax\r
+_InternalX86WriteGdtr:\r
+    movl    4(%esp), %eax\r
     lgdt    (%eax)\r
     ret\r
-\r
-\r
-\r
index a317e75388e958e6ee763d22e97b1dda6c4243cc..f1c7a92e3b789bd061856a80dc3a2781638efb7a 100644 (file)
 ;\r
 ;------------------------------------------------------------------------------\r
 \r
-    .686P\r
+    .386p\r
     .model  flat,C\r
     .code\r
 \r
+;------------------------------------------------------------------------------\r
+; VOID\r
+; EFIAPI\r
+; InternalX86WriteGdtr (\r
+;   IN      CONST IA32_DESCRIPTOR     *Idtr\r
+;   );\r
+;------------------------------------------------------------------------------\r
 InternalX86WriteGdtr  PROC\r
     mov     eax, [esp + 4]\r
     lgdt    fword ptr [eax]\r
index 3e6da5c1c5fa817e5e29bc4ae8256fda51aee830..fc5e6cd42e731de0e8956ff2fdd0fa55ab900367 100644 (file)
 #\r
 #------------------------------------------------------------------------------\r
 \r
-\r
-\r
-     \r
-\r
 #------------------------------------------------------------------------------\r
 # VOID\r
 # EFIAPI\r
 #   );\r
 #------------------------------------------------------------------------------\r
 .global _InternalX86WriteIdtr\r
-_InternalX86WriteIdtr: \r
-    movl    4(%esp),%eax\r
+_InternalX86WriteIdtr:\r
+    movl    4(%esp), %eax\r
     lidt    (%eax)\r
     ret\r
-\r
-\r
-\r
index d4b3b51a0470bb979cbcf9faf144a1f9a6a03382..65fca407f2ffd2b60758b467c41256350217befb 100644 (file)
 ;\r
 ;------------------------------------------------------------------------------\r
 \r
-    .686P\r
+    .386p\r
     .model  flat,C\r
     .code\r
 \r
+;------------------------------------------------------------------------------\r
+; VOID\r
+; EFIAPI\r
+; InternalX86WriteIdtr (\r
+;   IN      CONST IA32_DESCRIPTOR     *Idtr\r
+;   );\r
+;------------------------------------------------------------------------------\r
 InternalX86WriteIdtr  PROC\r
     mov     eax, [esp + 4]\r
     lidt    fword ptr [eax]\r
index 3797bd547d9bd24bbbc2905d516b2288476ee098..2be1e9dfb0bf2306e74bba2287c99445d9bc3865 100644 (file)
 #\r
 #------------------------------------------------------------------------------\r
 \r
-\r
-\r
-     \r
-\r
 #------------------------------------------------------------------------------\r
 # VOID\r
 # EFIAPI\r
 #   );\r
 #------------------------------------------------------------------------------\r
 .global _AsmWriteLdtr\r
-_AsmWriteLdtr: \r
-    movl    4(%esp),%eax\r
+_AsmWriteLdtr:\r
+    movl    4(%esp), %eax\r
     lldtw   %ax\r
     ret\r
-\r
-\r
-\r
index c4444219a9b8759cb09ace381ce9d21b16044a7a..a3dca7d7d9d9f6e45b3b58a344c617153601a016 100644 (file)
 #\r
 #------------------------------------------------------------------------------\r
 \r
-\r
-\r
-     \r
-     \r
-\r
 #------------------------------------------------------------------------------\r
-# UINT64\r
+# VOID\r
 # EFIAPI\r
 # AsmWriteMm0 (\r
 #   IN UINT64   Value\r
 #   );\r
 #------------------------------------------------------------------------------\r
 .global _AsmWriteMm0\r
-_AsmWriteMm0: \r
-    movq    4(%esp),%mm0\r
+_AsmWriteMm0:\r
+    movq    4(%esp), %mm0\r
     ret\r
-\r
-\r
-\r
index e924dbdb6132a13ce417fc3bc2c7f82035674018..15912f6c4a4e4f80216bb951ad1e7157b6b0762b 100644 (file)
 ;\r
 ;------------------------------------------------------------------------------\r
 \r
-    .586P\r
-    .model  flat\r
-    .xmm\r
+    .586\r
+    .model  flat,C\r
+    .mmx\r
     .code\r
 \r
 ;------------------------------------------------------------------------------\r
-; UINT64\r
+; VOID\r
 ; EFIAPI\r
 ; AsmWriteMm0 (\r
 ;   IN UINT64   Value\r
 ;   );\r
 ;------------------------------------------------------------------------------\r
-_AsmWriteMm0    PROC\r
+AsmWriteMm0 PROC\r
     movq    mm0, [esp + 4]\r
     ret\r
-_AsmWriteMm0    ENDP\r
+AsmWriteMm0 ENDP\r
 \r
     END\r
index e3a492f9eca201a578ea545e0f4153987dca5797..62ef07d1bc7e45dab10ed23ad65ab92be10aabba 100644 (file)
 #\r
 #------------------------------------------------------------------------------\r
 \r
-\r
-\r
-     \r
-     \r
-\r
 #------------------------------------------------------------------------------\r
-# UINT64\r
+# VOID\r
 # EFIAPI\r
 # AsmWriteMm1 (\r
 #   IN UINT64   Value\r
 #   );\r
 #------------------------------------------------------------------------------\r
 .global _AsmWriteMm1\r
-_AsmWriteMm1: \r
-    movq    4(%esp),%mm1\r
+_AsmWriteMm1:\r
+    movq    4(%esp), %mm1\r
     ret\r
-\r
-\r
-\r
index 1f1d8ce8dce1d621b5b34fa5ef2030dbc0cb44c1..097e760e8ca9680de757ac6189210db8b0b24731 100644 (file)
 ;\r
 ;------------------------------------------------------------------------------\r
 \r
-    .586P\r
-    .model  flat\r
-    .xmm\r
+    .586\r
+    .model  flat,C\r
+    .mmx\r
     .code\r
 \r
 ;------------------------------------------------------------------------------\r
-; UINT64\r
+; VOID\r
 ; EFIAPI\r
 ; AsmWriteMm1 (\r
 ;   IN UINT64   Value\r
 ;   );\r
 ;------------------------------------------------------------------------------\r
-_AsmWriteMm1    PROC\r
+AsmWriteMm1 PROC\r
     movq    mm1, [esp + 4]\r
     ret\r
-_AsmWriteMm1    ENDP\r
+AsmWriteMm1 ENDP\r
 \r
     END\r
index eaebb37636aa9b9f43d1d780d2363f2ac8fae90b..b43d455d0a9d696d6a08bf2ee47b263d92abb017 100644 (file)
 #\r
 #------------------------------------------------------------------------------\r
 \r
-\r
-\r
-     \r
-     \r
-\r
 #------------------------------------------------------------------------------\r
-# UINT64\r
+# VOID\r
 # EFIAPI\r
 # AsmWriteMm2 (\r
 #   IN UINT64   Value\r
 #   );\r
 #------------------------------------------------------------------------------\r
 .global _AsmWriteMm2\r
-_AsmWriteMm2: \r
-    movq    4(%esp),%mm2\r
+_AsmWriteMm2:\r
+    movq    4(%esp), %mm2\r
     ret\r
-\r
-\r
-\r
index a18417a0d1dc9a18fc195895b68287052ff81742..fea7081d280309eae58cc7508ae215ece9ab0961 100644 (file)
 ;\r
 ;------------------------------------------------------------------------------\r
 \r
-    .586P\r
-    .model  flat\r
-    .xmm\r
+    .586\r
+    .model  flat,C\r
+    .mmx\r
     .code\r
 \r
 ;------------------------------------------------------------------------------\r
-; UINT64\r
+; VOID\r
 ; EFIAPI\r
 ; AsmWriteMm2 (\r
 ;   IN UINT64   Value\r
 ;   );\r
 ;------------------------------------------------------------------------------\r
-_AsmWriteMm2    PROC\r
+AsmWriteMm2 PROC\r
     movq    mm2, [esp + 4]\r
     ret\r
-_AsmWriteMm2    ENDP\r
+AsmWriteMm2 ENDP\r
 \r
     END\r
index a514091732961effefc01518eb7349229bf3e009..ffc5c35a9f16f768c5b1c772516125b2a5a9a0e0 100644 (file)
 #\r
 #------------------------------------------------------------------------------\r
 \r
-\r
-\r
-     \r
-     \r
-\r
 #------------------------------------------------------------------------------\r
-# UINT64\r
+# VOID\r
 # EFIAPI\r
 # AsmWriteMm3 (\r
 #   IN UINT64   Value\r
 #   );\r
 #------------------------------------------------------------------------------\r
 .global _AsmWriteMm3\r
-_AsmWriteMm3: \r
-    movq    4(%esp),%mm3\r
+_AsmWriteMm3:\r
+    movq    4(%esp), %mm3\r
     ret\r
-\r
-\r
-\r
index 7aad49f77ff87c0f6706c038d4d5d05e77fcf94e..1af24908f77fe4c9f02761b46deb0345d17aad00 100644 (file)
 ;\r
 ;------------------------------------------------------------------------------\r
 \r
-    .586P\r
-    .model  flat\r
-    .xmm\r
+    .586\r
+    .model  flat,C\r
+    .mmx\r
     .code\r
 \r
 ;------------------------------------------------------------------------------\r
-; UINT64\r
+; VOID\r
 ; EFIAPI\r
 ; AsmWriteMm3 (\r
 ;   IN UINT64   Value\r
 ;   );\r
 ;------------------------------------------------------------------------------\r
-_AsmWriteMm3    PROC\r
+AsmWriteMm3 PROC\r
     movq    mm3, [esp + 4]\r
     ret\r
-_AsmWriteMm3    ENDP\r
+AsmWriteMm3 ENDP\r
 \r
     END\r
index 6d4a6cdce1e2e68f11eb787c289fa48cdc17349c..01fde70ebc015f725c47c6190f930602a195865f 100644 (file)
 #\r
 #------------------------------------------------------------------------------\r
 \r
-\r
-\r
-     \r
-     \r
-\r
 #------------------------------------------------------------------------------\r
-# UINT64\r
+# VOID\r
 # EFIAPI\r
 # AsmWriteMm4 (\r
 #   IN UINT64   Value\r
 #   );\r
 #------------------------------------------------------------------------------\r
 .global _AsmWriteMm4\r
-_AsmWriteMm4: \r
-    movq    4(%esp),%mm4\r
+_AsmWriteMm4:\r
+    movq    4(%esp), %mm4\r
     ret\r
-\r
-\r
-\r
index 8be9c4beb8a6bb299dc039a96191f29b3d59559a..2cf9da095c34f056ed89009e0ed79ebebdcd2e55 100644 (file)
 ;\r
 ;------------------------------------------------------------------------------\r
 \r
-    .586P\r
-    .model  flat\r
-    .xmm\r
+    .586\r
+    .model  flat,C\r
+    .mmx\r
     .code\r
 \r
 ;------------------------------------------------------------------------------\r
-; UINT64\r
+; VOID\r
 ; EFIAPI\r
 ; AsmWriteMm4 (\r
 ;   IN UINT64   Value\r
 ;   );\r
 ;------------------------------------------------------------------------------\r
-_AsmWriteMm4    PROC\r
+AsmWriteMm4 PROC\r
     movq    mm4, [esp + 4]\r
     ret\r
-_AsmWriteMm4    ENDP\r
+AsmWriteMm4 ENDP\r
 \r
     END\r
index 15d433271f781c417b77f4772482255c3d39aadc..9effef0758a20d5fd761424496bdbf3fbd4ffef4 100644 (file)
 #\r
 #------------------------------------------------------------------------------\r
 \r
-\r
-\r
-     \r
-     \r
-\r
 #------------------------------------------------------------------------------\r
-# UINT64\r
+# VOID\r
 # EFIAPI\r
 # AsmWriteMm5 (\r
 #   IN UINT64   Value\r
 #   );\r
 #------------------------------------------------------------------------------\r
 .global _AsmWriteMm5\r
-_AsmWriteMm5: \r
-    movq    4(%esp),%mm5\r
+_AsmWriteMm5:\r
+    movq    4(%esp), %mm5\r
     ret\r
-\r
-\r
-\r
index bc501b397c910803c7ad82b9d559214eecfb441a..9c9882ef105c6cd87f616a17e1f8c88a76815821 100644 (file)
 ;\r
 ;------------------------------------------------------------------------------\r
 \r
-    .586P\r
-    .model  flat\r
-    .xmm\r
+    .586\r
+    .model  flat,C\r
+    .mmx\r
     .code\r
 \r
 ;------------------------------------------------------------------------------\r
-; UINT64\r
+; VOID\r
 ; EFIAPI\r
 ; AsmWriteMm5 (\r
 ;   IN UINT64   Value\r
 ;   );\r
 ;------------------------------------------------------------------------------\r
-_AsmWriteMm5    PROC\r
+AsmWriteMm5 PROC\r
     movq    mm5, [esp + 4]\r
     ret\r
-_AsmWriteMm5    ENDP\r
+AsmWriteMm5 ENDP\r
 \r
     END\r
index 6b1361e7a31cbf2c1e2ea3cc49c23869f0c18f5b..c1ecd9ea0e88d4ddbe123529e433ec9badc8e252 100644 (file)
 #\r
 #------------------------------------------------------------------------------\r
 \r
-\r
-\r
-     \r
-     \r
-\r
 #------------------------------------------------------------------------------\r
-# UINT64\r
+# VOID\r
 # EFIAPI\r
 # AsmWriteMm6 (\r
 #   IN UINT64   Value\r
 #   );\r
 #------------------------------------------------------------------------------\r
 .global _AsmWriteMm6\r
-_AsmWriteMm6: \r
-    movq    4(%esp),%mm6\r
+_AsmWriteMm6:\r
+    movq    4(%esp), %mm6\r
     ret\r
-\r
-\r
-\r
index 4a6445cb637b0446d5f4bd291bc6635ee2ac564f..5e0cfad563c183fd918bd96a0b19d00c283f9cc7 100644 (file)
 ;\r
 ;------------------------------------------------------------------------------\r
 \r
-    .586P\r
-    .model  flat\r
-    .xmm\r
+    .586\r
+    .model  flat,C\r
+    .mmx\r
     .code\r
 \r
 ;------------------------------------------------------------------------------\r
-; UINT64\r
+; VOID\r
 ; EFIAPI\r
 ; AsmWriteMm6 (\r
 ;   IN UINT64   Value\r
 ;   );\r
 ;------------------------------------------------------------------------------\r
-_AsmWriteMm6    PROC\r
+AsmWriteMm6 PROC\r
     movq    mm6, [esp + 4]\r
     ret\r
-_AsmWriteMm6    ENDP\r
+AsmWriteMm6 ENDP\r
 \r
     END\r
index d702fbb2427485b014dd27bca44d264b584e99ca..c7cb0880b4a969562e67bd95e1fb3167aa5f4c01 100644 (file)
 #\r
 #------------------------------------------------------------------------------\r
 \r
-\r
-\r
-     \r
-     \r
-\r
 #------------------------------------------------------------------------------\r
-# UINT64\r
+# VOID\r
 # EFIAPI\r
 # AsmWriteMm7 (\r
 #   IN UINT64   Value\r
 #   );\r
 #------------------------------------------------------------------------------\r
 .global _AsmWriteMm7\r
-_AsmWriteMm7: \r
-    movq    4(%esp),%mm7\r
+_AsmWriteMm7:\r
+    movq    4(%esp), %mm7\r
     ret\r
-\r
-\r
-\r
index 3bc73fed272b5eebf4607658d93acda835d3e96e..faaa23bfd231f3db92ffa610288d2048be246881 100644 (file)
 ;\r
 ;------------------------------------------------------------------------------\r
 \r
-    .586P\r
-    .model  flat\r
-    .xmm\r
+    .586\r
+    .model  flat,C\r
+    .mmx\r
     .code\r
 \r
 ;------------------------------------------------------------------------------\r
-; UINT64\r
+; VOID\r
 ; EFIAPI\r
 ; AsmWriteMm7 (\r
 ;   IN UINT64   Value\r
 ;   );\r
 ;------------------------------------------------------------------------------\r
-_AsmWriteMm7    PROC\r
+AsmWriteMm7 PROC\r
     movq    mm7, [esp + 4]\r
     ret\r
-_AsmWriteMm7    ENDP\r
+AsmWriteMm7 ENDP\r
 \r
     END\r
diff --git a/MdePkg/Library/BaseLib/Ia32/WriteMsr32.S b/MdePkg/Library/BaseLib/Ia32/WriteMsr32.S
deleted file mode 100644 (file)
index 450b3b7..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-#------------------------------------------------------------------------------\r
-#\r
-# Copyright (c) 2006, Intel Corporation\r
-# All rights reserved. This program and the accompanying materials\r
-# are licensed and made available under the terms and conditions of the BSD License\r
-# which accompanies this distribution.  The full text of the license may be found at\r
-# http://opensource.org/licenses/bsd-license.php\r
-#\r
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-#\r
-# Module Name:\r
-#\r
-#   WriteMsr32.Asm\r
-#\r
-# Abstract:\r
-#\r
-#   AsmWriteMsr32 function\r
-#\r
-# Notes:\r
-#\r
-#------------------------------------------------------------------------------\r
-\r
-\r
-\r
-     \r
-\r
-#------------------------------------------------------------------------------\r
-# UINT32\r
-# EFIAPI\r
-# AsmWriteMsr32 (\r
-#   IN UINT32  Index,\r
-#   IN UINT32  Value\r
-#   );\r
-#------------------------------------------------------------------------------\r
-.global _AsmWriteMsr32\r
-_AsmWriteMsr32: \r
-    movl    8(%esp),%eax\r
-    xorl    %edx,%edx\r
-    movl    4(%esp),%ecx\r
-    wrmsr\r
-    ret\r
-\r
-\r
-\r
diff --git a/MdePkg/Library/BaseLib/Ia32/WriteMsr32.asm b/MdePkg/Library/BaseLib/Ia32/WriteMsr32.asm
deleted file mode 100644 (file)
index ba14514..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-;------------------------------------------------------------------------------\r
-;\r
-; Copyright (c) 2006, Intel Corporation\r
-; All rights reserved. This program and the accompanying materials\r
-; are licensed and made available under the terms and conditions of the BSD License\r
-; which accompanies this distribution.  The full text of the license may be found at\r
-; http://opensource.org/licenses/bsd-license.php\r
-;\r
-; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-;\r
-; Module Name:\r
-;\r
-;   WriteMsr32.Asm\r
-;\r
-; Abstract:\r
-;\r
-;   AsmWriteMsr32 function\r
-;\r
-; Notes:\r
-;\r
-;------------------------------------------------------------------------------\r
-\r
-    .586P\r
-    .model  flat\r
-    .code\r
-\r
-;------------------------------------------------------------------------------\r
-; UINT32\r
-; EFIAPI\r
-; AsmWriteMsr32 (\r
-;   IN UINT32  Index,\r
-;   IN UINT32  Value\r
-;   );\r
-;------------------------------------------------------------------------------\r
-_AsmWriteMsr32  PROC\r
-    mov     eax, [esp + 8]\r
-    xor     edx, edx\r
-    mov     ecx, [esp + 4]\r
-    wrmsr\r
-    ret\r
-_AsmWriteMsr32  ENDP\r
-\r
-    END\r
index 802aad780391e822c182c6ca83d7b840436796b4..8af214755488af7bc5f2682261fc519037d36cb7 100644 (file)
 #\r
 #------------------------------------------------------------------------------\r
 \r
-\r
-\r
-     \r
-\r
 #------------------------------------------------------------------------------\r
 # UINT64\r
 # EFIAPI\r
 #   );\r
 #------------------------------------------------------------------------------\r
 .global _AsmWriteMsr64\r
-_AsmWriteMsr64: \r
-    movl    12(%esp),%edx\r
-    movl    8(%esp),%eax\r
-    movl    4(%esp),%ecx\r
+_AsmWriteMsr64:\r
+    movl    12(%esp), %edx\r
+    movl    8(%esp), %eax\r
+    movl    4(%esp), %ecx\r
     wrmsr\r
     ret\r
-\r
-\r
-\r
index 5afc0742912a98072a26b2f7c41b2ae99de9a7b7..14edba60c1f41c154ccde10c45f138c0944e73a9 100644 (file)
@@ -21,8 +21,8 @@
 ;\r
 ;------------------------------------------------------------------------------\r
 \r
-    .586P\r
-    .model  flat\r
+    .586p\r
+    .model  flat,C\r
     .code\r
 \r
 ;------------------------------------------------------------------------------\r
 ;   IN UINT64  Value\r
 ;   );\r
 ;------------------------------------------------------------------------------\r
-_AsmWriteMsr64  PROC\r
+AsmWriteMsr64   PROC\r
     mov     edx, [esp + 12]\r
     mov     eax, [esp + 8]\r
     mov     ecx, [esp + 4]\r
     wrmsr\r
     ret\r
-_AsmWriteMsr64  ENDP\r
+AsmWriteMsr64   ENDP\r
 \r
     END\r
index 8bac97ab479bce1becbd07004226d37dea5ad5aa..f03479ae81e095a1306aaf418fb38b66ee2ff688 100644 (file)
@@ -26,6 +26,7 @@
 \r
 **/\r
 VOID\r
+EFIAPI\r
 InternalAssertJumpBuffer (\r
   IN      BASE_LIBRARY_JUMP_BUFFER  *JumpBuffer\r
   )\r
index 7b1e1b8bd292fd5c5ad2df4ea61e0a3fba0a8141..2609c941aa0a0aa2d715ba14249342396e00320d 100644 (file)
 \r
     .code\r
 \r
+;------------------------------------------------------------------------------\r
+; VOID\r
+; EFIAPI\r
+; InternalX86DisablePaging64 (\r
+;   IN      UINT16                    Cs,\r
+;   IN      UINT32                    EntryPoint,\r
+;   IN      UINT32                    Context1,  OPTIONAL\r
+;   IN      UINT32                    Context2,  OPTIONAL\r
+;   IN      UINT32                    NewStack\r
+;   );\r
+;------------------------------------------------------------------------------\r
 InternalX86DisablePaging64    PROC\r
     cli\r
     shl     rcx, 32\r
index 8acfc2f00fa19bc4f9b4635cd0bdc38e9b68a991..7e7037e9e6972371af0ee9cdb6996b999a56102b 100644 (file)
 \r
     .code\r
 \r
+;------------------------------------------------------------------------------\r
+; VOID\r
+; EFIAPI\r
+; InternalX86FxRestore (\r
+;   IN CONST IA32_FX_BUFFER *Buffer\r
+;   );\r
+;------------------------------------------------------------------------------\r
 InternalX86FxRestore  PROC\r
     fxrstor [rcx]\r
     ret\r
index cacb1f52832e8cdea0605c46b04ed014a2911795..ea19cd1648200a0de8540116523214867de408ff 100644 (file)
 \r
     .code\r
 \r
+;------------------------------------------------------------------------------\r
+; VOID\r
+; EFIAPI\r
+; InternalX86FxSave (\r
+;   OUT IA32_FX_BUFFER *Buffer\r
+;   );\r
+;------------------------------------------------------------------------------\r
 InternalX86FxSave PROC\r
     fxsave  [rcx]\r
     ret\r
index fb6378d030a69651c0c760d13549d8dfa650c618..6ef5f964e0e5d78b1d2e093d806501ba7b2cf43c 100644 (file)
 \r
     .code\r
 \r
+;------------------------------------------------------------------------------\r
+; VOID\r
+; EFIAPI\r
+; InternalLongJump (\r
+;   IN      BASE_LIBRARY_JUMP_BUFFER  *JumpBuffer,\r
+;   IN      UINTN                     Value\r
+;   );\r
+;------------------------------------------------------------------------------\r
 InternalLongJump    PROC\r
     mov     rbx, [rcx]\r
     mov     rsp, [rcx + 8]\r
index 126149a47c9a9ae461cc92e7b30c83ab31c16c72..642ce5b1697bfc81cd7fe71e838e3958992bc7d4 100644 (file)
@@ -31,7 +31,7 @@
 ;   );\r
 ;------------------------------------------------------------------------------\r
 AsmReadCs   PROC\r
-    mov     ax, cs\r
+    mov     eax, cs\r
     ret\r
 AsmReadCs   ENDP\r
 \r
index bdcddb65d89ee6be361e9f4a01b28a91c9b0689d..6f2629872b96c44598f31e4ce1138624eac5ce89 100644 (file)
@@ -31,9 +31,8 @@
 ;   );\r
 ;------------------------------------------------------------------------------\r
 AsmReadDs   PROC\r
-    mov     ax, ds\r
+    mov     eax, ds\r
     ret\r
 AsmReadDs   ENDP\r
 \r
     END\r
-\r
index 40384bcd7148dafcbc95fcdbfa21950e45c39eb3..d5fe84d73f3a62e60cc2c5c53582aef1586dad28 100644 (file)
@@ -31,7 +31,7 @@
 ;   );\r
 ;------------------------------------------------------------------------------\r
 AsmReadEs   PROC\r
-    mov     ax, es\r
+    mov     eax, es\r
     ret\r
 AsmReadEs   ENDP\r
 \r
index b63e47402311112772e468db06eeb3efae9ca768..d44ee545af81556f479ed325dbc036331a338be5 100644 (file)
@@ -31,7 +31,7 @@
 ;   );\r
 ;------------------------------------------------------------------------------\r
 AsmReadFs   PROC\r
-    mov     ax, fs\r
+    mov     eax, fs\r
     ret\r
 AsmReadFs   ENDP\r
 \r
index 2d40599a8bf239a138e5bf08939c1ed7ae7e8504..0bc2949b542b0cf5eb96e68d538ca596e53dde96 100644 (file)
 \r
     .code\r
 \r
+;------------------------------------------------------------------------------\r
+; VOID\r
+; EFIAPI\r
+; InternalX86ReadGdtr (\r
+;   OUT IA32_DESCRIPTOR  *Gdtr\r
+;   );\r
+;------------------------------------------------------------------------------\r
 InternalX86ReadGdtr   PROC\r
     sgdt    fword ptr [rcx]\r
     ret\r
index 02d140e670853189a28b85532c49b7325d957854..bc5de7691b2db7f9979465e22201707be6382ef0 100644 (file)
@@ -31,7 +31,7 @@
 ;   );\r
 ;------------------------------------------------------------------------------\r
 AsmReadGs   PROC\r
-    mov     ax, gs\r
+    mov     eax, gs\r
     ret\r
 AsmReadGs   ENDP\r
 \r
index 260f697178bf8c4f601c85ca800fdd079a06d8f2..db684f367121280e73086a315d8ffca9590fa209 100644 (file)
 \r
     .code\r
 \r
+;------------------------------------------------------------------------------\r
+; VOID\r
+; EFIAPI\r
+; InternalX86ReadIdtr (\r
+;   OUT     IA32_DESCRIPTOR           *Idtr\r
+;   );\r
+;------------------------------------------------------------------------------\r
 InternalX86ReadIdtr   PROC\r
     sidt    fword ptr [rcx]\r
     ret\r
index 1239bcacd616a38f30d97772121bf04095dc5399..a81d20829863ea3578c6455cf95c249618f79bbb 100644 (file)
@@ -24,7 +24,7 @@
     .code\r
 \r
 ;------------------------------------------------------------------------------\r
-; UINTN\r
+; UINT64\r
 ; EFIAPI\r
 ; AsmReadMm0 (\r
 ;   VOID\r
index b42bd7f63f7065f6c60bedbe81743f2084847a80..5da8c4f9e58bd1d16f854e50a57a35386ab7ee09 100644 (file)
@@ -24,7 +24,7 @@
     .code\r
 \r
 ;------------------------------------------------------------------------------\r
-; UINTN\r
+; UINT64\r
 ; EFIAPI\r
 ; AsmReadMm1 (\r
 ;   VOID\r
index b10782e403426979309da75ad05f9ec028d71cfb..3b2b1e3af3e02de5a268b38c319e830793ced602 100644 (file)
@@ -24,7 +24,7 @@
     .code\r
 \r
 ;------------------------------------------------------------------------------\r
-; UINTN\r
+; UINT64\r
 ; EFIAPI\r
 ; AsmReadMm2 (\r
 ;   VOID\r
index 15a96475bd36ce45340a570a4d581b359ca8a9ec..6283c30285fa1dd7d8e4044f0424419fbc838526 100644 (file)
@@ -24,7 +24,7 @@
     .code\r
 \r
 ;------------------------------------------------------------------------------\r
-; UINTN\r
+; UINT64\r
 ; EFIAPI\r
 ; AsmReadMm3 (\r
 ;   VOID\r
index 73f528342e1b29e89fee56744f8af6b747906e99..a65f130283e50be3a7e722fdfe214d197e006513 100644 (file)
@@ -24,7 +24,7 @@
     .code\r
 \r
 ;------------------------------------------------------------------------------\r
-; UINTN\r
+; UINT64\r
 ; EFIAPI\r
 ; AsmReadMm4 (\r
 ;   VOID\r
index a487889480d73ce1a376e6f1e5b669248ce88a6e..5295c38ae01fb4ea074d2864863c019a33486c9c 100644 (file)
@@ -24,7 +24,7 @@
     .code\r
 \r
 ;------------------------------------------------------------------------------\r
-; UINTN\r
+; UINT64\r
 ; EFIAPI\r
 ; AsmReadMm5 (\r
 ;   VOID\r
index 56f81bf7b1021817fce5b3850d00f2a97b5fd0b1..acdc99b888adddd14229cebf2944d4ed79de6e0a 100644 (file)
@@ -24,7 +24,7 @@
     .code\r
 \r
 ;------------------------------------------------------------------------------\r
-; UINTN\r
+; UINT64\r
 ; EFIAPI\r
 ; AsmReadMm6 (\r
 ;   VOID\r
index e3ad6bb6587e6fffd1d11bd622ebfa271ccd9f24..7a1b4e6111abefcd2e30ed33f5eb5b2c968b4894 100644 (file)
@@ -24,7 +24,7 @@
     .code\r
 \r
 ;------------------------------------------------------------------------------\r
-; UINTN\r
+; UINT64\r
 ; EFIAPI\r
 ; AsmReadMm7 (\r
 ;   VOID\r
diff --git a/MdePkg/Library/BaseLib/X64/ReadMsr32.asm b/MdePkg/Library/BaseLib/X64/ReadMsr32.asm
deleted file mode 100644 (file)
index 271eabb..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-;------------------------------------------------------------------------------\r
-;\r
-; Copyright (c) 2006, Intel Corporation\r
-; All rights reserved. This program and the accompanying materials\r
-; are licensed and made available under the terms and conditions of the BSD License\r
-; which accompanies this distribution.  The full text of the license may be found at\r
-; http://opensource.org/licenses/bsd-license.php\r
-;\r
-; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-;\r
-; Module Name:\r
-;\r
-;   ReadMsr32.Asm\r
-;\r
-; Abstract:\r
-;\r
-;   AsmReadMsr32 function\r
-;\r
-; Notes:\r
-;\r
-;------------------------------------------------------------------------------\r
-\r
-    .code\r
-\r
-;------------------------------------------------------------------------------\r
-; UINT32\r
-; EFIAPI\r
-; AsmReadMsr32 (\r
-;   IN UINT32  Index\r
-;   );\r
-;------------------------------------------------------------------------------\r
-AsmReadMsr32    PROC\r
-    rdmsr\r
-    ret\r
-AsmReadMsr32    ENDP\r
-\r
-    END\r
index 4444c18676ea8a67e8eb77e9a70a9efc2be2ed0e..580c0761a4cfcc07a41e024bffc43034a8b62ea1 100644 (file)
@@ -31,9 +31,9 @@
 ;   );\r
 ;------------------------------------------------------------------------------\r
 AsmReadMsr64    PROC\r
-    rdmsr\r
-    shl     rax, 20h\r
-    shrd    rax, rdx, 20h\r
+    rdmsr                               ; edx & eax are zero extended\r
+    shl     rdx, 20h\r
+    or      rax, rdx\r
     ret\r
 AsmReadMsr64    ENDP\r
 \r
index b5004d6f342d1666ed9f6018d7f161d2496a0cbf..5ca60fa85f677a8318fee0b364bfdf6a8f457ec7 100644 (file)
 ;------------------------------------------------------------------------------\r
 AsmReadPmc  PROC\r
     rdpmc\r
-    shl     ecx, 1\r
-    jnc     @F\r
-    shl     rax, 20h\r
-    shrd    rax, rdx, 20h\r
-@@:\r
+    shl     rdx, 20h\r
+    or      rax, rdx\r
     ret\r
 AsmReadPmc  ENDP\r
 \r
index 4aa480d71b4bfe5845174ae19ea59df3d0a6f214..2c2be564ac9273b5d3976d3a3fe3f847089f1bd6 100644 (file)
@@ -31,7 +31,7 @@
 ;   );\r
 ;------------------------------------------------------------------------------\r
 AsmReadSs   PROC\r
-    mov     ax, ss\r
+    mov     eax, ss\r
     ret\r
 AsmReadSs   ENDP\r
 \r
index 25fa2cc5d8387edd96a2b84eabff97abd313998a..7c45eebd5465a7c6320f98b7210c84f49f35b473 100644 (file)
@@ -32,8 +32,8 @@
 ;------------------------------------------------------------------------------\r
 AsmReadTsc  PROC\r
     rdtsc\r
-    shl     rax, 20h\r
-    shrd    rax, rdx, 20h\r
+    shl     rdx, 20h\r
+    or      rax, rdx\r
     ret\r
 AsmReadTsc  ENDP\r
 \r
index 148b0cb65e268dfb70e07e63d34215e932ac71c0..2ed581ea9d653a4b57c1d273e545fe885e4bc211 100644 (file)
 \r
 EXTERNDEF   InternalAssertJumpBuffer:PROC\r
 \r
+;------------------------------------------------------------------------------\r
+; UINTN\r
+; EFIAPI\r
+; SetJump (\r
+;   OUT     BASE_LIBRARY_JUMP_BUFFER  *JumpBuffer\r
+;   );\r
+;------------------------------------------------------------------------------\r
 SetJump     PROC\r
     push    rcx\r
     add     rsp, -20h\r
index b120434efb0c7ac3211ce433a89b21fa27adbc93..2c35c72a57713c78774211b06d9e8b25053df31f 100644 (file)
@@ -61,6 +61,10 @@ SavedGdt    LABEL   FWORD
             DW      ?\r
             DQ      ?\r
 \r
+;------------------------------------------------------------------------------\r
+; _BackFromUserCode() takes control in real mode after 'retf' has been executed\r
+; by user code. It will be shadowed to somewhere in memory below 1MB.\r
+;------------------------------------------------------------------------------\r
 _BackFromUserCode   PROC\r
     DB      16h                         ; push ss\r
     DB      0eh                         ; push cs\r
@@ -125,6 +129,10 @@ _16Gdtr     LABEL   FWORD
 _16GdtrBase DQ      _NullSegDesc\r
 _16Idtr     FWORD   (1 SHL 10) - 1\r
 \r
+;------------------------------------------------------------------------------\r
+; _ToUserCode() takes control in real mode before passing control to user code.\r
+; It will be shadowed to somewhere in memory below 1MB.\r
+;------------------------------------------------------------------------------\r
 _ToUserCode PROC\r
     mov     edi, ss\r
     mov     ss, edx                     ; set new segment selectors\r
@@ -184,11 +192,14 @@ _16DsDesc       LABEL   QWORD
                 DB      0\r
 GdtEnd          LABEL   QWORD\r
 \r
-;\r
-;   @param  RegSet  Pointer to a IA32_DWORD_REGS structure\r
-;   @param  Transition  Pointer to the transition code\r
-;   @return The address of the 16-bit stack after returning from user code\r
-;\r
+;------------------------------------------------------------------------------\r
+; IA32_REGISTER_SET *\r
+; EFIAPI\r
+; InternalAsmThunk16 (\r
+;   IN      IA32_REGISTER_SET         *RegisterSet,\r
+;   IN OUT  VOID                      *Transition\r
+;   );\r
+;------------------------------------------------------------------------------\r
 InternalAsmThunk16  PROC    USES    rbp rbx rsi rdi\r
     mov     r10d, ds\r
     mov     r11d, es\r
index defc7e7c96c3a82d1ef9a10ba1e82ec6ccf707ef..caf1904d2eb03a83255ab2065e62a667b58da046 100644 (file)
 ; UINTN\r
 ; EFIAPI\r
 ; AsmWriteCr0 (\r
-;   VOID\r
+;   UINTN  Cr0\r
 ;   );\r
 ;------------------------------------------------------------------------------\r
 AsmWriteCr0 PROC\r
     mov     cr0, rcx\r
+    mov     rax, rcx\r
     ret\r
 AsmWriteCr0 ENDP\r
 \r
index ebe6f89d622fa9d1106286513b8d75fe56ee578f..ee5b5462621d490dede1250da819eb5b1fa71e4f 100644 (file)
 ; UINTN\r
 ; EFIAPI\r
 ; AsmWriteCr2 (\r
-;   VOID\r
+;   UINTN  Cr2\r
 ;   );\r
 ;------------------------------------------------------------------------------\r
 AsmWriteCr2 PROC\r
     mov     cr2, rcx\r
+    mov     rax, rcx\r
     ret\r
 AsmWriteCr2 ENDP\r
 \r
index 5715dea9b7d8769bc6a71d685ea9cdbce6622b92..e63229820ef5872eed0bdb50ea9f80db4b0c39db 100644 (file)
 ; UINTN\r
 ; EFIAPI\r
 ; AsmWriteCr3 (\r
-;   VOID\r
+;   UINTN  Cr3\r
 ;   );\r
 ;------------------------------------------------------------------------------\r
 AsmWriteCr3 PROC\r
     mov     cr3, rcx\r
+    mov     rax, rcx\r
     ret\r
 AsmWriteCr3 ENDP\r
 \r
index 210744e16fa45deead1caf5bb36357a8b75a4f83..3e79fe23e46cf115aa1c6c3e3eaf592825124b48 100644 (file)
 ; UINTN\r
 ; EFIAPI\r
 ; AsmWriteCr4 (\r
-;   VOID\r
+;   UINTN  Cr4\r
 ;   );\r
 ;------------------------------------------------------------------------------\r
 AsmWriteCr4 PROC\r
     mov     cr4, rcx\r
+    mov     rax, rcx\r
     ret\r
 AsmWriteCr4 ENDP\r
 \r
index 2515a20404eac91ed79249ab08602a839dfad9b6..a1131fead9019cea0013366da3fca814cfa91d48 100644 (file)
 ; UINTN\r
 ; EFIAPI\r
 ; AsmWriteDr0 (\r
-;   VOID\r
+;   IN UINTN Value\r
 ;   );\r
 ;------------------------------------------------------------------------------\r
 AsmWriteDr0 PROC\r
     mov     dr0, rcx\r
+    mov     rax, rcx\r
     ret\r
 AsmWriteDr0 ENDP\r
 \r
index 89f36ac3f94b793f32b9789fd7a8c790193f22b8..366edb6ef881271415e96ff0ecabf93654ba0b64 100644 (file)
 ; UINTN\r
 ; EFIAPI\r
 ; AsmWriteDr1 (\r
-;   VOID\r
+;   IN UINTN Value\r
 ;   );\r
 ;------------------------------------------------------------------------------\r
 AsmWriteDr1 PROC\r
     mov     dr1, rcx\r
+    mov     rax, rcx\r
     ret\r
 AsmWriteDr1 ENDP\r
 \r
index 820977c2e4a17ff8904eddf86260a6dab9031860..bde8e3d929b4422e366645844470cc0b4758e791 100644 (file)
 ; UINTN\r
 ; EFIAPI\r
 ; AsmWriteDr2 (\r
-;   VOID\r
+;   IN UINTN Value\r
 ;   );\r
 ;------------------------------------------------------------------------------\r
 AsmWriteDr2 PROC\r
     mov     dr2, rcx\r
+    mov     rax, rcx\r
     ret\r
 AsmWriteDr2 ENDP\r
 \r
index 51c14072771dc64ca0d074a3d29f09bf1605f93b..65180a27d5ca8a54591ee6fb730ed963ea01d99e 100644 (file)
 ; UINTN\r
 ; EFIAPI\r
 ; AsmWriteDr3 (\r
-;   VOID\r
+;   IN UINTN Value\r
 ;   );\r
 ;------------------------------------------------------------------------------\r
 AsmWriteDr3 PROC\r
     mov     dr3, rcx\r
+    mov     rax, rcx\r
     ret\r
 AsmWriteDr3 ENDP\r
 \r
index 12b643825b6e462c868a0ea1d70ea3a2e229a676..ad618f1089aa7dda9f64cb8681b8f1078aeb6628 100644 (file)
 ; UINTN\r
 ; EFIAPI\r
 ; AsmWriteDr4 (\r
-;   VOID\r
+;   IN UINTN Value\r
 ;   );\r
 ;------------------------------------------------------------------------------\r
 AsmWriteDr4 PROC\r
     DB      0fh, 23h, 0e1h\r
+    mov     rax, rcx\r
     ret\r
 AsmWriteDr4 ENDP\r
 \r
index 6d454d5267740e61364799a06c98cdea9888c06e..91eeef20e334dd83019b0ab1d1b8f035f044e5ba 100644 (file)
 ;------------------------------------------------------------------------------\r
 ; UINTN\r
 ; EFIAPI\r
-; AsmWriteDr5 (\r
-;   VOID\r
+; AsmWriteDr6 (\r
+;   IN UINTN Value\r
 ;   );\r
 ;------------------------------------------------------------------------------\r
 AsmWriteDr5 PROC\r
     DB      0fh, 23h, 0e9h\r
+    mov     rax, rcx\r
     ret\r
 AsmWriteDr5 ENDP\r
 \r
index b7b9f2509d57d166ca768702b4223b65f425822d..f1ddae8bfcd7174ff75d89edede134790b638531 100644 (file)
 ; UINTN\r
 ; EFIAPI\r
 ; AsmWriteDr6 (\r
-;   VOID\r
+;   IN UINTN Value\r
 ;   );\r
 ;------------------------------------------------------------------------------\r
 AsmWriteDr6 PROC\r
     mov     dr6, rcx\r
+    mov     rax, rcx\r
     ret\r
 AsmWriteDr6 ENDP\r
 \r
index de2237b6e4a133c58e13ed341fe8696005cb23ef..6a0cbfa6ff603b53be9aec0fde511c541d97ceae 100644 (file)
 ; UINTN\r
 ; EFIAPI\r
 ; AsmWriteDr7 (\r
-;   VOID\r
+;   IN UINTN Value\r
 ;   );\r
 ;------------------------------------------------------------------------------\r
 AsmWriteDr7 PROC\r
     mov     dr7, rcx\r
+    mov     rax, rcx\r
     ret\r
 AsmWriteDr7 ENDP\r
 \r
index 1757e3dea4fa1255b5d2a1fc43d525239f74c1af..fa99a499e79c3e20f0e7cea710987f71459f54c5 100644 (file)
 \r
     .code\r
 \r
+;------------------------------------------------------------------------------\r
+; VOID\r
+; EFIAPI\r
+; InternalX86WriteGdtr (\r
+;   IN      CONST IA32_DESCRIPTOR     *Idtr\r
+;   );\r
+;------------------------------------------------------------------------------\r
 InternalX86WriteGdtr  PROC\r
     lgdt    fword ptr [rcx]\r
     ret\r
index 09fcb9e457c1a1dde7174b828d5493916de30225..2f6c081ab62b902acac11ee4ecd853ec6a220199 100644 (file)
 \r
     .code\r
 \r
+;------------------------------------------------------------------------------\r
+; VOID\r
+; EFIAPI\r
+; InternalX86WriteIdtr (\r
+;   IN      CONST IA32_DESCRIPTOR     *Idtr\r
+;   );\r
+;------------------------------------------------------------------------------\r
 InternalX86WriteIdtr  PROC\r
     lidt    fword ptr [rcx]\r
     ret\r
index bb9a576125c21c40f5d97f5fcf618ac3735f1138..0ad65e366d4957c13c6c40cf2b53d24ad1bbd116 100644 (file)
     .code\r
 \r
 ;------------------------------------------------------------------------------\r
-; UINTN\r
+; VOID\r
 ; EFIAPI\r
 ; AsmWriteMm0 (\r
-;   VOID\r
+;   IN UINT64   Value\r
 ;   );\r
 ;------------------------------------------------------------------------------\r
 AsmWriteMm0 PROC\r
index 1bab3bcd8e9e3a7b40338dd0d05a8a4f9b9a806e..66425a43c24635ae8ce2fdab332974970a94212b 100644 (file)
     .code\r
 \r
 ;------------------------------------------------------------------------------\r
-; UINTN\r
+; VOID\r
 ; EFIAPI\r
 ; AsmWriteMm1 (\r
-;   VOID\r
+;   IN UINT64   Value\r
 ;   );\r
 ;------------------------------------------------------------------------------\r
 AsmWriteMm1 PROC\r
index 97e8a6a6760369da475238d34c55917d21442691..bd0f0a0e1adcd3c94b5e7c0c25fe51f898ac09bd 100644 (file)
     .code\r
 \r
 ;------------------------------------------------------------------------------\r
-; UINTN\r
+; VOID\r
 ; EFIAPI\r
 ; AsmWriteMm2 (\r
-;   VOID\r
+;   IN UINT64   Value\r
 ;   );\r
 ;------------------------------------------------------------------------------\r
 AsmWriteMm2 PROC\r
index d55e19a40613092dd5b39f746842a8d47e0838ab..fa36ea64bb15cd66ef4f6313c82d9ded619ebc2d 100644 (file)
     .code\r
 \r
 ;------------------------------------------------------------------------------\r
-; UINTN\r
+; VOID\r
 ; EFIAPI\r
 ; AsmWriteMm3 (\r
-;   VOID\r
+;   IN UINT64   Value\r
 ;   );\r
 ;------------------------------------------------------------------------------\r
 AsmWriteMm3 PROC\r
index 2a69b93bcc7112b6303890af261a1f0d31cfef0c..d9bc46e16c5ec21cef11a09735885ad5dcb8b8a5 100644 (file)
     .code\r
 \r
 ;------------------------------------------------------------------------------\r
-; UINTN\r
+; VOID\r
 ; EFIAPI\r
 ; AsmWriteMm4 (\r
-;   VOID\r
+;   IN UINT64   Value\r
 ;   );\r
 ;------------------------------------------------------------------------------\r
 AsmWriteMm4 PROC\r
index c4d798bcbd43152c00b99c3a32a61f1429495077..f268bea8ec8966dcbbfb43e077ede93b3dad895d 100644 (file)
     .code\r
 \r
 ;------------------------------------------------------------------------------\r
-; UINTN\r
+; VOID\r
 ; EFIAPI\r
 ; AsmWriteMm5 (\r
-;   VOID\r
+;   IN UINT64   Value\r
 ;   );\r
 ;------------------------------------------------------------------------------\r
 AsmWriteMm5 PROC\r
index c0164f66da3a1308abee5de3b2cd63f89ec95a5a..cb32ea6dc384581cdefe7a59d5410a5aef6a4b4a 100644 (file)
     .code\r
 \r
 ;------------------------------------------------------------------------------\r
-; UINTN\r
+; VOID\r
 ; EFIAPI\r
 ; AsmWriteMm6 (\r
-;   VOID\r
+;   IN UINT64   Value\r
 ;   );\r
 ;------------------------------------------------------------------------------\r
 AsmWriteMm6 PROC\r
index 20768e2b7801cde942f5a5fc864b6bcb7e9e9f09..f5713823bb91ce5d6f2a1781e4abed7d16863f74 100644 (file)
     .code\r
 \r
 ;------------------------------------------------------------------------------\r
-; UINTN\r
+; VOID\r
 ; EFIAPI\r
 ; AsmWriteMm7 (\r
-;   VOID\r
+;   IN UINT64   Value\r
 ;   );\r
 ;------------------------------------------------------------------------------\r
 AsmWriteMm7 PROC\r
diff --git a/MdePkg/Library/BaseLib/X64/WriteMsr32.asm b/MdePkg/Library/BaseLib/X64/WriteMsr32.asm
deleted file mode 100644 (file)
index 0a74403..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-;------------------------------------------------------------------------------\r
-;\r
-; Copyright (c) 2006, Intel Corporation\r
-; All rights reserved. This program and the accompanying materials\r
-; are licensed and made available under the terms and conditions of the BSD License\r
-; which accompanies this distribution.  The full text of the license may be found at\r
-; http://opensource.org/licenses/bsd-license.php\r
-;\r
-; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-;\r
-; Module Name:\r
-;\r
-;   WriteMsr32.Asm\r
-;\r
-; Abstract:\r
-;\r
-;   AsmWriteMsr32 function\r
-;\r
-; Notes:\r
-;\r
-;------------------------------------------------------------------------------\r
-\r
-    .code\r
-\r
-;------------------------------------------------------------------------------\r
-; UINT32\r
-; EFIAPI\r
-; AsmWriteMsr32 (\r
-;   IN UINT32  Index,\r
-;   IN UINT32  Value\r
-;   );\r
-;------------------------------------------------------------------------------\r
-AsmWriteMsr32   PROC\r
-    mov     eax, edx\r
-    xor     edx, edx\r
-    wrmsr\r
-    ret\r
-AsmWriteMsr32   ENDP\r
-\r
-    END\r
index 3337f45891dbac0f7ce7b57b57ae010e6fe4f327..6b8066f922ccef426aa2d188216122bf92582be5 100644 (file)
 ;   );\r
 ;------------------------------------------------------------------------------\r
 AsmWriteMsr64   PROC\r
-    push    rdx\r
-    mov     eax, edx\r
+    mov     rax, rdx\r
     shr     rdx, 20h\r
     wrmsr\r
-    pop     rax\r
     ret\r
 AsmWriteMsr64   ENDP\r
 \r
diff --git a/MdePkg/Library/BaseLib/x86DisablePaging32.c b/MdePkg/Library/BaseLib/x86DisablePaging32.c
new file mode 100644 (file)
index 0000000..417a779
--- /dev/null
@@ -0,0 +1,65 @@
+/** @file\r
+  IA-32/x64 AsmDisablePaging32()\r
+\r
+  Copyright (c) 2006, Intel Corporation<BR>\r
+  All rights reserved. This program and the accompanying materials\r
+  are licensed and made available under the terms and conditions of the BSD License\r
+  which accompanies this distribution.  The full text of the license may be found at\r
+  http://opensource.org/licenses/bsd-license.php\r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+  Module Name:  x86DisablePaging32.c\r
+\r
+**/\r
+\r
+#include "BaseLibInternals.h"\r
+\r
+/**\r
+  Disables the 32-bit paging mode on the CPU.\r
+\r
+  Disables the 32-bit paging mode on the CPU and returns to 32-bit protected\r
+  mode. This function assumes the current execution mode is 32-paged protected\r
+  mode. This function is only available on IA-32. After the 32-bit paging mode\r
+  is disabled, control is transferred to the function specified by EntryPoint\r
+  using the new stack specified by NewStack and passing in the parameters\r
+  specified by Context1 and Context2. Context1 and Context2 are optional and\r
+  may be NULL. The function EntryPoint must never return.\r
+\r
+  If the current execution mode is not 32-bit paged mode, then ASSERT().\r
+  If EntryPoint is NULL, then ASSERT().\r
+  If NewStack is NULL, then ASSERT().\r
+\r
+  There are a number of constraints that must be followed before calling this\r
+  function:\r
+  1)  Interrupts must be disabled.\r
+  2)  The caller must be in 32-bit paged mode.\r
+  3)  CR0, CR3, and CR4 must be compatible with 32-bit paged mode.\r
+  4)  CR3 must point to valid page tables that guarantee that the pages for\r
+      this function and the stack are identity mapped.\r
+\r
+  @param  EntryPoint  A pointer to function to call with the new stack after\r
+                      paging is disabled.\r
+  @param  Context1    A pointer to the context to pass into the EntryPoint\r
+                      function as the first parameter after paging is disabled.\r
+  @param  Context2    A pointer to the context to pass into the EntryPoint\r
+                      function as the second parameter after paging is\r
+                      disabled.\r
+  @param  NewStack    A pointer to the new stack to use for the EntryPoint\r
+                      function after paging is disabled.\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+AsmDisablePaging32 (\r
+  IN      SWITCH_STACK_ENTRY_POINT  EntryPoint,\r
+  IN      VOID                      *Context1,  OPTIONAL\r
+  IN      VOID                      *Context2,  OPTIONAL\r
+  IN      VOID                      *NewStack\r
+  )\r
+{\r
+  ASSERT (EntryPoint != NULL);\r
+  ASSERT (NewStack != NULL);\r
+  InternalX86DisablePaging32 (EntryPoint, Context1, Context2, NewStack);\r
+}\r
diff --git a/MdePkg/Library/BaseLib/x86DisablePaging64.c b/MdePkg/Library/BaseLib/x86DisablePaging64.c
new file mode 100644 (file)
index 0000000..1849652
--- /dev/null
@@ -0,0 +1,62 @@
+/** @file\r
+  IA-32/x64 AsmDisablePaging64()\r
+\r
+  Copyright (c) 2006, Intel Corporation<BR>\r
+  All rights reserved. This program and the accompanying materials\r
+  are licensed and made available under the terms and conditions of the BSD License\r
+  which accompanies this distribution.  The full text of the license may be found at\r
+  http://opensource.org/licenses/bsd-license.php\r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+  Module Name:  x86DisablePaging64.c\r
+\r
+**/\r
+\r
+#include "BaseLibInternals.h"\r
+\r
+/**\r
+  Disables the 64-bit paging mode on the CPU.\r
+\r
+  Disables the 64-bit paging mode on the CPU and returns to 32-bit protected\r
+  mode. This function assumes the current execution mode is 64-paging mode.\r
+  This function is only available on X64. After the 64-bit paging mode is\r
+  disabled, control is transferred to the function specified by EntryPoint\r
+  using the new stack specified by NewStack and passing in the parameters\r
+  specified by Context1 and Context2. Context1 and Context2 are optional and\r
+  may be 0. The function EntryPoint must never return.\r
+\r
+  If the current execution mode is not 64-bit paged mode, then ASSERT().\r
+  If EntryPoint is 0, then ASSERT().\r
+  If NewStack is 0, then ASSERT().\r
+\r
+  @param  Cs          The 16-bit selector to load in the CS before EntryPoint\r
+                      is called. The descriptor in the GDT that this selector\r
+                      references must be setup for 32-bit protected mode.\r
+  @param  EntryPoint  The 64-bit virtual address of the function to call with\r
+                      the new stack after paging is disabled.\r
+  @param  Context1    The 64-bit virtual address of the context to pass into\r
+                      the EntryPoint function as the first parameter after\r
+                      paging is disabled.\r
+  @param  Context2    The 64-bit virtual address of the context to pass into\r
+                      the EntryPoint function as the second parameter after\r
+                      paging is disabled.\r
+  @param  NewStack    The 64-bit virtual address of the new stack to use for\r
+                      the EntryPoint function after paging is disabled.\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+AsmDisablePaging64 (\r
+  IN      UINT16                    Cs,\r
+  IN      UINT32                    EntryPoint,\r
+  IN      UINT32                    Context1,  OPTIONAL\r
+  IN      UINT32                    Context2,  OPTIONAL\r
+  IN      UINT32                    NewStack\r
+  )\r
+{\r
+  ASSERT (EntryPoint != 0);\r
+  ASSERT (NewStack != 0);\r
+  InternalX86DisablePaging64 (Cs, EntryPoint, Context1, Context2, NewStack);\r
+}\r
diff --git a/MdePkg/Library/BaseLib/x86EnablePaging32.c b/MdePkg/Library/BaseLib/x86EnablePaging32.c
new file mode 100644 (file)
index 0000000..f186146
--- /dev/null
@@ -0,0 +1,68 @@
+/** @file\r
+  IA-32/x64 AsmEnablePaging32()\r
+\r
+  Copyright (c) 2006, Intel Corporation<BR>\r
+  All rights reserved. This program and the accompanying materials\r
+  are licensed and made available under the terms and conditions of the BSD License\r
+  which accompanies this distribution.  The full text of the license may be found at\r
+  http://opensource.org/licenses/bsd-license.php\r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+  Module Name:  x86EnablePaging32.c\r
+\r
+**/\r
+\r
+#include "BaseLibInternals.h"\r
+\r
+/**\r
+  Enables the 32-bit paging mode on the CPU.\r
+\r
+  Enables the 32-bit paging mode on the CPU. CR0, CR3, CR4, and the page tables\r
+  must be properly initialized prior to calling this service. This function\r
+  assumes the current execution mode is 32-bit protected mode. This function is\r
+  only available on IA-32. After the 32-bit paging mode is enabled, control is\r
+  transferred to the function specified by EntryPoint using the new stack\r
+  specified by NewStack and passing in the parameters specified by Context1 and\r
+  Context2. Context1 and Context2 are optional and may be NULL. The function\r
+  EntryPoint must never return.\r
+\r
+  If the current execution mode is not 32-bit protected mode, then ASSERT().\r
+  If EntryPoint is NULL, then ASSERT().\r
+  If NewStack is NULL, then ASSERT().\r
+\r
+  There are a number of constraints that must be followed before calling this\r
+  function:\r
+  1)  Interrupts must be disabled.\r
+  2)  The caller must be in 32-bit protected mode with flat descriptors. This\r
+      means all descriptors must have a base of 0 and a limit of 4GB.\r
+  3)  CR0 and CR4 must be compatible with 32-bit protected mode with flat\r
+      descriptors.\r
+  4)  CR3 must point to valid page tables that will be used once the transition\r
+      is complete, and those page tables must guarantee that the pages for this\r
+      function and the stack are identity mapped.\r
+\r
+  @param  EntryPoint  A pointer to function to call with the new stack after\r
+                      paging is enabled.\r
+  @param  Context1    A pointer to the context to pass into the EntryPoint\r
+                      function as the first parameter after paging is enabled.\r
+  @param  Context2    A pointer to the context to pass into the EntryPoint\r
+                      function as the second parameter after paging is enabled.\r
+  @param  NewStack    A pointer to the new stack to use for the EntryPoint\r
+                      function after paging is enabled.\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+AsmEnablePaging32 (\r
+  IN      SWITCH_STACK_ENTRY_POINT  EntryPoint,\r
+  IN      VOID                      *Context1,  OPTIONAL\r
+  IN      VOID                      *Context2,  OPTIONAL\r
+  IN      VOID                      *NewStack\r
+  )\r
+{\r
+  ASSERT (EntryPoint != NULL);\r
+  ASSERT (NewStack != NULL);\r
+  InternalX86EnablePaging32 (EntryPoint, Context1, Context2, NewStack);\r
+}\r
diff --git a/MdePkg/Library/BaseLib/x86EnablePaging64.c b/MdePkg/Library/BaseLib/x86EnablePaging64.c
new file mode 100644 (file)
index 0000000..424568d
--- /dev/null
@@ -0,0 +1,64 @@
+/** @file\r
+  IA-32/x64 AsmEnablePaging64()\r
+\r
+  Copyright (c) 2006, Intel Corporation<BR>\r
+  All rights reserved. This program and the accompanying materials\r
+  are licensed and made available under the terms and conditions of the BSD License\r
+  which accompanies this distribution.  The full text of the license may be found at\r
+  http://opensource.org/licenses/bsd-license.php\r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+  Module Name:  x86EnablePaging64.c\r
+\r
+**/\r
+\r
+#include "BaseLibInternals.h"\r
+\r
+/**\r
+  Enables the 64-bit paging mode on the CPU.\r
+\r
+  Enables the 64-bit paging mode on the CPU. CR0, CR3, CR4, and the page tables\r
+  must be properly initialized prior to calling this service. This function\r
+  assumes the current execution mode is 32-bit protected mode with flat\r
+  descriptors. This function is only available on IA-32. After the 64-bit\r
+  paging mode is enabled, control is transferred to the function specified by\r
+  EntryPoint using the new stack specified by NewStack and passing in the\r
+  parameters specified by Context1 and Context2. Context1 and Context2 are\r
+  optional and may be 0. The function EntryPoint must never return.\r
+\r
+  If the current execution mode is not 32-bit protected mode with flat\r
+  descriptors, then ASSERT().\r
+  If EntryPoint is 0, then ASSERT().\r
+  If NewStack is 0, then ASSERT().\r
+\r
+  @param  Cs          The 16-bit selector to load in the CS before EntryPoint\r
+                      is called. The descriptor in the GDT that this selector\r
+                      references must be setup for long mode.\r
+  @param  EntryPoint  The 64-bit virtual address of the function to call with\r
+                      the new stack after paging is enabled.\r
+  @param  Context1    The 64-bit virtual address of the context to pass into\r
+                      the EntryPoint function as the first parameter after\r
+                      paging is enabled.\r
+  @param  Context2    The 64-bit virtual address of the context to pass into\r
+                      the EntryPoint function as the second parameter after\r
+                      paging is enabled.\r
+  @param  NewStack    The 64-bit virtual address of the new stack to use for\r
+                      the EntryPoint function after paging is enabled.\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+AsmEnablePaging64 (\r
+  IN      UINT16                    Cs,\r
+  IN      UINT64                    EntryPoint,\r
+  IN      UINT64                    Context1,  OPTIONAL\r
+  IN      UINT64                    Context2,  OPTIONAL\r
+  IN      UINT64                    NewStack\r
+  )\r
+{\r
+  ASSERT (EntryPoint != 0);\r
+  ASSERT (NewStack != 0);\r
+  InternalX86EnablePaging64 (Cs, EntryPoint, Context1, Context2, NewStack);\r
+}\r
diff --git a/MdePkg/Library/BaseLib/x86FxRestore.c b/MdePkg/Library/BaseLib/x86FxRestore.c
new file mode 100644 (file)
index 0000000..70a0c24
--- /dev/null
@@ -0,0 +1,48 @@
+/** @file\r
+  IA-32/x64 AsmFxRestore()\r
+\r
+  Copyright (c) 2006, Intel Corporation<BR>\r
+  All rights reserved. This program and the accompanying materials\r
+  are licensed and made available under the terms and conditions of the BSD License\r
+  which accompanies this distribution.  The full text of the license may be found at\r
+  http://opensource.org/licenses/bsd-license.php\r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+  Module Name:  x86FxRestore.c\r
+\r
+**/\r
+\r
+#include "BaseLibInternals.h"\r
+\r
+/**\r
+  Restores the current floating point/SSE/SSE2 context from a buffer.\r
+\r
+  Restores the current floating point/SSE/SSE2 state from the buffer specified\r
+  by Buffer. Buffer must be aligned on a 16-byte boundary. This function is\r
+  only available on IA-32 and X64.\r
+\r
+  If Buffer is NULL, then ASSERT().\r
+  If Buffer is not aligned on a 16-byte boundary, then ASSERT().\r
+  If Buffer was not saved with AsmFxSave(), then ASSERT().\r
+\r
+  @param  Buffer  Pointer to a buffer to save the floating point/SSE/SSE2 context.\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+AsmFxRestore (\r
+  IN CONST IA32_FX_BUFFER  *Buffer\r
+  )\r
+{\r
+  ASSERT (Buffer != NULL);\r
+  ASSERT (((UINTN)Buffer & 0xf) == 0);\r
+\r
+  //\r
+  // Check the flag recorded by AsmFxSave()\r
+  //\r
+  ASSERT (*(UINT32 *) (&Buffer[sizeof (IA32_FX_BUFFER) - 4]) == 0xAA5555AA);\r
+\r
+  InternalX86FxRestore (Buffer);\r
+}\r
diff --git a/MdePkg/Library/BaseLib/x86FxSave.c b/MdePkg/Library/BaseLib/x86FxSave.c
new file mode 100644 (file)
index 0000000..18c3291
--- /dev/null
@@ -0,0 +1,47 @@
+/** @file\r
+  IA-32/x64 AsmFxSave()\r
+\r
+  Copyright (c) 2006, Intel Corporation<BR>\r
+  All rights reserved. This program and the accompanying materials\r
+  are licensed and made available under the terms and conditions of the BSD License\r
+  which accompanies this distribution.  The full text of the license may be found at\r
+  http://opensource.org/licenses/bsd-license.php\r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+  Module Name:  x86FxSave.c\r
+\r
+**/\r
+\r
+#include "BaseLibInternals.h"\r
+\r
+/**\r
+  Save the current floating point/SSE/SSE2 context to a buffer.\r
+\r
+  Saves the current floating point/SSE/SSE2 state to the buffer specified by\r
+  Buffer. Buffer must be aligned on a 16-byte boundary. This function is only\r
+  available on IA-32 and X64.\r
+\r
+  If Buffer is NULL, then ASSERT().\r
+  If Buffer is not aligned on a 16-byte boundary, then ASSERT().\r
+\r
+  @param  Buffer  Pointer to a buffer to save the floating point/SSE/SSE2 context.\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+AsmFxSave (\r
+  OUT     IA32_FX_BUFFER            *Buffer\r
+  )\r
+{\r
+  ASSERT (Buffer != NULL);\r
+  ASSERT (((UINTN)Buffer & 0xf) == 0);\r
+\r
+  InternalX86FxSave (Buffer);\r
+\r
+  //\r
+  // Mark one flag at end of Buffer, it will be check by AsmFxRestor()\r
+  //\r
+  *(UINT32 *) (&Buffer[sizeof (IA32_FX_BUFFER) - 4]) = 0xAA5555AA;\r
+}\r
diff --git a/MdePkg/Library/BaseLib/x86GetInterruptState.c b/MdePkg/Library/BaseLib/x86GetInterruptState.c
new file mode 100644 (file)
index 0000000..2e06efb
--- /dev/null
@@ -0,0 +1,39 @@
+/** @file\r
+  IA-32/x64 GetInterruptState()\r
+\r
+  Copyright (c) 2006, Intel Corporation<BR>\r
+  All rights reserved. This program and the accompanying materials\r
+  are licensed and made available under the terms and conditions of the BSD License\r
+  which accompanies this distribution.  The full text of the license may be found at\r
+  http://opensource.org/licenses/bsd-license.php\r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+  Module Name:  x86GetInterruptState.c\r
+\r
+**/\r
+\r
+/**\r
+  Retrieves the current CPU interrupt state.\r
+\r
+  Retrieves the current CPU interrupt state. Returns TRUE is interrupts are\r
+  currently enabled. Otherwise returns FALSE.\r
+\r
+  @retval TRUE  CPU interrupts are enabled.\r
+  @retval FALSE CPU interrupts are disabled.\r
+\r
+**/\r
+BOOLEAN\r
+EFIAPI\r
+GetInterruptState (\r
+  VOID\r
+  )\r
+{\r
+  IA32_EFLAGS32                     EFlags;\r
+\r
+  EFlags.UintN = AsmReadEflags ();\r
+  return (BOOLEAN)(EFlags.Bits.IF == 1);\r
+}\r
+\r
+\r
diff --git a/MdePkg/Library/BaseLib/x86LowLevel.c b/MdePkg/Library/BaseLib/x86LowLevel.c
deleted file mode 100644 (file)
index 2819304..0000000
+++ /dev/null
@@ -1,992 +0,0 @@
-/** @file\r
-  IA-32/x64 specific functions.\r
-\r
-  Copyright (c) 2006, Intel Corporation<BR>\r
-  All rights reserved. This program and the accompanying materials\r
-  are licensed and made available under the terms and conditions of the BSD License\r
-  which accompanies this distribution.  The full text of the license may be found at\r
-  http://opensource.org/licenses/bsd-license.php\r
-\r
-  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-\r
-  Module Name:  x86LowLevel.c\r
-\r
-**/\r
-\r
-#include "BaseLibInternals.h"\r
-\r
-//\r
-// Bit-wise MSR operations\r
-//\r
-\r
-/**\r
-  Reads a 64-bit MSR, performs a bitwise inclusive OR on the lower 32-bits, and\r
-  writes the result back to the 64-bit MSR.\r
-\r
-  Reads the 64-bit MSR specified by Index, performs a bitwise inclusive OR\r
-  between the lower 32-bits of the read result and the value specified by\r
-  OrData, and writes the result to the 64-bit MSR specified by Index. The lower\r
-  32-bits of the value written to the MSR is returned. No parameter checking is\r
-  performed on Index or OrData, and some of these may cause CPU exceptions. The\r
-  caller must either guarantee that Index and OrData are valid, or the caller\r
-  must establish proper exception handlers. This function is only available on\r
-  IA-32 and X64.\r
-\r
-  @param  Index   The 32-bit MSR index to write.\r
-  @param  OrData  The value to OR with the read value from the MSR.\r
-\r
-  @return The lower 32-bit value written to the MSR.\r
-\r
-**/\r
-UINT32\r
-EFIAPI\r
-AsmMsrOr32 (\r
-  IN      UINT32                    Index,\r
-  IN      UINT32                    OrData\r
-  )\r
-{\r
-  return (UINT32)AsmMsrOr64 (Index, OrData);\r
-}\r
-\r
-/**\r
-  Reads a 64-bit MSR, performs a bitwise AND on the lower 32-bits, and writes\r
-  the result back to the 64-bit MSR.\r
-\r
-  Reads the 64-bit MSR specified by Index, performs a bitwise AND between the\r
-  lower 32-bits of the read result and the value specified by AndData, and\r
-  writes the result to the 64-bit MSR specified by Index. The lower 32-bits of\r
-  the value written to the MSR is returned. No parameter checking is performed\r
-  on Index or AndData, and some of these may cause CPU exceptions. The caller\r
-  must either guarantee that Index and AndData are valid, or the caller must\r
-  establish proper exception handlers. This function is only available on IA-32\r
-  and X64.\r
-\r
-  @param  Index   The 32-bit MSR index to write.\r
-  @param  AndData The value to AND with the read value from the MSR.\r
-\r
-  @return The lower 32-bit value written to the MSR.\r
-\r
-**/\r
-UINT32\r
-EFIAPI\r
-AsmMsrAnd32 (\r
-  IN      UINT32                    Index,\r
-  IN      UINT32                    AndData\r
-  )\r
-{\r
-  return (UINT32)AsmMsrAnd64 (Index, AndData);\r
-}\r
-\r
-/**\r
-  Reads a 64-bit MSR, performs a bitwise AND followed by a bitwise inclusive OR\r
-  on the lower 32-bits, and writes the result back to the 64-bit MSR.\r
-\r
-  Reads the 64-bit MSR specified by Index, performs a bitwise AND between the\r
-  lower 32-bits of the read result and the value specified by AndData\r
-  preserving the upper 32-bits, performs a bitwise inclusive OR between the\r
-  result of the AND operation and the value specified by OrData, and writes the\r
-  result to the 64-bit MSR specified by Address. The lower 32-bits of the value\r
-  written to the MSR is returned. No parameter checking is performed on Index,\r
-  AndData, or OrData, and some of these may cause CPU exceptions. The caller\r
-  must either guarantee that Index, AndData, and OrData are valid, or the\r
-  caller must establish proper exception handlers. This function is only\r
-  available on IA-32 and X64.\r
-\r
-  @param  Index   The 32-bit MSR index to write.\r
-  @param  AndData The value to AND with the read value from the MSR.\r
-  @param  OrData  The value to OR with the result of the AND operation.\r
-\r
-  @return The lower 32-bit value written to the MSR.\r
-\r
-**/\r
-UINT32\r
-EFIAPI\r
-AsmMsrAndThenOr32 (\r
-  IN      UINT32                    Index,\r
-  IN      UINT32                    AndData,\r
-  IN      UINT32                    OrData\r
-  )\r
-{\r
-  return (UINT32)AsmMsrAndThenOr64 (Index, AndData, OrData);\r
-}\r
-\r
-/**\r
-  Reads a bit field of an MSR.\r
-\r
-  Reads the bit field in the lower 32-bits of a 64-bit MSR. The bit field is\r
-  specified by the StartBit and the EndBit. The value of the bit field is\r
-  returned. The caller must either guarantee that Index is valid, or the caller\r
-  must set up exception handlers to catch the exceptions. This function is only\r
-  available on IA-32 and X64.\r
-\r
-  If StartBit is greater than 31, then ASSERT().\r
-  If EndBit is greater than 31, then ASSERT().\r
-  If EndBit is less than StartBit, then ASSERT().\r
-\r
-  @param  Index     The 32-bit MSR index to read.\r
-  @param  StartBit  The ordinal of the least significant bit in the bit field.\r
-                    Range 0..31.\r
-  @param  EndBit    The ordinal of the most significant bit in the bit field.\r
-                    Range 0..31.\r
-\r
-  @return The bit field read from the MSR.\r
-\r
-**/\r
-UINT32\r
-EFIAPI\r
-AsmMsrBitFieldRead32 (\r
-  IN      UINT32                    Index,\r
-  IN      UINTN                     StartBit,\r
-  IN      UINTN                     EndBit\r
-  )\r
-{\r
-  return BitFieldRead32 (AsmReadMsr32 (Index), StartBit, EndBit);\r
-}\r
-\r
-/**\r
-  Writes a bit field to an MSR.\r
-\r
-  Writes Value to a bit field in the lower 32-bits of a  64-bit MSR. The bit\r
-  field is specified by the StartBit and the EndBit. All other bits in the\r
-  destination MSR are preserved. The lower 32-bits of the MSR written is\r
-  returned. Extra left bits in Value are stripped. The caller must either\r
-  guarantee that Index and the data written is valid, or the caller must set up\r
-  exception handlers to catch the exceptions. This function is only available\r
-  on IA-32 and X64.\r
-\r
-  If StartBit is greater than 31, then ASSERT().\r
-  If EndBit is greater than 31, then ASSERT().\r
-  If EndBit is less than StartBit, then ASSERT().\r
-\r
-  @param  Index     The 32-bit MSR index to write.\r
-  @param  StartBit  The ordinal of the least significant bit in the bit field.\r
-                    Range 0..31.\r
-  @param  EndBit    The ordinal of the most significant bit in the bit field.\r
-                    Range 0..31.\r
-  @param  Value     New value of the bit field.\r
-\r
-  @return The lower 32-bit of the value written to the MSR.\r
-\r
-**/\r
-UINT32\r
-EFIAPI\r
-AsmMsrBitFieldWrite32 (\r
-  IN      UINT32                    Index,\r
-  IN      UINTN                     StartBit,\r
-  IN      UINTN                     EndBit,\r
-  IN      UINT32                    Value\r
-  )\r
-{\r
-  ASSERT (EndBit < sizeof (Value) * 8);\r
-  ASSERT (StartBit <= EndBit);\r
-  return (UINT32)AsmMsrBitFieldWrite64 (Index, StartBit, EndBit, Value);\r
-}\r
-\r
-/**\r
-  Reads a bit field in a 64-bit MSR, performs a bitwise OR, and writes the\r
-  result back to the bit field in the 64-bit MSR.\r
-\r
-  Reads the 64-bit MSR specified by Index, performs a bitwise inclusive OR\r
-  between the read result and the value specified by OrData, and writes the\r
-  result to the 64-bit MSR specified by Index. The lower 32-bits of the value\r
-  written to the MSR are returned. Extra left bits in OrData are stripped. The\r
-  caller must either guarantee that Index and the data written is valid, or\r
-  the caller must set up exception handlers to catch the exceptions. This\r
-  function is only available on IA-32 and X64.\r
-\r
-  If StartBit is greater than 31, then ASSERT().\r
-  If EndBit is greater than 31, then ASSERT().\r
-  If EndBit is less than StartBit, then ASSERT().\r
-\r
-  @param  Index     The 32-bit MSR index to write.\r
-  @param  StartBit  The ordinal of the least significant bit in the bit field.\r
-                    Range 0..31.\r
-  @param  EndBit    The ordinal of the most significant bit in the bit field.\r
-                    Range 0..31.\r
-  @param  OrData    The value to OR with the read value from the MSR.\r
-\r
-  @return The lower 32-bit of the value written to the MSR.\r
-\r
-**/\r
-UINT32\r
-EFIAPI\r
-AsmMsrBitFieldOr32 (\r
-  IN      UINT32                    Index,\r
-  IN      UINTN                     StartBit,\r
-  IN      UINTN                     EndBit,\r
-  IN      UINT32                    OrData\r
-  )\r
-{\r
-  ASSERT (EndBit < sizeof (OrData) * 8);\r
-  ASSERT (StartBit <= EndBit);\r
-  return (UINT32)AsmMsrBitFieldOr64 (Index, StartBit, EndBit, OrData);\r
-}\r
-\r
-/**\r
-  Reads a bit field in a 64-bit MSR, performs a bitwise AND, and writes the\r
-  result back to the bit field in the 64-bit MSR.\r
-\r
-  Reads the 64-bit MSR specified by Index, performs a bitwise AND between the\r
-  read result and the value specified by AndData, and writes the result to the\r
-  64-bit MSR specified by Index. The lower 32-bits of the value written to the\r
-  MSR are returned. Extra left bits in AndData are stripped. The caller must\r
-  either guarantee that Index and the data written is valid, or the caller must\r
-  set up exception handlers to catch the exceptions. This function is only\r
-  available on IA-32 and X64.\r
-\r
-  If StartBit is greater than 31, then ASSERT().\r
-  If EndBit is greater than 31, then ASSERT().\r
-  If EndBit is less than StartBit, then ASSERT().\r
-\r
-  @param  Index     The 32-bit MSR index to write.\r
-  @param  StartBit  The ordinal of the least significant bit in the bit field.\r
-                    Range 0..31.\r
-  @param  EndBit    The ordinal of the most significant bit in the bit field.\r
-                    Range 0..31.\r
-  @param  AndData   The value to AND with the read value from the MSR.\r
-\r
-  @return The lower 32-bit of the value written to the MSR.\r
-\r
-**/\r
-UINT32\r
-EFIAPI\r
-AsmMsrBitFieldAnd32 (\r
-  IN      UINT32                    Index,\r
-  IN      UINTN                     StartBit,\r
-  IN      UINTN                     EndBit,\r
-  IN      UINT32                    AndData\r
-  )\r
-{\r
-  ASSERT (EndBit < sizeof (AndData) * 8);\r
-  ASSERT (StartBit <= EndBit);\r
-  return (UINT32)AsmMsrBitFieldAnd64 (Index, StartBit, EndBit, AndData);\r
-}\r
-\r
-/**\r
-  Reads a bit field in a 64-bit MSR, performs a bitwise AND followed by a\r
-  bitwise inclusive OR, and writes the result back to the bit field in the\r
-  64-bit MSR.\r
-\r
-  Reads the 64-bit MSR specified by Index, performs a bitwise AND followed by a\r
-  bitwise inclusive OR between the read result and the value specified by\r
-  AndData, and writes the result to the 64-bit MSR specified by Index. The\r
-  lower 32-bits of the value written to the MSR are returned. Extra left bits\r
-  in both AndData and OrData are stripped. The caller must either guarantee\r
-  that Index and the data written is valid, or the caller must set up exception\r
-  handlers to catch the exceptions. This function is only available on IA-32\r
-  and X64.\r
-\r
-  If StartBit is greater than 31, then ASSERT().\r
-  If EndBit is greater than 31, then ASSERT().\r
-  If EndBit is less than StartBit, then ASSERT().\r
-\r
-  @param  Index     The 32-bit MSR index to write.\r
-  @param  StartBit  The ordinal of the least significant bit in the bit field.\r
-                    Range 0..31.\r
-  @param  EndBit    The ordinal of the most significant bit in the bit field.\r
-                    Range 0..31.\r
-  @param  AndData   The value to AND with the read value from the MSR.\r
-  @param  OrData    The value to OR with the result of the AND operation.\r
-\r
-  @return The lower 32-bit of the value written to the MSR.\r
-\r
-**/\r
-UINT32\r
-EFIAPI\r
-AsmMsrBitFieldAndThenOr32 (\r
-  IN      UINT32                    Index,\r
-  IN      UINTN                     StartBit,\r
-  IN      UINTN                     EndBit,\r
-  IN      UINT32                    AndData,\r
-  IN      UINT32                    OrData\r
-  )\r
-{\r
-  ASSERT (EndBit < sizeof (AndData) * 8);\r
-  ASSERT (StartBit <= EndBit);\r
-  return (UINT32)AsmMsrBitFieldAndThenOr64 (\r
-                   Index,\r
-                   StartBit,\r
-                   EndBit,\r
-                   AndData,\r
-                   OrData\r
-                   );\r
-}\r
-\r
-/**\r
-  Reads a 64-bit MSR, performs a bitwise inclusive OR, and writes the result\r
-  back to the 64-bit MSR.\r
-\r
-  Reads the 64-bit MSR specified by Index, performs a bitwise inclusive OR\r
-  between the read result and the value specified by OrData, and writes the\r
-  result to the 64-bit MSR specified by Index. The value written to the MSR is\r
-  returned. No parameter checking is performed on Index or OrData, and some of\r
-  these may cause CPU exceptions. The caller must either guarantee that Index\r
-  and OrData are valid, or the caller must establish proper exception handlers.\r
-  This function is only available on IA-32 and X64.\r
-\r
-  @param  Index   The 32-bit MSR index to write.\r
-  @param  OrData  The value to OR with the read value from the MSR.\r
-\r
-  @return The value written back to the MSR.\r
-\r
-**/\r
-UINT64\r
-EFIAPI\r
-AsmMsrOr64 (\r
-  IN      UINT32                    Index,\r
-  IN      UINT64                    OrData\r
-  )\r
-{\r
-  return AsmWriteMsr64 (Index, AsmReadMsr64 (Index) | OrData);\r
-}\r
-\r
-/**\r
-  Reads a 64-bit MSR, performs a bitwise AND, and writes the result back to the\r
-  64-bit MSR.\r
-\r
-  Reads the 64-bit MSR specified by Index, performs a bitwise AND between the\r
-  read result and the value specified by OrData, and writes the result to the\r
-  64-bit MSR specified by Index. The value written to the MSR is returned. No\r
-  parameter checking is performed on Index or OrData, and some of these may\r
-  cause CPU exceptions. The caller must either guarantee that Index and OrData\r
-  are valid, or the caller must establish proper exception handlers. This\r
-  function is only available on IA-32 and X64.\r
-\r
-  @param  Index   The 32-bit MSR index to write.\r
-  @param  AndData The value to AND with the read value from the MSR.\r
-\r
-  @return The value written back to the MSR.\r
-\r
-**/\r
-UINT64\r
-EFIAPI\r
-AsmMsrAnd64 (\r
-  IN      UINT32                    Index,\r
-  IN      UINT64                    AndData\r
-  )\r
-{\r
-  return AsmWriteMsr64 (Index, AsmReadMsr64 (Index) & AndData);\r
-}\r
-\r
-/**\r
-  Reads a 64-bit MSR, performs a bitwise AND followed by a bitwise inclusive\r
-  OR, and writes the result back to the 64-bit MSR.\r
-\r
-  Reads the 64-bit MSR specified by Index, performs a bitwise AND between read\r
-  result and the value specified by AndData, performs a bitwise inclusive OR\r
-  between the result of the AND operation and the value specified by OrData,\r
-  and writes the result to the 64-bit MSR specified by Index. The value written\r
-  to the MSR is returned. No parameter checking is performed on Index, AndData,\r
-  or OrData, and some of these may cause CPU exceptions. The caller must either\r
-  guarantee that Index, AndData, and OrData are valid, or the caller must\r
-  establish proper exception handlers. This function is only available on IA-32\r
-  and X64.\r
-\r
-  @param  Index   The 32-bit MSR index to write.\r
-  @param  AndData The value to AND with the read value from the MSR.\r
-  @param  OrData  The value to OR with the result of the AND operation.\r
-\r
-  @return The value written back to the MSR.\r
-\r
-**/\r
-UINT64\r
-EFIAPI\r
-AsmMsrAndThenOr64 (\r
-  IN      UINT32                    Index,\r
-  IN      UINT64                    AndData,\r
-  IN      UINT64                    OrData\r
-  )\r
-{\r
-  return AsmWriteMsr64 (Index, (AsmReadMsr64 (Index) & AndData) | OrData);\r
-}\r
-\r
-/**\r
-  Reads a bit field of an MSR.\r
-\r
-  Reads the bit field in the 64-bit MSR. The bit field is specified by the\r
-  StartBit and the EndBit. The value of the bit field is returned. The caller\r
-  must either guarantee that Index is valid, or the caller must set up\r
-  exception handlers to catch the exceptions. This function is only available\r
-  on IA-32 and X64.\r
-\r
-  If StartBit is greater than 63, then ASSERT().\r
-  If EndBit is greater than 63, then ASSERT().\r
-  If EndBit is less than StartBit, then ASSERT().\r
-\r
-  @param  Index     The 32-bit MSR index to read.\r
-  @param  StartBit  The ordinal of the least significant bit in the bit field.\r
-                    Range 0..63.\r
-  @param  EndBit    The ordinal of the most significant bit in the bit field.\r
-                    Range 0..63.\r
-\r
-  @return The value written back to the MSR.\r
-\r
-**/\r
-UINT64\r
-EFIAPI\r
-AsmMsrBitFieldRead64 (\r
-  IN      UINT32                    Index,\r
-  IN      UINTN                     StartBit,\r
-  IN      UINTN                     EndBit\r
-  )\r
-{\r
-  return BitFieldRead64 (AsmReadMsr64 (Index), StartBit, EndBit);\r
-}\r
-\r
-/**\r
-  Writes a bit field to an MSR.\r
-\r
-  Writes Value to a bit field in a 64-bit MSR. The bit field is specified by\r
-  the StartBit and the EndBit. All other bits in the destination MSR are\r
-  preserved. The MSR written is returned. Extra left bits in Value are\r
-  stripped. The caller must either guarantee that Index and the data written is\r
-  valid, or the caller must set up exception handlers to catch the exceptions.\r
-  This function is only available on IA-32 and X64.\r
-\r
-  If StartBit is greater than 63, then ASSERT().\r
-  If EndBit is greater than 63, then ASSERT().\r
-  If EndBit is less than StartBit, then ASSERT().\r
-\r
-  @param  Index     The 32-bit MSR index to write.\r
-  @param  StartBit  The ordinal of the least significant bit in the bit field.\r
-                    Range 0..63.\r
-  @param  EndBit    The ordinal of the most significant bit in the bit field.\r
-                    Range 0..63.\r
-  @param  Value     New value of the bit field.\r
-\r
-  @return The value written back to the MSR.\r
-\r
-**/\r
-UINT64\r
-EFIAPI\r
-AsmMsrBitFieldWrite64 (\r
-  IN      UINT32                    Index,\r
-  IN      UINTN                     StartBit,\r
-  IN      UINTN                     EndBit,\r
-  IN      UINT64                    Value\r
-  )\r
-{\r
-  return AsmWriteMsr64 (\r
-           Index,\r
-           BitFieldWrite64 (AsmReadMsr64 (Index), StartBit, EndBit, Value)\r
-           );\r
-}\r
-\r
-/**\r
-  Reads a bit field in a 64-bit MSR, performs a bitwise inclusive OR, and\r
-  writes the result back to the bit field in the 64-bit MSR.\r
-\r
-  Reads the 64-bit MSR specified by Index, performs a bitwise inclusive OR\r
-  between the read result and the value specified by OrData, and writes the\r
-  result to the 64-bit MSR specified by Index. The value written to the MSR is\r
-  returned. Extra left bits in OrData are stripped. The caller must either\r
-  guarantee that Index and the data written is valid, or the caller must set up\r
-  exception handlers to catch the exceptions. This function is only available\r
-  on IA-32 and X64.\r
-\r
-  If StartBit is greater than 63, then ASSERT().\r
-  If EndBit is greater than 63, then ASSERT().\r
-  If EndBit is less than StartBit, then ASSERT().\r
-\r
-  @param  Index     The 32-bit MSR index to write.\r
-  @param  StartBit  The ordinal of the least significant bit in the bit field.\r
-                    Range 0..63.\r
-  @param  EndBit    The ordinal of the most significant bit in the bit field.\r
-                    Range 0..63.\r
-  @param  OrData    The value to OR with the read value from the bit field.\r
-\r
-  @return The value written back to the MSR.\r
-\r
-**/\r
-UINT64\r
-EFIAPI\r
-AsmMsrBitFieldOr64 (\r
-  IN      UINT32                    Index,\r
-  IN      UINTN                     StartBit,\r
-  IN      UINTN                     EndBit,\r
-  IN      UINT64                    OrData\r
-  )\r
-{\r
-  return AsmWriteMsr64 (\r
-           Index,\r
-           BitFieldOr64 (AsmReadMsr64 (Index), StartBit, EndBit, OrData)\r
-           );\r
-}\r
-\r
-/**\r
-  Reads a bit field in a 64-bit MSR, performs a bitwise AND, and writes the\r
-  result back to the bit field in the 64-bit MSR.\r
-\r
-  Reads the 64-bit MSR specified by Index, performs a bitwise AND between the\r
-  read result and the value specified by AndData, and writes the result to the\r
-  64-bit MSR specified by Index. The value written to the MSR is returned.\r
-  Extra left bits in AndData are stripped. The caller must either guarantee\r
-  that Index and the data written is valid, or the caller must set up exception\r
-  handlers to catch the exceptions. This function is only available on IA-32\r
-  and X64.\r
-\r
-  If StartBit is greater than 63, then ASSERT().\r
-  If EndBit is greater than 63, then ASSERT().\r
-  If EndBit is less than StartBit, then ASSERT().\r
-\r
-  @param  Index     The 32-bit MSR index to write.\r
-  @param  StartBit  The ordinal of the least significant bit in the bit field.\r
-                    Range 0..63.\r
-  @param  EndBit    The ordinal of the most significant bit in the bit field.\r
-                    Range 0..63.\r
-  @param  AndData   The value to AND with the read value from the bit field.\r
-\r
-  @return The value written back to the MSR.\r
-\r
-**/\r
-UINT64\r
-EFIAPI\r
-AsmMsrBitFieldAnd64 (\r
-  IN      UINT32                    Index,\r
-  IN      UINTN                     StartBit,\r
-  IN      UINTN                     EndBit,\r
-  IN      UINT64                    AndData\r
-  )\r
-{\r
-  return AsmWriteMsr64 (\r
-           Index,\r
-           BitFieldAnd64 (AsmReadMsr64 (Index), StartBit, EndBit, AndData)\r
-           );\r
-}\r
-\r
-/**\r
-  Reads a bit field in a 64-bit MSR, performs a bitwise AND followed by a\r
-  bitwise inclusive OR, and writes the result back to the bit field in the\r
-  64-bit MSR.\r
-\r
-  Reads the 64-bit MSR specified by Index, performs a bitwise AND followed by\r
-  a bitwise inclusive OR between the read result and the value specified by\r
-  AndData, and writes the result to the 64-bit MSR specified by Index. The\r
-  value written to the MSR is returned. Extra left bits in both AndData and\r
-  OrData are stripped. The caller must either guarantee that Index and the data\r
-  written is valid, or the caller must set up exception handlers to catch the\r
-  exceptions. This function is only available on IA-32 and X64.\r
-\r
-  If StartBit is greater than 63, then ASSERT().\r
-  If EndBit is greater than 63, then ASSERT().\r
-  If EndBit is less than StartBit, then ASSERT().\r
-\r
-  @param  Index     The 32-bit MSR index to write.\r
-  @param  StartBit  The ordinal of the least significant bit in the bit field.\r
-                    Range 0..63.\r
-  @param  EndBit    The ordinal of the most significant bit in the bit field.\r
-                    Range 0..63.\r
-  @param  AndData   The value to AND with the read value from the bit field.\r
-  @param  OrData    The value to OR with the result of the AND operation.\r
-\r
-  @return The value written back to the MSR.\r
-\r
-**/\r
-UINT64\r
-EFIAPI\r
-AsmMsrBitFieldAndThenOr64 (\r
-  IN      UINT32                    Index,\r
-  IN      UINTN                     StartBit,\r
-  IN      UINTN                     EndBit,\r
-  IN      UINT64                    AndData,\r
-  IN      UINT64                    OrData\r
-  )\r
-{\r
-  return AsmWriteMsr64 (\r
-           Index,\r
-           BitFieldAndThenOr64 (\r
-             AsmReadMsr64 (Index),\r
-             StartBit,\r
-             EndBit,\r
-             AndData,\r
-             OrData\r
-             )\r
-           );\r
-}\r
-\r
-//\r
-// Base Library CPU Functions\r
-//\r
-\r
-/**\r
-  Retrieves the current CPU interrupt state.\r
-\r
-  Retrieves the current CPU interrupt state. Returns TRUE is interrupts are\r
-  currently enabled. Otherwise returns FALSE.\r
-\r
-  @retval TRUE  CPU interrupts are enabled.\r
-  @retval FALSE CPU interrupts are disabled.\r
-\r
-**/\r
-BOOLEAN\r
-EFIAPI\r
-GetInterruptState (\r
-  VOID\r
-  )\r
-{\r
-  IA32_EFLAGS32                     EFlags;\r
-\r
-  EFlags.UintN = AsmReadEflags ();\r
-  return (BOOLEAN)(EFlags.Bits.IF == 1);\r
-}\r
-\r
-//\r
-// Ia32 and x64 specific functions\r
-//\r
-\r
-/**\r
-  Reads the current Global Descriptor Table Register(GDTR) descriptor.\r
-\r
-  Reads and returns the current GDTR descriptor and returns it in Gdtr. This\r
-  function is only available on IA-32 and X64.\r
-\r
-  If Gdtr is NULL, then ASSERT().\r
-\r
-  @param  Gdtr  Pointer to a GDTR descriptor.\r
-\r
-**/\r
-VOID\r
-EFIAPI\r
-AsmReadGdtr (\r
-  OUT     IA32_DESCRIPTOR           *Gdtr\r
-  )\r
-{\r
-  ASSERT (Gdtr != NULL);\r
-  InternalX86ReadGdtr (Gdtr);\r
-}\r
-\r
-/**\r
-  Writes the current Global Descriptor Table Register (GDTR) descriptor.\r
-\r
-  Writes and the current GDTR descriptor specified by Gdtr. This function is\r
-  only available on IA-32 and X64.\r
-\r
-  If Gdtr is NULL, then ASSERT().\r
-\r
-  @param  Gdtr  Pointer to a GDTR descriptor.\r
-\r
-**/\r
-VOID\r
-EFIAPI\r
-AsmWriteGdtr (\r
-  IN      CONST IA32_DESCRIPTOR     *Gdtr\r
-  )\r
-{\r
-  ASSERT (Gdtr != NULL);\r
-  InternalX86WriteGdtr (Gdtr);\r
-}\r
-\r
-/**\r
-  Reads the current Interrupt Descriptor Table Register(GDTR) descriptor.\r
-\r
-  Reads and returns the current IDTR descriptor and returns it in Idtr. This\r
-  function is only available on IA-32 and X64.\r
-\r
-  If Idtr is NULL, then ASSERT().\r
-\r
-  @param  Idtr  Pointer to a IDTR descriptor.\r
-\r
-**/\r
-VOID\r
-EFIAPI\r
-AsmReadIdtr (\r
-  OUT     IA32_DESCRIPTOR           *Idtr\r
-  )\r
-{\r
-  ASSERT (Idtr != NULL);\r
-  InternalX86ReadIdtr (Idtr);\r
-}\r
-\r
-/**\r
-  Writes the current Interrupt Descriptor Table Register(GDTR) descriptor.\r
-\r
-  Writes the current IDTR descriptor and returns it in Idtr. This function is\r
-  only available on IA-32 and X64.\r
-\r
-  If Idtr is NULL, then ASSERT().\r
-\r
-  @param  Idtr  Pointer to a IDTR descriptor.\r
-\r
-**/\r
-VOID\r
-EFIAPI\r
-AsmWriteIdtr (\r
-  IN      CONST IA32_DESCRIPTOR     *Idtr\r
-  )\r
-{\r
-  ASSERT (Idtr != NULL);\r
-  InternalX86WriteIdtr (Idtr);\r
-}\r
-\r
-/**\r
-  Save the current floating point/SSE/SSE2 context to a buffer.\r
-\r
-  Saves the current floating point/SSE/SSE2 state to the buffer specified by\r
-  Buffer. Buffer must be aligned on a 16-byte boundary. This function is only\r
-  available on IA-32 and X64.\r
-\r
-  If Buffer is NULL, then ASSERT().\r
-  If Buffer is not aligned on a 16-byte boundary, then ASSERT().\r
-\r
-  @param  Buffer  Pointer to a buffer to save the floating point/SSE/SSE2 context.\r
-\r
-**/\r
-VOID\r
-EFIAPI\r
-AsmFxSave (\r
-  OUT     IA32_FX_BUFFER            *Buffer\r
-  )\r
-{\r
-  ASSERT (Buffer != NULL);\r
-  ASSERT (((UINTN)Buffer & 0xf) == 0);\r
-\r
-  InternalX86FxSave (Buffer);\r
-  \r
-  //\r
-  // Mark one flag at end of Buffer, it will be check by AsmFxRestor()\r
-  //\r
-  *(UINT32 *) (&Buffer[sizeof (IA32_FX_BUFFER) - 4]) = 0xAA5555AA; \r
-}\r
-\r
-/**\r
-  Restores the current floating point/SSE/SSE2 context from a buffer.\r
-\r
-  Restores the current floating point/SSE/SSE2 state from the buffer specified\r
-  by Buffer. Buffer must be aligned on a 16-byte boundary. This function is\r
-  only available on IA-32 and X64.\r
-\r
-  If Buffer is NULL, then ASSERT().\r
-  If Buffer is not aligned on a 16-byte boundary, then ASSERT().\r
-  If Buffer was not saved with AsmFxSave(), then ASSERT().\r
-\r
-  @param  Buffer  Pointer to a buffer to save the floating point/SSE/SSE2 context.\r
-\r
-**/\r
-VOID\r
-EFIAPI\r
-AsmFxRestore (\r
-  IN CONST IA32_FX_BUFFER  *Buffer\r
-  )\r
-{\r
-  ASSERT (Buffer != NULL);\r
-  ASSERT (((UINTN)Buffer & 0xf) == 0);\r
-\r
-  //\r
-  // Check the flag recorded by AsmFxSave()\r
-  //\r
-  ASSERT (*(UINT32 *) (&Buffer[sizeof (IA32_FX_BUFFER) - 4]) == 0xAA5555AA);\r
-\r
-  InternalX86FxRestore (Buffer);\r
-}\r
-\r
-/**\r
-  Enables the 32-bit paging mode on the CPU.\r
-\r
-  Enables the 32-bit paging mode on the CPU. CR0, CR3, CR4, and the page tables\r
-  must be properly initialized prior to calling this service. This function\r
-  assumes the current execution mode is 32-bit protected mode. This function is\r
-  only available on IA-32. After the 32-bit paging mode is enabled, control is\r
-  transferred to the function specified by EntryPoint using the new stack\r
-  specified by NewStack and passing in the parameters specified by Context1 and\r
-  Context2. Context1 and Context2 are optional and may be NULL. The function\r
-  EntryPoint must never return.\r
-\r
-  If the current execution mode is not 32-bit protected mode, then ASSERT().\r
-  If EntryPoint is NULL, then ASSERT().\r
-  If NewStack is NULL, then ASSERT().\r
-\r
-  There are a number of constraints that must be followed before calling this\r
-  function:\r
-  1)  Interrupts must be disabled.\r
-  2)  The caller must be in 32-bit protected mode with flat descriptors. This\r
-      means all descriptors must have a base of 0 and a limit of 4GB.\r
-  3)  CR0 and CR4 must be compatible with 32-bit protected mode with flat\r
-      descriptors.\r
-  4)  CR3 must point to valid page tables that will be used once the transition\r
-      is complete, and those page tables must guarantee that the pages for this\r
-      function and the stack are identity mapped.\r
-\r
-  @param  EntryPoint  A pointer to function to call with the new stack after\r
-                      paging is enabled.\r
-  @param  Context1    A pointer to the context to pass into the EntryPoint\r
-                      function as the first parameter after paging is enabled.\r
-  @param  Context2    A pointer to the context to pass into the EntryPoint\r
-                      function as the second parameter after paging is enabled.\r
-  @param  NewStack    A pointer to the new stack to use for the EntryPoint\r
-                      function after paging is enabled.\r
-\r
-**/\r
-VOID\r
-EFIAPI\r
-AsmEnablePaging32 (\r
-  IN      SWITCH_STACK_ENTRY_POINT  EntryPoint,\r
-  IN      VOID                      *Context1,  OPTIONAL\r
-  IN      VOID                      *Context2,  OPTIONAL\r
-  IN      VOID                      *NewStack\r
-  )\r
-{\r
-  ASSERT (EntryPoint != NULL);\r
-  ASSERT (NewStack != NULL);\r
-  InternalX86EnablePaging32 (EntryPoint, Context1, Context2, NewStack);\r
-}\r
-\r
-/**\r
-  Disables the 32-bit paging mode on the CPU.\r
-\r
-  Disables the 32-bit paging mode on the CPU and returns to 32-bit protected\r
-  mode. This function assumes the current execution mode is 32-paged protected\r
-  mode. This function is only available on IA-32. After the 32-bit paging mode\r
-  is disabled, control is transferred to the function specified by EntryPoint\r
-  using the new stack specified by NewStack and passing in the parameters\r
-  specified by Context1 and Context2. Context1 and Context2 are optional and\r
-  may be NULL. The function EntryPoint must never return.\r
-\r
-  If the current execution mode is not 32-bit paged mode, then ASSERT().\r
-  If EntryPoint is NULL, then ASSERT().\r
-  If NewStack is NULL, then ASSERT().\r
-\r
-  There are a number of constraints that must be followed before calling this\r
-  function:\r
-  1)  Interrupts must be disabled.\r
-  2)  The caller must be in 32-bit paged mode.\r
-  3)  CR0, CR3, and CR4 must be compatible with 32-bit paged mode.\r
-  4)  CR3 must point to valid page tables that guarantee that the pages for\r
-      this function and the stack are identity mapped.\r
-\r
-  @param  EntryPoint  A pointer to function to call with the new stack after\r
-                      paging is disabled.\r
-  @param  Context1    A pointer to the context to pass into the EntryPoint\r
-                      function as the first parameter after paging is disabled.\r
-  @param  Context2    A pointer to the context to pass into the EntryPoint\r
-                      function as the second parameter after paging is\r
-                      disabled.\r
-  @param  NewStack    A pointer to the new stack to use for the EntryPoint\r
-                      function after paging is disabled.\r
-\r
-**/\r
-VOID\r
-EFIAPI\r
-AsmDisablePaging32 (\r
-  IN      SWITCH_STACK_ENTRY_POINT  EntryPoint,\r
-  IN      VOID                      *Context1,  OPTIONAL\r
-  IN      VOID                      *Context2,  OPTIONAL\r
-  IN      VOID                      *NewStack\r
-  )\r
-{\r
-  ASSERT (EntryPoint != NULL);\r
-  ASSERT (NewStack != NULL);\r
-  InternalX86DisablePaging32 (EntryPoint, Context1, Context2, NewStack);\r
-}\r
-\r
-/**\r
-  Enables the 64-bit paging mode on the CPU.\r
-\r
-  Enables the 64-bit paging mode on the CPU. CR0, CR3, CR4, and the page tables\r
-  must be properly initialized prior to calling this service. This function\r
-  assumes the current execution mode is 32-bit protected mode with flat\r
-  descriptors. This function is only available on IA-32. After the 64-bit\r
-  paging mode is enabled, control is transferred to the function specified by\r
-  EntryPoint using the new stack specified by NewStack and passing in the\r
-  parameters specified by Context1 and Context2. Context1 and Context2 are\r
-  optional and may be 0. The function EntryPoint must never return.\r
-\r
-  If the current execution mode is not 32-bit protected mode with flat\r
-  descriptors, then ASSERT().\r
-  If EntryPoint is 0, then ASSERT().\r
-  If NewStack is 0, then ASSERT().\r
-\r
-  @param  Cs          The 16-bit selector to load in the CS before EntryPoint\r
-                      is called. The descriptor in the GDT that this selector\r
-                      references must be setup for long mode.\r
-  @param  EntryPoint  The 64-bit virtual address of the function to call with\r
-                      the new stack after paging is enabled.\r
-  @param  Context1    The 64-bit virtual address of the context to pass into\r
-                      the EntryPoint function as the first parameter after\r
-                      paging is enabled.\r
-  @param  Context2    The 64-bit virtual address of the context to pass into\r
-                      the EntryPoint function as the second parameter after\r
-                      paging is enabled.\r
-  @param  NewStack    The 64-bit virtual address of the new stack to use for\r
-                      the EntryPoint function after paging is enabled.\r
-\r
-**/\r
-VOID\r
-EFIAPI\r
-AsmEnablePaging64 (\r
-  IN      UINT16                    Cs,\r
-  IN      UINT64                    EntryPoint,\r
-  IN      UINT64                    Context1,  OPTIONAL\r
-  IN      UINT64                    Context2,  OPTIONAL\r
-  IN      UINT64                    NewStack\r
-  )\r
-{\r
-  ASSERT (EntryPoint != 0);\r
-  ASSERT (NewStack != 0);\r
-  InternalX86EnablePaging64 (Cs, EntryPoint, Context1, Context2, NewStack);\r
-}\r
-\r
-/**\r
-  Disables the 64-bit paging mode on the CPU.\r
-\r
-  Disables the 64-bit paging mode on the CPU and returns to 32-bit protected\r
-  mode. This function assumes the current execution mode is 64-paging mode.\r
-  This function is only available on X64. After the 64-bit paging mode is\r
-  disabled, control is transferred to the function specified by EntryPoint\r
-  using the new stack specified by NewStack and passing in the parameters\r
-  specified by Context1 and Context2. Context1 and Context2 are optional and\r
-  may be 0. The function EntryPoint must never return.\r
-\r
-  If the current execution mode is not 64-bit paged mode, then ASSERT().\r
-  If EntryPoint is 0, then ASSERT().\r
-  If NewStack is 0, then ASSERT().\r
-\r
-  @param  Cs          The 16-bit selector to load in the CS before EntryPoint\r
-                      is called. The descriptor in the GDT that this selector\r
-                      references must be setup for 32-bit protected mode.\r
-  @param  EntryPoint  The 64-bit virtual address of the function to call with\r
-                      the new stack after paging is disabled.\r
-  @param  Context1    The 64-bit virtual address of the context to pass into\r
-                      the EntryPoint function as the first parameter after\r
-                      paging is disabled.\r
-  @param  Context2    The 64-bit virtual address of the context to pass into\r
-                      the EntryPoint function as the second parameter after\r
-                      paging is disabled.\r
-  @param  NewStack    The 64-bit virtual address of the new stack to use for\r
-                      the EntryPoint function after paging is disabled.\r
-\r
-**/\r
-VOID\r
-EFIAPI\r
-AsmDisablePaging64 (\r
-  IN      UINT16                    Cs,\r
-  IN      UINT32                    EntryPoint,\r
-  IN      UINT32                    Context1,  OPTIONAL\r
-  IN      UINT32                    Context2,  OPTIONAL\r
-  IN      UINT32                    NewStack\r
-  )\r
-{\r
-  ASSERT (EntryPoint != 0);\r
-  ASSERT (NewStack != 0);\r
-  InternalX86DisablePaging64 (Cs, EntryPoint, Context1, Context2, NewStack);\r
-}\r
-\r
-//\r
-// x86 version of MemoryFence()\r
-//\r
-\r
-/**\r
-  Used to serialize load and store operations.\r
-\r
-  All loads and stores that proceed calls to this function are guaranteed to be\r
-  globally visible when this function returns.\r
-\r
-**/\r
-VOID\r
-EFIAPI\r
-MemoryFence (\r
-  VOID\r
-  )\r
-{\r
-  return;\r
-}\r
diff --git a/MdePkg/Library/BaseLib/x86MemoryFence.c b/MdePkg/Library/BaseLib/x86MemoryFence.c
new file mode 100644 (file)
index 0000000..96b1bf2
--- /dev/null
@@ -0,0 +1,31 @@
+/** @file\r
+  IA-32/x64 MemoryFence().\r
+\r
+  Copyright (c) 2006, Intel Corporation<BR>\r
+  All rights reserved. This program and the accompanying materials\r
+  are licensed and made available under the terms and conditions of the BSD License\r
+  which accompanies this distribution.  The full text of the license may be found at\r
+  http://opensource.org/licenses/bsd-license.php\r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+  Module Name:  x86MemoryFence.c\r
+\r
+**/\r
+\r
+/**\r
+  Used to serialize load and store operations.\r
+\r
+  All loads and stores that proceed calls to this function are guaranteed to be\r
+  globally visible when this function returns.\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+MemoryFence (\r
+  VOID\r
+  )\r
+{\r
+  return;\r
+}\r
diff --git a/MdePkg/Library/BaseLib/x86Msr.c b/MdePkg/Library/BaseLib/x86Msr.c
new file mode 100644 (file)
index 0000000..aa8e25b
--- /dev/null
@@ -0,0 +1,649 @@
+/** @file\r
+  IA-32/x64 MSR functions.\r
+\r
+  Copyright (c) 2006, Intel Corporation<BR>\r
+  All rights reserved. This program and the accompanying materials\r
+  are licensed and made available under the terms and conditions of the BSD License\r
+  which accompanies this distribution.  The full text of the license may be found at\r
+  http://opensource.org/licenses/bsd-license.php\r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+  Module Name:  x86Msr.c\r
+\r
+**/\r
+\r
+/**\r
+  Returns the lower 32-bits of a Machine Specific Register(MSR).\r
+\r
+  Reads and returns the lower 32-bits of the MSR specified by Index.\r
+  No parameter checking is performed on Index, and some Index values may cause\r
+  CPU exceptions. The caller must either guarantee that Index is valid, or the\r
+  caller must set up exception handlers to catch the exceptions. This function\r
+  is only available on IA-32 and X64.\r
+\r
+  @param  Index The 32-bit MSR index to read.\r
+\r
+  @return The lower 32 bits of the MSR identified by Index.\r
+\r
+**/\r
+UINT32\r
+EFIAPI\r
+AsmReadMsr32 (\r
+  IN      UINT32                    Index\r
+  )\r
+{\r
+  return (UINT32)AsmReadMsr64 (Index);\r
+}\r
+\r
+/**\r
+  Zero-extend a 32-bit value and writes it to a Machine Specific Register(MSR).\r
+\r
+  Writes the 32-bit value specified by Value to the MSR specified by Index. The\r
+  upper 32-bits of the MSR write are set to zero. The 32-bit value written to\r
+  the MSR is returned. No parameter checking is performed on Index or Value,\r
+  and some of these may cause CPU exceptions. The caller must either guarantee\r
+  that Index and Value are valid, or the caller must establish proper exception\r
+  handlers. This function is only available on IA-32 and X64.\r
+\r
+  @param  Index The 32-bit MSR index to write.\r
+  @param  Value The 32-bit value to write to the MSR.\r
+\r
+  @return Value\r
+\r
+**/\r
+UINT32\r
+EFIAPI\r
+AsmWriteMsr32 (\r
+  IN      UINT32                    Index,\r
+  IN      UINT32                    Value\r
+  )\r
+{\r
+  return (UINT32)AsmWriteMsr64 (Index, Value);\r
+}\r
+\r
+/**\r
+  Reads a 64-bit MSR, performs a bitwise inclusive OR on the lower 32-bits, and\r
+  writes the result back to the 64-bit MSR.\r
+\r
+  Reads the 64-bit MSR specified by Index, performs a bitwise inclusive OR\r
+  between the lower 32-bits of the read result and the value specified by\r
+  OrData, and writes the result to the 64-bit MSR specified by Index. The lower\r
+  32-bits of the value written to the MSR is returned. No parameter checking is\r
+  performed on Index or OrData, and some of these may cause CPU exceptions. The\r
+  caller must either guarantee that Index and OrData are valid, or the caller\r
+  must establish proper exception handlers. This function is only available on\r
+  IA-32 and X64.\r
+\r
+  @param  Index   The 32-bit MSR index to write.\r
+  @param  OrData  The value to OR with the read value from the MSR.\r
+\r
+  @return The lower 32-bit value written to the MSR.\r
+\r
+**/\r
+UINT32\r
+EFIAPI\r
+AsmMsrOr32 (\r
+  IN      UINT32                    Index,\r
+  IN      UINT32                    OrData\r
+  )\r
+{\r
+  return (UINT32)AsmMsrOr64 (Index, OrData);\r
+}\r
+\r
+/**\r
+  Reads a 64-bit MSR, performs a bitwise AND on the lower 32-bits, and writes\r
+  the result back to the 64-bit MSR.\r
+\r
+  Reads the 64-bit MSR specified by Index, performs a bitwise AND between the\r
+  lower 32-bits of the read result and the value specified by AndData, and\r
+  writes the result to the 64-bit MSR specified by Index. The lower 32-bits of\r
+  the value written to the MSR is returned. No parameter checking is performed\r
+  on Index or AndData, and some of these may cause CPU exceptions. The caller\r
+  must either guarantee that Index and AndData are valid, or the caller must\r
+  establish proper exception handlers. This function is only available on IA-32\r
+  and X64.\r
+\r
+  @param  Index   The 32-bit MSR index to write.\r
+  @param  AndData The value to AND with the read value from the MSR.\r
+\r
+  @return The lower 32-bit value written to the MSR.\r
+\r
+**/\r
+UINT32\r
+EFIAPI\r
+AsmMsrAnd32 (\r
+  IN      UINT32                    Index,\r
+  IN      UINT32                    AndData\r
+  )\r
+{\r
+  return (UINT32)AsmMsrAnd64 (Index, AndData);\r
+}\r
+\r
+/**\r
+  Reads a 64-bit MSR, performs a bitwise AND followed by a bitwise inclusive OR\r
+  on the lower 32-bits, and writes the result back to the 64-bit MSR.\r
+\r
+  Reads the 64-bit MSR specified by Index, performs a bitwise AND between the\r
+  lower 32-bits of the read result and the value specified by AndData\r
+  preserving the upper 32-bits, performs a bitwise inclusive OR between the\r
+  result of the AND operation and the value specified by OrData, and writes the\r
+  result to the 64-bit MSR specified by Address. The lower 32-bits of the value\r
+  written to the MSR is returned. No parameter checking is performed on Index,\r
+  AndData, or OrData, and some of these may cause CPU exceptions. The caller\r
+  must either guarantee that Index, AndData, and OrData are valid, or the\r
+  caller must establish proper exception handlers. This function is only\r
+  available on IA-32 and X64.\r
+\r
+  @param  Index   The 32-bit MSR index to write.\r
+  @param  AndData The value to AND with the read value from the MSR.\r
+  @param  OrData  The value to OR with the result of the AND operation.\r
+\r
+  @return The lower 32-bit value written to the MSR.\r
+\r
+**/\r
+UINT32\r
+EFIAPI\r
+AsmMsrAndThenOr32 (\r
+  IN      UINT32                    Index,\r
+  IN      UINT32                    AndData,\r
+  IN      UINT32                    OrData\r
+  )\r
+{\r
+  return (UINT32)AsmMsrAndThenOr64 (Index, AndData, OrData);\r
+}\r
+\r
+/**\r
+  Reads a bit field of an MSR.\r
+\r
+  Reads the bit field in the lower 32-bits of a 64-bit MSR. The bit field is\r
+  specified by the StartBit and the EndBit. The value of the bit field is\r
+  returned. The caller must either guarantee that Index is valid, or the caller\r
+  must set up exception handlers to catch the exceptions. This function is only\r
+  available on IA-32 and X64.\r
+\r
+  If StartBit is greater than 31, then ASSERT().\r
+  If EndBit is greater than 31, then ASSERT().\r
+  If EndBit is less than StartBit, then ASSERT().\r
+\r
+  @param  Index     The 32-bit MSR index to read.\r
+  @param  StartBit  The ordinal of the least significant bit in the bit field.\r
+                    Range 0..31.\r
+  @param  EndBit    The ordinal of the most significant bit in the bit field.\r
+                    Range 0..31.\r
+\r
+  @return The bit field read from the MSR.\r
+\r
+**/\r
+UINT32\r
+EFIAPI\r
+AsmMsrBitFieldRead32 (\r
+  IN      UINT32                    Index,\r
+  IN      UINTN                     StartBit,\r
+  IN      UINTN                     EndBit\r
+  )\r
+{\r
+  return BitFieldRead32 (AsmReadMsr32 (Index), StartBit, EndBit);\r
+}\r
+\r
+/**\r
+  Writes a bit field to an MSR.\r
+\r
+  Writes Value to a bit field in the lower 32-bits of a  64-bit MSR. The bit\r
+  field is specified by the StartBit and the EndBit. All other bits in the\r
+  destination MSR are preserved. The lower 32-bits of the MSR written is\r
+  returned. Extra left bits in Value are stripped. The caller must either\r
+  guarantee that Index and the data written is valid, or the caller must set up\r
+  exception handlers to catch the exceptions. This function is only available\r
+  on IA-32 and X64.\r
+\r
+  If StartBit is greater than 31, then ASSERT().\r
+  If EndBit is greater than 31, then ASSERT().\r
+  If EndBit is less than StartBit, then ASSERT().\r
+\r
+  @param  Index     The 32-bit MSR index to write.\r
+  @param  StartBit  The ordinal of the least significant bit in the bit field.\r
+                    Range 0..31.\r
+  @param  EndBit    The ordinal of the most significant bit in the bit field.\r
+                    Range 0..31.\r
+  @param  Value     New value of the bit field.\r
+\r
+  @return The lower 32-bit of the value written to the MSR.\r
+\r
+**/\r
+UINT32\r
+EFIAPI\r
+AsmMsrBitFieldWrite32 (\r
+  IN      UINT32                    Index,\r
+  IN      UINTN                     StartBit,\r
+  IN      UINTN                     EndBit,\r
+  IN      UINT32                    Value\r
+  )\r
+{\r
+  ASSERT (EndBit < sizeof (Value) * 8);\r
+  ASSERT (StartBit <= EndBit);\r
+  return (UINT32)AsmMsrBitFieldWrite64 (Index, StartBit, EndBit, Value);\r
+}\r
+\r
+/**\r
+  Reads a bit field in a 64-bit MSR, performs a bitwise OR, and writes the\r
+  result back to the bit field in the 64-bit MSR.\r
+\r
+  Reads the 64-bit MSR specified by Index, performs a bitwise inclusive OR\r
+  between the read result and the value specified by OrData, and writes the\r
+  result to the 64-bit MSR specified by Index. The lower 32-bits of the value\r
+  written to the MSR are returned. Extra left bits in OrData are stripped. The\r
+  caller must either guarantee that Index and the data written is valid, or\r
+  the caller must set up exception handlers to catch the exceptions. This\r
+  function is only available on IA-32 and X64.\r
+\r
+  If StartBit is greater than 31, then ASSERT().\r
+  If EndBit is greater than 31, then ASSERT().\r
+  If EndBit is less than StartBit, then ASSERT().\r
+\r
+  @param  Index     The 32-bit MSR index to write.\r
+  @param  StartBit  The ordinal of the least significant bit in the bit field.\r
+                    Range 0..31.\r
+  @param  EndBit    The ordinal of the most significant bit in the bit field.\r
+                    Range 0..31.\r
+  @param  OrData    The value to OR with the read value from the MSR.\r
+\r
+  @return The lower 32-bit of the value written to the MSR.\r
+\r
+**/\r
+UINT32\r
+EFIAPI\r
+AsmMsrBitFieldOr32 (\r
+  IN      UINT32                    Index,\r
+  IN      UINTN                     StartBit,\r
+  IN      UINTN                     EndBit,\r
+  IN      UINT32                    OrData\r
+  )\r
+{\r
+  ASSERT (EndBit < sizeof (OrData) * 8);\r
+  ASSERT (StartBit <= EndBit);\r
+  return (UINT32)AsmMsrBitFieldOr64 (Index, StartBit, EndBit, OrData);\r
+}\r
+\r
+/**\r
+  Reads a bit field in a 64-bit MSR, performs a bitwise AND, and writes the\r
+  result back to the bit field in the 64-bit MSR.\r
+\r
+  Reads the 64-bit MSR specified by Index, performs a bitwise AND between the\r
+  read result and the value specified by AndData, and writes the result to the\r
+  64-bit MSR specified by Index. The lower 32-bits of the value written to the\r
+  MSR are returned. Extra left bits in AndData are stripped. The caller must\r
+  either guarantee that Index and the data written is valid, or the caller must\r
+  set up exception handlers to catch the exceptions. This function is only\r
+  available on IA-32 and X64.\r
+\r
+  If StartBit is greater than 31, then ASSERT().\r
+  If EndBit is greater than 31, then ASSERT().\r
+  If EndBit is less than StartBit, then ASSERT().\r
+\r
+  @param  Index     The 32-bit MSR index to write.\r
+  @param  StartBit  The ordinal of the least significant bit in the bit field.\r
+                    Range 0..31.\r
+  @param  EndBit    The ordinal of the most significant bit in the bit field.\r
+                    Range 0..31.\r
+  @param  AndData   The value to AND with the read value from the MSR.\r
+\r
+  @return The lower 32-bit of the value written to the MSR.\r
+\r
+**/\r
+UINT32\r
+EFIAPI\r
+AsmMsrBitFieldAnd32 (\r
+  IN      UINT32                    Index,\r
+  IN      UINTN                     StartBit,\r
+  IN      UINTN                     EndBit,\r
+  IN      UINT32                    AndData\r
+  )\r
+{\r
+  ASSERT (EndBit < sizeof (AndData) * 8);\r
+  ASSERT (StartBit <= EndBit);\r
+  return (UINT32)AsmMsrBitFieldAnd64 (Index, StartBit, EndBit, AndData);\r
+}\r
+\r
+/**\r
+  Reads a bit field in a 64-bit MSR, performs a bitwise AND followed by a\r
+  bitwise inclusive OR, and writes the result back to the bit field in the\r
+  64-bit MSR.\r
+\r
+  Reads the 64-bit MSR specified by Index, performs a bitwise AND followed by a\r
+  bitwise inclusive OR between the read result and the value specified by\r
+  AndData, and writes the result to the 64-bit MSR specified by Index. The\r
+  lower 32-bits of the value written to the MSR are returned. Extra left bits\r
+  in both AndData and OrData are stripped. The caller must either guarantee\r
+  that Index and the data written is valid, or the caller must set up exception\r
+  handlers to catch the exceptions. This function is only available on IA-32\r
+  and X64.\r
+\r
+  If StartBit is greater than 31, then ASSERT().\r
+  If EndBit is greater than 31, then ASSERT().\r
+  If EndBit is less than StartBit, then ASSERT().\r
+\r
+  @param  Index     The 32-bit MSR index to write.\r
+  @param  StartBit  The ordinal of the least significant bit in the bit field.\r
+                    Range 0..31.\r
+  @param  EndBit    The ordinal of the most significant bit in the bit field.\r
+                    Range 0..31.\r
+  @param  AndData   The value to AND with the read value from the MSR.\r
+  @param  OrData    The value to OR with the result of the AND operation.\r
+\r
+  @return The lower 32-bit of the value written to the MSR.\r
+\r
+**/\r
+UINT32\r
+EFIAPI\r
+AsmMsrBitFieldAndThenOr32 (\r
+  IN      UINT32                    Index,\r
+  IN      UINTN                     StartBit,\r
+  IN      UINTN                     EndBit,\r
+  IN      UINT32                    AndData,\r
+  IN      UINT32                    OrData\r
+  )\r
+{\r
+  ASSERT (EndBit < sizeof (AndData) * 8);\r
+  ASSERT (StartBit <= EndBit);\r
+  return (UINT32)AsmMsrBitFieldAndThenOr64 (\r
+                   Index,\r
+                   StartBit,\r
+                   EndBit,\r
+                   AndData,\r
+                   OrData\r
+                   );\r
+}\r
+\r
+/**\r
+  Reads a 64-bit MSR, performs a bitwise inclusive OR, and writes the result\r
+  back to the 64-bit MSR.\r
+\r
+  Reads the 64-bit MSR specified by Index, performs a bitwise inclusive OR\r
+  between the read result and the value specified by OrData, and writes the\r
+  result to the 64-bit MSR specified by Index. The value written to the MSR is\r
+  returned. No parameter checking is performed on Index or OrData, and some of\r
+  these may cause CPU exceptions. The caller must either guarantee that Index\r
+  and OrData are valid, or the caller must establish proper exception handlers.\r
+  This function is only available on IA-32 and X64.\r
+\r
+  @param  Index   The 32-bit MSR index to write.\r
+  @param  OrData  The value to OR with the read value from the MSR.\r
+\r
+  @return The value written back to the MSR.\r
+\r
+**/\r
+UINT64\r
+EFIAPI\r
+AsmMsrOr64 (\r
+  IN      UINT32                    Index,\r
+  IN      UINT64                    OrData\r
+  )\r
+{\r
+  return AsmWriteMsr64 (Index, AsmReadMsr64 (Index) | OrData);\r
+}\r
+\r
+/**\r
+  Reads a 64-bit MSR, performs a bitwise AND, and writes the result back to the\r
+  64-bit MSR.\r
+\r
+  Reads the 64-bit MSR specified by Index, performs a bitwise AND between the\r
+  read result and the value specified by OrData, and writes the result to the\r
+  64-bit MSR specified by Index. The value written to the MSR is returned. No\r
+  parameter checking is performed on Index or OrData, and some of these may\r
+  cause CPU exceptions. The caller must either guarantee that Index and OrData\r
+  are valid, or the caller must establish proper exception handlers. This\r
+  function is only available on IA-32 and X64.\r
+\r
+  @param  Index   The 32-bit MSR index to write.\r
+  @param  AndData The value to AND with the read value from the MSR.\r
+\r
+  @return The value written back to the MSR.\r
+\r
+**/\r
+UINT64\r
+EFIAPI\r
+AsmMsrAnd64 (\r
+  IN      UINT32                    Index,\r
+  IN      UINT64                    AndData\r
+  )\r
+{\r
+  return AsmWriteMsr64 (Index, AsmReadMsr64 (Index) & AndData);\r
+}\r
+\r
+/**\r
+  Reads a 64-bit MSR, performs a bitwise AND followed by a bitwise inclusive\r
+  OR, and writes the result back to the 64-bit MSR.\r
+\r
+  Reads the 64-bit MSR specified by Index, performs a bitwise AND between read\r
+  result and the value specified by AndData, performs a bitwise inclusive OR\r
+  between the result of the AND operation and the value specified by OrData,\r
+  and writes the result to the 64-bit MSR specified by Index. The value written\r
+  to the MSR is returned. No parameter checking is performed on Index, AndData,\r
+  or OrData, and some of these may cause CPU exceptions. The caller must either\r
+  guarantee that Index, AndData, and OrData are valid, or the caller must\r
+  establish proper exception handlers. This function is only available on IA-32\r
+  and X64.\r
+\r
+  @param  Index   The 32-bit MSR index to write.\r
+  @param  AndData The value to AND with the read value from the MSR.\r
+  @param  OrData  The value to OR with the result of the AND operation.\r
+\r
+  @return The value written back to the MSR.\r
+\r
+**/\r
+UINT64\r
+EFIAPI\r
+AsmMsrAndThenOr64 (\r
+  IN      UINT32                    Index,\r
+  IN      UINT64                    AndData,\r
+  IN      UINT64                    OrData\r
+  )\r
+{\r
+  return AsmWriteMsr64 (Index, (AsmReadMsr64 (Index) & AndData) | OrData);\r
+}\r
+\r
+/**\r
+  Reads a bit field of an MSR.\r
+\r
+  Reads the bit field in the 64-bit MSR. The bit field is specified by the\r
+  StartBit and the EndBit. The value of the bit field is returned. The caller\r
+  must either guarantee that Index is valid, or the caller must set up\r
+  exception handlers to catch the exceptions. This function is only available\r
+  on IA-32 and X64.\r
+\r
+  If StartBit is greater than 63, then ASSERT().\r
+  If EndBit is greater than 63, then ASSERT().\r
+  If EndBit is less than StartBit, then ASSERT().\r
+\r
+  @param  Index     The 32-bit MSR index to read.\r
+  @param  StartBit  The ordinal of the least significant bit in the bit field.\r
+                    Range 0..63.\r
+  @param  EndBit    The ordinal of the most significant bit in the bit field.\r
+                    Range 0..63.\r
+\r
+  @return The value written back to the MSR.\r
+\r
+**/\r
+UINT64\r
+EFIAPI\r
+AsmMsrBitFieldRead64 (\r
+  IN      UINT32                    Index,\r
+  IN      UINTN                     StartBit,\r
+  IN      UINTN                     EndBit\r
+  )\r
+{\r
+  return BitFieldRead64 (AsmReadMsr64 (Index), StartBit, EndBit);\r
+}\r
+\r
+/**\r
+  Writes a bit field to an MSR.\r
+\r
+  Writes Value to a bit field in a 64-bit MSR. The bit field is specified by\r
+  the StartBit and the EndBit. All other bits in the destination MSR are\r
+  preserved. The MSR written is returned. Extra left bits in Value are\r
+  stripped. The caller must either guarantee that Index and the data written is\r
+  valid, or the caller must set up exception handlers to catch the exceptions.\r
+  This function is only available on IA-32 and X64.\r
+\r
+  If StartBit is greater than 63, then ASSERT().\r
+  If EndBit is greater than 63, then ASSERT().\r
+  If EndBit is less than StartBit, then ASSERT().\r
+\r
+  @param  Index     The 32-bit MSR index to write.\r
+  @param  StartBit  The ordinal of the least significant bit in the bit field.\r
+                    Range 0..63.\r
+  @param  EndBit    The ordinal of the most significant bit in the bit field.\r
+                    Range 0..63.\r
+  @param  Value     New value of the bit field.\r
+\r
+  @return The value written back to the MSR.\r
+\r
+**/\r
+UINT64\r
+EFIAPI\r
+AsmMsrBitFieldWrite64 (\r
+  IN      UINT32                    Index,\r
+  IN      UINTN                     StartBit,\r
+  IN      UINTN                     EndBit,\r
+  IN      UINT64                    Value\r
+  )\r
+{\r
+  return AsmWriteMsr64 (\r
+           Index,\r
+           BitFieldWrite64 (AsmReadMsr64 (Index), StartBit, EndBit, Value)\r
+           );\r
+}\r
+\r
+/**\r
+  Reads a bit field in a 64-bit MSR, performs a bitwise inclusive OR, and\r
+  writes the result back to the bit field in the 64-bit MSR.\r
+\r
+  Reads the 64-bit MSR specified by Index, performs a bitwise inclusive OR\r
+  between the read result and the value specified by OrData, and writes the\r
+  result to the 64-bit MSR specified by Index. The value written to the MSR is\r
+  returned. Extra left bits in OrData are stripped. The caller must either\r
+  guarantee that Index and the data written is valid, or the caller must set up\r
+  exception handlers to catch the exceptions. This function is only available\r
+  on IA-32 and X64.\r
+\r
+  If StartBit is greater than 63, then ASSERT().\r
+  If EndBit is greater than 63, then ASSERT().\r
+  If EndBit is less than StartBit, then ASSERT().\r
+\r
+  @param  Index     The 32-bit MSR index to write.\r
+  @param  StartBit  The ordinal of the least significant bit in the bit field.\r
+                    Range 0..63.\r
+  @param  EndBit    The ordinal of the most significant bit in the bit field.\r
+                    Range 0..63.\r
+  @param  OrData    The value to OR with the read value from the bit field.\r
+\r
+  @return The value written back to the MSR.\r
+\r
+**/\r
+UINT64\r
+EFIAPI\r
+AsmMsrBitFieldOr64 (\r
+  IN      UINT32                    Index,\r
+  IN      UINTN                     StartBit,\r
+  IN      UINTN                     EndBit,\r
+  IN      UINT64                    OrData\r
+  )\r
+{\r
+  return AsmWriteMsr64 (\r
+           Index,\r
+           BitFieldOr64 (AsmReadMsr64 (Index), StartBit, EndBit, OrData)\r
+           );\r
+}\r
+\r
+/**\r
+  Reads a bit field in a 64-bit MSR, performs a bitwise AND, and writes the\r
+  result back to the bit field in the 64-bit MSR.\r
+\r
+  Reads the 64-bit MSR specified by Index, performs a bitwise AND between the\r
+  read result and the value specified by AndData, and writes the result to the\r
+  64-bit MSR specified by Index. The value written to the MSR is returned.\r
+  Extra left bits in AndData are stripped. The caller must either guarantee\r
+  that Index and the data written is valid, or the caller must set up exception\r
+  handlers to catch the exceptions. This function is only available on IA-32\r
+  and X64.\r
+\r
+  If StartBit is greater than 63, then ASSERT().\r
+  If EndBit is greater than 63, then ASSERT().\r
+  If EndBit is less than StartBit, then ASSERT().\r
+\r
+  @param  Index     The 32-bit MSR index to write.\r
+  @param  StartBit  The ordinal of the least significant bit in the bit field.\r
+                    Range 0..63.\r
+  @param  EndBit    The ordinal of the most significant bit in the bit field.\r
+                    Range 0..63.\r
+  @param  AndData   The value to AND with the read value from the bit field.\r
+\r
+  @return The value written back to the MSR.\r
+\r
+**/\r
+UINT64\r
+EFIAPI\r
+AsmMsrBitFieldAnd64 (\r
+  IN      UINT32                    Index,\r
+  IN      UINTN                     StartBit,\r
+  IN      UINTN                     EndBit,\r
+  IN      UINT64                    AndData\r
+  )\r
+{\r
+  return AsmWriteMsr64 (\r
+           Index,\r
+           BitFieldAnd64 (AsmReadMsr64 (Index), StartBit, EndBit, AndData)\r
+           );\r
+}\r
+\r
+/**\r
+  Reads a bit field in a 64-bit MSR, performs a bitwise AND followed by a\r
+  bitwise inclusive OR, and writes the result back to the bit field in the\r
+  64-bit MSR.\r
+\r
+  Reads the 64-bit MSR specified by Index, performs a bitwise AND followed by\r
+  a bitwise inclusive OR between the read result and the value specified by\r
+  AndData, and writes the result to the 64-bit MSR specified by Index. The\r
+  value written to the MSR is returned. Extra left bits in both AndData and\r
+  OrData are stripped. The caller must either guarantee that Index and the data\r
+  written is valid, or the caller must set up exception handlers to catch the\r
+  exceptions. This function is only available on IA-32 and X64.\r
+\r
+  If StartBit is greater than 63, then ASSERT().\r
+  If EndBit is greater than 63, then ASSERT().\r
+  If EndBit is less than StartBit, then ASSERT().\r
+\r
+  @param  Index     The 32-bit MSR index to write.\r
+  @param  StartBit  The ordinal of the least significant bit in the bit field.\r
+                    Range 0..63.\r
+  @param  EndBit    The ordinal of the most significant bit in the bit field.\r
+                    Range 0..63.\r
+  @param  AndData   The value to AND with the read value from the bit field.\r
+  @param  OrData    The value to OR with the result of the AND operation.\r
+\r
+  @return The value written back to the MSR.\r
+\r
+**/\r
+UINT64\r
+EFIAPI\r
+AsmMsrBitFieldAndThenOr64 (\r
+  IN      UINT32                    Index,\r
+  IN      UINTN                     StartBit,\r
+  IN      UINTN                     EndBit,\r
+  IN      UINT64                    AndData,\r
+  IN      UINT64                    OrData\r
+  )\r
+{\r
+  return AsmWriteMsr64 (\r
+           Index,\r
+           BitFieldAndThenOr64 (\r
+             AsmReadMsr64 (Index),\r
+             StartBit,\r
+             EndBit,\r
+             AndData,\r
+             OrData\r
+             )\r
+           );\r
+}\r
diff --git a/MdePkg/Library/BaseLib/x86ReadGdtr.c b/MdePkg/Library/BaseLib/x86ReadGdtr.c
new file mode 100644 (file)
index 0000000..20d41c0
--- /dev/null
@@ -0,0 +1,38 @@
+/** @file\r
+  IA-32/x64 AsmReadGdtr()\r
+\r
+  Copyright (c) 2006, Intel Corporation<BR>\r
+  All rights reserved. This program and the accompanying materials\r
+  are licensed and made available under the terms and conditions of the BSD License\r
+  which accompanies this distribution.  The full text of the license may be found at\r
+  http://opensource.org/licenses/bsd-license.php\r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+  Module Name:  x86ReadGdtr.c\r
+\r
+**/\r
+\r
+#include "BaseLibInternals.h"\r
+\r
+/**\r
+  Reads the current Global Descriptor Table Register(GDTR) descriptor.\r
+\r
+  Reads and returns the current GDTR descriptor and returns it in Gdtr. This\r
+  function is only available on IA-32 and X64.\r
+\r
+  If Gdtr is NULL, then ASSERT().\r
+\r
+  @param  Gdtr  Pointer to a GDTR descriptor.\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+AsmReadGdtr (\r
+  OUT     IA32_DESCRIPTOR           *Gdtr\r
+  )\r
+{\r
+  ASSERT (Gdtr != NULL);\r
+  InternalX86ReadGdtr (Gdtr);\r
+}\r
diff --git a/MdePkg/Library/BaseLib/x86ReadIdtr.c b/MdePkg/Library/BaseLib/x86ReadIdtr.c
new file mode 100644 (file)
index 0000000..f902b0c
--- /dev/null
@@ -0,0 +1,38 @@
+/** @file\r
+  IA-32/x64 AsmReadIdtr()\r
+\r
+  Copyright (c) 2006, Intel Corporation<BR>\r
+  All rights reserved. This program and the accompanying materials\r
+  are licensed and made available under the terms and conditions of the BSD License\r
+  which accompanies this distribution.  The full text of the license may be found at\r
+  http://opensource.org/licenses/bsd-license.php\r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+  Module Name:  x86ReadIdtr.c\r
+\r
+**/\r
+\r
+#include "BaseLibInternals.h"\r
+\r
+/**\r
+  Reads the current Interrupt Descriptor Table Register(GDTR) descriptor.\r
+\r
+  Reads and returns the current IDTR descriptor and returns it in Idtr. This\r
+  function is only available on IA-32 and X64.\r
+\r
+  If Idtr is NULL, then ASSERT().\r
+\r
+  @param  Idtr  Pointer to a IDTR descriptor.\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+AsmReadIdtr (\r
+  OUT     IA32_DESCRIPTOR           *Idtr\r
+  )\r
+{\r
+  ASSERT (Idtr != NULL);\r
+  InternalX86ReadIdtr (Idtr);\r
+}\r
index 9e69255181fd4a62da0d490fa6a2487524adbb2c..c74962afc70abc1a4193eac973c94d8cc1b178e3 100644 (file)
@@ -58,6 +58,7 @@ extern CONST UINT16                 mTransition;
 \r
 **/\r
 IA32_REGISTER_SET *\r
+EFIAPI\r
 InternalAsmThunk16 (\r
   IN      IA32_REGISTER_SET         *RegisterSet,\r
   IN OUT  VOID                      *Transition\r
diff --git a/MdePkg/Library/BaseLib/x86WriteGdtr.c b/MdePkg/Library/BaseLib/x86WriteGdtr.c
new file mode 100644 (file)
index 0000000..c3df563
--- /dev/null
@@ -0,0 +1,38 @@
+/** @file\r
+  IA-32/x64 AsmWriteGdtr()\r
+\r
+  Copyright (c) 2006, Intel Corporation<BR>\r
+  All rights reserved. This program and the accompanying materials\r
+  are licensed and made available under the terms and conditions of the BSD License\r
+  which accompanies this distribution.  The full text of the license may be found at\r
+  http://opensource.org/licenses/bsd-license.php\r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+  Module Name:  x86GetInterruptState.c\r
+\r
+**/\r
+\r
+#include "BaseLibInternals.h"\r
+\r
+/**\r
+  Writes the current Global Descriptor Table Register (GDTR) descriptor.\r
+\r
+  Writes and the current GDTR descriptor specified by Gdtr. This function is\r
+  only available on IA-32 and X64.\r
+\r
+  If Gdtr is NULL, then ASSERT().\r
+\r
+  @param  Gdtr  Pointer to a GDTR descriptor.\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+AsmWriteGdtr (\r
+  IN      CONST IA32_DESCRIPTOR     *Gdtr\r
+  )\r
+{\r
+  ASSERT (Gdtr != NULL);\r
+  InternalX86WriteGdtr (Gdtr);\r
+}\r
diff --git a/MdePkg/Library/BaseLib/x86WriteIdtr.c b/MdePkg/Library/BaseLib/x86WriteIdtr.c
new file mode 100644 (file)
index 0000000..cfe6758
--- /dev/null
@@ -0,0 +1,38 @@
+/** @file\r
+  IA-32/x64 AsmWriteIdtr()\r
+\r
+  Copyright (c) 2006, Intel Corporation<BR>\r
+  All rights reserved. This program and the accompanying materials\r
+  are licensed and made available under the terms and conditions of the BSD License\r
+  which accompanies this distribution.  The full text of the license may be found at\r
+  http://opensource.org/licenses/bsd-license.php\r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+  Module Name:  x86WriteIdtr.c\r
+\r
+**/\r
+\r
+#include "BaseLibInternals.h"\r
+\r
+/**\r
+  Writes the current Interrupt Descriptor Table Register(GDTR) descriptor.\r
+\r
+  Writes the current IDTR descriptor and returns it in Idtr. This function is\r
+  only available on IA-32 and X64.\r
+\r
+  If Idtr is NULL, then ASSERT().\r
+\r
+  @param  Idtr  Pointer to a IDTR descriptor.\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+AsmWriteIdtr (\r
+  IN      CONST IA32_DESCRIPTOR     *Idtr\r
+  )\r
+{\r
+  ASSERT (Idtr != NULL);\r
+  InternalX86WriteIdtr (Idtr);\r
+}\r