Optimize the size of the Base Library for the MSFT 32-bit tool chains by taking advantage of inline assembly.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1567 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
mdkinney 2006-09-19 19:04:40 +00:00
parent b053781829
commit 23086ba84c
95 changed files with 3115 additions and 94 deletions

View File

@ -100,103 +100,114 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
<Filename SupArchList="IA32">Unaligned.c</Filename>
<Filename SupArchList="IA32">Ia32/Non-existing.c</Filename>
<Filename SupArchList="IA32">Ia32/InternalSwitchStack.c</Filename>
<Filename SupArchList="IA32">Ia32/LShiftU64.asm</Filename>
<Filename SupArchList="IA32">Ia32/RShiftU64.asm</Filename>
<Filename SupArchList="IA32">Ia32/ARShiftU64.asm</Filename>
<Filename SupArchList="IA32">Ia32/LRotU64.asm</Filename>
<Filename SupArchList="IA32">Ia32/RRotU64.asm</Filename>
<Filename SupArchList="IA32">Ia32/MultU64x32.asm</Filename>
<Filename SupArchList="IA32">Ia32/MultU64x64.asm</Filename>
<Filename SupArchList="IA32">Ia32/DivU64x32.asm</Filename>
<Filename SupArchList="IA32">Ia32/ModU64x32.asm</Filename>
<Filename SupArchList="IA32">Ia32/DivU64x32Remainder.asm</Filename>
<Filename SupArchList="IA32">Ia32/DivU64x64Remainder.asm</Filename>
<Filename SupArchList="IA32">Ia32/ARShiftU64.c</Filename>
<Filename SupArchList="IA32">Ia32/CpuBreakpoint.c</Filename>
<Filename SupArchList="IA32">Ia32/CpuFlushTlb.c</Filename>
<Filename SupArchList="IA32">Ia32/CpuSleep.c</Filename>
<Filename SupArchList="IA32">Ia32/CpuId.c</Filename>
<Filename SupArchList="IA32">Ia32/CpuIdEx.c</Filename>
<Filename SupArchList="IA32">Ia32/CpuPause.c</Filename>
<Filename SupArchList="IA32">Ia32/DisableInterrupts.c</Filename>
<Filename SupArchList="IA32">Ia32/DisablePaging32.c</Filename>
<Filename SupArchList="IA32">Ia32/DivU64x32.c</Filename>
<Filename SupArchList="IA32">Ia32/DivU64x32Remainder.c</Filename>
<Filename SupArchList="IA32">Ia32/DivU64x64Remainder.c</Filename>
<Filename SupArchList="IA32">Ia32/DivS64x64Remainder.c</Filename>
<Filename SupArchList="IA32">Ia32/SwapBytes64.asm</Filename>
<Filename SupArchList="IA32">Ia32/SetJump.asm</Filename>
<Filename SupArchList="IA32">Ia32/LongJump.asm</Filename>
<Filename SupArchList="IA32">Ia32/CpuId.asm</Filename>
<Filename SupArchList="IA32">Ia32/CpuIdEx.asm</Filename>
<Filename SupArchList="IA32">Ia32/ReadEflags.asm</Filename>
<Filename SupArchList="IA32">Ia32/ReadMsr64.asm</Filename>
<Filename SupArchList="IA32">Ia32/WriteMsr64.asm</Filename>
<Filename SupArchList="IA32">Ia32/ReadCr0.asm</Filename>
<Filename SupArchList="IA32">Ia32/ReadCr2.asm</Filename>
<Filename SupArchList="IA32">Ia32/ReadCr3.asm</Filename>
<Filename SupArchList="IA32">Ia32/ReadCr4.asm</Filename>
<Filename SupArchList="IA32">Ia32/WriteCr0.asm</Filename>
<Filename SupArchList="IA32">Ia32/WriteCr2.asm</Filename>
<Filename SupArchList="IA32">Ia32/WriteCr3.asm</Filename>
<Filename SupArchList="IA32">Ia32/WriteCr4.asm</Filename>
<Filename SupArchList="IA32">Ia32/ReadDr0.asm</Filename>
<Filename SupArchList="IA32">Ia32/ReadDr1.asm</Filename>
<Filename SupArchList="IA32">Ia32/ReadDr2.asm</Filename>
<Filename SupArchList="IA32">Ia32/ReadDr3.asm</Filename>
<Filename SupArchList="IA32">Ia32/ReadDr4.asm</Filename>
<Filename SupArchList="IA32">Ia32/ReadDr5.asm</Filename>
<Filename SupArchList="IA32">Ia32/ReadDr6.asm</Filename>
<Filename SupArchList="IA32">Ia32/ReadDr7.asm</Filename>
<Filename SupArchList="IA32">Ia32/WriteDr0.asm</Filename>
<Filename SupArchList="IA32">Ia32/WriteDr1.asm</Filename>
<Filename SupArchList="IA32">Ia32/WriteDr2.asm</Filename>
<Filename SupArchList="IA32">Ia32/WriteDr3.asm</Filename>
<Filename SupArchList="IA32">Ia32/WriteDr4.asm</Filename>
<Filename SupArchList="IA32">Ia32/WriteDr5.asm</Filename>
<Filename SupArchList="IA32">Ia32/WriteDr6.asm</Filename>
<Filename SupArchList="IA32">Ia32/WriteDr7.asm</Filename>
<Filename SupArchList="IA32">Ia32/ReadCs.asm</Filename>
<Filename SupArchList="IA32">Ia32/ReadDs.asm</Filename>
<Filename SupArchList="IA32">Ia32/ReadEs.asm</Filename>
<Filename SupArchList="IA32">Ia32/ReadFs.asm</Filename>
<Filename SupArchList="IA32">Ia32/ReadGs.asm</Filename>
<Filename SupArchList="IA32">Ia32/ReadSs.asm</Filename>
<Filename SupArchList="IA32">Ia32/ReadTr.asm</Filename>
<Filename SupArchList="IA32">Ia32/ReadGdtr.asm</Filename>
<Filename SupArchList="IA32">Ia32/WriteGdtr.asm</Filename>
<Filename SupArchList="IA32">Ia32/ReadIdtr.asm</Filename>
<Filename SupArchList="IA32">Ia32/WriteIdtr.asm</Filename>
<Filename SupArchList="IA32">Ia32/ReadLdtr.asm</Filename>
<Filename SupArchList="IA32">Ia32/WriteLdtr.asm</Filename>
<Filename SupArchList="IA32">Ia32/FxSave.asm</Filename>
<Filename SupArchList="IA32">Ia32/FxRestore.asm</Filename>
<Filename SupArchList="IA32">Ia32/ReadMm0.asm</Filename>
<Filename SupArchList="IA32">Ia32/ReadMm1.asm</Filename>
<Filename SupArchList="IA32">Ia32/ReadMm2.asm</Filename>
<Filename SupArchList="IA32">Ia32/ReadMm3.asm</Filename>
<Filename SupArchList="IA32">Ia32/ReadMm4.asm</Filename>
<Filename SupArchList="IA32">Ia32/ReadMm5.asm</Filename>
<Filename SupArchList="IA32">Ia32/ReadMm6.asm</Filename>
<Filename SupArchList="IA32">Ia32/ReadMm7.asm</Filename>
<Filename SupArchList="IA32">Ia32/WriteMm0.asm</Filename>
<Filename SupArchList="IA32">Ia32/WriteMm1.asm</Filename>
<Filename SupArchList="IA32">Ia32/WriteMm2.asm</Filename>
<Filename SupArchList="IA32">Ia32/WriteMm3.asm</Filename>
<Filename SupArchList="IA32">Ia32/WriteMm4.asm</Filename>
<Filename SupArchList="IA32">Ia32/WriteMm5.asm</Filename>
<Filename SupArchList="IA32">Ia32/WriteMm6.asm</Filename>
<Filename SupArchList="IA32">Ia32/WriteMm7.asm</Filename>
<Filename SupArchList="IA32">Ia32/ReadTsc.asm</Filename>
<Filename SupArchList="IA32">Ia32/ReadPmc.asm</Filename>
<Filename SupArchList="IA32">Ia32/Monitor.asm</Filename>
<Filename SupArchList="IA32">Ia32/Mwait.asm</Filename>
<Filename SupArchList="IA32">Ia32/EnablePaging32.asm</Filename>
<Filename SupArchList="IA32">Ia32/DisablePaging32.asm</Filename>
<Filename SupArchList="IA32">Ia32/EnableDisableInterrupts.c</Filename>
<Filename SupArchList="IA32">Ia32/EnableInterrupts.c</Filename>
<Filename SupArchList="IA32">Ia32/EnablePaging32.c</Filename>
<Filename SupArchList="IA32">Ia32/EnablePaging64.asm</Filename>
<Filename SupArchList="IA32">Ia32/Wbinvd.asm</Filename>
<Filename SupArchList="IA32">Ia32/Invd.asm</Filename>
<Filename SupArchList="IA32">Ia32/FlushCacheLine.asm</Filename>
<Filename SupArchList="IA32">Ia32/InterlockedIncrement.asm</Filename>
<Filename SupArchList="IA32">Ia32/InterlockedDecrement.asm</Filename>
<Filename SupArchList="IA32">Ia32/InterlockedCompareExchange32.asm</Filename>
<Filename SupArchList="IA32">Ia32/InterlockedCompareExchange64.asm</Filename>
<Filename SupArchList="IA32">Ia32/EnableInterrupts.asm</Filename>
<Filename SupArchList="IA32">Ia32/DisableInterrupts.asm</Filename>
<Filename SupArchList="IA32">Ia32/EnableDisableInterrupts.asm</Filename>
<Filename SupArchList="IA32">Ia32/CpuSleep.asm</Filename>
<Filename SupArchList="IA32">Ia32/CpuPause.asm</Filename>
<Filename SupArchList="IA32">Ia32/CpuBreakpoint.asm</Filename>
<Filename SupArchList="IA32">Ia32/CpuFlushTlb.asm</Filename>
<Filename SupArchList="IA32">Ia32/FlushCacheLine.c</Filename>
<Filename SupArchList="IA32">Ia32/FxSave.c</Filename>
<Filename SupArchList="IA32">Ia32/FxRestore.c</Filename>
<Filename SupArchList="IA32">Ia32/InterlockedIncrement.c</Filename>
<Filename SupArchList="IA32">Ia32/InterlockedDecrement.c</Filename>
<Filename SupArchList="IA32">Ia32/InterlockedCompareExchange32.c</Filename>
<Filename SupArchList="IA32">Ia32/InterlockedCompareExchange64.c</Filename>
<Filename SupArchList="IA32">Ia32/Invd.c</Filename>
<Filename SupArchList="IA32">Ia32/LongJump.c</Filename>
<Filename SupArchList="IA32">Ia32/LRotU64.c</Filename>
<Filename SupArchList="IA32">Ia32/LShiftU64.c</Filename>
<Filename SupArchList="IA32">Ia32/MultU64x32.c</Filename>
<Filename SupArchList="IA32">Ia32/MultU64x64.c</Filename>
<Filename SupArchList="IA32">Ia32/ModU64x32.c</Filename>
<Filename SupArchList="IA32">Ia32/Monitor.c</Filename>
<Filename SupArchList="IA32">Ia32/Mwait.c</Filename>
<Filename SupArchList="IA32">Ia32/ReadCr0.c</Filename>
<Filename SupArchList="IA32">Ia32/ReadCr2.c</Filename>
<Filename SupArchList="IA32">Ia32/ReadCr3.c</Filename>
<Filename SupArchList="IA32">Ia32/ReadCr4.c</Filename>
<Filename SupArchList="IA32">Ia32/ReadDr0.c</Filename>
<Filename SupArchList="IA32">Ia32/ReadDr1.c</Filename>
<Filename SupArchList="IA32">Ia32/ReadDr2.c</Filename>
<Filename SupArchList="IA32">Ia32/ReadDr3.c</Filename>
<Filename SupArchList="IA32">Ia32/ReadDr4.c</Filename>
<Filename SupArchList="IA32">Ia32/ReadDr5.c</Filename>
<Filename SupArchList="IA32">Ia32/ReadDr6.c</Filename>
<Filename SupArchList="IA32">Ia32/ReadDr7.c</Filename>
<Filename SupArchList="IA32">Ia32/ReadEflags.c</Filename>
<Filename SupArchList="IA32">Ia32/ReadMm0.c</Filename>
<Filename SupArchList="IA32">Ia32/ReadMm1.c</Filename>
<Filename SupArchList="IA32">Ia32/ReadMm2.c</Filename>
<Filename SupArchList="IA32">Ia32/ReadMm3.c</Filename>
<Filename SupArchList="IA32">Ia32/ReadMm4.c</Filename>
<Filename SupArchList="IA32">Ia32/ReadMm5.c</Filename>
<Filename SupArchList="IA32">Ia32/ReadMm6.c</Filename>
<Filename SupArchList="IA32">Ia32/ReadMm7.c</Filename>
<Filename SupArchList="IA32">Ia32/ReadMsr64.c</Filename>
<Filename SupArchList="IA32">Ia32/ReadCs.c</Filename>
<Filename SupArchList="IA32">Ia32/ReadDs.c</Filename>
<Filename SupArchList="IA32">Ia32/ReadEs.c</Filename>
<Filename SupArchList="IA32">Ia32/ReadFs.c</Filename>
<Filename SupArchList="IA32">Ia32/ReadGs.c</Filename>
<Filename SupArchList="IA32">Ia32/ReadSs.c</Filename>
<Filename SupArchList="IA32">Ia32/ReadTr.c</Filename>
<Filename SupArchList="IA32">Ia32/ReadGdtr.c</Filename>
<Filename SupArchList="IA32">Ia32/ReadIdtr.c</Filename>
<Filename SupArchList="IA32">Ia32/ReadLdtr.c</Filename>
<Filename SupArchList="IA32">Ia32/ReadTsc.c</Filename>
<Filename SupArchList="IA32">Ia32/ReadPmc.c</Filename>
<Filename SupArchList="IA32">Ia32/RShiftU64.c</Filename>
<Filename SupArchList="IA32">Ia32/RRotU64.c</Filename>
<Filename SupArchList="IA32">Ia32/SetJump.c</Filename>
<Filename SupArchList="IA32">Ia32/SwapBytes64.c</Filename>
<Filename SupArchList="IA32">Ia32/Thunk16.asm</Filename>
<Filename SupArchList="IA32">Ia32/WriteMsr64.c</Filename>
<Filename SupArchList="IA32">Ia32/WriteCr0.c</Filename>
<Filename SupArchList="IA32">Ia32/WriteCr2.c</Filename>
<Filename SupArchList="IA32">Ia32/WriteCr3.c</Filename>
<Filename SupArchList="IA32">Ia32/WriteCr4.c</Filename>
<Filename SupArchList="IA32">Ia32/WriteDr0.c</Filename>
<Filename SupArchList="IA32">Ia32/WriteDr1.c</Filename>
<Filename SupArchList="IA32">Ia32/WriteDr2.c</Filename>
<Filename SupArchList="IA32">Ia32/WriteDr3.c</Filename>
<Filename SupArchList="IA32">Ia32/WriteDr4.c</Filename>
<Filename SupArchList="IA32">Ia32/WriteDr5.c</Filename>
<Filename SupArchList="IA32">Ia32/WriteDr6.c</Filename>
<Filename SupArchList="IA32">Ia32/WriteDr7.c</Filename>
<Filename SupArchList="IA32">Ia32/WriteGdtr.c</Filename>
<Filename SupArchList="IA32">Ia32/WriteIdtr.c</Filename>
<Filename SupArchList="IA32">Ia32/WriteLdtr.c</Filename>
<Filename SupArchList="IA32">Ia32/WriteMm0.c</Filename>
<Filename SupArchList="IA32">Ia32/WriteMm1.c</Filename>
<Filename SupArchList="IA32">Ia32/WriteMm2.c</Filename>
<Filename SupArchList="IA32">Ia32/WriteMm3.c</Filename>
<Filename SupArchList="IA32">Ia32/WriteMm4.c</Filename>
<Filename SupArchList="IA32">Ia32/WriteMm5.c</Filename>
<Filename SupArchList="IA32">Ia32/WriteMm6.c</Filename>
<Filename SupArchList="IA32">Ia32/WriteMm7.c</Filename>
<Filename SupArchList="IA32">Ia32/Wbinvd.c</Filename>
<!-- GCC assembly code is with .S extension -->
<Filename SupArchList="IA32">Ia32/LShiftU64.S</Filename>
<Filename SupArchList="IA32">Ia32/RShiftU64.S</Filename>

View File

@ -0,0 +1,36 @@
/** @file
64-bit arithmetic right shift function for IA-32.
Copyright (c) 2006, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#if _MSC_EXTENSIONS
UINT64
EFIAPI
InternalMathARShiftU64 (
IN UINT64 Operand,
IN UINTN Count
)
{
_asm {
mov cl, byte ptr [Count]
mov eax, dword ptr [Operand + 4]
cdq
test cl, 32
cmovz edx, eax
cmovz eax, dword ptr [Operand + 0]
shrd eax, edx, cl
sar edx, cl
}
}
#endif

View File

@ -0,0 +1,28 @@
/** @file
CpuBreakpoint function.
Copyright (c) 2006, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#if _MSC_EXTENSIONS
VOID
EFIAPI
CpuBreakpoint (
VOID
)
{
_asm {
int 3
}
}
#endif

View File

@ -0,0 +1,29 @@
/** @file
CpuFlushTlb function.
Copyright (c) 2006, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#if _MSC_EXTENSIONS
VOID
EFIAPI
CpuFlushTlb (
VOID
)
{
_asm {
mov eax, cr3
mov cr3, eax
}
}
#endif

View File

@ -0,0 +1,52 @@
/** @file
AsmCpuid function.
Copyright (c) 2006, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#if _MSC_EXTENSIONS
UINT32
EFIAPI
AsmCpuid (
IN UINT32 Index,
OUT UINT32 *RegisterEax, OPTIONAL
OUT UINT32 *RegisterEbx, OPTIONAL
OUT UINT32 *RegisterEcx, OPTIONAL
OUT UINT32 *RegisterEdx OPTIONAL
)
{
_asm {
mov eax, Index
cpuid
push ecx
mov ecx, RegisterEax
jecxz SkipEax
mov [ecx], eax
SkipEax:
mov ecx, RegisterEbx
jecxz SkipEbx
mov [ecx], ebx
SkipEbx:
pop eax
mov ecx, RegisterEcx
jecxz SkipEcx
mov [ecx], eax
SkipEcx:
mov ecx, RegisterEdx
jecxz SkipEdx
mov [ecx], edx
SkipEdx:
mov eax, Index
}
}
#endif

View File

@ -0,0 +1,54 @@
/** @file
AsmCpuidEx function.
Copyright (c) 2006, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#if _MSC_EXTENSIONS
UINT32
EFIAPI
AsmCpuidEx (
IN UINT32 Index,
IN UINT32 SubIndex,
OUT UINT32 *RegisterEax, OPTIONAL
OUT UINT32 *RegisterEbx, OPTIONAL
OUT UINT32 *RegisterEcx, OPTIONAL
OUT UINT32 *RegisterEdx OPTIONAL
)
{
_asm {
mov eax, Index
mov ecx, SubIndex
cpuid
push ecx
mov ecx, RegisterEax
jecxz SkipEax
mov [ecx], eax
SkipEax:
mov ecx, RegisterEbx
jecxz SkipEbx
mov [ecx], ebx
SkipEbx:
pop eax
mov ecx, RegisterEcx
jecxz SkipEcx
mov [ecx], eax
SkipEcx:
mov ecx, RegisterEdx
jecxz SkipEdx
mov [ecx], edx
SkipEdx:
mov eax, Index
}
}
#endif

View File

@ -0,0 +1,28 @@
/** @file
CpuPause function.
Copyright (c) 2006, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#if _MSC_EXTENSIONS
VOID
EFIAPI
CpuPause (
VOID
)
{
_asm {
pause
}
}
#endif

View File

@ -0,0 +1,28 @@
/** @file
CpuSleep function.
Copyright (c) 2006, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#if _MSC_EXTENSIONS
VOID
EFIAPI
CpuSleep (
VOID
)
{
_asm {
hlt
}
}
#endif

View File

@ -0,0 +1,28 @@
/** @file
DisableInterrupts function.
Copyright (c) 2006, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#if _MSC_EXTENSIONS
VOID
EFIAPI
DisableInterrupts (
VOID
)
{
_asm {
cli
}
}
#endif

View File

@ -0,0 +1,49 @@
/** @file
AsmDisablePaging32 function.
Copyright (c) 2006, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#if _MSC_EXTENSIONS
__declspec (naked)
VOID
EFIAPI
InternalX86DisablePaging32 (
IN SWITCH_STACK_ENTRY_POINT EntryPoint,
IN VOID *Context1, OPTIONAL
IN VOID *Context2, OPTIONAL
IN VOID *NewStack
)
{
_asm {
push ebp
mov ebp, esp
mov ebx, EntryPoint
mov ecx, Context1
mov edx, Context2
pushfd
pop edi // save EFLAGS to edi
cli
mov eax, cr0
btr eax, 31
mov esp, NewStack
mov cr0, eax
push edi
popfd // restore EFLAGS from edi
push edx
push ecx
call ebx
jmp $ // EntryPoint() should not return
}
}
#endif

View File

@ -0,0 +1,36 @@
/** @file
Calculate the quotient of a 64-bit integer by a 32-bit integer
Copyright (c) 2006, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#if _MSC_EXTENSIONS
UINT64
EFIAPI
InternalMathDivU64x32 (
IN UINT64 Dividend,
IN UINT32 Divisor
)
{
_asm {
mov eax, dword ptr [Dividend + 4]
mov ecx, Divisor
xor edx, edx
div ecx
push eax ; save quotient on stack
mov eax, dword ptr [Dividend]
div ecx
pop edx ; restore high-order dword of the quotient
}
}
#endif

View File

@ -0,0 +1,41 @@
/** @file
Set error flag for all division functions
Copyright (c) 2006, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#if _MSC_EXTENSIONS
UINT64
EFIAPI
InternalMathDivRemU64x32 (
IN UINT64 Dividend,
IN UINT32 Divisor,
OUT UINT32 *Remainder
)
{
_asm {
mov ecx, Divisor
mov eax, dword ptr [Dividend + 4]
xor edx, edx
div ecx
push eax
mov eax, dword ptr [Dividend + 0]
div ecx
mov ecx, Remainder
jecxz RemainderNull // abandon remainder if Remainder == NULL
mov [ecx], edx
RemainderNull:
pop edx
}
}
#endif

View File

@ -0,0 +1,68 @@
/** @file
Calculate the quotient of a 64-bit integer by a 64-bit integer and returns
both the quotient and the remainderSet error flag for all division functions
Copyright (c) 2006, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#if _MSC_EXTENSIONS
UINT64
EFIAPI
InternalMathDivRemU64x64 (
IN UINT64 Dividend,
IN UINT64 Divisor,
OUT UINT64 *Remainder OPTIONAL
)
{
_asm {
mov edx, dword ptr [Dividend + 4]
mov eax, dword ptr [Dividend + 0] // edx:eax <- dividend
mov edi, edx
mov esi, eax // edi:esi <- dividend
mov ebx, dword ptr [Divisor + 0] // ecx:ebx <- divisor
BitLoop:
shr edx, 1
rcr eax, 1
shrd ebx, ecx, 1
shr ecx, 1
jnz BitLoop
div ebx
mov ebx, eax // ebx <- quotient
mov ecx, dword ptr [Divisor + 4]
mul dword ptr [Divisor]
imul ecx, ebx
add edx, ecx
mov ecx, Remainder
jc TooLarge // product > 2^64
cmp edi, edx // compare high 32 bits
ja Correct
jb TooLarge // product > dividend
cmp esi, eax
jae Correct // product <= dividend
TooLarge:
dec ebx // adjust quotient by -1
jecxz Return // return if Remainder == NULL
sub eax, dword ptr [Divisor + 0]
sbb edx, dword ptr [Divisor + 4]
Correct:
jecxz Return
sub esi, eax
sbb edi, edx // edi:esi <- remainder
mov [ecx], esi
mov [ecx + 4], edi
Return:
mov eax, ebx // eax <- quotient
xor edx, edx
}
}
#endif

View File

@ -0,0 +1,31 @@
/** @file
EnableDisableInterrupts function
Copyright (c) 2006, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#if _MSC_EXTENSIONS
VOID
EFIAPI
EnableDisableInterrupts (
VOID
)
{
_asm {
sti
nop
nop
cli
}
}
#endif

View File

@ -0,0 +1,28 @@
/** @file
EnableInterrupts function
Copyright (c) 2006, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#if _MSC_EXTENSIONS
VOID
EFIAPI
EnableInterrupts (
VOID
)
{
_asm {
sti
}
}
#endif

View File

@ -0,0 +1,49 @@
/** @file
AsmEnablePaging32 function
Copyright (c) 2006, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#if _MSC_EXTENSIONS
__declspec (naked)
VOID
EFIAPI
InternalX86EnablePaging32 (
IN SWITCH_STACK_ENTRY_POINT EntryPoint,
IN VOID *Context1, OPTIONAL
IN VOID *Context2, OPTIONAL
IN VOID *NewStack
)
{
_asm {
push ebp
mov ebp, esp
mov ebx, EntryPoint
mov ecx, Context1
mov edx, Context2
pushfd
pop edi
cli
mov eax, cr0
bts eax, 31
mov esp, NewStack
mov cr0, eax
push edi
popfd
push edx
push ecx
call ebx
jmp $
}
}
#endif

View File

@ -0,0 +1,29 @@
/** @file
AsmFlushCacheLine function
Copyright (c) 2006, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#if _MSC_EXTENSIONS
VOID *
EFIAPI
AsmFlushCacheLine (
IN VOID *LinearAddress
)
{
_asm {
mov eax, LinearAddress
clflush [eax]
}
}
#endif

View File

@ -0,0 +1,29 @@
/** @file
AsmFxRestore function
Copyright (c) 2006, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#if _MSC_EXTENSIONS
VOID
EFIAPI
InternalX86FxRestore (
IN CONST IA32_FX_BUFFER *Buffer
)
{
_asm {
mov eax, Buffer
fxrstor [eax]
}
}
#endif

View File

@ -0,0 +1,29 @@
/** @file
AsmFxSave function
Copyright (c) 2006, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#if _MSC_EXTENSIONS
VOID
EFIAPI
InternalX86FxSave (
OUT IA32_FX_BUFFER *Buffer
)
{
_asm {
mov eax, Buffer
fxsave [eax]
}
}
#endif

View File

@ -0,0 +1,33 @@
/** @file
InterlockedCompareExchange32 function
Copyright (c) 2006, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#if _MSC_EXTENSIONS
UINT32
EFIAPI
InternalSyncCompareExchange32 (
IN UINT32 *Value,
IN UINT32 CompareValue,
IN UINT32 ExchangeValue
)
{
_asm {
mov ecx, Value
mov eax, CompareValue
mov edx, ExchangeValue
lock cmpxchg [ecx], edx
}
}
#endif

View File

@ -0,0 +1,35 @@
/** @file
InterlockedCompareExchange64 function
Copyright (c) 2006, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#if _MSC_EXTENSIONS
UINT64
EFIAPI
InternalSyncCompareExchange64 (
IN UINT64 *Value,
IN UINT64 CompareValue,
IN UINT64 ExchangeValue
)
{
_asm {
mov esi, Value
mov eax, dword ptr [CompareValue + 0]
mov edx, dword ptr [CompareValue + 4]
mov ebx, dword ptr [ExchangeValue + 0]
mov ecx, dword ptr [ExchangeValue + 4]
lock cmpxchg8b qword ptr [esi]
}
}
#endif

View File

@ -0,0 +1,30 @@
/** @file
InterlockedDecrement function
Copyright (c) 2006, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#if _MSC_EXTENSIONS
UINT32
EFIAPI
InternalSyncDecrement (
IN UINT32 *Value
)
{
_asm {
mov eax, Value
lock dec dword ptr [eax]
mov eax, [eax]
}
}
#endif

View File

@ -0,0 +1,30 @@
/** @file
InterLockedIncrement function
Copyright (c) 2006, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#if _MSC_EXTENSIONS
UINT32
EFIAPI
InternalSyncIncrement (
IN UINT32 *Value
)
{
_asm {
mov eax, Value
lock inc dword ptr [eax]
mov eax, [eax]
}
}
#endif

View File

@ -0,0 +1,28 @@
/** @file
AsmInvd function
Copyright (c) 2006, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#if _MSC_EXTENSIONS
VOID
EFIAPI
AsmInvd (
VOID
)
{
_asm {
invd
}
}
#endif

View File

@ -0,0 +1,39 @@
/** @file
64-bit left rotation for Ia32
Copyright (c) 2006, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#if _MSC_EXTENSIONS
UINT64
EFIAPI
InternalMathLRotU64 (
IN UINT64 Operand,
IN UINTN Count
)
{
_asm {
mov cl, byte ptr [Count]
mov edx, dword ptr [Operand + 4]
mov eax, dword ptr [Operand + 0]
shld ebx, edx, cl
shld edx, eax, cl
ror ebx, cl
shld eax, ebx, cl
test cl, 32 ; Count >= 32?
cmovnz ecx, eax
cmovnz eax, edx
cmovnz edx, ecx
}
}
#endif

View File

@ -0,0 +1,36 @@
/** @file
64-bit left shift function for IA-32.
Copyright (c) 2006, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#if _MSC_EXTENSIONS
UINT64
EFIAPI
InternalMathLShiftU64 (
IN UINT64 Operand,
IN UINTN Count
)
{
_asm {
mov cl, byte ptr [Count]
xor eax, eax
mov edx, dword ptr [Operand + 0]
test cl, 32 // Count >= 32?
cmovz eax, edx
cmovz edx, dword ptr [Operand + 4]
shld edx, eax, cl
shl eax, cl
}
}
#endif

View File

@ -0,0 +1,38 @@
/** @file
Implementation of _LongJump() on IA-32.
Copyright (c) 2006, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#if _MSC_EXTENSIONS
__declspec (naked)
VOID
EFIAPI
InternalLongJump (
IN BASE_LIBRARY_JUMP_BUFFER *JumpBuffer,
IN UINTN Value
)
{
_asm {
pop eax ; skip return address
pop edx ; edx <- JumpBuffer
pop eax ; eax <- Value
mov ebx, [edx]
mov esi, [edx + 4]
mov edi, [edx + 8]
mov ebp, [edx + 12]
mov esp, [edx + 16]
jmp dword ptr [edx + 20]
}
}
#endif

View File

@ -0,0 +1,35 @@
/** @file
Calculate the remainder of a 64-bit integer by a 32-bit integer
Copyright (c) 2006, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#if _MSC_EXTENSIONS
UINT32
EFIAPI
InternalMathModU64x32 (
IN UINT64 Dividend,
IN UINT32 Divisor
)
{
_asm {
mov eax, dword ptr [Dividend + 4]
mov ecx, Divisor
xor edx, edx
div ecx
mov eax, dword ptr [Dividend + 0]
div ecx
mov eax, edx
}
}
#endif

View File

@ -0,0 +1,35 @@
/** @file
AsmMonitor function
Copyright (c) 2006, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#if _MSC_EXTENSIONS
UINTN
EFIAPI
AsmMonitor (
IN UINTN RegisterEax,
IN UINTN RegisterEcx,
IN UINTN RegisterEdx
)
{
_asm {
mov eax, RegisterEax
mov ecx, RegisterEcx
mov edx, RegisterEdx
_emit 0x0f // monitor
_emit 0x01
_emit 0xc8
}
}
#endif

View File

@ -0,0 +1,33 @@
/** @file
Calculate the product of a 64-bit integer and a 32-bit integer
Copyright (c) 2006, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#if _MSC_EXTENSIONS
UINT64
EFIAPI
InternalMathMultU64x32 (
IN UINT64 Multiplicand,
IN UINT32 Multiplier
)
{
_asm {
mov ecx, Multiplier
mov eax, ecx
imul ecx, dword ptr [Multiplicand + 4] // overflow not detectable
mul dword ptr [Multiplicand + 0]
add edx, ecx
}
}
#endif

View File

@ -0,0 +1,37 @@
/** @file
Calculate the product of a 64-bit integer and another 64-bit integer
Copyright (c) 2006, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#if _MSC_EXTENSIONS
UINT64
EFIAPI
InternalMathMultU64x64 (
IN UINT64 Multiplicand,
IN UINT64 Multiplier
)
{
_asm {
mov ebx, dword ptr [Multiplicand + 0]
mov edx, dword ptr [Multiplier + 0]
mov ecx, ebx
mov eax, edx
imul ebx, dword ptr [Multiplier + 4]
imul edx, dword ptr [Multiplicand + 4]
add ebx, edx
mul ecx
add edx, ebx
}
}
#endif

View File

@ -0,0 +1,33 @@
/** @file
AsmMwait function
Copyright (c) 2006, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#if _MSC_EXTENSIONS
UINTN
EFIAPI
AsmMwait (
IN UINTN RegisterEax,
IN UINTN RegisterEcx
)
{
_asm {
mov eax, RegisterEax
mov ecx, RegisterEcx
_emit 0x0f // mwait
_emit 0x01
_emit 0xC9
}
}
#endif

View File

@ -0,0 +1,39 @@
/** @file
64-bit right rotation for Ia32
Copyright (c) 2006, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#if _MSC_EXTENSIONS
UINT64
EFIAPI
InternalMathRRotU64 (
IN UINT64 Operand,
IN UINTN Count
)
{
_asm {
mov cl, byte ptr [Count]
mov eax, dword ptr [Operand + 0]
mov edx, dword ptr [Operand + 4]
shrd ebx, eax, cl
shrd eax, edx, cl
rol ebx, cl
shrd edx, ebx, cl
test cl, 32 // Count >= 32?
cmovnz ecx, eax
cmovnz eax, edx
cmovnz edx, ecx
}
}
#endif

View File

@ -0,0 +1,36 @@
/** @file
64-bit logical right shift function for IA-32
Copyright (c) 2006, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#if _MSC_EXTENSIONS
UINT64
EFIAPI
InternalMathRShiftU64 (
IN UINT64 Operand,
IN UINTN Count
)
{
_asm {
mov cl, byte ptr [Count]
xor edx, edx
mov eax, dword ptr [Operand + 4]
test cl, 32
cmovz edx, eax
cmovz eax, dword ptr [Operand + 0]
shrd eax, edx, cl
shr edx, cl
}
}
#endif

View File

@ -0,0 +1,28 @@
/** @file
AsmReadCr0 function
Copyright (c) 2006, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#if _MSC_EXTENSIONS
UINTN
EFIAPI
AsmReadCr0 (
VOID
)
{
__asm {
mov eax, cr0
}
}
#endif

View File

@ -0,0 +1,28 @@
/** @file
AsmReadCr2 function
Copyright (c) 2006, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#if _MSC_EXTENSIONS
UINTN
EFIAPI
AsmReadCr2 (
VOID
)
{
__asm {
mov eax, cr2
}
}
#endif

View File

@ -0,0 +1,28 @@
/** @file
AsmReadCr3 function
Copyright (c) 2006, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#if _MSC_EXTENSIONS
UINTN
EFIAPI
AsmReadCr3 (
VOID
)
{
__asm {
mov eax, cr3
}
}
#endif

View File

@ -0,0 +1,30 @@
/** @file
AsmReadCr4 function
Copyright (c) 2006, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#if _MSC_EXTENSIONS
UINTN
EFIAPI
AsmReadCr4 (
VOID
)
{
__asm {
_emit 0x0f // mov eax, cr4
_emit 0x20
_emit 0xE0
}
}
#endif

View File

@ -0,0 +1,29 @@
/** @file
AsmReadCs function
Copyright (c) 2006, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#if _MSC_EXTENSIONS
UINT16
EFIAPI
AsmReadCs (
VOID
)
{
__asm {
xor eax, eax
mov ax, cs
}
}
#endif

View File

@ -0,0 +1,28 @@
/** @file
AsmReadDr0 function
Copyright (c) 2006, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#if _MSC_EXTENSIONS
UINTN
EFIAPI
AsmReadDr0 (
VOID
)
{
__asm {
mov eax, dr0
}
}
#endif

View File

@ -0,0 +1,28 @@
/** @file
AsmReadDr1 function
Copyright (c) 2006, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#if _MSC_EXTENSIONS
UINTN
EFIAPI
AsmReadDr1 (
VOID
)
{
__asm {
mov eax, dr1
}
}
#endif

View File

@ -0,0 +1,28 @@
/** @file
AsmReadDr2 function
Copyright (c) 2006, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#if _MSC_EXTENSIONS
UINTN
EFIAPI
AsmReadDr2 (
VOID
)
{
__asm {
mov eax, dr2
}
}
#endif

View File

@ -0,0 +1,28 @@
/** @file
AsmReadDr3 function
Copyright (c) 2006, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#if _MSC_EXTENSIONS
UINTN
EFIAPI
AsmReadDr3 (
VOID
)
{
__asm {
mov eax, dr3
}
}
#endif

View File

@ -0,0 +1,30 @@
/** @file
AsmReadDr4 function
Copyright (c) 2006, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#if _MSC_EXTENSIONS
UINTN
EFIAPI
AsmReadDr4 (
VOID
)
{
__asm {
_emit 0x0f
_emit 0x21
_emit 0xe0
}
}
#endif

View File

@ -0,0 +1,30 @@
/** @file
AsmReadDr5 function
Copyright (c) 2006, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#if _MSC_EXTENSIONS
UINTN
EFIAPI
AsmReadDr5 (
VOID
)
{
__asm {
_emit 0x0f
_emit 0x21
_emit 0xe8
}
}
#endif

View File

@ -0,0 +1,28 @@
/** @file
AsmReadDr6 function
Copyright (c) 2006, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#if _MSC_EXTENSIONS
UINTN
EFIAPI
AsmReadDr6 (
VOID
)
{
__asm {
mov eax, dr6
}
}
#endif

View File

@ -0,0 +1,28 @@
/** @file
AsmReadDr7 function
Copyright (c) 2006, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#if _MSC_EXTENSIONS
UINTN
EFIAPI
AsmReadDr7 (
VOID
)
{
__asm {
mov eax, dr7
}
}
#endif

View File

@ -0,0 +1,29 @@
/** @file
AsmReadDs function
Copyright (c) 2006, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#if _MSC_EXTENSIONS
UINT16
EFIAPI
AsmReadDs (
VOID
)
{
__asm {
xor eax, eax
mov ax, ds
}
}
#endif

View File

@ -0,0 +1,29 @@
/** @file
AsmReadEflags function
Copyright (c) 2006, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#if _MSC_EXTENSIONS
UINTN
EFIAPI
AsmReadEflags (
VOID
)
{
__asm {
pushfd
pop eax
}
}
#endif

View File

@ -0,0 +1,29 @@
/** @file
AsmReadEs function
Copyright (c) 2006, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#if _MSC_EXTENSIONS
UINT16
EFIAPI
AsmReadEs (
VOID
)
{
__asm {
xor eax, eax
mov ax, es
}
}
#endif

View File

@ -0,0 +1,29 @@
/** @file
AsmReadFs function
Copyright (c) 2006, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#if _MSC_EXTENSIONS
UINT16
EFIAPI
AsmReadFs (
VOID
)
{
__asm {
xor eax, eax
mov ax, fs
}
}
#endif

View File

@ -0,0 +1,29 @@
/** @file
AsmReadGdtr function
Copyright (c) 2006, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#if _MSC_EXTENSIONS
VOID
EFIAPI
InternalX86ReadGdtr (
OUT IA32_DESCRIPTOR *Gdtr
)
{
_asm {
mov eax, Gdtr
sgdt fword ptr [eax]
}
}
#endif

View File

@ -0,0 +1,29 @@
/** @file
AsmReadGs function
Copyright (c) 2006, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#if _MSC_EXTENSIONS
UINT16
EFIAPI
AsmReadGs (
VOID
)
{
__asm {
xor eax, eax
mov ax, gs
}
}
#endif

View File

@ -0,0 +1,29 @@
/** @file
AsmReadIdtr function
Copyright (c) 2006, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#if _MSC_EXTENSIONS
VOID
EFIAPI
InternalX86ReadIdtr (
OUT IA32_DESCRIPTOR *Idtr
)
{
_asm {
mov eax, Idtr
sidt fword ptr [eax]
}
}
#endif

View File

@ -0,0 +1,28 @@
/** @file
AsmReadLdtr function
Copyright (c) 2006, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#if _MSC_EXTENSIONS
UINT16
EFIAPI
AsmReadLdtr (
VOID
)
{
_asm {
sldt ax
}
}
#endif

View File

@ -0,0 +1,33 @@
/** @file
AsmReadMm0 function
Copyright (c) 2006, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#if _MSC_EXTENSIONS
UINT64
EFIAPI
AsmReadMm0 (
VOID
)
{
_asm {
push eax
push eax
movq [esp], mm0
pop eax
pop edx
emms
}
}
#endif

View File

@ -0,0 +1,33 @@
/** @file
AsmReadMm1 function
Copyright (c) 2006, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#if _MSC_EXTENSIONS
UINT64
EFIAPI
AsmReadMm1 (
VOID
)
{
_asm {
push eax
push eax
movq [esp], mm1
pop eax
pop edx
emms
}
}
#endif

View File

@ -0,0 +1,33 @@
/** @file
AsmReadMm2 function
Copyright (c) 2006, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#if _MSC_EXTENSIONS
UINT64
EFIAPI
AsmReadMm2 (
VOID
)
{
_asm {
push eax
push eax
movq [esp], mm2
pop eax
pop edx
emms
}
}
#endif

View File

@ -0,0 +1,33 @@
/** @file
AsmReadMm3 function
Copyright (c) 2006, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#if _MSC_EXTENSIONS
UINT64
EFIAPI
AsmReadMm3 (
VOID
)
{
_asm {
push eax
push eax
movq [esp], mm3
pop eax
pop edx
emms
}
}
#endif

View File

@ -0,0 +1,33 @@
/** @file
AsmReadMm4 function
Copyright (c) 2006, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#if _MSC_EXTENSIONS
UINT64
EFIAPI
AsmReadMm4 (
VOID
)
{
_asm {
push eax
push eax
movq [esp], mm4
pop eax
pop edx
emms
}
}
#endif

View File

@ -0,0 +1,33 @@
/** @file
AsmReadMm5 function
Copyright (c) 2006, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#if _MSC_EXTENSIONS
UINT64
EFIAPI
AsmReadMm5 (
VOID
)
{
_asm {
push eax
push eax
movq [esp], mm5
pop eax
pop edx
emms
}
}
#endif

View File

@ -0,0 +1,33 @@
/** @file
AsmReadMm6 function
Copyright (c) 2006, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#if _MSC_EXTENSIONS
UINT64
EFIAPI
AsmReadMm6 (
VOID
)
{
_asm {
push eax
push eax
movq [esp], mm6
pop eax
pop edx
emms
}
}
#endif

View File

@ -0,0 +1,33 @@
/** @file
AsmReadMm7 function
Copyright (c) 2006, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#if _MSC_EXTENSIONS
UINT64
EFIAPI
AsmReadMm7 (
VOID
)
{
_asm {
push eax
push eax
movq [esp], mm7
pop eax
pop edx
emms
}
}
#endif

View File

@ -0,0 +1,29 @@
/** @file
AsmReadMsr64 function
Copyright (c) 2006, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#if _MSC_EXTENSIONS
UINT64
EFIAPI
AsmReadMsr64 (
IN UINT32 Index
)
{
_asm {
mov ecx, Index
rdmsr
}
}
#endif

View File

@ -0,0 +1,29 @@
/** @file
AsmReadPmc function
Copyright (c) 2006, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#if _MSC_EXTENSIONS
UINT64
EFIAPI
AsmReadPmc (
IN UINT32 PmcIndex
)
{
_asm {
mov ecx, PmcIndex
rdpmc
}
}
#endif

View File

@ -0,0 +1,29 @@
/** @file
AsmReadSs function
Copyright (c) 2006, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#if _MSC_EXTENSIONS
UINT16
EFIAPI
AsmReadSs (
VOID
)
{
__asm {
xor eax, eax
mov ax, ss
}
}
#endif

View File

@ -0,0 +1,28 @@
/** @file
AsmReadTr function
Copyright (c) 2006, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#if _MSC_EXTENSIONS
UINT16
EFIAPI
AsmReadTr (
VOID
)
{
_asm {
str ax
}
}
#endif

View File

@ -0,0 +1,28 @@
/** @file
AsmReadTsc function
Copyright (c) 2006, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#if _MSC_EXTENSIONS
UINT64
EFIAPI
AsmReadTsc (
VOID
)
{
_asm {
rdtsc
}
}
#endif

View File

@ -0,0 +1,47 @@
/** @file
Implementation of SetJump() on IA-32.
Copyright (c) 2006, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#if _MSC_EXTENSIONS
VOID
EFIAPI
InternalAssertJumpBuffer (
IN BASE_LIBRARY_JUMP_BUFFER *JumpBuffer
);
_declspec (naked)
UINTN
EFIAPI
SetJump (
OUT BASE_LIBRARY_JUMP_BUFFER *JumpBuffer
)
{
_asm {
push [esp + 4]
call InternalAssertJumpBuffer
pop ecx
pop ecx
mov edx, [esp]
mov [edx], ebx
mov [edx + 4], esi
mov [edx + 8], edi
mov [edx + 12], ebp
mov [edx + 16], esp
mov [edx + 20], ecx
xor eax, eax
jmp ecx
}
}
#endif

View File

@ -0,0 +1,31 @@
/** @file
Implementation of 64-bit swap bytes
Copyright (c) 2006, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#if _MSC_EXTENSIONS
UINT64
EFIAPI
InternalMathSwapBytes64 (
IN UINT64 Operand
)
{
_asm {
mov eax, dword ptr [Operand + 4]
mov edx, dword ptr [Operand + 0]
bswap eax
bswap edx
}
}
#endif

View File

@ -0,0 +1,28 @@
/** @file
AsmWbinvd function
Copyright (c) 2006, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#if _MSC_EXTENSIONS
VOID
EFIAPI
AsmWbinvd (
VOID
)
{
_asm {
wbinvd
}
}
#endif

View File

@ -0,0 +1,29 @@
/** @file
AsmWriteCr0 function
Copyright (c) 2006, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#if _MSC_EXTENSIONS
UINTN
EFIAPI
AsmWriteCr0 (
UINTN Value
)
{
_asm {
mov eax, Value
mov cr0, eax
}
}
#endif

View File

@ -0,0 +1,29 @@
/** @file
AsmWriteCr2 function
Copyright (c) 2006, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#if _MSC_EXTENSIONS
UINTN
EFIAPI
AsmWriteCr2 (
UINTN Value
)
{
_asm {
mov eax, Value
mov cr2, eax
}
}
#endif

View File

@ -0,0 +1,29 @@
/** @file
AsmWriteCr3 function
Copyright (c) 2006, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#if _MSC_EXTENSIONS
UINTN
EFIAPI
AsmWriteCr3 (
UINTN Value
)
{
_asm {
mov eax, Value
mov cr3, eax
}
}
#endif

View File

@ -0,0 +1,31 @@
/** @file
AsmWriteCr4 function
Copyright (c) 2006, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#if _MSC_EXTENSIONS
UINTN
EFIAPI
AsmWriteCr4 (
UINTN Value
)
{
_asm {
mov eax, Value
_emit 0x0f // mov cr4, eax
_emit 0x22
_emit 0xE0
}
}
#endif

View File

@ -0,0 +1,29 @@
/** @file
AsmWriteDr0 function
Copyright (c) 2006, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#if _MSC_EXTENSIONS
UINTN
EFIAPI
AsmWriteDr0 (
IN UINTN Value
)
{
_asm {
mov eax, Value
mov dr0, eax
}
}
#endif

View File

@ -0,0 +1,29 @@
/** @file
AsmWriteDr1 function
Copyright (c) 2006, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#if _MSC_EXTENSIONS
UINTN
EFIAPI
AsmWriteDr1 (
IN UINTN Value
)
{
_asm {
mov eax, Value
mov dr1, eax
}
}
#endif

View File

@ -0,0 +1,29 @@
/** @file
AsmWriteDr2 function
Copyright (c) 2006, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#if _MSC_EXTENSIONS
UINTN
EFIAPI
AsmWriteDr2 (
IN UINTN Value
)
{
_asm {
mov eax, Value
mov dr2, eax
}
}
#endif

View File

@ -0,0 +1,29 @@
/** @file
AsmWriteDr3 function
Copyright (c) 2006, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#if _MSC_EXTENSIONS
UINTN
EFIAPI
AsmWriteDr3 (
IN UINTN Value
)
{
_asm {
mov eax, Value
mov dr3, eax
}
}
#endif

View File

@ -0,0 +1,31 @@
/** @file
AsmWriteDr4 function
Copyright (c) 2006, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#if _MSC_EXTENSIONS
UINTN
EFIAPI
AsmWriteDr4 (
IN UINTN Value
)
{
_asm {
mov eax, Value
_emit 0x0f // mov dr4, eax
_emit 0x23
_emit 0xe0
}
}
#endif

View File

@ -0,0 +1,31 @@
/** @file
AsmWriteDr5 function
Copyright (c) 2006, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#if _MSC_EXTENSIONS
UINTN
EFIAPI
AsmWriteDr5 (
IN UINTN Value
)
{
_asm {
mov eax, Value
_emit 0x0f // mov dr5, eax
_emit 0x23
_emit 0xe8
}
}
#endif

View File

@ -0,0 +1,29 @@
/** @file
AsmWriteDr6 function
Copyright (c) 2006, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#if _MSC_EXTENSIONS
UINTN
EFIAPI
AsmWriteDr6 (
IN UINTN Value
)
{
_asm {
mov eax, Value
mov dr6, eax
}
}
#endif

View File

@ -0,0 +1,29 @@
/** @file
AsmWriteDr7 function
Copyright (c) 2006, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#if _MSC_EXTENSIONS
UINTN
EFIAPI
AsmWriteDr7 (
IN UINTN Value
)
{
_asm {
mov eax, Value
mov dr7, eax
}
}
#endif

View File

@ -0,0 +1,29 @@
/** @file
AsmWriteGdtr function
Copyright (c) 2006, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#if _MSC_EXTENSIONS
VOID
EFIAPI
InternalX86WriteGdtr (
IN CONST IA32_DESCRIPTOR *Gdtr
)
{
_asm {
mov eax, Gdtr
lgdt fword ptr [eax]
}
}
#endif

View File

@ -0,0 +1,29 @@
/** @file
AsmWriteIdtr function
Copyright (c) 2006, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#if _MSC_EXTENSIONS
VOID
EFIAPI
InternalX86WriteIdtr (
IN CONST IA32_DESCRIPTOR *Idtr
)
{
_asm {
mov eax, Idtr
lidt fword ptr [eax]
}
}
#endif

View File

@ -0,0 +1,30 @@
/** @file
AsmWriteLdtr function
Copyright (c) 2006, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#if _MSC_EXTENSIONS
VOID
EFIAPI
AsmWriteLdtr (
IN UINT16 Ldtr
)
{
_asm {
xor eax, eax
mov ax, Ldtr
lldt ax
}
}
#endif

View File

@ -0,0 +1,29 @@
/** @file
AsmWriteMm0 function
Copyright (c) 2006, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#if _MSC_EXTENSIONS
VOID
EFIAPI
AsmWriteMm0 (
IN UINT64 Value
)
{
_asm {
movq mm0, qword ptr [Value]
emms
}
}
#endif

View File

@ -0,0 +1,29 @@
/** @file
AsmWriteMm1 function
Copyright (c) 2006, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#if _MSC_EXTENSIONS
VOID
EFIAPI
AsmWriteMm1 (
IN UINT64 Value
)
{
_asm {
movq mm1, qword ptr [Value]
emms
}
}
#endif

View File

@ -0,0 +1,29 @@
/** @file
AsmWriteMm2 function
Copyright (c) 2006, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#if _MSC_EXTENSIONS
VOID
EFIAPI
AsmWriteMm2 (
IN UINT64 Value
)
{
_asm {
movq mm2, qword ptr [Value]
emms
}
}
#endif

View File

@ -0,0 +1,29 @@
/** @file
AsmWriteMm3 function
Copyright (c) 2006, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#if _MSC_EXTENSIONS
VOID
EFIAPI
AsmWriteMm3 (
IN UINT64 Value
)
{
_asm {
movq mm3, qword ptr [Value]
emms
}
}
#endif

View File

@ -0,0 +1,29 @@
/** @file
AsmWriteMm4 function
Copyright (c) 2006, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#if _MSC_EXTENSIONS
VOID
EFIAPI
AsmWriteMm4 (
IN UINT64 Value
)
{
_asm {
movq mm4, qword ptr [Value]
emms
}
}
#endif

View File

@ -0,0 +1,29 @@
/** @file
AsmWriteMm5 function
Copyright (c) 2006, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#if _MSC_EXTENSIONS
VOID
EFIAPI
AsmWriteMm5 (
IN UINT64 Value
)
{
_asm {
movq mm5, qword ptr [Value]
emms
}
}
#endif

View File

@ -0,0 +1,29 @@
/** @file
AsmWriteMm6 function
Copyright (c) 2006, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#if _MSC_EXTENSIONS
VOID
EFIAPI
AsmWriteMm6 (
IN UINT64 Value
)
{
_asm {
movq mm6, qword ptr [Value]
emms
}
}
#endif

View File

@ -0,0 +1,29 @@
/** @file
AsmWriteMm7 function
Copyright (c) 2006, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#if _MSC_EXTENSIONS
VOID
EFIAPI
AsmWriteMm7 (
IN UINT64 Value
)
{
_asm {
movq mm7, qword ptr [Value]
emms
}
}
#endif

View File

@ -0,0 +1,32 @@
/** @file
AsmWriteMsr64 function
Copyright (c) 2006, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#if _MSC_EXTENSIONS
UINT64
EFIAPI
AsmWriteMsr64 (
IN UINT32 Index,
IN UINT64 Value
)
{
_asm {
mov edx, dword ptr [Value + 4]
mov eax, dword ptr [Value + 0]
mov ecx, Index
wrmsr
}
}
#endif