Initial port to x86_64 gnu assembly.
authorbbahnsen <bbahnsen@de2fecce-e211-0410-80a6-f3fac2684e05>
Thu, 16 Nov 2006 01:11:41 +0000 (01:11 +0000)
committerbbahnsen <bbahnsen@de2fecce-e211-0410-80a6-f3fac2684e05>
Thu, 16 Nov 2006 01:11:41 +0000 (01:11 +0000)
git-svn-id: https://edk2.tianocore.org/svn/edk2/trunk@1959 de2fecce-e211-0410-80a6-f3fac2684e05

83 files changed:
edk2/MdePkg/Library/BaseLib/X64/CpuBreakpoint.S [new file with mode: 0644]
edk2/MdePkg/Library/BaseLib/X64/CpuFlushTlb.S [new file with mode: 0644]
edk2/MdePkg/Library/BaseLib/X64/CpuId.S [new file with mode: 0644]
edk2/MdePkg/Library/BaseLib/X64/CpuIdEx.S [new file with mode: 0644]
edk2/MdePkg/Library/BaseLib/X64/CpuPause.S [new file with mode: 0644]
edk2/MdePkg/Library/BaseLib/X64/CpuSleep.S [new file with mode: 0644]
edk2/MdePkg/Library/BaseLib/X64/DisableInterrupts.S [new file with mode: 0644]
edk2/MdePkg/Library/BaseLib/X64/DisablePaging64.S [new file with mode: 0644]
edk2/MdePkg/Library/BaseLib/X64/EnableDisableInterrupts.S [new file with mode: 0644]
edk2/MdePkg/Library/BaseLib/X64/EnableInterrupts.S [new file with mode: 0644]
edk2/MdePkg/Library/BaseLib/X64/EnablePaging64.S [new file with mode: 0644]
edk2/MdePkg/Library/BaseLib/X64/FlushCacheLine.S [new file with mode: 0644]
edk2/MdePkg/Library/BaseLib/X64/FxRestore.S [new file with mode: 0644]
edk2/MdePkg/Library/BaseLib/X64/FxSave.S [new file with mode: 0644]
edk2/MdePkg/Library/BaseLib/X64/InterlockedCompareExchange32.S [new file with mode: 0644]
edk2/MdePkg/Library/BaseLib/X64/InterlockedCompareExchange64.S [new file with mode: 0644]
edk2/MdePkg/Library/BaseLib/X64/InterlockedDecrement.S [new file with mode: 0644]
edk2/MdePkg/Library/BaseLib/X64/InterlockedIncrement.S [new file with mode: 0644]
edk2/MdePkg/Library/BaseLib/X64/Invd.S [new file with mode: 0644]
edk2/MdePkg/Library/BaseLib/X64/LongJump.S [new file with mode: 0644]
edk2/MdePkg/Library/BaseLib/X64/Monitor.S [new file with mode: 0644]
edk2/MdePkg/Library/BaseLib/X64/Mwait.S [new file with mode: 0644]
edk2/MdePkg/Library/BaseLib/X64/ReadCr0.S [new file with mode: 0644]
edk2/MdePkg/Library/BaseLib/X64/ReadCr2.S [new file with mode: 0644]
edk2/MdePkg/Library/BaseLib/X64/ReadCr3.S [new file with mode: 0644]
edk2/MdePkg/Library/BaseLib/X64/ReadCr4.S [new file with mode: 0644]
edk2/MdePkg/Library/BaseLib/X64/ReadCs.S [new file with mode: 0644]
edk2/MdePkg/Library/BaseLib/X64/ReadDr0.S [new file with mode: 0644]
edk2/MdePkg/Library/BaseLib/X64/ReadDr1.S [new file with mode: 0644]
edk2/MdePkg/Library/BaseLib/X64/ReadDr2.S [new file with mode: 0644]
edk2/MdePkg/Library/BaseLib/X64/ReadDr3.S [new file with mode: 0644]
edk2/MdePkg/Library/BaseLib/X64/ReadDr4.S [new file with mode: 0644]
edk2/MdePkg/Library/BaseLib/X64/ReadDr5.S [new file with mode: 0644]
edk2/MdePkg/Library/BaseLib/X64/ReadDr6.S [new file with mode: 0644]
edk2/MdePkg/Library/BaseLib/X64/ReadDr7.S [new file with mode: 0644]
edk2/MdePkg/Library/BaseLib/X64/ReadDs.S [new file with mode: 0644]
edk2/MdePkg/Library/BaseLib/X64/ReadEflags.S [new file with mode: 0644]
edk2/MdePkg/Library/BaseLib/X64/ReadEs.S [new file with mode: 0644]
edk2/MdePkg/Library/BaseLib/X64/ReadFs.S [new file with mode: 0644]
edk2/MdePkg/Library/BaseLib/X64/ReadGdtr.S [new file with mode: 0644]
edk2/MdePkg/Library/BaseLib/X64/ReadGs.S [new file with mode: 0644]
edk2/MdePkg/Library/BaseLib/X64/ReadIdtr.S [new file with mode: 0644]
edk2/MdePkg/Library/BaseLib/X64/ReadLdtr.S [new file with mode: 0644]
edk2/MdePkg/Library/BaseLib/X64/ReadMm0.S [new file with mode: 0644]
edk2/MdePkg/Library/BaseLib/X64/ReadMm1.S [new file with mode: 0644]
edk2/MdePkg/Library/BaseLib/X64/ReadMm2.S [new file with mode: 0644]
edk2/MdePkg/Library/BaseLib/X64/ReadMm3.S [new file with mode: 0644]
edk2/MdePkg/Library/BaseLib/X64/ReadMm4.S [new file with mode: 0644]
edk2/MdePkg/Library/BaseLib/X64/ReadMm5.S [new file with mode: 0644]
edk2/MdePkg/Library/BaseLib/X64/ReadMm6.S [new file with mode: 0644]
edk2/MdePkg/Library/BaseLib/X64/ReadMm7.S [new file with mode: 0644]
edk2/MdePkg/Library/BaseLib/X64/ReadMsr64.S [new file with mode: 0644]
edk2/MdePkg/Library/BaseLib/X64/ReadPmc.S [new file with mode: 0644]
edk2/MdePkg/Library/BaseLib/X64/ReadSs.S [new file with mode: 0644]
edk2/MdePkg/Library/BaseLib/X64/ReadTr.S [new file with mode: 0644]
edk2/MdePkg/Library/BaseLib/X64/ReadTsc.S [new file with mode: 0644]
edk2/MdePkg/Library/BaseLib/X64/SetJump.S [new file with mode: 0644]
edk2/MdePkg/Library/BaseLib/X64/SwitchStack.S [new file with mode: 0644]
edk2/MdePkg/Library/BaseLib/X64/Wbinvd.S [new file with mode: 0644]
edk2/MdePkg/Library/BaseLib/X64/WriteCr0.S [new file with mode: 0644]
edk2/MdePkg/Library/BaseLib/X64/WriteCr2.S [new file with mode: 0644]
edk2/MdePkg/Library/BaseLib/X64/WriteCr3.S [new file with mode: 0644]
edk2/MdePkg/Library/BaseLib/X64/WriteCr4.S [new file with mode: 0644]
edk2/MdePkg/Library/BaseLib/X64/WriteDr0.S [new file with mode: 0644]
edk2/MdePkg/Library/BaseLib/X64/WriteDr1.S [new file with mode: 0644]
edk2/MdePkg/Library/BaseLib/X64/WriteDr2.S [new file with mode: 0644]
edk2/MdePkg/Library/BaseLib/X64/WriteDr3.S [new file with mode: 0644]
edk2/MdePkg/Library/BaseLib/X64/WriteDr4.S [new file with mode: 0644]
edk2/MdePkg/Library/BaseLib/X64/WriteDr5.S [new file with mode: 0644]
edk2/MdePkg/Library/BaseLib/X64/WriteDr6.S [new file with mode: 0644]
edk2/MdePkg/Library/BaseLib/X64/WriteDr7.S [new file with mode: 0644]
edk2/MdePkg/Library/BaseLib/X64/WriteGdtr.S [new file with mode: 0644]
edk2/MdePkg/Library/BaseLib/X64/WriteIdtr.S [new file with mode: 0644]
edk2/MdePkg/Library/BaseLib/X64/WriteLdtr.S [new file with mode: 0644]
edk2/MdePkg/Library/BaseLib/X64/WriteMm0.S [new file with mode: 0644]
edk2/MdePkg/Library/BaseLib/X64/WriteMm1.S [new file with mode: 0644]
edk2/MdePkg/Library/BaseLib/X64/WriteMm2.S [new file with mode: 0644]
edk2/MdePkg/Library/BaseLib/X64/WriteMm3.S [new file with mode: 0644]
edk2/MdePkg/Library/BaseLib/X64/WriteMm4.S [new file with mode: 0644]
edk2/MdePkg/Library/BaseLib/X64/WriteMm5.S [new file with mode: 0644]
edk2/MdePkg/Library/BaseLib/X64/WriteMm6.S [new file with mode: 0644]
edk2/MdePkg/Library/BaseLib/X64/WriteMm7.S [new file with mode: 0644]
edk2/MdePkg/Library/BaseLib/X64/WriteMsr64.S [new file with mode: 0644]

diff --git a/edk2/MdePkg/Library/BaseLib/X64/CpuBreakpoint.S b/edk2/MdePkg/Library/BaseLib/X64/CpuBreakpoint.S
new file mode 100644 (file)
index 0000000..710006b
--- /dev/null
@@ -0,0 +1,25 @@
+#------------------------------------------------------------------------------
+#
+# Copyright (c) 2006, Intel Corporation
+# All rights reserved. This program and the accompanying materials
+# are licensed and made available under the terms and conditions of the BSD License
+# which accompanies this distribution.  The full text of the license may be found at
+# http://opensource.org/licenses/bsd-license.php
+#
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+#
+# Module Name:
+#
+#   CpuBreakpoint.S
+#
+# Abstract:
+#
+#   Implementation of CpuBreakpoint() on x86_64
+#
+#------------------------------------------------------------------------------
+
+.global _CpuBreakpoint
+_CpuBreakpoint:
+       int $0x3
+       ret
diff --git a/edk2/MdePkg/Library/BaseLib/X64/CpuFlushTlb.S b/edk2/MdePkg/Library/BaseLib/X64/CpuFlushTlb.S
new file mode 100644 (file)
index 0000000..2dbaf84
--- /dev/null
@@ -0,0 +1,35 @@
+#------------------------------------------------------------------------------ \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
+#   CpuFlushTlb.Asm\r
+#\r
+# Abstract:\r
+#\r
+#   CpuFlushTlb function\r
+#\r
+# Notes:\r
+#\r
+#------------------------------------------------------------------------------\r
+\r
+.global _CpuFlushTlb\r
+\r
+#------------------------------------------------------------------------------\r
+# VOID\r
+# EFIAPI\r
+# CpuFlushTlb (\r
+#   VOID\r
+#   );\r
+#------------------------------------------------------------------------------\r
+_CpuFlushTlb:\r
+    mov     %cr3, %rax\r
+    mov     %rax, %cr3\r
+    ret\r
diff --git a/edk2/MdePkg/Library/BaseLib/X64/CpuId.S b/edk2/MdePkg/Library/BaseLib/X64/CpuId.S
new file mode 100644 (file)
index 0000000..98d7faa
--- /dev/null
@@ -0,0 +1,60 @@
+#------------------------------------------------------------------------------
+#
+# Copyright (c) 2006, Intel Corporation
+# All rights reserved. This program and the accompanying materials
+# are licensed and made available under the terms and conditions of the BSD License
+# which accompanies this distribution.  The full text of the license may be found at
+# http://opensource.org/licenses/bsd-license.php
+#
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+#
+# Module Name:
+#
+#   CpuId.S
+#
+# Abstract:
+#
+#   AsmCpuid function
+#
+# Notes:
+#
+#------------------------------------------------------------------------------
+
+#------------------------------------------------------------------------------
+#  VOID
+#  EFIAPI
+#  AsmCpuid (
+#    IN   UINT32  RegisterInEax,
+#    OUT  UINT32  *RegisterOutEax  OPTIONAL,
+#    OUT  UINT32  *RegisterOutEbx  OPTIONAL,
+#    OUT  UINT32  *RegisterOutEcx  OPTIONAL,
+#    OUT  UINT32  *RegisterOutEdx  OPTIONAL
+#    )
+#------------------------------------------------------------------------------
+.global _AsmCpuid;
+_AsmCpuid:
+    push    %rbx
+    mov     %ecx, %eax
+    push    %rax                         # save Index on stack
+    push    %rdx
+    cpuid
+    test    %r9, %r9
+    jz      L1
+    mov     %ecx, (%r9)
+L1:
+    pop     %rcx
+    jrcxz   L2
+    mov     %eax, (%rcx)
+L2:
+    mov     %r8, %rcx
+    jrcxz   L3
+    mov     %ebx, (%rcx)
+L3:
+    mov     0x38(%rsp), %rcx
+    jrcxz   L4
+    mov     %edx, (%rcx)
+L4:
+    pop     %rax                         # restore Index to rax as return value
+    pop     %rbx
+    ret
diff --git a/edk2/MdePkg/Library/BaseLib/X64/CpuIdEx.S b/edk2/MdePkg/Library/BaseLib/X64/CpuIdEx.S
new file mode 100644 (file)
index 0000000..e5317e0
--- /dev/null
@@ -0,0 +1,62 @@
+#------------------------------------------------------------------------------
+#
+# Copyright (c) 2006, Intel Corporation
+# All rights reserved. This program and the accompanying materials
+# are licensed and made available under the terms and conditions of the BSD License
+# which accompanies this distribution.  The full text of the license may be found at
+# http://opensource.org/licenses/bsd-license.php
+#
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+#
+# Module Name:
+#
+#   CpuIdEx.Asm
+#
+# Abstract:
+#
+#   AsmCpuidEx function
+#
+# Notes:
+#
+#------------------------------------------------------------------------------
+
+#------------------------------------------------------------------------------
+#  UINT32
+#  EFIAPI
+#  AsmCpuidEx (
+#    IN   UINT32  RegisterInEax,
+#    IN   UINT32  RegisterInEcx,
+#    OUT  UINT32  *RegisterOutEax  OPTIONAL,
+#    OUT  UINT32  *RegisterOutEbx  OPTIONAL,
+#    OUT  UINT32  *RegisterOutEcx  OPTIONAL,
+#    OUT  UINT32  *RegisterOutEdx  OPTIONAL
+#    )
+#------------------------------------------------------------------------------
+.global _AsmCpuidEx
+_AsmCpuidEx:
+    push    %rbx
+    movl    %ecx,%eax
+    movl    %edx,%ecx
+    push    %rax
+    cpuid
+    mov     0x38(%rsp), %r10
+    test    %r10, %r10
+    jz      L1
+    mov     %ecx,(%r10)
+L1: 
+    mov     %r8, %rcx
+    jrcxz   L2
+    movl    %eax,(%rcx)
+L2: 
+    mov     %r9, %rcx
+    jrcxz   L3
+    mov     %ebx, (%rcx)
+L3: 
+    mov     0x40(%rsp), %rcx
+    jrcxz   L4
+    mov     %edx, (%rcx)
+L4: 
+    pop     %rax
+    pop     %rbx
+    ret
diff --git a/edk2/MdePkg/Library/BaseLib/X64/CpuPause.S b/edk2/MdePkg/Library/BaseLib/X64/CpuPause.S
new file mode 100644 (file)
index 0000000..0ecaa85
--- /dev/null
@@ -0,0 +1,34 @@
+#------------------------------------------------------------------------------ ;\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
+#   CpuPause.S\r
+#\r
+# Abstract:\r
+#\r
+#   CpuPause function\r
+#\r
+# Notes:\r
+#\r
+#------------------------------------------------------------------------------\r
+\r
+\r
+#------------------------------------------------------------------------------\r
+# VOID\r
+# EFIAPI\r
+# CpuPause (\r
+#   VOID\r
+#   );\r
+#------------------------------------------------------------------------------\r
+.global _CpuPause;\r
+_CpuPause:\r
+    pause\r
+    ret\r
diff --git a/edk2/MdePkg/Library/BaseLib/X64/CpuSleep.S b/edk2/MdePkg/Library/BaseLib/X64/CpuSleep.S
new file mode 100644 (file)
index 0000000..681e4c1
--- /dev/null
@@ -0,0 +1,34 @@
+#------------------------------------------------------------------------------ ;\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
+#   CpuSleep.S\r
+#\r
+# Abstract:\r
+#\r
+#   CpuSleep function\r
+#\r
+# Notes:\r
+#\r
+#------------------------------------------------------------------------------\r
+\r
+\r
+#------------------------------------------------------------------------------\r
+# VOID\r
+# EFIAPI\r
+# CpuSleep (\r
+#   VOID\r
+#   );\r
+#------------------------------------------------------------------------------\r
+.global _CpuSleep;\r
+_CpuSleep:\r
+    hlt\r
+    ret\r
diff --git a/edk2/MdePkg/Library/BaseLib/X64/DisableInterrupts.S b/edk2/MdePkg/Library/BaseLib/X64/DisableInterrupts.S
new file mode 100644 (file)
index 0000000..da16886
--- /dev/null
@@ -0,0 +1,35 @@
+#------------------------------------------------------------------------------\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
+#   DisableInterrupts.S\r
+#\r
+# Abstract:\r
+#\r
+#   DisableInterrupts function\r
+#\r
+# Notes:\r
+#\r
+#------------------------------------------------------------------------------\r
+\r
+\r
+#------------------------------------------------------------------------------\r
+# VOID\r
+# EFIAPI\r
+# DisableInterrupts (\r
+#   VOID\r
+#   );\r
+#------------------------------------------------------------------------------\r
+.global _DisableInterrupts;\r
+_DisableInterrupts:\r
+    cli\r
+    ret\r
diff --git a/edk2/MdePkg/Library/BaseLib/X64/DisablePaging64.S b/edk2/MdePkg/Library/BaseLib/X64/DisablePaging64.S
new file mode 100644 (file)
index 0000000..d23313d
--- /dev/null
@@ -0,0 +1,66 @@
+#------------------------------------------------------------------------------
+#
+# Copyright (c) 2006, Intel Corporation
+# All rights reserved. This program and the accompanying materials
+# are licensed and made available under the terms and conditions of the BSD License
+# which accompanies this distribution.  The full text of the license may be found at
+# http://opensource.org/licenses/bsd-license.php
+#
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+#
+# Module Name:
+#
+#   DisablePaging64.S
+#
+# Abstract:
+#
+#   AsmDisablePaging64 function
+#
+# Notes:
+#
+#------------------------------------------------------------------------------
+
+    
+
+#------------------------------------------------------------------------------
+# VOID
+# EFIAPI
+# InternalX86DisablePaging64 (
+#   IN      UINT16                    Cs,                      %rdi
+#   IN      UINT64                    EntryPoint,              %rsi
+#   IN      UINT64                    Context1,  OPTIONAL      %rdx
+#   IN      UINT32                    Context2,  OPTIONAL      %rcx
+#   IN      UINT64                    NewStack                 %r8
+#   );
+#------------------------------------------------------------------------------
+
+.global _InternalX86DisablePaging64
+_InternalX86DisablePaging64:
+    cli    
+    shl    $0x20,%rcx
+    lea    (%rip), %eax
+    mov    %eax,%ecx
+    push   %rcx
+    mov    %edx,%ebx
+    mov    %r8d,%esi
+    mov    %r9d,%edi
+    mov    0x28(%rsp),%eax
+    lret   
+L1:
+    mov    %eax,%esp
+    mov    %cr0,%rax
+    btr    $0x1f,%eax
+    mov    %rax,%cr0
+    mov    $0xc0000080,%ecx
+    rdmsr  
+    and    $0xfe,%ah
+    wrmsr  
+    mov    %cr4,%rax
+    and    $0xdf,%al
+    mov    %rax,%cr4
+    push   %rdi
+    push   %rsi
+    callq  *%rbx
+    jmp    .
+
diff --git a/edk2/MdePkg/Library/BaseLib/X64/EnableDisableInterrupts.S b/edk2/MdePkg/Library/BaseLib/X64/EnableDisableInterrupts.S
new file mode 100644 (file)
index 0000000..581b7bb
--- /dev/null
@@ -0,0 +1,37 @@
+#------------------------------------------------------------------------------
+#
+# Copyright (c) 2006, Intel Corporation
+# All rights reserved. This program and the accompanying materials
+# are licensed and made available under the terms and conditions of the BSD License
+# which accompanies this distribution.  The full text of the license may be found at
+# http://opensource.org/licenses/bsd-license.php
+#
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+#
+# Module Name:
+#
+#   EnableDisableInterrupts.S
+#
+# Abstract:
+#
+#   EnableDisableInterrupts function
+#
+# Notes:
+#
+#------------------------------------------------------------------------------
+
+
+#------------------------------------------------------------------------------
+# VOID
+# EFIAPI
+# EnableDisableInterrupts (
+#   VOID
+#   );
+#------------------------------------------------------------------------------
+.global _EnableDisableInterrupts;
+.align 16;
+_EnableDisableInterrupts:
+    sti
+    cli
+    ret
diff --git a/edk2/MdePkg/Library/BaseLib/X64/EnableInterrupts.S b/edk2/MdePkg/Library/BaseLib/X64/EnableInterrupts.S
new file mode 100644 (file)
index 0000000..b81bcd0
--- /dev/null
@@ -0,0 +1,35 @@
+#------------------------------------------------------------------------------
+#
+# Copyright (c) 2006, Intel Corporation
+# All rights reserved. This program and the accompanying materials
+# are licensed and made available under the terms and conditions of the BSD License
+# which accompanies this distribution.  The full text of the license may be found at
+# http://opensource.org/licenses/bsd-license.php
+#
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+#
+# Module Name:
+#
+#   EnableInterrupts.S
+#
+# Abstract:
+#
+#   EnableInterrupts function
+#
+# Notes:
+#
+#------------------------------------------------------------------------------
+
+
+#------------------------------------------------------------------------------
+# VOID
+# EFIAPI
+# EnableInterrupts (
+#   VOID
+#   );
+#------------------------------------------------------------------------------
+.global _EnableInterrupts;
+_EnableInterrupts:
+    sti
+    ret
diff --git a/edk2/MdePkg/Library/BaseLib/X64/EnablePaging64.S b/edk2/MdePkg/Library/BaseLib/X64/EnablePaging64.S
new file mode 100644 (file)
index 0000000..15209c0
--- /dev/null
@@ -0,0 +1,61 @@
+#------------------------------------------------------------------------------
+#
+# Copyright (c) 2006, Intel Corporation
+# All rights reserved. This program and the accompanying materials
+# are licensed and made available under the terms and conditions of the BSD License
+# which accompanies this distribution.  The full text of the license may be found at
+# http://opensource.org/licenses/bsd-license.php
+#
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+#
+# Module Name:
+#
+#   EnablePaging64.S
+#
+# Abstract:
+#
+#   AsmEnablePaging64 function
+#
+# Notes:
+#
+#------------------------------------------------------------------------------
+
+
+#------------------------------------------------------------------------------
+# VOID
+# EFIAPI
+# InternalX86EnablePaging64 (
+#   IN      UINT16                    Cs,                      %rdi
+#   IN      UINT64                    EntryPoint,              %rsi
+#   IN      UINT64                    Context1,  OPTIONAL      %rdx
+#   IN      UINT64                    Context2,  OPTIONAL      %rcx
+#   IN      UINT64                    NewStack                 %r8
+#   );
+#------------------------------------------------------------------------------
+.global _InternalX86EnablePaging64;
+_InternalX86EnablePaging64:
+    cli    
+    pop    %rax
+    callq  Base
+Base:
+    addl   $(L1-Base),(%rsp)
+    mov    %cr4,%rax
+    or     $0x20,%al
+    mov    %rax,%cr4
+    mov    $0xc0000080,%ecx
+    rdmsr  
+    or     $0x1,%ah
+    wrmsr  
+    mov    %cr0,%rax
+    bts    $0x1f,%eax
+    mov    %rax,%cr0
+    lret   
+L1:
+    addr32 mov (%esp),%rbx
+    addr32 mov 0x8(%esp),%rcx
+    addr32 mov 0x10(%esp),%rdx
+    addr32 mov 0x18(%esp),%rsp
+    add    $-0x20,%rsp
+    callq  *%rbx
+    jmp    .
diff --git a/edk2/MdePkg/Library/BaseLib/X64/FlushCacheLine.S b/edk2/MdePkg/Library/BaseLib/X64/FlushCacheLine.S
new file mode 100644 (file)
index 0000000..4c5a52f
--- /dev/null
@@ -0,0 +1,36 @@
+#------------------------------------------------------------------------------
+#
+# Copyright (c) 2006, Intel Corporation
+# All rights reserved. This program and the accompanying materials
+# are licensed and made available under the terms and conditions of the BSD License
+# which accompanies this distribution.  The full text of the license may be found at
+# http://opensource.org/licenses/bsd-license.php
+#
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+#
+# Module Name:
+#
+#   FlushCacheLine.S
+#
+# Abstract:
+#
+#   AsmFlushCacheLine function
+#
+# Notes:
+#
+#------------------------------------------------------------------------------
+
+
+#------------------------------------------------------------------------------
+# VOID *
+# EFIAPI 
+# AsmFlushCacheLine (
+#   IN      VOID                      *LinearAddress
+#   );
+#------------------------------------------------------------------------------
+.global _AsmFlushCacheLine;
+_AsmFlushCacheLine:
+    clflush (%rdi)
+    mov     %rdi, %rax
+    ret
diff --git a/edk2/MdePkg/Library/BaseLib/X64/FxRestore.S b/edk2/MdePkg/Library/BaseLib/X64/FxRestore.S
new file mode 100644 (file)
index 0000000..cc9750c
--- /dev/null
@@ -0,0 +1,35 @@
+#------------------------------------------------------------------------------
+#
+# Copyright (c) 2006, Intel Corporation
+# All rights reserved. This program and the accompanying materials
+# are licensed and made available under the terms and conditions of the BSD License
+# which accompanies this distribution.  The full text of the license may be found at
+# http://opensource.org/licenses/bsd-license.php
+#
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+#
+# Module Name:
+#
+#   FxRestore.S
+#
+# Abstract:
+#
+#   AsmFxRestore function
+#
+# Notes:
+#
+#------------------------------------------------------------------------------
+
+
+#------------------------------------------------------------------------------
+# VOID
+# EFIAPI
+# InternalX86FxRestore (
+#   IN CONST IA32_FX_BUFFER *Buffer
+#   )#
+#------------------------------------------------------------------------------
+.global _InternalX86FxRestore;
+_InternalX86FxRestore:
+    fxrstor (%rcx)
+    ret
diff --git a/edk2/MdePkg/Library/BaseLib/X64/FxSave.S b/edk2/MdePkg/Library/BaseLib/X64/FxSave.S
new file mode 100644 (file)
index 0000000..432d7b9
--- /dev/null
@@ -0,0 +1,35 @@
+#------------------------------------------------------------------------------
+#
+# Copyright (c) 2006, Intel Corporation
+# All rights reserved. This program and the accompanying materials
+# are licensed and made available under the terms and conditions of the BSD License
+# which accompanies this distribution.  The full text of the license may be found at
+# http://opensource.org/licenses/bsd-license.php
+#
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+#
+# Module Name:
+#
+#   FxSave.S
+#
+# Abstract:
+#
+#   AsmFxSave function
+#
+# Notes:
+#
+#------------------------------------------------------------------------------
+
+
+#------------------------------------------------------------------------------
+# VOID
+# EFIAPI
+# InternalX86FxSave (
+#   OUT IA32_FX_BUFFER *Buffer
+#   );
+#------------------------------------------------------------------------------
+.global _InternalX86FxSave;
+_InternalX86FxSave:
+    fxsave  (%rcx)
+    ret
diff --git a/edk2/MdePkg/Library/BaseLib/X64/InterlockedCompareExchange32.S b/edk2/MdePkg/Library/BaseLib/X64/InterlockedCompareExchange32.S
new file mode 100644 (file)
index 0000000..cd85279
--- /dev/null
@@ -0,0 +1,37 @@
+#------------------------------------------------------------------------------\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
+#   InterlockedCompareExchange32.Asm\r
+#\r
+# Abstract:\r
+#\r
+#   InterlockedCompareExchange32 function\r
+#\r
+# Notes:\r
+#\r
+#------------------------------------------------------------------------------\r
+\r
+#------------------------------------------------------------------------------\r
+# UINT32\r
+# EFIAPI\r
+# InterlockedCompareExchange32 (\r
+#   IN      UINT32                    *Value,\r
+#   IN      UINT32                    CompareValue,\r
+#   IN      UINT32                    ExchangeValue\r
+#   );\r
+#------------------------------------------------------------------------------\r
+.global _InternalSyncCompareExchange32;\r
+_InternalSyncCompareExchange32:\r
+    mov     %edx, %eax\r
+    lock    cmpxchg %r8d, (%rcx)\r
+    ret\r
diff --git a/edk2/MdePkg/Library/BaseLib/X64/InterlockedCompareExchange64.S b/edk2/MdePkg/Library/BaseLib/X64/InterlockedCompareExchange64.S
new file mode 100644 (file)
index 0000000..ae27964
--- /dev/null
@@ -0,0 +1,39 @@
+#------------------------------------------------------------------------------
+#
+# Copyright (c) 2006, Intel Corporation
+# All rights reserved. This program and the accompanying materials
+# are licensed and made available under the terms and conditions of the BSD License
+# which accompanies this distribution.  The full text of the license may be found at
+# http://opensource.org/licenses/bsd-license.php
+#
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+#
+# Module Name:
+#
+#   InterlockedCompareExchange64.S
+#
+# Abstract:
+#
+#   InterlockedCompareExchange64 function
+#
+# Notes:
+#
+#------------------------------------------------------------------------------
+
+
+#------------------------------------------------------------------------------
+# UINT64
+# EFIAPI
+# InterlockedCompareExchange64 (
+#   IN      UINT64                    *Value,
+#   IN      UINT64                    CompareValue,
+#   IN      UINT64                    ExchangeValue
+#   );
+#------------------------------------------------------------------------------
+.global _InternalSyncCompareExchange64;
+.align 16;
+_InternalSyncCompareExchange64:
+    mov     %rsi, %rax
+    lock    cmpxchg %rdx,(%rdi)
+    ret
diff --git a/edk2/MdePkg/Library/BaseLib/X64/InterlockedDecrement.S b/edk2/MdePkg/Library/BaseLib/X64/InterlockedDecrement.S
new file mode 100644 (file)
index 0000000..59ca54b
--- /dev/null
@@ -0,0 +1,36 @@
+#------------------------------------------------------------------------------
+#
+# Copyright (c) 2006, Intel Corporation
+# All rights reserved. This program and the accompanying materials
+# are licensed and made available under the terms and conditions of the BSD License
+# which accompanies this distribution.  The full text of the license may be found at
+# http://opensource.org/licenses/bsd-license.php
+#
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+#
+# Module Name:
+#
+#   InterlockedDecrement.S
+#
+# Abstract:
+#
+#   InterlockedDecrement function
+#
+# Notes:
+#
+#------------------------------------------------------------------------------
+
+
+#------------------------------------------------------------------------------
+# UINT32
+# EFIAPI
+# InterlockedDecrement (
+#   IN      UINT32                    *Value
+#   );
+#------------------------------------------------------------------------------
+.global _InternalSyncDecrement;
+_InternalSyncDecrement:
+    lock    decl (%rcx)
+    mov     (%rcx), %eax
+    ret
diff --git a/edk2/MdePkg/Library/BaseLib/X64/InterlockedIncrement.S b/edk2/MdePkg/Library/BaseLib/X64/InterlockedIncrement.S
new file mode 100644 (file)
index 0000000..df4cb97
--- /dev/null
@@ -0,0 +1,36 @@
+#------------------------------------------------------------------------------
+#
+# Copyright (c) 2006, Intel Corporation
+# All rights reserved. This program and the accompanying materials
+# are licensed and made available under the terms and conditions of the BSD License
+# which accompanies this distribution.  The full text of the license may be found at
+# http://opensource.org/licenses/bsd-license.php
+#
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+#
+# Module Name:
+#
+#   InterlockedIncrement.S
+#
+# Abstract:
+#
+#   InterlockedIncrement function
+#
+# Notes:
+#
+#------------------------------------------------------------------------------
+
+
+#------------------------------------------------------------------------------
+# UINT32
+# EFIAPI
+# InterlockedIncrement (
+#   IN      UINT32                    *Value
+#   );
+#------------------------------------------------------------------------------
+.global _InternalSyncIncrement;
+_InternalSyncIncrement:
+    lock    incl  (%rcx)
+    mov     (%rcx), %eax
+    ret
diff --git a/edk2/MdePkg/Library/BaseLib/X64/Invd.S b/edk2/MdePkg/Library/BaseLib/X64/Invd.S
new file mode 100644 (file)
index 0000000..030ae45
--- /dev/null
@@ -0,0 +1,35 @@
+#------------------------------------------------------------------------------
+#
+# Copyright (c) 2006, Intel Corporation
+# All rights reserved. This program and the accompanying materials
+# are licensed and made available under the terms and conditions of the BSD License
+# which accompanies this distribution.  The full text of the license may be found at
+# http://opensource.org/licenses/bsd-license.php
+#
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+#
+# Module Name:
+#
+#   Invd.S
+#
+# Abstract:
+#
+#   AsmInvd function
+#
+# Notes:
+#
+#------------------------------------------------------------------------------
+
+
+#------------------------------------------------------------------------------
+# VOID
+# EFIAPI
+# AsmInvd (
+#   VOID
+#   )#
+#------------------------------------------------------------------------------
+.global _AsmInvd;
+_AsmInvd:
+    invd
+    ret
diff --git a/edk2/MdePkg/Library/BaseLib/X64/LongJump.S b/edk2/MdePkg/Library/BaseLib/X64/LongJump.S
new file mode 100644 (file)
index 0000000..1a6f859
--- /dev/null
@@ -0,0 +1,42 @@
+#------------------------------------------------------------------------------\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
+#   LongJump.Asm\r
+#\r
+# Abstract:\r
+#\r
+#   Implementation of _LongJump() on x64.\r
+#\r
+#------------------------------------------------------------------------------\r
+\r
+#------------------------------------------------------------------------------\r
+# VOID\r
+# EFIAPI\r
+# InternalLongJump (\r
+#   IN      BASE_LIBRARY_JUMP_BUFFER  *JumpBuffer,\r
+#   IN      UINTN                     Value\r
+#   );\r
+#------------------------------------------------------------------------------\r
+.global _InternalLongJump\r
+_InternalLongJump:\r
+    mov     (%rcx), %rbx\r
+    mov     0x8(%rcx), %rsp\r
+    mov     0x10(%rcx), %rbp\r
+    mov     0x18(%rcx), %rdi\r
+    mov     0x20(%rcx), %rsi\r
+    mov     0x28(%rcx), %r12\r
+    mov     0x30(%rcx), %r13\r
+    mov     0x38(%rcx), %r14\r
+    mov     0x40(%rcx), %r15\r
+    mov     %rdx, %rax\r
+    jmp     *0x48(%rcx)\r
diff --git a/edk2/MdePkg/Library/BaseLib/X64/Monitor.S b/edk2/MdePkg/Library/BaseLib/X64/Monitor.S
new file mode 100644 (file)
index 0000000..13da27d
--- /dev/null
@@ -0,0 +1,41 @@
+#------------------------------------------------------------------------------
+#
+# Copyright (c) 2006, Intel Corporation
+# All rights reserved. This program and the accompanying materials
+# are licensed and made available under the terms and conditions of the BSD License
+# which accompanies this distribution.  The full text of the license may be found at
+# http://opensource.org/licenses/bsd-license.php
+#
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+#
+# Module Name:
+#
+#   Monitor.S
+#
+# Abstract:
+#
+#   AsmMonitor function
+#
+# Notes:
+#
+#------------------------------------------------------------------------------
+
+
+#------------------------------------------------------------------------------
+# UINT64
+# EFIAPI
+# AsmMonitor (
+#   IN      UINTN                     Eax,
+#   IN      UINTN                     Ecx,
+#   IN      UINTN                     Edx
+#   );
+#------------------------------------------------------------------------------
+.global _AsmMonitor;
+.align 16;
+_AsmMonitor:
+    mov    %ecx,%eax
+    mov    %edx,%ecx
+    mov    %r8d,%edx
+    monitor
+    ret
diff --git a/edk2/MdePkg/Library/BaseLib/X64/Mwait.S b/edk2/MdePkg/Library/BaseLib/X64/Mwait.S
new file mode 100644 (file)
index 0000000..a32d004
--- /dev/null
@@ -0,0 +1,39 @@
+#------------------------------------------------------------------------------
+#
+# Copyright (c) 2006, Intel Corporation
+# All rights reserved. This program and the accompanying materials
+# are licensed and made available under the terms and conditions of the BSD License
+# which accompanies this distribution.  The full text of the license may be found at
+# http://opensource.org/licenses/bsd-license.php
+#
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+#
+# Module Name:
+#
+#   Mwait.S
+#
+# Abstract:
+#
+#   AsmMwait function
+#
+# Notes:
+#
+#------------------------------------------------------------------------------
+
+
+#------------------------------------------------------------------------------
+# UINT64
+# EFIAPI
+# AsmMwait (
+#   IN      UINTN                     Eax,
+#   IN      UINTN                     Ecx
+#   );
+#------------------------------------------------------------------------------
+.global _AsmMwait;
+.align 16;
+_AsmMwait:
+    mov    %ecx,%eax
+    mov    %edx,%ecx
+    mwait  %rax,%rcx
+    ret
diff --git a/edk2/MdePkg/Library/BaseLib/X64/ReadCr0.S b/edk2/MdePkg/Library/BaseLib/X64/ReadCr0.S
new file mode 100644 (file)
index 0000000..fa916d0
--- /dev/null
@@ -0,0 +1,36 @@
+#------------------------------------------------------------------------------
+#
+# Copyright (c) 2006, Intel Corporation
+# All rights reserved. This program and the accompanying materials
+# are licensed and made available under the terms and conditions of the BSD License
+# which accompanies this distribution.  The full text of the license may be found at
+# http://opensource.org/licenses/bsd-license.php
+#
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+#
+# Module Name:
+#
+#   ReadCr0.S
+#
+# Abstract:
+#
+#   AsmReadCr0 function
+#
+# Notes:
+#
+#------------------------------------------------------------------------------
+
+
+#------------------------------------------------------------------------------
+# UINTN
+# EFIAPI
+# AsmReadCr0 (
+#   VOID
+#   );
+#------------------------------------------------------------------------------
+.global _AsmReadCr0;
+.align 16;
+_AsmReadCr0:
+    mov     %cr0, %rax
+    ret
diff --git a/edk2/MdePkg/Library/BaseLib/X64/ReadCr2.S b/edk2/MdePkg/Library/BaseLib/X64/ReadCr2.S
new file mode 100644 (file)
index 0000000..96361be
--- /dev/null
@@ -0,0 +1,36 @@
+#------------------------------------------------------------------------------
+#
+# Copyright (c) 2006, Intel Corporation
+# All rights reserved. This program and the accompanying materials
+# are licensed and made available under the terms and conditions of the BSD License
+# which accompanies this distribution.  The full text of the license may be found at
+# http://opensource.org/licenses/bsd-license.php
+#
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+#
+# Module Name:
+#
+#   ReadCr2.S
+#
+# Abstract:
+#
+#   AsmReadCr2 function
+#
+# Notes:
+#
+#------------------------------------------------------------------------------
+
+
+#------------------------------------------------------------------------------
+# UINTN
+# EFIAPI
+# AsmReadCr2 (
+#   VOID
+#   );
+#------------------------------------------------------------------------------
+.global _AsmReadCr2;
+.align 16;
+_AsmReadCr2:
+    mov     %cr2, %rax
+    ret
diff --git a/edk2/MdePkg/Library/BaseLib/X64/ReadCr3.S b/edk2/MdePkg/Library/BaseLib/X64/ReadCr3.S
new file mode 100644 (file)
index 0000000..480486f
--- /dev/null
@@ -0,0 +1,36 @@
+#------------------------------------------------------------------------------
+#
+# Copyright (c) 2006, Intel Corporation
+# All rights reserved. This program and the accompanying materials
+# are licensed and made available under the terms and conditions of the BSD License
+# which accompanies this distribution.  The full text of the license may be found at
+# http://opensource.org/licenses/bsd-license.php
+#
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+#
+# Module Name:
+#
+#   ReadCr3.S
+#
+# Abstract:
+#
+#   AsmReadCr3 function
+#
+# Notes:
+#
+#------------------------------------------------------------------------------
+
+
+#------------------------------------------------------------------------------
+# UINTN
+# EFIAPI
+# AsmReadCr3 (
+#   VOID
+#   );
+#------------------------------------------------------------------------------
+.global _AsmReadCr3;
+.align 16;
+_AsmReadCr3:
+    mov     %cr3, %rax
+    ret
diff --git a/edk2/MdePkg/Library/BaseLib/X64/ReadCr4.S b/edk2/MdePkg/Library/BaseLib/X64/ReadCr4.S
new file mode 100644 (file)
index 0000000..e89b5cd
--- /dev/null
@@ -0,0 +1,36 @@
+#------------------------------------------------------------------------------
+#
+# Copyright (c) 2006, Intel Corporation
+# All rights reserved. This program and the accompanying materials
+# are licensed and made available under the terms and conditions of the BSD License
+# which accompanies this distribution.  The full text of the license may be found at
+# http://opensource.org/licenses/bsd-license.php
+#
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+#
+# Module Name:
+#
+#   ReadCr4.S
+#
+# Abstract:
+#
+#   AsmReadCr4 function
+#
+# Notes:
+#
+#------------------------------------------------------------------------------
+
+
+#------------------------------------------------------------------------------
+# UINTN
+# EFIAPI
+# AsmReadCr4 (
+#   VOID
+#   );
+#------------------------------------------------------------------------------
+.global _AsmReadCr4;
+.align 16;
+_AsmReadCr4:
+    mov     %cr4, %rax
+    ret
diff --git a/edk2/MdePkg/Library/BaseLib/X64/ReadCs.S b/edk2/MdePkg/Library/BaseLib/X64/ReadCs.S
new file mode 100644 (file)
index 0000000..677747b
--- /dev/null
@@ -0,0 +1,36 @@
+#------------------------------------------------------------------------------
+#
+# Copyright (c) 2006, Intel Corporation
+# All rights reserved. This program and the accompanying materials
+# are licensed and made available under the terms and conditions of the BSD License
+# which accompanies this distribution.  The full text of the license may be found at
+# http://opensource.org/licenses/bsd-license.php
+#
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+#
+# Module Name:
+#
+#   ReadCs.S
+#
+# Abstract:
+#
+#   AsmReadCs function
+#
+# Notes:
+#
+#------------------------------------------------------------------------------
+
+
+#------------------------------------------------------------------------------
+# UINT16
+# EFIAPI
+# AsmReadCs (
+#   VOID
+#   );
+#------------------------------------------------------------------------------
+.global _AsmReadCs;
+.align 16;
+_AsmReadCs:
+    mov     %cs, %eax
+    ret
diff --git a/edk2/MdePkg/Library/BaseLib/X64/ReadDr0.S b/edk2/MdePkg/Library/BaseLib/X64/ReadDr0.S
new file mode 100644 (file)
index 0000000..1b441c3
--- /dev/null
@@ -0,0 +1,36 @@
+#------------------------------------------------------------------------------
+#
+# Copyright (c) 2006, Intel Corporation
+# All rights reserved. This program and the accompanying materials
+# are licensed and made available under the terms and conditions of the BSD License
+# which accompanies this distribution.  The full text of the license may be found at
+# http://opensource.org/licenses/bsd-license.php
+#
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+#
+# Module Name:
+#
+#   ReadDr0.S
+#
+# Abstract:
+#
+#   AsmReadDr0 function
+#
+# Notes:
+#
+#------------------------------------------------------------------------------
+
+
+#------------------------------------------------------------------------------
+# UINTN
+# EFIAPI
+# AsmReadDr0 (
+#   VOID
+#   );
+#------------------------------------------------------------------------------
+.global _AsmReadDr0;
+.align 16;
+_AsmReadDr0:
+    mov     %dr0, %rax
+    ret
diff --git a/edk2/MdePkg/Library/BaseLib/X64/ReadDr1.S b/edk2/MdePkg/Library/BaseLib/X64/ReadDr1.S
new file mode 100644 (file)
index 0000000..5151a80
--- /dev/null
@@ -0,0 +1,36 @@
+#------------------------------------------------------------------------------
+#
+# Copyright (c) 2006, Intel Corporation
+# All rights reserved. This program and the accompanying materials
+# are licensed and made available under the terms and conditions of the BSD License
+# which accompanies this distribution.  The full text of the license may be found at
+# http://opensource.org/licenses/bsd-license.php
+#
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+#
+# Module Name:
+#
+#   ReadDr1.S
+#
+# Abstract:
+#
+#   AsmReadDr1 function
+#
+# Notes:
+#
+#------------------------------------------------------------------------------
+
+
+#------------------------------------------------------------------------------
+# UINTN
+# EFIAPI
+# AsmReadDr1 (
+#   VOID
+#   );
+#------------------------------------------------------------------------------
+.global _AsmReadDr1;
+.align 16;
+_AsmReadDr1:
+    mov     %dr1, %rax
+    ret
diff --git a/edk2/MdePkg/Library/BaseLib/X64/ReadDr2.S b/edk2/MdePkg/Library/BaseLib/X64/ReadDr2.S
new file mode 100644 (file)
index 0000000..f4516af
--- /dev/null
@@ -0,0 +1,36 @@
+#------------------------------------------------------------------------------
+#
+# Copyright (c) 2006, Intel Corporation
+# All rights reserved. This program and the accompanying materials
+# are licensed and made available under the terms and conditions of the BSD License
+# which accompanies this distribution.  The full text of the license may be found at
+# http://opensource.org/licenses/bsd-license.php
+#
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+#
+# Module Name:
+#
+#   ReadDr2.S
+#
+# Abstract:
+#
+#   AsmReadDr2 function
+#
+# Notes:
+#
+#------------------------------------------------------------------------------
+
+
+#------------------------------------------------------------------------------
+# UINTN
+# EFIAPI
+# AsmReadDr2 (
+#   VOID
+#   );
+#------------------------------------------------------------------------------
+.global _AsmReadDr2;
+.align 16;
+_AsmReadDr2:
+    mov     %dr2, %rax
+    ret
diff --git a/edk2/MdePkg/Library/BaseLib/X64/ReadDr3.S b/edk2/MdePkg/Library/BaseLib/X64/ReadDr3.S
new file mode 100644 (file)
index 0000000..c5c679c
--- /dev/null
@@ -0,0 +1,36 @@
+#------------------------------------------------------------------------------
+#
+# Copyright (c) 2006, Intel Corporation
+# All rights reserved. This program and the accompanying materials
+# are licensed and made available under the terms and conditions of the BSD License
+# which accompanies this distribution.  The full text of the license may be found at
+# http://opensource.org/licenses/bsd-license.php
+#
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+#
+# Module Name:
+#
+#   ReadDr3.S
+#
+# Abstract:
+#
+#   AsmReadDr3 function
+#
+# Notes:
+#
+#------------------------------------------------------------------------------
+
+
+#------------------------------------------------------------------------------
+# UINTN
+# EFIAPI
+# AsmReadDr3 (
+#   VOID
+#   );
+#------------------------------------------------------------------------------
+.global _AsmReadDr3;
+.align 16;
+_AsmReadDr3:
+    mov     %dr3, %rax
+    ret
diff --git a/edk2/MdePkg/Library/BaseLib/X64/ReadDr4.S b/edk2/MdePkg/Library/BaseLib/X64/ReadDr4.S
new file mode 100644 (file)
index 0000000..f98c9ed
--- /dev/null
@@ -0,0 +1,37 @@
+#------------------------------------------------------------------------------
+#
+# Copyright (c) 2006, Intel Corporation
+# All rights reserved. This program and the accompanying materials
+# are licensed and made available under the terms and conditions of the BSD License
+# which accompanies this distribution.  The full text of the license may be found at
+# http://opensource.org/licenses/bsd-license.php
+#
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+#
+# Module Name:
+#
+#   ReadDr4.S
+#
+# Abstract:
+#
+#   AsmReadDr4 function
+#
+# Notes:
+#
+#------------------------------------------------------------------------------
+
+
+#------------------------------------------------------------------------------
+# UINTN
+# EFIAPI
+# AsmReadDr4 (
+#   VOID
+#   );
+#------------------------------------------------------------------------------
+.global _AsmReadDr4;
+.align 16;
+_AsmReadDr4:
+    #DB      0fh, 21h, 0e0h
+    mov     %dr4, %rax
+    ret
diff --git a/edk2/MdePkg/Library/BaseLib/X64/ReadDr5.S b/edk2/MdePkg/Library/BaseLib/X64/ReadDr5.S
new file mode 100644 (file)
index 0000000..421f57a
--- /dev/null
@@ -0,0 +1,36 @@
+#------------------------------------------------------------------------------
+#
+# Copyright (c) 2006, Intel Corporation
+# All rights reserved. This program and the accompanying materials
+# are licensed and made available under the terms and conditions of the BSD License
+# which accompanies this distribution.  The full text of the license may be found at
+# http://opensource.org/licenses/bsd-license.php
+#
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+#
+# Module Name:
+#
+#   ReadDr5.S
+#
+# Abstract:
+#
+#   AsmReadDr5 function
+#
+# Notes:
+#
+#------------------------------------------------------------------------------
+
+
+#------------------------------------------------------------------------------
+# UINTN
+# EFIAPI
+# AsmReadDr5 (
+#   VOID
+#   );
+#------------------------------------------------------------------------------
+.global _AsmReadDr5;
+.align 16;
+_AsmReadDr5:
+    mov        %dr5, %rax
+    ret
diff --git a/edk2/MdePkg/Library/BaseLib/X64/ReadDr6.S b/edk2/MdePkg/Library/BaseLib/X64/ReadDr6.S
new file mode 100644 (file)
index 0000000..6a159d8
--- /dev/null
@@ -0,0 +1,36 @@
+#------------------------------------------------------------------------------
+#
+# Copyright (c) 2006, Intel Corporation
+# All rights reserved. This program and the accompanying materials
+# are licensed and made available under the terms and conditions of the BSD License
+# which accompanies this distribution.  The full text of the license may be found at
+# http://opensource.org/licenses/bsd-license.php
+#
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+#
+# Module Name:
+#
+#   ReadDr6.S
+#
+# Abstract:
+#
+#   AsmReadDr6 function
+#
+# Notes:
+#
+#------------------------------------------------------------------------------
+
+
+#------------------------------------------------------------------------------
+# UINTN
+# EFIAPI
+# AsmReadDr6 (
+#   VOID
+#   );
+#------------------------------------------------------------------------------
+.global _AsmReadDr6;
+.align 16;
+_AsmReadDr6:
+    mov        %dr6, %rax
+    ret
diff --git a/edk2/MdePkg/Library/BaseLib/X64/ReadDr7.S b/edk2/MdePkg/Library/BaseLib/X64/ReadDr7.S
new file mode 100644 (file)
index 0000000..9ffb09d
--- /dev/null
@@ -0,0 +1,36 @@
+#------------------------------------------------------------------------------
+#
+# Copyright (c) 2006, Intel Corporation
+# All rights reserved. This program and the accompanying materials
+# are licensed and made available under the terms and conditions of the BSD License
+# which accompanies this distribution.  The full text of the license may be found at
+# http://opensource.org/licenses/bsd-license.php
+#
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+#
+# Module Name:
+#
+#   ReadDr7.S
+#
+# Abstract:
+#
+#   AsmReadDr7 function
+#
+# Notes:
+#
+#------------------------------------------------------------------------------
+
+
+#------------------------------------------------------------------------------
+# UINTN
+# EFIAPI
+# AsmReadDr7 (
+#   VOID
+#   );
+#------------------------------------------------------------------------------
+.global _AsmReadDr7;
+.align 16;
+_AsmReadDr7:
+    mov        %dr7, %rax
+    ret
diff --git a/edk2/MdePkg/Library/BaseLib/X64/ReadDs.S b/edk2/MdePkg/Library/BaseLib/X64/ReadDs.S
new file mode 100644 (file)
index 0000000..58bee11
--- /dev/null
@@ -0,0 +1,36 @@
+#------------------------------------------------------------------------------
+#
+# Copyright (c) 2006, Intel Corporation
+# All rights reserved. This program and the accompanying materials
+# are licensed and made available under the terms and conditions of the BSD License
+# which accompanies this distribution.  The full text of the license may be found at
+# http://opensource.org/licenses/bsd-license.php
+#
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+#
+# Module Name:
+#
+#   ReadDs.S
+#
+# Abstract:
+#
+#   AsmReadDs function
+#
+# Notes:
+#
+#------------------------------------------------------------------------------
+
+
+#------------------------------------------------------------------------------
+# UINT16
+# EFIAPI
+# AsmReadDs (
+#   VOID
+#   );
+#------------------------------------------------------------------------------
+.global _AsmReadDs;
+.align 16;
+_AsmReadDs:
+    movl       %ds, %eax
+    ret
diff --git a/edk2/MdePkg/Library/BaseLib/X64/ReadEflags.S b/edk2/MdePkg/Library/BaseLib/X64/ReadEflags.S
new file mode 100644 (file)
index 0000000..e895387
--- /dev/null
@@ -0,0 +1,37 @@
+#------------------------------------------------------------------------------
+#
+# Copyright (c) 2006, Intel Corporation
+# All rights reserved. This program and the accompanying materials
+# are licensed and made available under the terms and conditions of the BSD License
+# which accompanies this distribution.  The full text of the license may be found at
+# http://opensource.org/licenses/bsd-license.php
+#
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+#
+# Module Name:
+#
+#   ReadEflags.S
+#
+# Abstract:
+#
+#   AsmReadEflags function
+#
+# Notes:
+#
+#------------------------------------------------------------------------------
+
+
+#------------------------------------------------------------------------------
+# UINTN
+# EFIAPI
+# AsmReadEflags (
+#   VOID
+#   );
+#------------------------------------------------------------------------------
+.global _AsmReadEflags;
+.align 16;
+_AsmReadEflags:
+    pushfq
+    pop     %rax
+    ret
diff --git a/edk2/MdePkg/Library/BaseLib/X64/ReadEs.S b/edk2/MdePkg/Library/BaseLib/X64/ReadEs.S
new file mode 100644 (file)
index 0000000..93df650
--- /dev/null
@@ -0,0 +1,36 @@
+#------------------------------------------------------------------------------
+#
+# Copyright (c) 2006, Intel Corporation
+# All rights reserved. This program and the accompanying materials
+# are licensed and made available under the terms and conditions of the BSD License
+# which accompanies this distribution.  The full text of the license may be found at
+# http://opensource.org/licenses/bsd-license.php
+#
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+#
+# Module Name:
+#
+#   ReadEs.S
+#
+# Abstract:
+#
+#   AsmReadEs function
+#
+# Notes:
+#
+#------------------------------------------------------------------------------
+
+
+#------------------------------------------------------------------------------
+# UINT16
+# EFIAPI
+# AsmReadEs (
+#   VOID
+#   );
+#------------------------------------------------------------------------------
+.global _AsmReadEs;
+.align 16;
+_AsmReadEs:
+    mov     %es, %eax
+    ret
diff --git a/edk2/MdePkg/Library/BaseLib/X64/ReadFs.S b/edk2/MdePkg/Library/BaseLib/X64/ReadFs.S
new file mode 100644 (file)
index 0000000..ff658e1
--- /dev/null
@@ -0,0 +1,36 @@
+#------------------------------------------------------------------------------
+#
+# Copyright (c) 2006, Intel Corporation
+# All rights reserved. This program and the accompanying materials
+# are licensed and made available under the terms and conditions of the BSD License
+# which accompanies this distribution.  The full text of the license may be found at
+# http://opensource.org/licenses/bsd-license.php
+#
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+#
+# Module Name:
+#
+#   ReadFs.S
+#
+# Abstract:
+#
+#   AsmReadFs function
+#
+# Notes:
+#
+#------------------------------------------------------------------------------
+
+
+#------------------------------------------------------------------------------
+# UINT16
+# EFIAPI
+# AsmReadFs (
+#   VOID
+#   );
+#------------------------------------------------------------------------------
+.global _AsmReadFs;
+.align 16;
+_AsmReadFs:
+    mov     %fs, %eax
+    ret
diff --git a/edk2/MdePkg/Library/BaseLib/X64/ReadGdtr.S b/edk2/MdePkg/Library/BaseLib/X64/ReadGdtr.S
new file mode 100644 (file)
index 0000000..c271a02
--- /dev/null
@@ -0,0 +1,36 @@
+#------------------------------------------------------------------------------
+#
+# Copyright (c) 2006, Intel Corporation
+# All rights reserved. This program and the accompanying materials
+# are licensed and made available under the terms and conditions of the BSD License
+# which accompanies this distribution.  The full text of the license may be found at
+# http://opensource.org/licenses/bsd-license.php
+#
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+#
+# Module Name:
+#
+#   ReadGdtr.S
+#
+# Abstract:
+#
+#   AsmReadGdtr function
+#
+# Notes:
+#
+#------------------------------------------------------------------------------
+
+
+#------------------------------------------------------------------------------
+# VOID
+# EFIAPI
+# InternalX86ReadGdtr (
+#   OUT IA32_DESCRIPTOR  *Gdtr
+#   );
+#------------------------------------------------------------------------------
+.global _InternalX86ReadGdtr;
+.align 16;
+_InternalX86ReadGdtr:
+    sgdt  (%rcx)
+    ret
diff --git a/edk2/MdePkg/Library/BaseLib/X64/ReadGs.S b/edk2/MdePkg/Library/BaseLib/X64/ReadGs.S
new file mode 100644 (file)
index 0000000..f92776c
--- /dev/null
@@ -0,0 +1,36 @@
+#------------------------------------------------------------------------------
+#
+# Copyright (c) 2006, Intel Corporation
+# All rights reserved. This program and the accompanying materials
+# are licensed and made available under the terms and conditions of the BSD License
+# which accompanies this distribution.  The full text of the license may be found at
+# http://opensource.org/licenses/bsd-license.php
+#
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+#
+# Module Name:
+#
+#   ReadGs.S
+#
+# Abstract:
+#
+#   AsmReadGs function
+#
+# Notes:
+#
+#------------------------------------------------------------------------------
+
+
+#------------------------------------------------------------------------------
+# UINT16
+# EFIAPI
+# AsmReadGs (
+#   VOID
+#   );
+#------------------------------------------------------------------------------
+.global _AsmReadGs;
+.align 16;
+_AsmReadGs:
+    mov     %gs, %eax
+    ret
diff --git a/edk2/MdePkg/Library/BaseLib/X64/ReadIdtr.S b/edk2/MdePkg/Library/BaseLib/X64/ReadIdtr.S
new file mode 100644 (file)
index 0000000..cd7c09e
--- /dev/null
@@ -0,0 +1,36 @@
+#------------------------------------------------------------------------------
+#
+# Copyright (c) 2006, Intel Corporation
+# All rights reserved. This program and the accompanying materials
+# are licensed and made available under the terms and conditions of the BSD License
+# which accompanies this distribution.  The full text of the license may be found at
+# http://opensource.org/licenses/bsd-license.php
+#
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+#
+# Module Name:
+#
+#   ReadIdtr.AS
+#
+# Abstract:
+#
+#   AsmReadIdtr function
+#
+# Notes:
+#
+#------------------------------------------------------------------------------
+
+
+#------------------------------------------------------------------------------
+# VOID
+# EFIAPI
+# InternalX86ReadIdtr (
+#   OUT     IA32_DESCRIPTOR           *Idtr
+#   );
+#------------------------------------------------------------------------------
+.global _InternalX86ReadIdtr;
+.align 16;
+_InternalX86ReadIdtr:
+    sidt    (%rcx)
+    ret
diff --git a/edk2/MdePkg/Library/BaseLib/X64/ReadLdtr.S b/edk2/MdePkg/Library/BaseLib/X64/ReadLdtr.S
new file mode 100644 (file)
index 0000000..fac8e25
--- /dev/null
@@ -0,0 +1,36 @@
+#------------------------------------------------------------------------------
+#
+# Copyright (c) 2006, Intel Corporation
+# All rights reserved. This program and the accompanying materials
+# are licensed and made available under the terms and conditions of the BSD License
+# which accompanies this distribution.  The full text of the license may be found at
+# http://opensource.org/licenses/bsd-license.php
+#
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+#
+# Module Name:
+#
+#   ReadLdtr.AS
+#
+# Abstract:
+#
+#   AsmReadLdtr function
+#
+# Notes:
+#
+#------------------------------------------------------------------------------
+
+
+#------------------------------------------------------------------------------
+# UINT16
+# EFIAPI
+# AsmReadLdtr (
+#   VOID
+#   );
+#------------------------------------------------------------------------------
+.global _AsmReadLdtr;
+.align 16;
+_AsmReadLdtr:
+    sldt    %eax
+    ret
diff --git a/edk2/MdePkg/Library/BaseLib/X64/ReadMm0.S b/edk2/MdePkg/Library/BaseLib/X64/ReadMm0.S
new file mode 100644 (file)
index 0000000..b5912ca
--- /dev/null
@@ -0,0 +1,37 @@
+#------------------------------------------------------------------------------
+#
+# Copyright (c) 2006, Intel Corporation
+# All rights reserved. This program and the accompanying materials
+# are licensed and made available under the terms and conditions of the BSD License
+# which accompanies this distribution.  The full text of the license may be found at
+# http://opensource.org/licenses/bsd-license.php
+#
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+#
+# Module Name:
+#
+#   ReadMm0.S
+#
+# Abstract:
+#
+#   AsmReadMm0 function
+#
+# Notes:
+#
+#------------------------------------------------------------------------------
+
+
+#------------------------------------------------------------------------------
+# UINT64
+# EFIAPI
+# AsmReadMm0 (
+#   VOID
+#   );
+#------------------------------------------------------------------------------
+.global _AsmReadMm0;
+.align 16;
+_AsmReadMm0:
+    #DB      48h, 0fh, 7eh, 0c0h
+    movd       %mm0, %rax
+    ret
diff --git a/edk2/MdePkg/Library/BaseLib/X64/ReadMm1.S b/edk2/MdePkg/Library/BaseLib/X64/ReadMm1.S
new file mode 100644 (file)
index 0000000..1f26cd4
--- /dev/null
@@ -0,0 +1,37 @@
+#------------------------------------------------------------------------------
+#
+# Copyright (c) 2006, Intel Corporation
+# All rights reserved. This program and the accompanying materials
+# are licensed and made available under the terms and conditions of the BSD License
+# which accompanies this distribution.  The full text of the license may be found at
+# http://opensource.org/licenses/bsd-license.php
+#
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+#
+# Module Name:
+#
+#   ReadMm1.S
+#
+# Abstract:
+#
+#   AsmReadMm1 function
+#
+# Notes:
+#
+#------------------------------------------------------------------------------
+
+
+#------------------------------------------------------------------------------
+# UINT64
+# EFIAPI
+# AsmReadMm1 (
+#   VOID
+#   );
+#------------------------------------------------------------------------------
+.global _AsmReadMm1;
+.align 16;
+_AsmReadMm1:
+    #DB      48h, 0fh, 7eh, 0c8h
+    movd       %mm1, %rax
+    ret
diff --git a/edk2/MdePkg/Library/BaseLib/X64/ReadMm2.S b/edk2/MdePkg/Library/BaseLib/X64/ReadMm2.S
new file mode 100644 (file)
index 0000000..ef864af
--- /dev/null
@@ -0,0 +1,37 @@
+#------------------------------------------------------------------------------
+#
+# Copyright (c) 2006, Intel Corporation
+# All rights reserved. This program and the accompanying materials
+# are licensed and made available under the terms and conditions of the BSD License
+# which accompanies this distribution.  The full text of the license may be found at
+# http://opensource.org/licenses/bsd-license.php
+#
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+#
+# Module Name:
+#
+#   ReadMm2.S
+#
+# Abstract:
+#
+#   AsmReadMm2 function
+#
+# Notes:
+#
+#------------------------------------------------------------------------------
+
+
+#------------------------------------------------------------------------------
+# UINT64
+# EFIAPI
+# AsmReadMm2 (
+#   VOID
+#   );
+#------------------------------------------------------------------------------
+.global _AsmReadMm2;
+.align 16;
+_AsmReadMm2:
+    #DB      48h, 0fh, 7eh, 0d0h
+    movd       %mm2, %rax
+    ret
diff --git a/edk2/MdePkg/Library/BaseLib/X64/ReadMm3.S b/edk2/MdePkg/Library/BaseLib/X64/ReadMm3.S
new file mode 100644 (file)
index 0000000..bd76cb2
--- /dev/null
@@ -0,0 +1,37 @@
+#------------------------------------------------------------------------------
+#
+# Copyright (c) 2006, Intel Corporation
+# All rights reserved. This program and the accompanying materials
+# are licensed and made available under the terms and conditions of the BSD License
+# which accompanies this distribution.  The full text of the license may be found at
+# http://opensource.org/licenses/bsd-license.php
+#
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+#
+# Module Name:
+#
+#   ReadMm3.S
+#
+# Abstract:
+#
+#   AsmReadMm3 function
+#
+# Notes:
+#
+#------------------------------------------------------------------------------
+
+
+#------------------------------------------------------------------------------
+# UINT64
+# EFIAPI
+# AsmReadMm3 (
+#   VOID
+#   );
+#------------------------------------------------------------------------------
+.global _AsmReadMm3;
+.align 16;
+_AsmReadMm3:
+    #DB      48h, 0fh, 7eh, 0d8h
+    movd       %mm3, %rax
+    ret
diff --git a/edk2/MdePkg/Library/BaseLib/X64/ReadMm4.S b/edk2/MdePkg/Library/BaseLib/X64/ReadMm4.S
new file mode 100644 (file)
index 0000000..99d7668
--- /dev/null
@@ -0,0 +1,37 @@
+#------------------------------------------------------------------------------
+#
+# Copyright (c) 2006, Intel Corporation
+# All rights reserved. This program and the accompanying materials
+# are licensed and made available under the terms and conditions of the BSD License
+# which accompanies this distribution.  The full text of the license may be found at
+# http://opensource.org/licenses/bsd-license.php
+#
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+#
+# Module Name:
+#
+#   ReadMm4.AS
+#
+# Abstract:
+#
+#   AsmReadMm4 function
+#
+# Notes:
+#
+#------------------------------------------------------------------------------
+
+
+#------------------------------------------------------------------------------
+# UINT64
+# EFIAPI
+# AsmReadMm4 (
+#   VOID
+#   );
+#------------------------------------------------------------------------------
+.global _AsmReadMm4;
+.align 16;
+_AsmReadMm4:
+    #DB      48h, 0fh, 7eh, 0e0h
+    movd       %mm4, %rax
+    ret
diff --git a/edk2/MdePkg/Library/BaseLib/X64/ReadMm5.S b/edk2/MdePkg/Library/BaseLib/X64/ReadMm5.S
new file mode 100644 (file)
index 0000000..7a01c53
--- /dev/null
@@ -0,0 +1,37 @@
+#------------------------------------------------------------------------------
+#
+# Copyright (c) 2006, Intel Corporation
+# All rights reserved. This program and the accompanying materials
+# are licensed and made available under the terms and conditions of the BSD License
+# which accompanies this distribution.  The full text of the license may be found at
+# http://opensource.org/licenses/bsd-license.php
+#
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+#
+# Module Name:
+#
+#   ReadMm5.S
+#
+# Abstract:
+#
+#   AsmReadMm5 function
+#
+# Notes:
+#
+#------------------------------------------------------------------------------
+
+
+#------------------------------------------------------------------------------
+# UINT64
+# EFIAPI
+# AsmReadMm5 (
+#   VOID
+#   );
+#------------------------------------------------------------------------------
+.global _AsmReadMm5;
+.align 16;
+_AsmReadMm5:
+    #DB      48h, 0fh, 7eh, 0e8h
+    movd       %mm5, %rax
+    ret
diff --git a/edk2/MdePkg/Library/BaseLib/X64/ReadMm6.S b/edk2/MdePkg/Library/BaseLib/X64/ReadMm6.S
new file mode 100644 (file)
index 0000000..0c7ea79
--- /dev/null
@@ -0,0 +1,37 @@
+#------------------------------------------------------------------------------
+#
+# Copyright (c) 2006, Intel Corporation
+# All rights reserved. This program and the accompanying materials
+# are licensed and made available under the terms and conditions of the BSD License
+# which accompanies this distribution.  The full text of the license may be found at
+# http://opensource.org/licenses/bsd-license.php
+#
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+#
+# Module Name:
+#
+#   ReadMm6.S
+#
+# Abstract:
+#
+#   AsmReadMm6 function
+#
+# Notes:
+#
+#------------------------------------------------------------------------------
+
+
+#------------------------------------------------------------------------------
+# UINT64
+# EFIAPI
+# AsmReadMm6 (
+#   VOID
+#   );
+#------------------------------------------------------------------------------
+.global _AsmReadMm6;
+.align 16;
+_AsmReadMm6:
+    #DB      48h, 0fh, 7eh, 0f0h
+    movd       %mm6, %rax
+    ret
diff --git a/edk2/MdePkg/Library/BaseLib/X64/ReadMm7.S b/edk2/MdePkg/Library/BaseLib/X64/ReadMm7.S
new file mode 100644 (file)
index 0000000..68f1dbd
--- /dev/null
@@ -0,0 +1,37 @@
+#------------------------------------------------------------------------------
+#
+# Copyright (c) 2006, Intel Corporation
+# All rights reserved. This program and the accompanying materials
+# are licensed and made available under the terms and conditions of the BSD License
+# which accompanies this distribution.  The full text of the license may be found at
+# http://opensource.org/licenses/bsd-license.php
+#
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+#
+# Module Name:
+#
+#   ReadMm7.S
+#
+# Abstract:
+#
+#   AsmReadMm7 function
+#
+# Notes:
+#
+#------------------------------------------------------------------------------
+
+
+#------------------------------------------------------------------------------
+# UINT64
+# EFIAPI
+# AsmReadMm7 (
+#   VOID
+#   );
+#------------------------------------------------------------------------------
+.global _AsmReadMm7;
+.align 16;
+_AsmReadMm7:
+    #DB      48h, 0fh, 7eh, 0f8h
+    movd       %mm7, %rax
+    ret
diff --git a/edk2/MdePkg/Library/BaseLib/X64/ReadMsr64.S b/edk2/MdePkg/Library/BaseLib/X64/ReadMsr64.S
new file mode 100644 (file)
index 0000000..ac101cd
--- /dev/null
@@ -0,0 +1,38 @@
+#------------------------------------------------------------------------------
+#
+# Copyright (c) 2006, Intel Corporation
+# All rights reserved. This program and the accompanying materials
+# are licensed and made available under the terms and conditions of the BSD License
+# which accompanies this distribution.  The full text of the license may be found at
+# http://opensource.org/licenses/bsd-license.php
+#
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+#
+# Module Name:
+#
+#   ReadMsr64.S
+#
+# Abstract:
+#
+#   AsmReadMsr64 function
+#
+# Notes:
+#
+#------------------------------------------------------------------------------
+
+
+#------------------------------------------------------------------------------
+# UINT64
+# EFIAPI
+# AsmReadMsr64 (
+#   IN UINT32  Index
+#   );
+#------------------------------------------------------------------------------
+.global _AsmReadMsr64;
+.align 16;
+_AsmReadMsr64:
+    rdmsr                               # edx & eax are zero extended
+    shl     $0x20, %rdx
+    or      %rdx, %rax
+    ret
diff --git a/edk2/MdePkg/Library/BaseLib/X64/ReadPmc.S b/edk2/MdePkg/Library/BaseLib/X64/ReadPmc.S
new file mode 100644 (file)
index 0000000..115f633
--- /dev/null
@@ -0,0 +1,38 @@
+#------------------------------------------------------------------------------
+#
+# Copyright (c) 2006, Intel Corporation
+# All rights reserved. This program and the accompanying materials
+# are licensed and made available under the terms and conditions of the BSD License
+# which accompanies this distribution.  The full text of the license may be found at
+# http://opensource.org/licenses/bsd-license.php
+#
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+#
+# Module Name:
+#
+#   ReadPmc.S
+#
+# Abstract:
+#
+#   AsmReadPmc function
+#
+# Notes:
+#
+#------------------------------------------------------------------------------
+
+
+#------------------------------------------------------------------------------
+# UINT64
+# EFIAPI
+# AsmReadPmc (
+#   IN UINT32   PmcIndex
+#   );
+#------------------------------------------------------------------------------
+.global _AsmReadPmc;
+.align 16;
+_AsmReadPmc:
+    rdpmc
+    shl     $0x20, %rdx
+    or      %rdx, %rax
+    ret
diff --git a/edk2/MdePkg/Library/BaseLib/X64/ReadSs.S b/edk2/MdePkg/Library/BaseLib/X64/ReadSs.S
new file mode 100644 (file)
index 0000000..a93a703
--- /dev/null
@@ -0,0 +1,36 @@
+#------------------------------------------------------------------------------
+#
+# Copyright (c) 2006, Intel Corporation
+# All rights reserved. This program and the accompanying materials
+# are licensed and made available under the terms and conditions of the BSD License
+# which accompanies this distribution.  The full text of the license may be found at
+# http://opensource.org/licenses/bsd-license.php
+#
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+#
+# Module Name:
+#
+#   ReadSs.S
+#
+# Abstract:
+#
+#   AsmReadSs function
+#
+# Notes:
+#
+#------------------------------------------------------------------------------
+
+
+#------------------------------------------------------------------------------
+# UINT16
+# EFIAPI
+# AsmReadSs (
+#   VOID
+#   );
+#------------------------------------------------------------------------------
+.global _AsmReadSs;
+.align 16;
+_AsmReadSs:
+    movl     %ss, %eax
+    ret
diff --git a/edk2/MdePkg/Library/BaseLib/X64/ReadTr.S b/edk2/MdePkg/Library/BaseLib/X64/ReadTr.S
new file mode 100644 (file)
index 0000000..5e3146b
--- /dev/null
@@ -0,0 +1,36 @@
+#------------------------------------------------------------------------------
+#
+# Copyright (c) 2006, Intel Corporation
+# All rights reserved. This program and the accompanying materials
+# are licensed and made available under the terms and conditions of the BSD License
+# which accompanies this distribution.  The full text of the license may be found at
+# http://opensource.org/licenses/bsd-license.php
+#
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+#
+# Module Name:
+#
+#   ReadTr.S
+#
+# Abstract:
+#
+#   AsmReadTr function
+#
+# Notes:
+#
+#------------------------------------------------------------------------------
+
+
+#------------------------------------------------------------------------------
+# UINT16
+# EFIAPI
+# AsmReadTr (
+#   VOID
+#   );
+#------------------------------------------------------------------------------
+.global _AsmReadTr;
+.align 16;
+_AsmReadTr: 
+    str     %eax
+    ret
diff --git a/edk2/MdePkg/Library/BaseLib/X64/ReadTsc.S b/edk2/MdePkg/Library/BaseLib/X64/ReadTsc.S
new file mode 100644 (file)
index 0000000..776ffc2
--- /dev/null
@@ -0,0 +1,38 @@
+#------------------------------------------------------------------------------
+#
+# Copyright (c) 2006, Intel Corporation
+# All rights reserved. This program and the accompanying materials
+# are licensed and made available under the terms and conditions of the BSD License
+# which accompanies this distribution.  The full text of the license may be found at
+# http://opensource.org/licenses/bsd-license.php
+#
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+#
+# Module Name:
+#
+#   ReadTsc.S
+#
+# Abstract:
+#
+#   AsmReadTsc function
+#
+# Notes:
+#
+#------------------------------------------------------------------------------
+
+
+#------------------------------------------------------------------------------
+# UINT64
+# EFIAPI
+# AsmReadTsc (
+#   VOID
+#   );
+#------------------------------------------------------------------------------
+.global _AsmReadTsc;
+.align 16;
+_AsmReadTsc:
+    rdtsc
+    shl     $0x20, %rdx
+    or      %rdx, %rax
+    ret
diff --git a/edk2/MdePkg/Library/BaseLib/X64/SetJump.S b/edk2/MdePkg/Library/BaseLib/X64/SetJump.S
new file mode 100644 (file)
index 0000000..a88efcf
--- /dev/null
@@ -0,0 +1,42 @@
+#------------------------------------------------------------------------------
+#
+# Copyright (c) 2006, Intel Corporation
+# All rights reserved. This program and the accompanying materials
+# are licensed and made available under the terms and conditions of the BSD License
+# which accompanies this distribution.  The full text of the license may be found at
+# http://opensource.org/licenses/bsd-license.php
+#
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+#
+# Module Name:
+#
+#   SetJump.S
+#
+# Abstract:
+#
+#   Implementation of SetJump() on x86_64
+#
+#------------------------------------------------------------------------------
+
+.extern InternalAssertJumpBuffer;
+.global _SetJump;
+_SetJump:
+    push   %rcx
+    add    $0xffffffffffffffe0,%rsp
+    call   InternalAssertJumpBuffer
+    add    $0x20,%rsp
+    pop    %rcx
+    pop    %rdx
+    mov    %rbx,(%rcx)
+    mov    %rsp,0x8(%rcx)
+    mov    %rbp,0x10(%rcx)
+    mov    %rdi,0x18(%rcx)
+    mov    %rsi,0x20(%rcx)
+    mov    %r12,0x28(%rcx)
+    mov    %r13,0x30(%rcx)
+    mov    %r14,0x38(%rcx)
+    mov    %r15,0x40(%rcx)
+    mov    %rdx,0x48(%rcx)
+    xor    %rax,%rax
+    jmpq   *%rdx
diff --git a/edk2/MdePkg/Library/BaseLib/X64/SwitchStack.S b/edk2/MdePkg/Library/BaseLib/X64/SwitchStack.S
new file mode 100644 (file)
index 0000000..85cdb43
--- /dev/null
@@ -0,0 +1,44 @@
+#------------------------------------------------------------------------------
+#
+# Copyright (c) 2006, Intel Corporation
+# All rights reserved. This program and the accompanying materials
+# are licensed and made available under the terms and conditions of the BSD License
+# which accompanies this distribution.  The full text of the license may be found at
+# http://opensource.org/licenses/bsd-license.php
+#
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+#
+# Module Name:
+#
+#   SwitchStack.S
+#
+# Abstract:
+#
+#------------------------------------------------------------------------------
+
+
+#------------------------------------------------------------------------------
+# Routine Description:
+#
+#   Routine for switching stacks with 1 parameter
+#
+# Arguments:
+#
+#   (rdi) EntryPoint    - Entry point with new stack.
+#   (rsi) Context1      - Parameter1 for entry point.
+#   (rdx)  Context2     - Parameter2 for entry point.
+#   (rcx)  NewStack     - Pointer to new stack.
+#
+# Returns:
+#
+#   None
+#
+#------------------------------------------------------------------------------
+.global _InternalSwitchStack;
+_InternalSwitchStack:
+    mov     %rcx, %rax
+    mov     %rdx, %rcx
+    mov     %r8, %rdx
+    lea     -0x20(%r9), %rsp
+    call    *%rax
diff --git a/edk2/MdePkg/Library/BaseLib/X64/Wbinvd.S b/edk2/MdePkg/Library/BaseLib/X64/Wbinvd.S
new file mode 100644 (file)
index 0000000..a4b9704
--- /dev/null
@@ -0,0 +1,36 @@
+#------------------------------------------------------------------------------
+#
+# Copyright (c) 2006, Intel Corporation
+# All rights reserved. This program and the accompanying materials
+# are licensed and made available under the terms and conditions of the BSD License
+# which accompanies this distribution.  The full text of the license may be found at
+# http://opensource.org/licenses/bsd-license.php
+#
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+#
+# Module Name:
+#
+#   Wbinvd.S
+#
+# Abstract:
+#
+#   AsmWbinvd function
+#
+# Notes:
+#
+#------------------------------------------------------------------------------
+
+
+#------------------------------------------------------------------------------
+# VOID
+# EFIAPI
+# AsmWbinvd (
+#   VOID
+#   );
+#------------------------------------------------------------------------------
+.global _AsmWbinvd;
+.align 16;
+_AsmWbinvd:
+    wbinvd
+    ret
diff --git a/edk2/MdePkg/Library/BaseLib/X64/WriteCr0.S b/edk2/MdePkg/Library/BaseLib/X64/WriteCr0.S
new file mode 100644 (file)
index 0000000..f77dc81
--- /dev/null
@@ -0,0 +1,36 @@
+#------------------------------------------------------------------------------
+#
+# Copyright (c) 2006, Intel Corporation
+# All rights reserved. This program and the accompanying materials
+# are licensed and made available under the terms and conditions of the BSD License
+# which accompanies this distribution.  The full text of the license may be found at
+# http://opensource.org/licenses/bsd-license.php
+#
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+#
+# Module Name:
+#
+#   WriteCr0.S
+#
+# Abstract:
+#
+#   AsmWriteCr0 function
+#
+# Notes:
+#
+#------------------------------------------------------------------------------
+
+
+#------------------------------------------------------------------------------
+# UINTN
+# EFIAPI
+# AsmWriteCr0 (
+#   UINTN  Cr0
+#   );
+#------------------------------------------------------------------------------
+.global _AsmWriteCr0;
+_AsmWriteCr0:
+    mov    %rcx,%cr0
+    mov    %rcx,%rax
+    ret
diff --git a/edk2/MdePkg/Library/BaseLib/X64/WriteCr2.S b/edk2/MdePkg/Library/BaseLib/X64/WriteCr2.S
new file mode 100644 (file)
index 0000000..6682161
--- /dev/null
@@ -0,0 +1,36 @@
+#------------------------------------------------------------------------------
+#
+# Copyright (c) 2006, Intel Corporation
+# All rights reserved. This program and the accompanying materials
+# are licensed and made available under the terms and conditions of the BSD License
+# which accompanies this distribution.  The full text of the license may be found at
+# http://opensource.org/licenses/bsd-license.php
+#
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+#
+# Module Name:
+#
+#   WriteCr2.S
+#
+# Abstract:
+#
+#   AsmWriteCr2 function
+#
+# Notes:
+#
+#------------------------------------------------------------------------------
+
+
+#------------------------------------------------------------------------------
+# UINTN
+# EFIAPI
+# AsmWriteCr2 (
+#   UINTN  Cr2
+#   );
+#------------------------------------------------------------------------------
+.global _AsmWriteCr2;
+_AsmWriteCr0:
+    mov    %rcx,%cr2
+    mov    %rcx,%rax
+    ret
diff --git a/edk2/MdePkg/Library/BaseLib/X64/WriteCr3.S b/edk2/MdePkg/Library/BaseLib/X64/WriteCr3.S
new file mode 100644 (file)
index 0000000..880ed97
--- /dev/null
@@ -0,0 +1,36 @@
+#------------------------------------------------------------------------------
+#
+# Copyright (c) 2006, Intel Corporation
+# All rights reserved. This program and the accompanying materials
+# are licensed and made available under the terms and conditions of the BSD License
+# which accompanies this distribution.  The full text of the license may be found at
+# http://opensource.org/licenses/bsd-license.php
+#
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+#
+# Module Name:
+#
+#   WriteCr3.S
+#
+# Abstract:
+#
+#   AsmWriteCr3 function
+#
+# Notes:
+#
+#------------------------------------------------------------------------------
+
+
+#------------------------------------------------------------------------------
+# UINTN
+# EFIAPI
+# AsmWriteCr3 (
+#   UINTN  Cr3
+#   );
+#------------------------------------------------------------------------------
+.global _AsmWriteCr3;
+_AsmWriteCr3:
+    mov    %rcx,%cr3
+    mov    %rcx,%rax
+    ret
diff --git a/edk2/MdePkg/Library/BaseLib/X64/WriteCr4.S b/edk2/MdePkg/Library/BaseLib/X64/WriteCr4.S
new file mode 100644 (file)
index 0000000..0469363
--- /dev/null
@@ -0,0 +1,36 @@
+#------------------------------------------------------------------------------
+#
+# Copyright (c) 2006, Intel Corporation
+# All rights reserved. This program and the accompanying materials
+# are licensed and made available under the terms and conditions of the BSD License
+# which accompanies this distribution.  The full text of the license may be found at
+# http://opensource.org/licenses/bsd-license.php
+#
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+#
+# Module Name:
+#
+#   WriteCr4.S
+#
+# Abstract:
+#
+#   AsmWriteCr4 function
+#
+# Notes:
+#
+#------------------------------------------------------------------------------
+
+
+#------------------------------------------------------------------------------
+# UINTN
+# EFIAPI
+# AsmWriteCr4 (
+#   UINTN  Cr4
+#   );
+#------------------------------------------------------------------------------
+.global _AsmWriteCr4;
+_AsmWriteCr4:
+    mov    %rcx,%cr4
+    mov    %rcx,%rax
+    ret
diff --git a/edk2/MdePkg/Library/BaseLib/X64/WriteDr0.S b/edk2/MdePkg/Library/BaseLib/X64/WriteDr0.S
new file mode 100644 (file)
index 0000000..080e56a
--- /dev/null
@@ -0,0 +1,37 @@
+#------------------------------------------------------------------------------
+#
+# Copyright (c) 2006, Intel Corporation
+# All rights reserved. This program and the accompanying materials
+# are licensed and made available under the terms and conditions of the BSD License
+# which accompanies this distribution.  The full text of the license may be found at
+# http://opensource.org/licenses/bsd-license.php
+#
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+#
+# Module Name:
+#
+#   WriteDr0.S
+#
+# Abstract:
+#
+#   AsmWriteDr0 function
+#
+# Notes:
+#
+#------------------------------------------------------------------------------
+
+
+#------------------------------------------------------------------------------
+# UINTN
+# EFIAPI
+# AsmWriteDr0 (
+#   UINTN  Value
+#   );
+#------------------------------------------------------------------------------
+.global _AsmWriteDr0;
+.align 16;
+_AsmWriteDr0:
+    mov     %rcx, %dr0
+    mov     %rcx, %rax
+    ret
diff --git a/edk2/MdePkg/Library/BaseLib/X64/WriteDr1.S b/edk2/MdePkg/Library/BaseLib/X64/WriteDr1.S
new file mode 100644 (file)
index 0000000..af61b68
--- /dev/null
@@ -0,0 +1,37 @@
+#------------------------------------------------------------------------------
+#
+# Copyright (c) 2006, Intel Corporation
+# All rights reserved. This program and the accompanying materials
+# are licensed and made available under the terms and conditions of the BSD License
+# which accompanies this distribution.  The full text of the license may be found at
+# http://opensource.org/licenses/bsd-license.php
+#
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+#
+# Module Name:
+#
+#   WriteDr1.S
+#
+# Abstract:
+#
+#   AsmWriteDr1 function
+#
+# Notes:
+#
+#------------------------------------------------------------------------------
+
+
+#------------------------------------------------------------------------------
+# UINTN
+# EFIAPI
+# AsmWriteDr1 (
+#   UINTN  Value
+#   );
+#------------------------------------------------------------------------------
+.global _AsmWriteDr1;
+.align 16;
+_AsmWriteDr1:
+    mov     %rcx, %dr1
+    mov     %rcx, rax
+    ret
diff --git a/edk2/MdePkg/Library/BaseLib/X64/WriteDr2.S b/edk2/MdePkg/Library/BaseLib/X64/WriteDr2.S
new file mode 100644 (file)
index 0000000..a9e5369
--- /dev/null
@@ -0,0 +1,37 @@
+#------------------------------------------------------------------------------
+#
+# Copyright (c) 2006, Intel Corporation
+# All rights reserved. This program and the accompanying materials
+# are licensed and made available under the terms and conditions of the BSD License
+# which accompanies this distribution.  The full text of the license may be found at
+# http://opensource.org/licenses/bsd-license.php
+#
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+#
+# Module Name:
+#
+#   WriteDr2.S
+#
+# Abstract:
+#
+#   AsmWriteDr2 function
+#
+# Notes:
+#
+#------------------------------------------------------------------------------
+
+
+#------------------------------------------------------------------------------
+# UINTN
+# EFIAPI
+# AsmWriteDr2 (
+#   UINTN  Value
+#   );
+#------------------------------------------------------------------------------
+.global _AsmWriteDr2;
+.align 16;
+_AsmWriteDr2:
+    mov     %rcx, %dr2
+    mov     %rcx, rax
+    ret
diff --git a/edk2/MdePkg/Library/BaseLib/X64/WriteDr3.S b/edk2/MdePkg/Library/BaseLib/X64/WriteDr3.S
new file mode 100644 (file)
index 0000000..04017cc
--- /dev/null
@@ -0,0 +1,37 @@
+#------------------------------------------------------------------------------
+#
+# Copyright (c) 2006, Intel Corporation
+# All rights reserved. This program and the accompanying materials
+# are licensed and made available under the terms and conditions of the BSD License
+# which accompanies this distribution.  The full text of the license may be found at
+# http://opensource.org/licenses/bsd-license.php
+#
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+#
+# Module Name:
+#
+#   WriteDr3.S
+#
+# Abstract:
+#
+#   AsmWriteDr3 function
+#
+# Notes:
+#
+#------------------------------------------------------------------------------
+
+
+#------------------------------------------------------------------------------
+# UINTN
+# EFIAPI
+# AsmWriteDr3 (
+#   UINTN  Value
+#   );
+#------------------------------------------------------------------------------
+.global _AsmWriteDr3;
+.align 16;
+_AsmWriteDr3:
+    mov     %rcx, %dr3
+    mov     %rcx, rax
+    ret
diff --git a/edk2/MdePkg/Library/BaseLib/X64/WriteDr4.S b/edk2/MdePkg/Library/BaseLib/X64/WriteDr4.S
new file mode 100644 (file)
index 0000000..b6b4e78
--- /dev/null
@@ -0,0 +1,36 @@
+#------------------------------------------------------------------------------
+#
+# Copyright (c) 2006, Intel Corporation
+# All rights reserved. This program and the accompanying materials
+# are licensed and made available under the terms and conditions of the BSD License
+# which accompanies this distribution.  The full text of the license may be found at
+# http://opensource.org/licenses/bsd-license.php
+#
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+#
+# Module Name:
+#
+#   WriteDr4.S
+#
+# Abstract:
+#
+#   AsmWriteDr4 function
+#
+# Notes:
+#
+#------------------------------------------------------------------------------
+
+
+#------------------------------------------------------------------------------
+# UINTN
+# EFIAPI
+# AsmWriteDr4 (
+#   IN UINTN Value
+#   );
+#------------------------------------------------------------------------------
+.global _AsmWriteDr4;
+_AsmWriteDr4:
+    mov     %rcx, %dr4
+    mov     %rcx, %rax
+    ret
diff --git a/edk2/MdePkg/Library/BaseLib/X64/WriteDr5.S b/edk2/MdePkg/Library/BaseLib/X64/WriteDr5.S
new file mode 100644 (file)
index 0000000..7539095
--- /dev/null
@@ -0,0 +1,36 @@
+#------------------------------------------------------------------------------
+#
+# Copyright (c) 2006, Intel Corporation
+# All rights reserved. This program and the accompanying materials
+# are licensed and made available under the terms and conditions of the BSD License
+# which accompanies this distribution.  The full text of the license may be found at
+# http://opensource.org/licenses/bsd-license.php
+#
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+#
+# Module Name:
+#
+#   WriteDr5.S
+#
+# Abstract:
+#
+#   AsmWriteDr5 function
+#
+# Notes:
+#
+#------------------------------------------------------------------------------
+
+
+#------------------------------------------------------------------------------
+# UINTN
+# EFIAPI
+# AsmWriteDr5 (
+#   IN UINTN Value
+#   );
+#------------------------------------------------------------------------------
+.global _AsmWriteDr5;
+_AsmWriteDr5:
+    mov     %rcx, %dr5
+    mov     %rcx, %rax
+    ret
diff --git a/edk2/MdePkg/Library/BaseLib/X64/WriteDr6.S b/edk2/MdePkg/Library/BaseLib/X64/WriteDr6.S
new file mode 100644 (file)
index 0000000..8627260
--- /dev/null
@@ -0,0 +1,36 @@
+#------------------------------------------------------------------------------
+#
+# Copyright (c) 2006, Intel Corporation
+# All rights reserved. This program and the accompanying materials
+# are licensed and made available under the terms and conditions of the BSD License
+# which accompanies this distribution.  The full text of the license may be found at
+# http://opensource.org/licenses/bsd-license.php
+#
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+#
+# Module Name:
+#
+#   WriteDr6.S
+#
+# Abstract:
+#
+#   AsmWriteDr6 function
+#
+# Notes:
+#
+#------------------------------------------------------------------------------
+
+
+#------------------------------------------------------------------------------
+# UINTN
+# EFIAPI
+# AsmWriteDr6 (
+#   IN UINTN Value
+#   );
+#------------------------------------------------------------------------------
+.global _AsmWriteDr6;
+_AsmWriteDr6:
+    mov     %rcx, %dr6
+    mov     %rcx, %rax
+    ret
diff --git a/edk2/MdePkg/Library/BaseLib/X64/WriteDr7.S b/edk2/MdePkg/Library/BaseLib/X64/WriteDr7.S
new file mode 100644 (file)
index 0000000..8699d95
--- /dev/null
@@ -0,0 +1,36 @@
+#------------------------------------------------------------------------------
+#
+# Copyright (c) 2006, Intel Corporation
+# All rights reserved. This program and the accompanying materials
+# are licensed and made available under the terms and conditions of the BSD License
+# which accompanies this distribution.  The full text of the license may be found at
+# http://opensource.org/licenses/bsd-license.php
+#
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+#
+# Module Name:
+#
+#   WriteDr7.S
+#
+# Abstract:
+#
+#   AsmWriteDr7 function
+#
+# Notes:
+#
+#------------------------------------------------------------------------------
+
+
+#------------------------------------------------------------------------------
+# UINTN
+# EFIAPI
+# AsmWriteDr7 (
+#   IN UINTN Value
+#   );
+#------------------------------------------------------------------------------
+.global _AsmWriteDr7;
+_AsmWriteDr7:
+    mov     %rcx, %dr7
+    mov     %rcx, %rax
+    ret
diff --git a/edk2/MdePkg/Library/BaseLib/X64/WriteGdtr.S b/edk2/MdePkg/Library/BaseLib/X64/WriteGdtr.S
new file mode 100644 (file)
index 0000000..1e9d84b
--- /dev/null
@@ -0,0 +1,35 @@
+#------------------------------------------------------------------------------
+#
+# Copyright (c) 2006, Intel Corporation
+# All rights reserved. This program and the accompanying materials
+# are licensed and made available under the terms and conditions of the BSD License
+# which accompanies this distribution.  The full text of the license may be found at
+# http://opensource.org/licenses/bsd-license.php
+#
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+#
+# Module Name:
+#
+#   WriteGdtr.S
+#
+# Abstract:
+#
+#   AsmWriteGdtr function
+#
+# Notes:
+#
+#------------------------------------------------------------------------------
+
+
+#------------------------------------------------------------------------------
+# VOID
+# EFIAPI
+# InternalX86WriteGdtr (
+#   IN      CONST IA32_DESCRIPTOR     *Idtr
+#   );
+#------------------------------------------------------------------------------
+.global _InternalX86WriteGdtr;
+_InternalX86WriteGdtr:
+    lgdt    (%rcx)
+    ret
diff --git a/edk2/MdePkg/Library/BaseLib/X64/WriteIdtr.S b/edk2/MdePkg/Library/BaseLib/X64/WriteIdtr.S
new file mode 100644 (file)
index 0000000..feb085f
--- /dev/null
@@ -0,0 +1,36 @@
+#------------------------------------------------------------------------------
+#
+# Copyright (c) 2006, Intel Corporation
+# All rights reserved. This program and the accompanying materials
+# are licensed and made available under the terms and conditions of the BSD License
+# which accompanies this distribution.  The full text of the license may be found at
+# http://opensource.org/licenses/bsd-license.php
+#
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+#
+# Module Name:
+#
+#   WriteIdtr.S
+#
+# Abstract:
+#
+#   AsmWriteIdtr function
+#
+# Notes:
+#
+#------------------------------------------------------------------------------
+
+
+#------------------------------------------------------------------------------
+# VOID
+# EFIAPI
+# InternalX86WriteIdtr (
+#   IN      CONST IA32_DESCRIPTOR     *Idtr
+#   );
+#------------------------------------------------------------------------------
+.global _InternalX86WriteIdtr;
+.align 16;
+_InternalX86WriteIdtr:
+    lidt    (%rcx)
+    ret
diff --git a/edk2/MdePkg/Library/BaseLib/X64/WriteLdtr.S b/edk2/MdePkg/Library/BaseLib/X64/WriteLdtr.S
new file mode 100644 (file)
index 0000000..c07ab83
--- /dev/null
@@ -0,0 +1,36 @@
+#------------------------------------------------------------------------------
+#
+# Copyright (c) 2006, Intel Corporation
+# All rights reserved. This program and the accompanying materials
+# are licensed and made available under the terms and conditions of the BSD License
+# which accompanies this distribution.  The full text of the license may be found at
+# http://opensource.org/licenses/bsd-license.php
+#
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+#
+# Module Name:
+#
+#   WriteLdtr.S
+#
+# Abstract:
+#
+#   AsmWriteLdtr function
+#
+# Notes:
+#
+#------------------------------------------------------------------------------
+
+
+#------------------------------------------------------------------------------
+# VOID
+# EFIAPI
+# AsmWriteLdtr (
+#   IN UINT16 Ldtr
+#   );
+#------------------------------------------------------------------------------
+.global _AsmWriteLdtr;
+.align 16;
+_AsmWriteLdtr:
+    lldt    %cx
+    ret
diff --git a/edk2/MdePkg/Library/BaseLib/X64/WriteMm0.S b/edk2/MdePkg/Library/BaseLib/X64/WriteMm0.S
new file mode 100644 (file)
index 0000000..2d805a1
--- /dev/null
@@ -0,0 +1,35 @@
+#------------------------------------------------------------------------------
+#
+# Copyright (c) 2006, Intel Corporation
+# All rights reserved. This program and the accompanying materials
+# are licensed and made available under the terms and conditions of the BSD License
+# which accompanies this distribution.  The full text of the license may be found at
+# http://opensource.org/licenses/bsd-license.php
+#
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+#
+# Module Name:
+#
+#   WriteMm0.S
+#
+# Abstract:
+#
+#   AsmWriteMm0 function
+#
+# Notes:
+#
+#------------------------------------------------------------------------------
+
+
+#------------------------------------------------------------------------------
+# VOID
+# EFIAPI
+# AsmWriteMm0 (
+#   IN UINT64   Value
+#   );
+#------------------------------------------------------------------------------
+.global _AsmWriteMm0;
+_AsmWriteMm0:
+    movd       %rcx, %xmm0
+    ret
diff --git a/edk2/MdePkg/Library/BaseLib/X64/WriteMm1.S b/edk2/MdePkg/Library/BaseLib/X64/WriteMm1.S
new file mode 100644 (file)
index 0000000..ff8162e
--- /dev/null
@@ -0,0 +1,35 @@
+#------------------------------------------------------------------------------
+#
+# Copyright (c) 2006, Intel Corporation
+# All rights reserved. This program and the accompanying materials
+# are licensed and made available under the terms and conditions of the BSD License
+# which accompanies this distribution.  The full text of the license may be found at
+# http://opensource.org/licenses/bsd-license.php
+#
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+#
+# Module Name:
+#
+#   WriteMm1.S
+#
+# Abstract:
+#
+#   AsmWriteMm1 function
+#
+# Notes:
+#
+#------------------------------------------------------------------------------
+
+
+#------------------------------------------------------------------------------
+# VOID
+# EFIAPI
+# AsmWriteMm1 (
+#   IN UINT64   Value
+#   );
+#------------------------------------------------------------------------------
+.global _AsmWriteMm1;
+_AsmWriteMm1:
+    movd       %rcx, %mm1
+    ret
diff --git a/edk2/MdePkg/Library/BaseLib/X64/WriteMm2.S b/edk2/MdePkg/Library/BaseLib/X64/WriteMm2.S
new file mode 100644 (file)
index 0000000..a98e736
--- /dev/null
@@ -0,0 +1,35 @@
+#------------------------------------------------------------------------------
+#
+# Copyright (c) 2006, Intel Corporation
+# All rights reserved. This program and the accompanying materials
+# are licensed and made available under the terms and conditions of the BSD License
+# which accompanies this distribution.  The full text of the license may be found at
+# http://opensource.org/licenses/bsd-license.php
+#
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+#
+# Module Name:
+#
+#   WriteMm2.S
+#
+# Abstract:
+#
+#   AsmWriteMm2 function
+#
+# Notes:
+#
+#------------------------------------------------------------------------------
+
+
+#------------------------------------------------------------------------------
+# VOID
+# EFIAPI
+# AsmWriteMm2 (
+#   IN UINT64   Value
+#   );
+#------------------------------------------------------------------------------
+.global _AsmWriteMm2; 
+_AsmWriteMm2:
+    movd       %rcx, %mm2
+    ret
diff --git a/edk2/MdePkg/Library/BaseLib/X64/WriteMm3.S b/edk2/MdePkg/Library/BaseLib/X64/WriteMm3.S
new file mode 100644 (file)
index 0000000..81561e3
--- /dev/null
@@ -0,0 +1,35 @@
+#------------------------------------------------------------------------------
+#
+# Copyright (c) 2006, Intel Corporation
+# All rights reserved. This program and the accompanying materials
+# are licensed and made available under the terms and conditions of the BSD License
+# which accompanies this distribution.  The full text of the license may be found at
+# http://opensource.org/licenses/bsd-license.php
+#
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+#
+# Module Name:
+#
+#   WriteMm3.S
+#
+# Abstract:
+#
+#   AsmWriteMm3 function
+#
+# Notes:
+#
+#------------------------------------------------------------------------------
+
+
+#------------------------------------------------------------------------------
+# VOID
+# EFIAPI
+# AsmWriteMm3 (
+#   IN UINT64   Value
+#   );
+#------------------------------------------------------------------------------
+.global _AsmWriteMm3;
+_AsmWriteMm3:
+    movd       %rcx, %mm3
+    ret
diff --git a/edk2/MdePkg/Library/BaseLib/X64/WriteMm4.S b/edk2/MdePkg/Library/BaseLib/X64/WriteMm4.S
new file mode 100644 (file)
index 0000000..124d946
--- /dev/null
@@ -0,0 +1,35 @@
+#------------------------------------------------------------------------------
+#
+# Copyright (c) 2006, Intel Corporation
+# All rights reserved. This program and the accompanying materials
+# are licensed and made available under the terms and conditions of the BSD License
+# which accompanies this distribution.  The full text of the license may be found at
+# http://opensource.org/licenses/bsd-license.php
+#
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+#
+# Module Name:
+#
+#   WriteMm4.S
+#
+# Abstract:
+#
+#   AsmWriteMm4 function
+#
+# Notes:
+#
+#------------------------------------------------------------------------------
+
+
+#------------------------------------------------------------------------------
+# VOID
+# EFIAPI
+# AsmWriteMm4 (
+#   IN UINT64   Value
+#   );
+#------------------------------------------------------------------------------
+.global _AsmWriteMm4;
+_AsmWriteMm4:
+    movd       %rcx, %mm4
+    ret
diff --git a/edk2/MdePkg/Library/BaseLib/X64/WriteMm5.S b/edk2/MdePkg/Library/BaseLib/X64/WriteMm5.S
new file mode 100644 (file)
index 0000000..0935ddc
--- /dev/null
@@ -0,0 +1,35 @@
+#------------------------------------------------------------------------------
+#
+# Copyright (c) 2006, Intel Corporation
+# All rights reserved. This program and the accompanying materials
+# are licensed and made available under the terms and conditions of the BSD License
+# which accompanies this distribution.  The full text of the license may be found at
+# http://opensource.org/licenses/bsd-license.php
+#
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+#
+# Module Name:
+#
+#   WriteMm5.S
+#
+# Abstract:
+#
+#   AsmWriteMm5 function
+#
+# Notes:
+#
+#------------------------------------------------------------------------------
+
+
+#------------------------------------------------------------------------------
+# VOID
+# EFIAPI
+# AsmWriteMm5 (
+#   IN UINT64   Value
+#   );
+#------------------------------------------------------------------------------
+.global _AsmWriteMm5;
+_AsmWriteMm5:
+    movd       %rcx, %mm5
+    ret
diff --git a/edk2/MdePkg/Library/BaseLib/X64/WriteMm6.S b/edk2/MdePkg/Library/BaseLib/X64/WriteMm6.S
new file mode 100644 (file)
index 0000000..02b50cf
--- /dev/null
@@ -0,0 +1,35 @@
+#------------------------------------------------------------------------------
+#
+# Copyright (c) 2006, Intel Corporation
+# All rights reserved. This program and the accompanying materials
+# are licensed and made available under the terms and conditions of the BSD License
+# which accompanies this distribution.  The full text of the license may be found at
+# http://opensource.org/licenses/bsd-license.php
+#
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+#
+# Module Name:
+#
+#   WriteMm6.S
+#
+# Abstract:
+#
+#   AsmWriteMm6 function
+#
+# Notes:
+#
+#------------------------------------------------------------------------------
+
+
+#------------------------------------------------------------------------------
+# VOID
+# EFIAPI
+# AsmWriteMm6 (
+#   IN UINT64   Value
+#   );
+#------------------------------------------------------------------------------
+.global _AsmWriteMm6;
+_AsmWriteMm6:
+    movd       %rcx, %mm6
+    ret
diff --git a/edk2/MdePkg/Library/BaseLib/X64/WriteMm7.S b/edk2/MdePkg/Library/BaseLib/X64/WriteMm7.S
new file mode 100644 (file)
index 0000000..6029272
--- /dev/null
@@ -0,0 +1,35 @@
+#------------------------------------------------------------------------------
+#
+# Copyright (c) 2006, Intel Corporation
+# All rights reserved. This program and the accompanying materials
+# are licensed and made available under the terms and conditions of the BSD License
+# which accompanies this distribution.  The full text of the license may be found at
+# http://opensource.org/licenses/bsd-license.php
+#
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+#
+# Module Name:
+#
+#   WriteMm7.S
+#
+# Abstract:
+#
+#   AsmWriteMm7 function
+#
+# Notes:
+#
+#------------------------------------------------------------------------------
+
+
+#------------------------------------------------------------------------------
+# VOID
+# EFIAPI
+# AsmWriteMm7 (
+#   IN UINT64   Value
+#   );
+#------------------------------------------------------------------------------
+.global _AsmWriteMm7;
+_AsmWriteMm7:
+    movd       %rcx, %mm7
+    ret
diff --git a/edk2/MdePkg/Library/BaseLib/X64/WriteMsr64.S b/edk2/MdePkg/Library/BaseLib/X64/WriteMsr64.S
new file mode 100644 (file)
index 0000000..88ff48b
--- /dev/null
@@ -0,0 +1,40 @@
+#------------------------------------------------------------------------------
+#
+# Copyright (c) 2006, Intel Corporation
+# All rights reserved. This program and the accompanying materials
+# are licensed and made available under the terms and conditions of the BSD License
+# which accompanies this distribution.  The full text of the license may be found at
+# http://opensource.org/licenses/bsd-license.php
+#
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+#
+# Module Name:
+#
+#   WriteMsr64.S
+#
+# Abstract:
+#
+#   AsmWriteMsr64 function
+#
+# Notes:
+#
+#------------------------------------------------------------------------------
+
+
+#------------------------------------------------------------------------------
+# UINT64
+# EFIAPI
+# AsmWriteMsr64 (
+#   IN UINT32  Index,
+#   IN UINT64  Value
+#   );
+# TODO:
+#------------------------------------------------------------------------------
+.global _AsmWriteMsr64;
+.align 16;
+_AsmWriteMsr64:
+    mov        %rdx, %rax
+    shr $0x20, %rdx
+    wrmsr
+    ret