--- /dev/null
+/** @file\r
+ Base Library CPU Functions for EBC\r
+\r
+ Copyright (c) 2006, Intel Corporation<BR>\r
+ All rights reserved. This program and the accompanying materials\r
+ are licensed and made available under the terms and conditions of the BSD License\r
+ which accompanies this distribution. The full text of the license may be found at\r
+ http://opensource.org/licenses/bsd-license.php\r
+\r
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+**/\r
+\r
+extern\r
+UINT64\r
+_break (\r
+ CHAR8 BreakCode\r
+ );\r
+\r
+/**\r
+ Generates a breakpoint on the CPU.\r
+\r
+ Generates a breakpoint on the CPU. The breakpoint must be implemented such\r
+ that code can resume normal execution after the breakpoint.\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+CpuBreakpoint (\r
+ VOID\r
+ )\r
+{\r
+ _break (3);\r
+}\r
+\r
+/**\r
+ Used to serialize load and store operations.\r
+\r
+ All loads and stores that proceed calls to this function are guaranteed to be\r
+ globally visible when this function returns.\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+MemoryFence (\r
+ VOID\r
+ )\r
+{\r
+}\r
+\r
+/**\r
+ Disables CPU interrupts.\r
+\r
+ Disables CPU interrupts.\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+DisableInterrupts (\r
+ VOID\r
+ )\r
+{\r
+ ASSERT (FALSE);\r
+}\r
+\r
+/**\r
+ Enables CPU interrupts.\r
+\r
+ Enables CPU interrupts.\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+EnableInterrupts (\r
+ VOID\r
+ )\r
+{\r
+ ASSERT (FALSE);\r
+}\r
+\r
+/**\r
+ Retrieves the current CPU interrupt state.\r
+\r
+ Retrieves the current CPU interrupt state. Returns TRUE is interrupts are\r
+ currently enabled. Otherwise returns FALSE.\r
+\r
+ @retval TRUE CPU interrupts are enabled.\r
+ @retval FALSE CPU interrupts are disabled.\r
+\r
+**/\r
+BOOLEAN\r
+EFIAPI\r
+GetInterruptState (\r
+ VOID\r
+ )\r
+{\r
+ ASSERT (FALSE);\r
+ return FALSE;\r
+}\r
+\r
+/**\r
+ Enables CPU interrupts for the smallest window required to capture any\r
+ pending interrupts.\r
+\r
+ Enables CPU interrupts for the smallest window required to capture any\r
+ pending interrupts.\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+EnableDisableInterrupts (\r
+ VOID\r
+ )\r
+{\r
+ EnableInterrupts ();\r
+ DisableInterrupts ();\r
+}\r
+\r
+/**\r
+ Requests CPU to pause for a short period of time.\r
+\r
+ Requests CPU to pause for a short period of time. Typically used in MP\r
+ systems to prevent memory starvation while waiting for a spin lock.\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+CpuPause (\r
+ VOID\r
+ )\r
+{\r
+}\r
+\r
+/**\r
+ Flushes all the Translation Lookaside Buffers(TLB) entries in a CPU.\r
+\r
+ Flushes all the Translation Lookaside Buffers(TLB) entries in a CPU.\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+CpuFlushTlb (\r
+ VOID\r
+ )\r
+{\r
+ ASSERT (FALSE);\r
+}\r
+\r
+/**\r
+ Places the CPU in a sleep state until an interrupt is received.\r
+\r
+ Places the CPU in a sleep state until an interrupt is received. If interrupts\r
+ are disabled prior to calling this function, then the CPU will be placed in a\r
+ sleep state indefinitely.\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+CpuSleep (\r
+ VOID\r
+ )\r
+{\r
+}\r
--- /dev/null
+/** @file\r
+ Switch Stack functions.\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: SetJumpLongJump.c\r
+\r
+**/\r
+\r
+/**\r
+ Worker function that checks ASSERT condition for JumpBuffer\r
+\r
+ Checks ASSERT condition for JumpBuffer.\r
+\r
+ If JumpBuffer is NULL, then ASSERT().\r
+ For IPF CPUs, if JumpBuffer is not aligned on a 16-byte boundary, then ASSERT().\r
+\r
+ @param JumpBuffer A pointer to CPU context buffer.\r
+\r
+**/\r
+VOID\r
+InternalAssertJumpBuffer (\r
+ IN BASE_LIBRARY_JUMP_BUFFER *JumpBuffer\r
+ );\r
+\r
+/**\r
+ Saves the current CPU context that can be restored with a call to LongJump() and returns 0.\r
+\r
+ Saves the current CPU context in the buffer specified by JumpBuffer and returns 0. The initial \r
+ call to SetJump() must always return 0. Subsequent calls to LongJump() cause a non-zero \r
+ value to be returned by SetJump(). \r
+\r
+ If JumpBuffer is NULL, then ASSERT().\r
+ For IPF CPUs, if JumpBuffer is not aligned on a 16-byte boundary, then ASSERT().\r
+\r
+ @param JumpBuffer A pointer to CPU context buffer.\r
+ \r
+**/\r
+UINTN\r
+EFIAPI\r
+SetJump (\r
+ IN BASE_LIBRARY_JUMP_BUFFER *JumpBuffer\r
+ )\r
+{\r
+ InternalAssertJumpBuffer (JumpBuffer);\r
+ return 0;\r
+}\r
+\r
+/**\r
+ Restores the CPU context that was saved with SetJump().\r
+\r
+ Restores the CPU context from the buffer specified by JumpBuffer.\r
+ This function never returns to the caller.\r
+ Instead is resumes execution based on the state of JumpBuffer.\r
+\r
+ @param JumpBuffer A pointer to CPU context buffer.\r
+ @param Value The value to return when the SetJump() context is restored.\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+InternalLongJump (\r
+ IN BASE_LIBRARY_JUMP_BUFFER *JumpBuffer,\r
+ IN UINTN Value\r
+ )\r
+{\r
+ //\r
+ // This function cannot work on EBC\r
+ //\r
+ ASSERT (FALSE);\r
+}\r
--- /dev/null
+/** @file\r
+ Switch Stack functions.\r
+\r
+ Copyright (c) 2006 - 2007, Intel Corporation<BR>\r
+ All rights reserved. This program and the accompanying materials\r
+ are licensed and made available under the terms and conditions of the BSD License\r
+ which accompanies this distribution. The full text of the license may be found at\r
+ http://opensource.org/licenses/bsd-license.php\r
+\r
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+ Module Name: SwitchStack.c\r
+\r
+**/\r
+\r
+/**\r
+ Transfers control to a function starting with a new stack.\r
+\r
+ Transfers control to the function specified by EntryPoint using the\r
+ new stack specified by NewStack and passing in the parameters specified\r
+ by Context1 and Context2. Context1 and Context2 are optional and may\r
+ be NULL. The function EntryPoint must never return.\r
+ Marker will be ignored on IA-32, x64, and EBC.\r
+ IPF CPUs expect one additional parameter of type VOID * that specifies\r
+ the new backing store pointer.\r
+\r
+ If EntryPoint is NULL, then ASSERT().\r
+ If NewStack is NULL, then ASSERT().\r
+\r
+ @param EntryPoint A pointer to function to call with the new stack.\r
+ @param Context1 A pointer to the context to pass into the EntryPoint\r
+ function.\r
+ @param Context2 A pointer to the context to pass into the EntryPoint\r
+ function.\r
+ @param NewStack A pointer to the new stack to use for the EntryPoint\r
+ function.\r
+ @param Marker VA_LIST marker for the variable argument list.\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+InternalSwitchStack (\r
+ IN SWITCH_STACK_ENTRY_POINT EntryPoint,\r
+ IN VOID *Context1, OPTIONAL\r
+ IN VOID *Context2, OPTIONAL\r
+ IN VOID *NewStack,\r
+ IN VA_LIST Marker\r
+ )\r
+\r
+{\r
+ //\r
+ // This version of this function does not actually change the stack pointer\r
+ // This is to support compilation of CPU types that do not support assemblers\r
+ // such as EBC\r
+ //\r
+\r
+ //\r
+ // Stack should be aligned with CPU_STACK_ALIGNMENT\r
+ //\r
+ ASSERT (((UINTN)NewStack & (CPU_STACK_ALIGNMENT - 1)) == 0);\r
+\r
+ EntryPoint (Context1, Context2);\r
+}\r
--- /dev/null
+/** @file\r
+ Implementation of synchronization functions on EBC.\r
+\r
+ Copyright (c) 2006, Intel Corporation<BR>\r
+ All rights reserved. This program and the accompanying materials\r
+ are licensed and made available under the terms and conditions of the BSD License\r
+ which accompanies this distribution. The full text of the license may be found at\r
+ http://opensource.org/licenses/bsd-license.php\r
+\r
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+ Module Name: Synchronization.c\r
+\r
+**/\r
+\r
+UINT32\r
+EFIAPI\r
+InternalSyncCompareExchange32 (\r
+ IN volatile UINT32 *Value,\r
+ IN UINT32 CompareValue,\r
+ IN UINT32 ExchangeValue\r
+ )\r
+{\r
+ return *Value != CompareValue ? *Value :\r
+ ((*Value = ExchangeValue), CompareValue);\r
+}\r
+\r
+/**\r
+ Performs an atomic compare exchange operation on a 64-bit unsigned integer.\r
+\r
+ Performs an atomic compare exchange operation on the 64-bit unsigned integer specified \r
+ by Value. If Value is equal to CompareValue, then Value is set to ExchangeValue and \r
+ CompareValue is returned. If Value is not equal to CompareValue, then Value is returned. \r
+ The compare exchange operation must be performed using MP safe mechanisms.\r
+\r
+ @param Value A pointer to the 64-bit value for the compare exchange\r
+ operation.\r
+ @param CompareValue 64-bit value used in compare operation.\r
+ @param ExchangeValue 64-bit value used in exchange operation.\r
+\r
+ @return The original *Value before exchange.\r
+\r
+**/\r
+UINT64\r
+EFIAPI\r
+InternalSyncCompareExchange64 (\r
+ IN volatile UINT64 *Value,\r
+ IN UINT64 CompareValue,\r
+ IN UINT64 ExchangeValue\r
+ )\r
+{\r
+ return *Value != CompareValue ? *Value :\r
+ ((*Value = ExchangeValue), CompareValue);\r
+}\r
+\r
+/**\r
+ Performs an atomic increment of an 32-bit unsigned integer.\r
+\r
+ Performs an atomic increment of the 32-bit unsigned integer specified by\r
+ Value and returns the incremented value. The increment operation must be\r
+ performed using MP safe mechanisms. The state of the return value is not\r
+ guaranteed to be MP safe.\r
+\r
+ @param Value A pointer to the 32-bit value to increment.\r
+\r
+ @return The incremented value.\r
+\r
+**/\r
+UINT32\r
+EFIAPI\r
+InternalSyncIncrement (\r
+ IN volatile UINT32 *Value\r
+ )\r
+{\r
+ return ++*Value;\r
+}\r
+\r
+/**\r
+ Performs an atomic decrement of an 32-bit unsigned integer.\r
+\r
+ Performs an atomic decrement of the 32-bit unsigned integer specified by\r
+ Value and returns the decrement value. The decrement operation must be\r
+ performed using MP safe mechanisms. The state of the return value is not\r
+ guaranteed to be MP safe.\r
+\r
+ @param Value A pointer to the 32-bit value to decrement.\r
+\r
+ @return The decrement value.\r
+\r
+**/\r
+UINT32\r
+EFIAPI\r
+InternalSyncDecrement (\r
+ IN volatile UINT32 *Value\r
+ )\r
+{\r
+ return --*Value;\r
+}\r
-//\r
-// Include common header file for this module.\r
-//\r
-#include "CommonHeader.h"\r
-\r
#------------------------------------------------------------------------------\r
#\r
# Copyright (c) 2006, Intel Corporation\r
-//\r
-// Include common header file for this module.\r
-//\r
-#include "CommonHeader.h"\r
-\r
#------------------------------------------------------------------------------ ;\r
# Copyright (c) 2006, Intel Corporation\r
# All rights reserved. This program and the accompanying materials\r
-//\r
-// Include common header file for this module.\r
-//\r
-#include "CommonHeader.h"\r
-\r
#------------------------------------------------------------------------------ ;\r
# Copyright (c) 2006, Intel Corporation\r
# All rights reserved. This program and the accompanying materials\r
-//\r
-// Include common header file for this module.\r
-//\r
-#include "CommonHeader.h"\r
-\r
#------------------------------------------------------------------------------\r
#\r
# Copyright (c) 2006, Intel Corporation\r
-//\r
-// Include common header file for this module.\r
-//\r
-#include "CommonHeader.h"\r
-\r
-#------------------------------------------------------------------------------\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
-# CpuIdEx.Asm\r
-#\r
-# Abstract:\r
-#\r
-# AsmCpuidEx function\r
-#\r
-# Notes:\r
-#\r
-#------------------------------------------------------------------------------\r
-\r
- .686:\r
- .code:\r
-\r
-#------------------------------------------------------------------------------\r
-# UINT32\r
-# EFIAPI\r
-# AsmCpuidEx (\r
-# IN UINT32 RegisterInEax,\r
-# IN UINT32 RegisterInEcx,\r
-# OUT UINT32 *RegisterOutEax OPTIONAL,\r
-# OUT UINT32 *RegisterOutEbx OPTIONAL,\r
-# OUT UINT32 *RegisterOutEcx OPTIONAL,\r
-# OUT UINT32 *RegisterOutEdx OPTIONAL\r
-# )\r
-#------------------------------------------------------------------------------\r
-.globl ASM_PFX(AsmCpuidEx)\r
-ASM_PFX(AsmCpuidEx):\r
- push %ebx\r
- push %ebp\r
- movl %esp, %ebp\r
- movl 12(%ebp), %eax\r
- movl 16(%ebp), %ecx\r
- cpuid\r
- push %ecx\r
- movl 20(%ebp), %ecx\r
- jecxz L1\r
- movl %eax, (%ecx)\r
-L1:\r
- movl 24(%ebp), %ecx\r
- jecxz L2\r
- movl %ebx, (%ecx)\r
-L2:\r
- movl 28(%ebp), %ecx\r
- jecxz L3\r
- popl (%ecx)\r
-L3:\r
- movl 32(%ebp), %edx\r
- jecxz L4\r
- movl %edx, (%ecx)\r
-L4:\r
- movl 12(%ebp), %eax\r
- leave\r
- pop %ebx\r
- ret\r
+#------------------------------------------------------------------------------
+#
+# 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:
+#
+#------------------------------------------------------------------------------
+
+ .686:
+ .code:
+
+#------------------------------------------------------------------------------
+# 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
+# )
+#------------------------------------------------------------------------------
+.globl ASM_PFX(AsmCpuidEx)
+ASM_PFX(AsmCpuidEx):
+ push %ebx
+ push %ebp
+ movl %esp, %ebp
+ movl 12(%ebp), %eax
+ movl 16(%ebp), %ecx
+ cpuid
+ push %ecx
+ movl 20(%ebp), %ecx
+ jecxz L1
+ movl %eax, (%ecx)
+L1:
+ movl 24(%ebp), %ecx
+ jecxz L2
+ movl %ebx, (%ecx)
+L2:
+ movl 28(%ebp), %ecx
+ jecxz L3
+ popl (%ecx)
+L3:
+ movl 32(%ebp), %edx
+ jecxz L4
+ movl %edx, (%ecx)
+L4:
+ movl 12(%ebp), %eax
+ leave
+ pop %ebx
+ ret
-//\r
-// Include common header file for this module.\r
-//\r
-#include "CommonHeader.h"\r
-\r
#------------------------------------------------------------------------------ ;\r
# Copyright (c) 2006, Intel Corporation\r
# All rights reserved. This program and the accompanying materials\r
-//\r
-// Include common header file for this module.\r
-//\r
-#include "CommonHeader.h"\r
-\r
#------------------------------------------------------------------------------ ;\r
# Copyright (c) 2006, Intel Corporation\r
# All rights reserved. This program and the accompanying materials\r
-//\r
-// Include common header file for this module.\r
-//\r
-#include "CommonHeader.h"\r
-\r
#------------------------------------------------------------------------------\r
#\r
# Copyright (c) 2006, Intel Corporation\r
-//\r
-// Include common header file for this module.\r
-//\r
-#include "CommonHeader.h"\r
-\r
#------------------------------------------------------------------------------\r
#\r
# Copyright (c) 2006, Intel Corporation\r
-//\r
-// Include common header file for this module.\r
-//\r
-#include "CommonHeader.h"\r
-\r
-#------------------------------------------------------------------------------\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
-# DivU64x32.asm\r
-#\r
-# Abstract:\r
-#\r
-# Calculate the quotient of a 64-bit integer by a 32-bit integer\r
-#\r
-#------------------------------------------------------------------------------\r
-\r
-.globl ASM_PFX(InternalMathDivU64x32)\r
-\r
-#------------------------------------------------------------------------------\r
-# UINT64\r
-# EFIAPI\r
-# InternalMathDivU64x32 (\r
-# IN UINT64 Dividend,\r
-# IN UINT32 Divisor\r
-# );\r
-#------------------------------------------------------------------------------\r
-ASM_PFX(InternalMathDivU64x32):\r
- movl 8(%esp), %eax\r
- movl 12(%esp), %ecx\r
- xorl %edx, %edx\r
- divl %ecx\r
- push %eax\r
- movl 8(%esp), %eax\r
- divl %ecx\r
- pop %edx\r
- ret\r
+#------------------------------------------------------------------------------
+#
+# 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:
+#
+# DivU64x32.asm
+#
+# Abstract:
+#
+# Calculate the quotient of a 64-bit integer by a 32-bit integer
+#
+#------------------------------------------------------------------------------
+
+.globl ASM_PFX(InternalMathDivU64x32)
+
+#------------------------------------------------------------------------------
+# UINT64
+# EFIAPI
+# InternalMathDivU64x32 (
+# IN UINT64 Dividend,
+# IN UINT32 Divisor
+# );
+#------------------------------------------------------------------------------
+ASM_PFX(InternalMathDivU64x32):
+ movl 8(%esp), %eax
+ movl 12(%esp), %ecx
+ xorl %edx, %edx
+ divl %ecx
+ push %eax
+ movl 8(%esp), %eax
+ divl %ecx
+ pop %edx
+ ret
-//\r
-// Include common header file for this module.\r
-//\r
-#include "CommonHeader.h"\r
-\r
#------------------------------------------------------------------------------\r
#\r
# Copyright (c) 2006, Intel Corporation\r
-//\r
-// Include common header file for this module.\r
-//\r
-#include "CommonHeader.h"\r
-\r
#------------------------------------------------------------------------------\r
#\r
# Copyright (c) 2006, Intel Corporation\r
-//\r
-// Include common header file for this module.\r
-//\r
-#include "CommonHeader.h"\r
-\r
#------------------------------------------------------------------------------\r
#\r
# Copyright (c) 2006, Intel Corporation\r
-//\r
-// Include common header file for this module.\r
-//\r
-#include "CommonHeader.h"\r
-\r
#------------------------------------------------------------------------------\r
#\r
# Copyright (c) 2006, Intel Corporation\r
-//\r
-// Include common header file for this module.\r
-//\r
-#include "CommonHeader.h"\r
-\r
#------------------------------------------------------------------------------\r
#\r
# Copyright (c) 2006, Intel Corporation\r
-//\r
-// Include common header file for this module.\r
-//\r
-#include "CommonHeader.h"\r
-\r
#------------------------------------------------------------------------------\r
#\r
# Copyright (c) 2006, Intel Corporation\r
-//\r
-// Include common header file for this module.\r
-//\r
-\r
-\r
;------------------------------------------------------------------------------\r
;\r
; Copyright (c) 2006, Intel Corporation\r
-//\r
-// Include common header file for this module.\r
-//\r
-#include "CommonHeader.h"\r
-\r
#------------------------------------------------------------------------------\r
#\r
# Copyright (c) 2006, Intel Corporation\r
-//\r
-// Include common header file for this module.\r
-//\r
-#include "CommonHeader.h"\r
-\r
#------------------------------------------------------------------------------\r
#\r
# Copyright (c) 2006, Intel Corporation\r
-//\r
-// Include common header file for this module.\r
-//\r
-#include "CommonHeader.h"\r
-\r
#------------------------------------------------------------------------------\r
#\r
# Copyright (c) 2006, Intel Corporation\r
-//\r
-// Include common header file for this module.\r
-//\r
-#include "CommonHeader.h"\r
-\r
#------------------------------------------------------------------------------\r
#\r
# Copyright (c) 2006, Intel Corporation\r
-//\r
-// Include common header file for this module.\r
-//\r
-#include "CommonHeader.h"\r
-\r
#------------------------------------------------------------------------------\r
#\r
# Copyright (c) 2006, Intel Corporation\r
-//\r
-// Include common header file for this module.\r
-//\r
-#include "CommonHeader.h"\r
-\r
#------------------------------------------------------------------------------\r
#\r
# Copyright (c) 2006, Intel Corporation\r
-//\r
-// Include common header file for this module.\r
-//\r
-#include "CommonHeader.h"\r
-\r
#------------------------------------------------------------------------------\r
#\r
# Copyright (c) 2006, Intel Corporation\r
-//\r
-// Include common header file for this module.\r
-//\r
-#include "CommonHeader.h"\r
-\r
#------------------------------------------------------------------------------\r
#\r
# Copyright (c) 2006, Intel Corporation\r
-//\r
-// Include common header file for this module.\r
-//\r
-#include "CommonHeader.h"\r
-\r
#------------------------------------------------------------------------------\r
#\r
# Copyright (c) 2006, Intel Corporation\r
-//\r
-// Include common header file for this module.\r
-//\r
-#include "CommonHeader.h"\r
-\r
-#------------------------------------------------------------------------------\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
-# LShiftU64.asm\r
-#\r
-# Abstract:\r
-#\r
-# 64-bit left shift function for IA-32\r
-#\r
-#------------------------------------------------------------------------------\r
-\r
-.globl ASM_PFX(InternalMathLShiftU64)\r
-\r
-#------------------------------------------------------------------------------\r
-# UINT64\r
-# EFIAPI\r
-# InternalMathLShiftU64 (\r
-# IN UINT64 Operand,\r
-# IN UINTN Count\r
-# );\r
-#------------------------------------------------------------------------------\r
-ASM_PFX(InternalMathLShiftU64):\r
- movb 12(%esp), %cl\r
- xorl %eax, %eax\r
- movl 4(%esp), %edx\r
- testb $32, %cl\r
- cmovz %edx, %eax\r
- cmovz 0x8(%esp), %edx\r
- shld %cl, %eax, %edx\r
- shl %cl, %eax\r
- ret\r
+#------------------------------------------------------------------------------
+#
+# 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:
+#
+# LShiftU64.asm
+#
+# Abstract:
+#
+# 64-bit left shift function for IA-32
+#
+#------------------------------------------------------------------------------
+
+.globl ASM_PFX(InternalMathLShiftU64)
+
+#------------------------------------------------------------------------------
+# UINT64
+# EFIAPI
+# InternalMathLShiftU64 (
+# IN UINT64 Operand,
+# IN UINTN Count
+# );
+#------------------------------------------------------------------------------
+ASM_PFX(InternalMathLShiftU64):
+ movb 12(%esp), %cl
+ xorl %eax, %eax
+ movl 4(%esp), %edx
+ testb $32, %cl
+ cmovz %edx, %eax
+ cmovz 0x8(%esp), %edx
+ shld %cl, %eax, %edx
+ shl %cl, %eax
+ ret
-//\r
-// Include common header file for this module.\r
-//\r
-#include "CommonHeader.h"\r
-\r
-#------------------------------------------------------------------------------\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 IA-32.\r
-#\r
-#------------------------------------------------------------------------------\r
-\r
-.globl ASM_PFX(InternalLongJump)\r
-\r
-#------------------------------------------------------------------------------\r
-# VOID\r
-# EFIAPI\r
-# InternalLongJump (\r
-# IN BASE_LIBRARY_JUMP_BUFFER *JumpBuffer,\r
-# IN UINTN Value\r
-# );\r
-#------------------------------------------------------------------------------\r
-ASM_PFX(InternalLongJump):\r
- pop %eax\r
- pop %edx\r
- pop %eax\r
- movl (%edx), %ebx\r
- movl 4(%edx), %esi\r
- movl 8(%edx), %edi\r
- movl 12(%edx), %ebp\r
- movl 16(%edx), %esp\r
- jmp *20(%edx)\r
+#------------------------------------------------------------------------------
+#
+# 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:
+#
+# LongJump.Asm
+#
+# Abstract:
+#
+# Implementation of _LongJump() on IA-32.
+#
+#------------------------------------------------------------------------------
+
+.globl ASM_PFX(InternalLongJump)
+
+#------------------------------------------------------------------------------
+# VOID
+# EFIAPI
+# InternalLongJump (
+# IN BASE_LIBRARY_JUMP_BUFFER *JumpBuffer,
+# IN UINTN Value
+# );
+#------------------------------------------------------------------------------
+ASM_PFX(InternalLongJump):
+ pop %eax
+ pop %edx
+ pop %eax
+ movl (%edx), %ebx
+ movl 4(%edx), %esi
+ movl 8(%edx), %edi
+ movl 12(%edx), %ebp
+ movl 16(%edx), %esp
+ jmp *20(%edx)
-//\r
-// Include common header file for this module.\r
-//\r
-#include "CommonHeader.h"\r
-\r
#------------------------------------------------------------------------------\r
#\r
# Copyright (c) 2006, Intel Corporation\r
-//\r
-// Include common header file for this module.\r
-//\r
-#include "CommonHeader.h"\r
-\r
#------------------------------------------------------------------------------\r
#\r
# Copyright (c) 2006, Intel Corporation\r
-//\r
-// Include common header file for this module.\r
-//\r
-#include "CommonHeader.h"\r
-\r
-#------------------------------------------------------------------------------\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
-# MultU64x32.asm\r
-#\r
-# Abstract:\r
-#\r
-# Calculate the product of a 64-bit integer and a 32-bit integer\r
-#\r
-#------------------------------------------------------------------------------\r
-\r
- .386:\r
- .code:\r
-\r
-.globl ASM_PFX(InternalMathMultU64x32)\r
-\r
-#------------------------------------------------------------------------------\r
-# UINT64\r
-# EFIAPI\r
-# InternalMathMultU64x32 (\r
-# IN UINT64 Multiplicand,\r
-# IN UINT32 Multiplier\r
-# );\r
-#------------------------------------------------------------------------------\r
-ASM_PFX(InternalMathMultU64x32):\r
- movl 12(%esp), %ecx\r
- movl %ecx, %eax\r
- imull 8(%esp), %ecx\r
- mull 0x4(%esp)\r
- addl %ecx, %edx\r
- ret\r
+#------------------------------------------------------------------------------
+#
+# 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:
+#
+# MultU64x32.asm
+#
+# Abstract:
+#
+# Calculate the product of a 64-bit integer and a 32-bit integer
+#
+#------------------------------------------------------------------------------
+
+ .386:
+ .code:
+
+.globl ASM_PFX(InternalMathMultU64x32)
+
+#------------------------------------------------------------------------------
+# UINT64
+# EFIAPI
+# InternalMathMultU64x32 (
+# IN UINT64 Multiplicand,
+# IN UINT32 Multiplier
+# );
+#------------------------------------------------------------------------------
+ASM_PFX(InternalMathMultU64x32):
+ movl 12(%esp), %ecx
+ movl %ecx, %eax
+ imull 8(%esp), %ecx
+ mull 0x4(%esp)
+ addl %ecx, %edx
+ ret
-//\r
-// Include common header file for this module.\r
-//\r
-#include "CommonHeader.h"\r
-\r
#------------------------------------------------------------------------------\r
#\r
# Copyright (c) 2006, Intel Corporation\r
-//\r
-// Include common header file for this module.\r
-//\r
-#include "CommonHeader.h"\r
-\r
#------------------------------------------------------------------------------\r
#\r
# Copyright (c) 2006, Intel Corporation\r
-//\r
-// Include common header file for this module.\r
-//\r
-#include "CommonHeader.h"\r
-\r
#------------------------------------------------------------------------------\r
#\r
# Copyright (c) 2006, Intel Corporation\r
-//\r
-// Include common header file for this module.\r
-//\r
-#include "CommonHeader.h"\r
-\r
-#------------------------------------------------------------------------------\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
-# RShiftU64.asm\r
-#\r
-# Abstract:\r
-#\r
-# 64-bit logical right shift function for IA-32\r
-#\r
-#------------------------------------------------------------------------------\r
-\r
- .686:\r
- .code:\r
-\r
-.globl ASM_PFX(InternalMathRShiftU64)\r
-\r
-#------------------------------------------------------------------------------\r
-# UINT64\r
-# EFIAPI\r
-# InternalMathRShiftU64 (\r
-# IN UINT64 Operand,\r
-# IN UINTN Count\r
-# );\r
-#------------------------------------------------------------------------------\r
-ASM_PFX(InternalMathRShiftU64):\r
- movb 12(%esp), %cl\r
- xorl %edx, %edx\r
- movl 8(%esp), %eax\r
- testb $32, %cl\r
- cmovz %eax, %edx\r
- cmovz 0x4(%esp), %eax\r
- shrdl %cl, %edx, %eax\r
- shr %cl, %edx\r
- ret\r
+#------------------------------------------------------------------------------
+#
+# 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:
+#
+# RShiftU64.asm
+#
+# Abstract:
+#
+# 64-bit logical right shift function for IA-32
+#
+#------------------------------------------------------------------------------
+
+ .686:
+ .code:
+
+.globl ASM_PFX(InternalMathRShiftU64)
+
+#------------------------------------------------------------------------------
+# UINT64
+# EFIAPI
+# InternalMathRShiftU64 (
+# IN UINT64 Operand,
+# IN UINTN Count
+# );
+#------------------------------------------------------------------------------
+ASM_PFX(InternalMathRShiftU64):
+ movb 12(%esp), %cl
+ xorl %edx, %edx
+ movl 8(%esp), %eax
+ testb $32, %cl
+ cmovz %eax, %edx
+ cmovz 0x4(%esp), %eax
+ shrdl %cl, %edx, %eax
+ shr %cl, %edx
+ ret
-//\r
-// Include common header file for this module.\r
-//\r
-#include "CommonHeader.h"\r
-\r
#------------------------------------------------------------------------------\r
#\r
# Copyright (c) 2006, Intel Corporation\r
-//\r
-// Include common header file for this module.\r
-//\r
-#include "CommonHeader.h"\r
-\r
#------------------------------------------------------------------------------\r
#\r
# Copyright (c) 2006, Intel Corporation\r
-//\r
-// Include common header file for this module.\r
-//\r
-#include "CommonHeader.h"\r
-\r
#------------------------------------------------------------------------------\r
#\r
# Copyright (c) 2006, Intel Corporation\r
-//\r
-// Include common header file for this module.\r
-//\r
-#include "CommonHeader.h"\r
-\r
#------------------------------------------------------------------------------\r
#\r
# Copyright (c) 2006, Intel Corporation\r
-//\r
-// Include common header file for this module.\r
-//\r
-#include "CommonHeader.h"\r
-\r
#------------------------------------------------------------------------------\r
#\r
# Copyright (c) 2006, Intel Corporation\r
-//\r
-// Include common header file for this module.\r
-//\r
-#include "CommonHeader.h"\r
-\r
#------------------------------------------------------------------------------\r
#\r
# Copyright (c) 2006, Intel Corporation\r
-//\r
-// Include common header file for this module.\r
-//\r
-#include "CommonHeader.h"\r
-\r
#------------------------------------------------------------------------------\r
#\r
# Copyright (c) 2006, Intel Corporation\r
-//\r
-// Include common header file for this module.\r
-//\r
-#include "CommonHeader.h"\r
-\r
#------------------------------------------------------------------------------\r
#\r
# Copyright (c) 2006, Intel Corporation\r
-//\r
-// Include common header file for this module.\r
-//\r
-#include "CommonHeader.h"\r
-\r
#------------------------------------------------------------------------------\r
#\r
# Copyright (c) 2006, Intel Corporation\r
-//\r
-// Include common header file for this module.\r
-//\r
-#include "CommonHeader.h"\r
-\r
#------------------------------------------------------------------------------\r
#\r
# Copyright (c) 2006, Intel Corporation\r
-//\r
-// Include common header file for this module.\r
-//\r
-#include "CommonHeader.h"\r
-\r
#------------------------------------------------------------------------------\r
#\r
# Copyright (c) 2006, Intel Corporation\r
-//\r
-// Include common header file for this module.\r
-//\r
-#include "CommonHeader.h"\r
-\r
#------------------------------------------------------------------------------\r
#\r
# Copyright (c) 2006, Intel Corporation\r
-//\r
-// Include common header file for this module.\r
-//\r
-#include "CommonHeader.h"\r
-\r
#------------------------------------------------------------------------------\r
#\r
# Copyright (c) 2006, Intel Corporation\r
-//\r
-// Include common header file for this module.\r
-//\r
-#include "CommonHeader.h"\r
-\r
#------------------------------------------------------------------------------\r
#\r
# Copyright (c) 2006, Intel Corporation\r
-//\r
-// Include common header file for this module.\r
-//\r
-#include "CommonHeader.h"\r
-\r
#------------------------------------------------------------------------------\r
#\r
# Copyright (c) 2006, Intel Corporation\r
-//\r
-// Include common header file for this module.\r
-//\r
-#include "CommonHeader.h"\r
-\r
#------------------------------------------------------------------------------\r
#\r
# Copyright (c) 2006, Intel Corporation\r
-//\r
-// Include common header file for this module.\r
-//\r
-#include "CommonHeader.h"\r
-\r
#------------------------------------------------------------------------------\r
#\r
# Copyright (c) 2006, Intel Corporation\r
-//\r
-// Include common header file for this module.\r
-//\r
-#include "CommonHeader.h"\r
-\r
#------------------------------------------------------------------------------\r
#\r
# Copyright (c) 2006, Intel Corporation\r
-//\r
-// Include common header file for this module.\r
-//\r
-#include "CommonHeader.h"\r
-\r
#------------------------------------------------------------------------------\r
#\r
# Copyright (c) 2006, Intel Corporation\r
-//\r
-// Include common header file for this module.\r
-//\r
-#include "CommonHeader.h"\r
-\r
#------------------------------------------------------------------------------\r
#\r
# Copyright (c) 2006, Intel Corporation\r
-//\r
-// Include common header file for this module.\r
-//\r
-#include "CommonHeader.h"\r
-\r
#------------------------------------------------------------------------------\r
#\r
# Copyright (c) 2006, Intel Corporation\r
-//\r
-// Include common header file for this module.\r
-//\r
-#include "CommonHeader.h"\r
-\r
#------------------------------------------------------------------------------\r
#\r
# Copyright (c) 2006, Intel Corporation\r
-//\r
-// Include common header file for this module.\r
-//\r
-#include "CommonHeader.h"\r
-\r
#------------------------------------------------------------------------------\r
#\r
# Copyright (c) 2006, Intel Corporation\r
-//\r
-// Include common header file for this module.\r
-//\r
-#include "CommonHeader.h"\r
-\r
#------------------------------------------------------------------------------\r
#\r
# Copyright (c) 2006, Intel Corporation\r
-//\r
-// Include common header file for this module.\r
-//\r
-#include "CommonHeader.h"\r
-\r
#------------------------------------------------------------------------------\r
#\r
# Copyright (c) 2006, Intel Corporation\r
-//\r
-// Include common header file for this module.\r
-//\r
-#include "CommonHeader.h"\r
-\r
#------------------------------------------------------------------------------\r
#\r
# Copyright (c) 2006, Intel Corporation\r
-//\r
-// Include common header file for this module.\r
-//\r
-#include "CommonHeader.h"\r
-\r
#------------------------------------------------------------------------------\r
#\r
# Copyright (c) 2006, Intel Corporation\r
-//\r
-// Include common header file for this module.\r
-//\r
-#include "CommonHeader.h"\r
-\r
#------------------------------------------------------------------------------\r
#\r
# Copyright (c) 2006, Intel Corporation\r
-//\r
-// Include common header file for this module.\r
-//\r
-#include "CommonHeader.h"\r
-\r
#------------------------------------------------------------------------------\r
#\r
# Copyright (c) 2006, Intel Corporation\r
-//\r
-// Include common header file for this module.\r
-//\r
-#include "CommonHeader.h"\r
-\r
#------------------------------------------------------------------------------\r
#\r
# Copyright (c) 2006, Intel Corporation\r
-//\r
-// Include common header file for this module.\r
-//\r
-#include "CommonHeader.h"\r
-\r
#------------------------------------------------------------------------------\r
#\r
# Copyright (c) 2006, Intel Corporation\r
-//\r
-// Include common header file for this module.\r
-//\r
-#include "CommonHeader.h"\r
-\r
#------------------------------------------------------------------------------\r
#\r
# Copyright (c) 2006, Intel Corporation\r
-//\r
-// Include common header file for this module.\r
-//\r
-#include "CommonHeader.h"\r
-\r
#------------------------------------------------------------------------------\r
#\r
# Copyright (c) 2006, Intel Corporation\r
-//\r
-// Include common header file for this module.\r
-//\r
-#include "CommonHeader.h"\r
-\r
#------------------------------------------------------------------------------\r
#\r
# Copyright (c) 2006, Intel Corporation\r
-//\r
-// Include common header file for this module.\r
-//\r
-#include "CommonHeader.h"\r
-\r
#------------------------------------------------------------------------------\r
#\r
# Copyright (c) 2006, Intel Corporation\r
-//\r
-// Include common header file for this module.\r
-//\r
-#include "CommonHeader.h"\r
-\r
-#------------------------------------------------------------------------------\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
-# CpuId.Asm\r
-#\r
-# Abstract:\r
-#\r
-# AsmCpuid function\r
-#\r
-# Notes:\r
-#\r
-#------------------------------------------------------------------------------\r
-\r
-\r
-#------------------------------------------------------------------------------\r
-# UINT64\r
-# EFIAPI\r
-# InternalMathSwapBytes64 (\r
-# IN UINT64 Operand\r
-# );\r
-#------------------------------------------------------------------------------\r
-.globl ASM_PFX(InternalMathSwapBytes64)\r
-ASM_PFX(InternalMathSwapBytes64):\r
- movl 8(%esp), %eax\r
- movl 4(%esp), %edx\r
- bswapl %eax\r
- bswapl %edx\r
- ret\r
+#------------------------------------------------------------------------------
+#
+# 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.Asm
+#
+# Abstract:
+#
+# AsmCpuid function
+#
+# Notes:
+#
+#------------------------------------------------------------------------------
+
+
+#------------------------------------------------------------------------------
+# UINT64
+# EFIAPI
+# InternalMathSwapBytes64 (
+# IN UINT64 Operand
+# );
+#------------------------------------------------------------------------------
+.globl ASM_PFX(InternalMathSwapBytes64)
+ASM_PFX(InternalMathSwapBytes64):
+ movl 8(%esp), %eax
+ movl 4(%esp), %edx
+ bswapl %eax
+ bswapl %edx
+ ret
-//\r
-// Include common header file for this module.\r
-//\r
-#include "CommonHeader.h"\r
-\r
#------------------------------------------------------------------------------\r
#\r
# Copyright (c) 2006, Intel Corporation\r
-//\r
-// Include common header file for this module.\r
-//\r
-#include "CommonHeader.h"\r
-\r
#------------------------------------------------------------------------------\r
#\r
# Copyright (c) 2006, Intel Corporation\r
-//\r
-// Include common header file for this module.\r
-//\r
-#include "CommonHeader.h"\r
-\r
#------------------------------------------------------------------------------\r
#\r
# Copyright (c) 2006, Intel Corporation\r
-//\r
-// Include common header file for this module.\r
-//\r
-#include "CommonHeader.h"\r
-\r
#------------------------------------------------------------------------------\r
#\r
# Copyright (c) 2006, Intel Corporation\r
-//\r
-// Include common header file for this module.\r
-//\r
-#include "CommonHeader.h"\r
-\r
#------------------------------------------------------------------------------\r
#\r
# Copyright (c) 2006, Intel Corporation\r
-//\r
-// Include common header file for this module.\r
-//\r
-#include "CommonHeader.h"\r
-\r
#------------------------------------------------------------------------------\r
#\r
# Copyright (c) 2006, Intel Corporation\r
-//\r
-// Include common header file for this module.\r
-//\r
-#include "CommonHeader.h"\r
-\r
#------------------------------------------------------------------------------\r
#\r
# Copyright (c) 2006, Intel Corporation\r
-//\r
-// Include common header file for this module.\r
-//\r
-#include "CommonHeader.h"\r
-\r
#------------------------------------------------------------------------------\r
#\r
# Copyright (c) 2006, Intel Corporation\r
-//\r
-// Include common header file for this module.\r
-//\r
-#include "CommonHeader.h"\r
-\r
#------------------------------------------------------------------------------\r
#\r
# Copyright (c) 2006, Intel Corporation\r
-//\r
-// Include common header file for this module.\r
-//\r
-#include "CommonHeader.h"\r
-\r
#------------------------------------------------------------------------------\r
#\r
# Copyright (c) 2006, Intel Corporation\r
-//\r
-// Include common header file for this module.\r
-//\r
-#include "CommonHeader.h"\r
-\r
#------------------------------------------------------------------------------\r
#\r
# Copyright (c) 2006, Intel Corporation\r
-//\r
-// Include common header file for this module.\r
-//\r
-#include "CommonHeader.h"\r
-\r
#------------------------------------------------------------------------------\r
#\r
# Copyright (c) 2006, Intel Corporation\r
-//\r
-// Include common header file for this module.\r
-//\r
-#include "CommonHeader.h"\r
-\r
#------------------------------------------------------------------------------\r
#\r
# Copyright (c) 2006, Intel Corporation\r
-//\r
-// Include common header file for this module.\r
-//\r
-#include "CommonHeader.h"\r
-\r
#------------------------------------------------------------------------------\r
#\r
# Copyright (c) 2006, Intel Corporation\r
-//\r
-// Include common header file for this module.\r
-//\r
-#include "CommonHeader.h"\r
-\r
#------------------------------------------------------------------------------\r
#\r
# Copyright (c) 2006, Intel Corporation\r
-//\r
-// Include common header file for this module.\r
-//\r
-#include "CommonHeader.h"\r
-\r
#------------------------------------------------------------------------------\r
#\r
# Copyright (c) 2006, Intel Corporation\r
-//\r
-// Include common header file for this module.\r
-//\r
-#include "CommonHeader.h"\r
-\r
#------------------------------------------------------------------------------\r
#\r
# Copyright (c) 2006, Intel Corporation\r
-//\r
-// Include common header file for this module.\r
-//\r
-#include "CommonHeader.h"\r
-\r
#------------------------------------------------------------------------------\r
#\r
# Copyright (c) 2006, Intel Corporation\r
-//\r
-// Include common header file for this module.\r
-//\r
-#include "CommonHeader.h"\r
-\r
#------------------------------------------------------------------------------\r
#\r
# Copyright (c) 2006, Intel Corporation\r
-//\r
-// Include common header file for this module.\r
-//\r
-#include "CommonHeader.h"\r
-\r
#------------------------------------------------------------------------------\r
#\r
# Copyright (c) 2006, Intel Corporation\r
-//\r
-// Include common header file for this module.\r
-//\r
-#include "CommonHeader.h"\r
-\r
#------------------------------------------------------------------------------\r
#\r
# Copyright (c) 2006, Intel Corporation\r
-//\r
-// Include common header file for this module.\r
-//\r
-#include "CommonHeader.h"\r
-\r
#------------------------------------------------------------------------------\r
#\r
# Copyright (c) 2006, Intel Corporation\r
-//\r
-// Include common header file for this module.\r
-//\r
-#include "CommonHeader.h"\r
-\r
#------------------------------------------------------------------------------\r
#\r
# Copyright (c) 2006, Intel Corporation\r
-//\r
-// Include common header file for this module.\r
-//\r
-#include "CommonHeader.h"\r
-\r
#------------------------------------------------------------------------------\r
#\r
# Copyright (c) 2006, Intel Corporation\r
-//\r
-// Include common header file for this module.\r
-//\r
-#include "CommonHeader.h"\r
-\r
#------------------------------------------------------------------------------\r
#\r
# Copyright (c) 2006, Intel Corporation\r
-//\r
-// Include common header file for this module.\r
-//\r
-#include "CommonHeader.h"\r
-\r
#------------------------------------------------------------------------------\r
#\r
# Copyright (c) 2006, Intel Corporation\r
--- /dev/null
+/// @file\r
+/// IPF specific Debug Breakpoint Registers accessing functions\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: AccessDbr.s\r
+///\r
+///\r
+\r
+//---------------------------------------------------------------------------------\r
+//++\r
+// AsmReadDbr\r
+//\r
+// This routine is used to Reads the current value of Data Breakpoint Register (DBR).\r
+//\r
+// Arguments :\r
+//\r
+// On Entry : The 8-bit DBR index to read.\r
+//\r
+// Return Value: The current value of DBR by Index.\r
+//\r
+//--\r
+//----------------------------------------------------------------------------------\r
+.text\r
+.type AsmReadDbr, @function\r
+.proc AsmReadDbr\r
+.regstk 1, 0, 0, 0\r
+\r
+AsmReadDbr::\r
+ mov r8 = dbr[in0];;\r
+ br.ret.dpnt b0;;\r
+.endp AsmReadDbr\r
+\r
+//---------------------------------------------------------------------------------\r
+//++\r
+// AsmWriteDbr\r
+//\r
+// This routine is used to write the current value to Data Breakpoint Register (DBR).\r
+//\r
+// Arguments :\r
+//\r
+// On Entry : The 8-bit DBR index to read.\r
+// The value should be written to DBR\r
+//\r
+// Return Value: The value written to DBR.\r
+//\r
+//--\r
+//----------------------------------------------------------------------------------\r
+.text\r
+.type AsmWriteDbr, @function\r
+.proc AsmWriteDbr\r
+.regstk 2, 0, 0, 0\r
+\r
+AsmWriteDbr::\r
+ mov dbr[in0] = in1\r
+ mov r8 = in1;;\r
+ srlz.d;;\r
+ br.ret.dpnt b0;;\r
+.endp AsmWriteDbr\r
+\r
+\r
+//---------------------------------------------------------------------------------\r
+//++\r
+// AsmReadIbr\r
+//\r
+// This routine is used to Reads the current value of Instruction Breakpoint Register (IBR).\r
+//\r
+// Arguments :\r
+//\r
+// On Entry : The 8-bit IBR index.\r
+//\r
+// Return Value: The current value of IBR by Index.\r
+//\r
+//--\r
+//----------------------------------------------------------------------------------\r
+.text\r
+.type AsmReadIbr, @function\r
+.proc AsmReadIbr\r
+.regstk 1, 0, 0, 0\r
+\r
+AsmReadIbr::\r
+ mov r8 = ibr[in0];;\r
+ br.ret.dpnt b0;;\r
+.endp AsmReadIbr\r
+\r
+//---------------------------------------------------------------------------------\r
+//++\r
+// AsmWriteIbr\r
+//\r
+// This routine is used to write the current value to Instruction Breakpoint Register (IBR).\r
+//\r
+// Arguments :\r
+//\r
+// On Entry : The 8-bit IBR index.\r
+// The value should be written to IBR\r
+//\r
+// Return Value: The value written to IBR.\r
+//\r
+//--\r
+//----------------------------------------------------------------------------------\r
+.text\r
+.type AsmWriteIbr, @function\r
+.proc AsmWriteIbr\r
+.regstk 2, 0, 0, 0\r
+\r
+AsmWriteIbr::\r
+ mov ibr[in0] = in1\r
+ mov r8 = in1;;\r
+ srlz.i;;\r
+ br.ret.dpnt b0;;\r
+.endp AsmWriteIbr\r
--- /dev/null
+/// @file\r
+/// IPF specific External Interrupt Control Registers accessing functions\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: AccessEicr.s\r
+///\r
+///\r
+\r
+//---------------------------------------------------------------------------------\r
+//++\r
+// AsmReadLid\r
+//\r
+// This routine is used to read the value of Local Interrupt ID Register (LID).\r
+//\r
+// Arguments :\r
+//\r
+// On Entry :\r
+//\r
+// Return Value: The current value of LID.\r
+//\r
+//--\r
+//----------------------------------------------------------------------------------\r
+.text\r
+.type AsmReadLid, @function\r
+.proc AsmReadLid\r
+\r
+AsmReadLid::\r
+ mov r8 = cr.lid;;\r
+ srlz.d;;\r
+ br.ret.dpnt b0;;\r
+.endp AsmReadLid\r
+\r
+//---------------------------------------------------------------------------------\r
+//++\r
+// AsmWriteLid\r
+//\r
+// This routine is used to write the value to Local Interrupt ID Register (LID).\r
+//\r
+// Arguments :\r
+//\r
+// On Entry : The value need to be written to LID.\r
+//\r
+// Return Value: The value written to LID.\r
+//\r
+//--\r
+//----------------------------------------------------------------------------------\r
+.text\r
+.type AsmWriteLid, @function\r
+.proc AsmWriteLid\r
+.regstk 1, 0, 0, 0\r
+\r
+AsmWriteLid::\r
+ mov cr.lid = in0\r
+ mov r8 = in0;;\r
+ srlz.d;;\r
+ br.ret.dpnt b0;;\r
+.endp AsmWriteLid\r
+\r
+\r
+//---------------------------------------------------------------------------------\r
+//++\r
+// AsmReadIvr\r
+//\r
+// This routine is used to read the value of External Interrupt Vector Register (IVR).\r
+//\r
+// Arguments :\r
+//\r
+// On Entry :\r
+//\r
+// Return Value: The current value of IVR.\r
+//\r
+//--\r
+//----------------------------------------------------------------------------------\r
+.text\r
+.type AsmReadIvr, @function\r
+.proc AsmReadIvr\r
+\r
+AsmReadIvr::\r
+ mov r8 = cr.ivr;;\r
+ srlz.d;;\r
+ br.ret.dpnt b0;;\r
+.endp AsmReadIvr\r
+\r
+\r
+//---------------------------------------------------------------------------------\r
+//++\r
+// AsmReadTpr\r
+//\r
+// This routine is used to read the value of Task Priority Register (TPR).\r
+//\r
+// Arguments :\r
+//\r
+// On Entry :\r
+//\r
+// Return Value: The current value of TPR.\r
+//\r
+//--\r
+//----------------------------------------------------------------------------------\r
+.text\r
+.type AsmReadTpr, @function\r
+.proc AsmReadTpr\r
+\r
+AsmReadTpr::\r
+ mov r8 = cr.tpr;;\r
+ br.ret.dpnt b0;;\r
+.endp AsmReadTpr\r
+\r
+//---------------------------------------------------------------------------------\r
+//++\r
+// AsmWriteTpr\r
+//\r
+// This routine is used to write the value to Task Priority Register (TPR).\r
+//\r
+// Arguments :\r
+//\r
+// On Entry : The value need to be written to TPR.\r
+//\r
+// Return Value: The value written to TPR.\r
+//\r
+//--\r
+//----------------------------------------------------------------------------------\r
+.text\r
+.type AsmWriteTpr, @function\r
+.proc AsmWriteTpr\r
+.regstk 1, 0, 0, 0\r
+\r
+AsmWriteTpr::\r
+ mov cr.tpr = in0\r
+ mov r8 = in0;;\r
+ srlz.d;;\r
+ br.ret.dpnt b0;;\r
+.endp AsmWriteTpr\r
+\r
+\r
+//---------------------------------------------------------------------------------\r
+//++\r
+// AsmWriteEoi\r
+//\r
+// This routine is used to write the value to End of External Interrupt Register (EOI).\r
+//\r
+// Arguments :\r
+//\r
+// On Entry : The value need to be written to EOI.\r
+//\r
+// Return Value: The value written to EOI.\r
+//\r
+//--\r
+//----------------------------------------------------------------------------------\r
+.text\r
+.type AsmWriteEoi, @function\r
+.proc AsmWriteEoi\r
+\r
+AsmWriteEoi::\r
+ mov cr.eoi = r0;;\r
+ srlz.d;;\r
+ br.ret.dpnt b0;;\r
+.endp AsmWriteEoi\r
+\r
+\r
+//---------------------------------------------------------------------------------\r
+//++\r
+// AsmReadIrr0\r
+//\r
+// This routine is used to Read the value of External Interrupt Request Register 0 (IRR0).\r
+//\r
+// Arguments :\r
+//\r
+// On Entry :\r
+//\r
+// Return Value: The current value of IRR0.\r
+//\r
+//--\r
+//----------------------------------------------------------------------------------\r
+.text\r
+.type AsmReadIrr0, @function\r
+.proc AsmReadIrr0\r
+\r
+AsmReadIrr0::\r
+ mov r8 = cr.irr0;;\r
+ br.ret.dpnt b0;;\r
+.endp AsmReadIrr0\r
+\r
+\r
+//---------------------------------------------------------------------------------\r
+//++\r
+// AsmReadIrr1\r
+//\r
+// This routine is used to Read the value of External Interrupt Request Register 1 (IRR1).\r
+//\r
+// Arguments :\r
+//\r
+// On Entry :\r
+//\r
+// Return Value: The current value of IRR1.\r
+//\r
+//--\r
+//----------------------------------------------------------------------------------\r
+.text\r
+.type AsmReadIrr1, @function\r
+.proc AsmReadIrr1\r
+\r
+AsmReadIrr1::\r
+ mov r8 = cr.irr1;;\r
+ br.ret.dpnt b0;;\r
+.endp AsmReadIrr1\r
+\r
+\r
+//---------------------------------------------------------------------------------\r
+//++\r
+// AsmReadIrr2\r
+//\r
+// This routine is used to Read the value of External Interrupt Request Register 2 (IRR2).\r
+//\r
+// Arguments :\r
+//\r
+// On Entry :\r
+//\r
+// Return Value: The current value of IRR2.\r
+//\r
+//--\r
+//----------------------------------------------------------------------------------\r
+.text\r
+.type AsmReadIrr2, @function\r
+.proc AsmReadIrr2\r
+\r
+AsmReadIrr2::\r
+ mov r8 = cr.irr2;;\r
+ br.ret.dpnt b0;;\r
+.endp AsmReadIrr2\r
+\r
+\r
+//---------------------------------------------------------------------------------\r
+//++\r
+// AsmReadIrr3\r
+//\r
+// This routine is used to Read the value of External Interrupt Request Register 3 (IRR3).\r
+//\r
+// Arguments :\r
+//\r
+// On Entry :\r
+//\r
+// Return Value: The current value of IRR3.\r
+//\r
+//--\r
+//----------------------------------------------------------------------------------\r
+.text\r
+.type AsmReadIrr3, @function\r
+.proc AsmReadIrr3\r
+\r
+AsmReadIrr3::\r
+ mov r8 = cr.irr3;;\r
+ br.ret.dpnt b0;;\r
+.endp AsmReadIrr3\r
+\r
+\r
+//---------------------------------------------------------------------------------\r
+//++\r
+// AsmReadItv\r
+//\r
+// This routine is used to Read the value of Interval Timer Vector Register (ITV).\r
+//\r
+// Arguments :\r
+//\r
+// On Entry :\r
+//\r
+// Return Value: The current value of ITV.\r
+//\r
+//--\r
+//----------------------------------------------------------------------------------\r
+.text\r
+.type AsmReadItv, @function\r
+.proc AsmReadItv\r
+\r
+AsmReadItv::\r
+ mov r8 = cr.itv;;\r
+ br.ret.dpnt b0;;\r
+.endp AsmReadItv\r
+\r
+//---------------------------------------------------------------------------------\r
+//++\r
+// AsmWriteItv\r
+//\r
+// This routine is used to write the value to Interval Timer Vector Register (ITV).\r
+//\r
+// Arguments :\r
+//\r
+// On Entry : The value need to be written to ITV\r
+//\r
+// Return Value: The value written to ITV.\r
+//\r
+//--\r
+//----------------------------------------------------------------------------------\r
+.text\r
+.type AsmWriteItv, @function\r
+.proc AsmWriteItv\r
+.regstk 1, 0, 0, 0\r
+\r
+AsmWriteItv::\r
+ mov cr.itv = in0\r
+ mov r8 = in0;;\r
+ srlz.d;;\r
+ br.ret.dpnt b0;;\r
+.endp AsmWriteItv\r
+\r
+\r
+//---------------------------------------------------------------------------------\r
+//++\r
+// AsmReadPmv\r
+//\r
+// This routine is used to Read the value of Performance Monitoring Vector Register (PMV).\r
+//\r
+// Arguments :\r
+//\r
+// On Entry :\r
+//\r
+// Return Value: The current value of PMV.\r
+//\r
+//--\r
+//----------------------------------------------------------------------------------\r
+.text\r
+.type AsmReadPmv, @function\r
+.proc AsmReadPmv\r
+\r
+AsmReadPmv::\r
+ mov r8 = cr.pmv;;\r
+ br.ret.dpnt b0;;\r
+.endp AsmReadPmv\r
+\r
+//---------------------------------------------------------------------------------\r
+//++\r
+// AsmWritePmv\r
+//\r
+// This routine is used to write the value to Performance Monitoring Vector Register (PMV).\r
+//\r
+// Arguments :\r
+//\r
+// On Entry : The value need to be written to PMV\r
+//\r
+// Return Value: The value written to PMV.\r
+//\r
+//--\r
+//----------------------------------------------------------------------------------\r
+.text\r
+.type AsmWritePmv, @function\r
+.proc AsmWritePmv\r
+.regstk 1, 0, 0, 0\r
+\r
+AsmWritePmv::\r
+ mov cr.pmv = in0\r
+ mov r8 = in0;;\r
+ srlz.d;;\r
+ br.ret.dpnt b0;;\r
+.endp AsmWritePmv\r
+\r
+\r
+//---------------------------------------------------------------------------------\r
+//++\r
+// AsmReadCmcv\r
+//\r
+// This routine is used to Read the value of Corrected Machine Check Vector Register (CMCV).\r
+//\r
+// Arguments :\r
+//\r
+// On Entry :\r
+//\r
+// Return Value: The current value of CMCV.\r
+//\r
+//--\r
+//----------------------------------------------------------------------------------\r
+.text\r
+.type AsmReadCmcv, @function\r
+.proc AsmReadCmcv\r
+\r
+AsmReadCmcv::\r
+ mov r8 = cr.cmcv;;\r
+ br.ret.dpnt b0;;\r
+.endp AsmReadCmcv\r
+\r
+//---------------------------------------------------------------------------------\r
+//++\r
+// AsmWriteCmcv\r
+//\r
+// This routine is used to write the value to Corrected Machine Check Vector Register (CMCV).\r
+//\r
+// Arguments :\r
+//\r
+// On Entry : The value need to be written to CMCV\r
+//\r
+// Return Value: The value written to CMCV.\r
+//\r
+//--\r
+//----------------------------------------------------------------------------------\r
+.text\r
+.type AsmWriteCmcv, @function\r
+.proc AsmWriteCmcv\r
+.regstk 1, 0, 0, 0\r
+\r
+AsmWriteCmcv::\r
+ mov cr.cmcv = in0\r
+ mov r8 = in0;;\r
+ srlz.d;;\r
+ br.ret.dpnt b0;;\r
+.endp AsmWriteCmcv\r
+\r
+\r
+//---------------------------------------------------------------------------------\r
+//++\r
+// AsmReadLrr0\r
+//\r
+// This routine is used to read the value of Local Redirection Register 0 (LRR0).\r
+//\r
+// Arguments :\r
+//\r
+// On Entry :\r
+//\r
+// Return Value: The current value of LRR0.\r
+//\r
+//--\r
+//----------------------------------------------------------------------------------\r
+.text\r
+.type AsmReadLrr0, @function\r
+.proc AsmReadLrr0\r
+\r
+AsmReadLrr0::\r
+ mov r8 = cr.lrr0;;\r
+ br.ret.dpnt b0;;\r
+.endp AsmReadLrr0\r
+\r
+//---------------------------------------------------------------------------------\r
+//++\r
+// AsmWriteLrr0\r
+//\r
+// This routine is used to write the value to Local Redirection Register 0 (LRR0).\r
+//\r
+// Arguments :\r
+//\r
+// On Entry : The value need to be written to LRR0.\r
+//\r
+// Return Value: The value written to LRR0.\r
+//\r
+//--\r
+//----------------------------------------------------------------------------------\r
+.text\r
+.type AsmWriteLrr0, @function\r
+.proc AsmWriteLrr0\r
+.regstk 1, 0, 0, 0\r
+\r
+AsmWriteLrr0::\r
+ mov cr.lrr0 = in0\r
+ mov r8 = in0;;\r
+ srlz.d;;\r
+ br.ret.dpnt b0;;\r
+.endp AsmWriteLrr0\r
+\r
+\r
+//---------------------------------------------------------------------------------\r
+//++\r
+// AsmReadLrr1\r
+//\r
+// This routine is used to read the value of Local Redirection Register 1 (LRR1).\r
+//\r
+// Arguments :\r
+//\r
+// On Entry :\r
+//\r
+// Return Value: The current value of LRR1.\r
+//\r
+//--\r
+//----------------------------------------------------------------------------------\r
+.text\r
+.type AsmReadLrr1, @function\r
+.proc AsmReadLrr1\r
+\r
+AsmReadLrr1::\r
+ mov r8 = cr.lrr1;;\r
+ br.ret.dpnt b0;;\r
+.endp AsmReadLrr1\r
+\r
+//---------------------------------------------------------------------------------\r
+//++\r
+// AsmWriteLrr1\r
+//\r
+// This routine is used to write the value to Local Redirection Register 1 (LRR1).\r
+//\r
+// Arguments :\r
+//\r
+// On Entry : The value need to be written to LRR1.\r
+//\r
+// Return Value: The value written to LRR1.\r
+//\r
+//--\r
+//----------------------------------------------------------------------------------\r
+.text\r
+.type AsmWriteLrr1, @function\r
+.proc AsmWriteLrr1\r
+.regstk 1, 0, 0, 0\r
+\r
+AsmWriteLrr1::\r
+ mov cr.lrr1 = in0\r
+ mov r8 = in0;;\r
+ srlz.d;;\r
+ br.ret.dpnt b0;;\r
+.endp AsmWriteLrr1\r
+\r
--- /dev/null
+/// @file\r
+/// IPF specific Global Control Registers accessing functions\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: AccessGcr.s\r
+///\r
+///\r
+\r
+//---------------------------------------------------------------------------------\r
+//++\r
+// AsmReadDcr\r
+//\r
+// This routine is used to Read the value of Default Control Register (DCR).\r
+//\r
+// Arguments :\r
+//\r
+// On Entry :\r
+//\r
+// Return Value: The current value of DCR.\r
+//\r
+//--\r
+//----------------------------------------------------------------------------------\r
+.text\r
+.type AsmReadDcr, @function\r
+.proc AsmReadDcr\r
+\r
+AsmReadDcr::\r
+ mov r8 = cr.dcr;;\r
+ br.ret.dpnt b0;;\r
+.endp AsmReadDcr\r
+\r
+//---------------------------------------------------------------------------------\r
+//++\r
+// AsmWriteDcr\r
+//\r
+// This routine is used to write the value to Default Control Register (DCR).\r
+//\r
+// Arguments :\r
+//\r
+// On Entry : The value need to be written to DCR\r
+//\r
+// Return Value: The value written to DCR.\r
+//\r
+//--\r
+//----------------------------------------------------------------------------------\r
+.text\r
+.type AsmWriteDcr, @function\r
+.proc AsmWriteDcr\r
+.regstk 1, 0, 0, 0\r
+\r
+AsmWriteDcr::\r
+ mov cr.dcr = in0\r
+ mov r8 = in0;;\r
+ srlz.i;;\r
+ srlz.d;;\r
+ br.ret.dpnt b0;;\r
+.endp AsmWriteDcr\r
+\r
+\r
+//---------------------------------------------------------------------------------\r
+//++\r
+// AsmReadItc\r
+//\r
+// This routine is used to Read the value of Interval Timer Counter Register (ITC).\r
+//\r
+// Arguments :\r
+//\r
+// On Entry :\r
+//\r
+// Return Value: The current value of ITC.\r
+//\r
+//--\r
+//----------------------------------------------------------------------------------\r
+.text\r
+.type AsmReadItc, @function\r
+.proc AsmReadItc\r
+\r
+AsmReadItc::\r
+ mov r8 = ar.itc;;\r
+ br.ret.dpnt b0;;\r
+.endp AsmReadItc\r
+\r
+//---------------------------------------------------------------------------------\r
+//++\r
+// AsmWriteItc\r
+//\r
+// This routine is used to write the value to Interval Timer Counter Register (ITC).\r
+//\r
+// Arguments :\r
+//\r
+// On Entry : The value need to be written to the ITC\r
+//\r
+// Return Value: The value written to the ITC.\r
+//\r
+//--\r
+//----------------------------------------------------------------------------------\r
+.text\r
+.type AsmWriteItc, @function\r
+.proc AsmWriteItc\r
+.regstk 1, 0, 0, 0\r
+\r
+AsmWriteItc::\r
+ mov ar.itc = in0\r
+ mov r8 = in0;;\r
+ br.ret.dpnt b0;;\r
+.endp AsmWriteItc\r
+\r
+\r
+//---------------------------------------------------------------------------------\r
+//++\r
+// AsmReadItm\r
+//\r
+// This routine is used to Read the value of Interval Timer Match Register (ITM).\r
+//\r
+// Arguments :\r
+//\r
+// On Entry :\r
+//\r
+// Return Value: The current value of ITM.\r
+//\r
+//--\r
+//----------------------------------------------------------------------------------\r
+.text\r
+.type AsmReadItm, @function\r
+.proc AsmReadItm\r
+\r
+AsmReadItm::\r
+ mov r8 = cr.itm;;\r
+ br.ret.dpnt b0;;\r
+.endp AsmReadItm\r
+\r
+//---------------------------------------------------------------------------------\r
+//++\r
+// AsmWriteItm\r
+//\r
+// This routine is used to write the value to Interval Timer Match Register (ITM).\r
+//\r
+// Arguments :\r
+//\r
+// On Entry : The value need to be written to ITM\r
+//\r
+// Return Value: The value written to ITM.\r
+//\r
+//--\r
+//----------------------------------------------------------------------------------\r
+.text\r
+.type AsmWriteItm, @function\r
+.proc AsmWriteItm\r
+.regstk 1, 0, 0, 0\r
+\r
+AsmWriteItm::\r
+ mov cr.itm = in0\r
+ mov r8 = in0;;\r
+ srlz.d;\r
+ br.ret.dpnt b0;;\r
+.endp AsmWriteItm\r
+\r
+\r
+//---------------------------------------------------------------------------------\r
+//++\r
+// AsmReadIva\r
+//\r
+// This routine is used to read the value of Interruption Vector Address Register (IVA).\r
+//\r
+// Arguments :\r
+//\r
+// On Entry :\r
+//\r
+// Return Value: The current value of IVA.\r
+//\r
+//--\r
+//----------------------------------------------------------------------------------\r
+.text\r
+.type AsmReadIva, @function\r
+.proc AsmReadIva\r
+\r
+AsmReadIva::\r
+ mov r8 = cr.iva;;\r
+ br.ret.dpnt b0;;\r
+.endp AsmReadIva\r
+\r
+//---------------------------------------------------------------------------------\r
+//++\r
+// AsmWriteIva\r
+//\r
+// This routine is used to write the value to Interruption Vector Address Register (IVA).\r
+//\r
+// Arguments :\r
+//\r
+// On Entry : The value need to be written to IVA\r
+//\r
+// Return Value: The value written to IVA.\r
+//\r
+//--\r
+//----------------------------------------------------------------------------------\r
+.text\r
+.type AsmWriteIva, @function\r
+.proc AsmWriteIva\r
+.regstk 1, 0, 0, 0\r
+\r
+AsmWriteIva::\r
+ mov cr.iva = in0\r
+ mov r8 = in0;;\r
+ br.ret.dpnt b0;;\r
+.endp AsmWriteIva\r
+\r
+\r
+//---------------------------------------------------------------------------------\r
+//++\r
+// AsmReadPta\r
+//\r
+// This routine is used to read the value of Page Table Address Register (PTA).\r
+//\r
+// Arguments :\r
+//\r
+// On Entry :\r
+//\r
+// Return Value: The current value of PTA.\r
+//\r
+//--\r
+//----------------------------------------------------------------------------------\r
+.text\r
+.type AsmReadPta, @function\r
+.proc AsmReadPta\r
+\r
+AsmReadPta::\r
+ mov r8 = cr.pta;;\r
+ br.ret.dpnt b0;;\r
+.endp AsmReadPta\r
+\r
+//---------------------------------------------------------------------------------\r
+//++\r
+// AsmWritePta\r
+//\r
+// This routine is used to write the value to Page Table Address Register (PTA)).\r
+//\r
+// Arguments :\r
+//\r
+// On Entry : The value need to be written to PTA\r
+//\r
+// Return Value: The value written to PTA.\r
+//\r
+//--\r
+//----------------------------------------------------------------------------------\r
+.text\r
+.type AsmWritePta, @function\r
+.proc AsmWritePta\r
+.regstk 1, 0, 0, 0\r
+\r
+AsmWritePta::\r
+ mov cr.pta = in0\r
+ mov r8 = in0;;\r
+ srlz.i;;\r
+ srlz.d;;\r
+ br.ret.dpnt b0;;\r
+.endp AsmWritePta
\ No newline at end of file
--- /dev/null
+/// @file\r
+/// IPF specific Global Pointer and Stack Pointer accessing functions\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: AccessGp.s\r
+///\r
+///\r
+\r
+//---------------------------------------------------------------------------------\r
+//++\r
+// AsmReadGp\r
+//\r
+// This routine is used to read the current value of 64-bit Global Pointer (GP).\r
+//\r
+// Arguments :\r
+//\r
+// On Entry :\r
+//\r
+// Return Value: The current GP value.\r
+//\r
+//--\r
+//----------------------------------------------------------------------------------\r
+.text\r
+.type AsmReadGp, @function\r
+.proc AsmReadGp\r
+\r
+AsmReadGp::\r
+ mov r8 = gp;;\r
+ br.ret.dpnt b0;;\r
+.endp AsmReadGp\r
+\r
+//---------------------------------------------------------------------------------\r
+//++\r
+// AsmWriteGp\r
+//\r
+// This routine is used to write the current value of 64-bit Global Pointer (GP).\r
+//\r
+// Arguments :\r
+//\r
+// On Entry : The value need to be written.\r
+//\r
+// Return Value: The value have been written.\r
+//\r
+//--\r
+//----------------------------------------------------------------------------------\r
+.text\r
+.type AsmWriteGp, @function\r
+.proc AsmWriteGp\r
+.regstk 1, 0, 0, 0\r
+\r
+AsmWriteGp::\r
+ mov gp = in0\r
+ mov r8 = in0;;\r
+ br.ret.dpnt b0;;\r
+.endp AsmWriteGp\r
+\r
+//---------------------------------------------------------------------------------\r
+//++\r
+// AsmReadSp\r
+//\r
+// This routine is used to read the current value of 64-bit Stack Pointer (SP).\r
+//\r
+// Arguments :\r
+//\r
+// On Entry :\r
+//\r
+// Return Value: The current SP value.\r
+//\r
+//--\r
+//----------------------------------------------------------------------------------\r
+.text\r
+.type AsmReadSp, @function\r
+.proc AsmReadSp\r
+\r
+AsmReadSp::\r
+ mov r8 = sp;;\r
+ br.ret.dpnt b0;;\r
+.endp AsmReadSp\r
--- /dev/null
+/// @file\r
+/// IPF specific AsmReadKrX() and AsmWriteKrX functions, 'X' is from '0' to '7'\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: AccessKr.s\r
+///\r
+///\r
+\r
+//---------------------------------------------------------------------------------\r
+//++\r
+// AsmReadKr0\r
+//\r
+// This routine is used to get KR0.\r
+//\r
+// Arguments :\r
+//\r
+// On Entry : None.\r
+//\r
+// Return Value: The value store in KR0.\r
+//\r
+//--\r
+//----------------------------------------------------------------------------------\r
+.text\r
+.type AsmReadKr0, @function\r
+.proc AsmReadKr0\r
+\r
+AsmReadKr0::\r
+ mov r8 = ar.k0;;\r
+ br.ret.dpnt b0;;\r
+.endp AsmReadKr0\r
+\r
+//---------------------------------------------------------------------------------\r
+//++\r
+// AsmWriteKr0\r
+//\r
+// This routine is used to Write KR0.\r
+//\r
+// Arguments :\r
+//\r
+// On Entry : None.\r
+//\r
+// Return Value: The value written to the KR0.\r
+//\r
+//--\r
+//----------------------------------------------------------------------------------\r
+\r
+.text\r
+.type AsmWriteKr0, @function\r
+.proc AsmWriteKr0\r
+.regstk 1, 0, 0, 0\r
+\r
+AsmWriteKr0::\r
+ mov ar.k0 = in0\r
+ mov r8 = in0;;\r
+ br.ret.dpnt b0;;\r
+.endp AsmWriteKr0\r
+\r
+\r
+//---------------------------------------------------------------------------------\r
+//++\r
+// AsmReadKr1\r
+//\r
+// This routine is used to get KR1.\r
+//\r
+// Arguments :\r
+//\r
+// On Entry : None.\r
+//\r
+// Return Value: The value store in KR1.\r
+//\r
+//--\r
+//----------------------------------------------------------------------------------\r
+.text\r
+.type AsmReadKr1, @function\r
+.proc AsmReadKr1\r
+\r
+AsmReadKr1::\r
+ mov r8 = ar.k1;;\r
+ br.ret.dpnt b0;;\r
+.endp AsmReadKr1\r
+\r
+//---------------------------------------------------------------------------------\r
+//++\r
+// AsmWriteKr1\r
+//\r
+// This routine is used to Write KR1.\r
+//\r
+// Arguments :\r
+//\r
+// On Entry : None.\r
+//\r
+// Return Value: The value written to the KR1.\r
+//\r
+//--\r
+//----------------------------------------------------------------------------------\r
+.text\r
+.type AsmWriteKr1, @function\r
+.proc AsmWriteKr1\r
+\r
+AsmWriteKr1::\r
+ mov ar.k1 = in0\r
+ mov r8 = in0;;\r
+ br.ret.dpnt b0;;\r
+.endp AsmWriteKr1\r
+\r
+\r
+//---------------------------------------------------------------------------------\r
+//++\r
+// AsmReadKr2\r
+//\r
+// This routine is used to get KR2.\r
+//\r
+// Arguments :\r
+//\r
+// On Entry : None.\r
+//\r
+// Return Value: The value store in KR2.\r
+//\r
+//--\r
+//----------------------------------------------------------------------------------\r
+.text\r
+.type AsmReadKr2, @function\r
+.proc AsmReadKr2\r
+\r
+AsmReadKr2::\r
+ mov r8 = ar.k2;;\r
+ br.ret.dpnt b0;;\r
+.endp AsmReadKr2\r
+\r
+//---------------------------------------------------------------------------------\r
+//++\r
+// AsmWriteKr2\r
+//\r
+// This routine is used to Write KR2.\r
+//\r
+// Arguments :\r
+//\r
+// On Entry : None.\r
+//\r
+// Return Value: The value written to the KR2.\r
+//\r
+//--\r
+//----------------------------------------------------------------------------------\r
+.text\r
+.type AsmWriteKr2, @function\r
+.proc AsmWriteKr2\r
+\r
+AsmWriteKr2::\r
+ mov ar.k2 = in0\r
+ mov r8 = in0;;\r
+ br.ret.dpnt b0;;\r
+.endp AsmWriteKr2\r
+\r
+\r
+//---------------------------------------------------------------------------------\r
+//++\r
+// AsmReadKr3\r
+//\r
+// This routine is used to get KR3.\r
+//\r
+// Arguments :\r
+//\r
+// On Entry : None.\r
+//\r
+// Return Value: The value store in KR3.\r
+//\r
+//--\r
+//----------------------------------------------------------------------------------\r
+.text\r
+.type AsmReadKr3, @function\r
+.proc AsmReadKr3\r
+\r
+AsmReadKr3::\r
+ mov r8 = ar.k3;;\r
+ br.ret.dpnt b0;;\r
+.endp AsmReadKr3\r
+\r
+//---------------------------------------------------------------------------------\r
+//++\r
+// AsmWriteKr3\r
+//\r
+// This routine is used to Write KR3.\r
+//\r
+// Arguments :\r
+//\r
+// On Entry : None.\r
+//\r
+// Return Value: The value written to the KR3.\r
+//\r
+//--\r
+//----------------------------------------------------------------------------------\r
+.text\r
+.type AsmWriteKr3, @function\r
+.proc AsmWriteKr3\r
+\r
+AsmWriteKr3::\r
+ mov ar.k3 = in0\r
+ mov r8 = in0;;\r
+ br.ret.dpnt b0;;\r
+.endp AsmWriteKr3\r
+\r
+\r
+//---------------------------------------------------------------------------------\r
+//++\r
+// AsmReadKr4\r
+//\r
+// This routine is used to get KR4.\r
+//\r
+// Arguments :\r
+//\r
+// On Entry : None.\r
+//\r
+// Return Value: The value store in KR4.\r
+//\r
+//--\r
+//----------------------------------------------------------------------------------\r
+.text\r
+.type AsmReadKr4, @function\r
+.proc AsmReadKr4\r
+\r
+AsmReadKr4::\r
+ mov r8 = ar.k4;;\r
+ br.ret.dpnt b0;;\r
+.endp AsmReadKr4\r
+\r
+//---------------------------------------------------------------------------------\r
+//++\r
+// AsmWriteKr4\r
+//\r
+// This routine is used to Write KR4.\r
+//\r
+// Arguments :\r
+//\r
+// On Entry : None.\r
+//\r
+// Return Value: The value written to the KR4.\r
+//\r
+//--\r
+//----------------------------------------------------------------------------------\r
+.text\r
+.type AsmWriteKr4, @function\r
+.proc AsmWriteKr4\r
+\r
+AsmWriteKr4::\r
+ mov ar.k4 = in0\r
+ mov r8 = in0;;\r
+ br.ret.dpnt b0;;\r
+.endp AsmWriteKr4\r
+\r
+\r
+//---------------------------------------------------------------------------------\r
+//++\r
+// AsmReadKr5\r
+//\r
+// This routine is used to get KR5.\r
+//\r
+// Arguments :\r
+//\r
+// On Entry : None.\r
+//\r
+// Return Value: The value store in KR5.\r
+//\r
+//--\r
+//----------------------------------------------------------------------------------\r
+.text\r
+.type AsmReadKr5, @function\r
+.proc AsmReadKr5\r
+\r
+AsmReadKr5::\r
+ mov r8 = ar.k5;;\r
+ br.ret.dpnt b0;;\r
+.endp AsmReadKr5\r
+\r
+//---------------------------------------------------------------------------------\r
+//++\r
+// AsmWriteKr5\r
+//\r
+// This routine is used to Write KR5.\r
+//\r
+// Arguments :\r
+//\r
+// On Entry : None.\r
+//\r
+// Return Value: The value written to the KR5.\r
+//\r
+//--\r
+//----------------------------------------------------------------------------------\r
+.text\r
+.type AsmWriteKr5, @function\r
+.proc AsmWriteKr5\r
+\r
+AsmWriteKr5::\r
+ mov ar.k5 = in0\r
+ mov r8 = in0;;\r
+ br.ret.dpnt b0;;\r
+.endp AsmWriteKr5\r
+\r
+\r
+//---------------------------------------------------------------------------------\r
+//++\r
+// AsmReadKr6\r
+//\r
+// This routine is used to get KR6.\r
+//\r
+// Arguments :\r
+//\r
+// On Entry : None.\r
+//\r
+// Return Value: The value store in KR6.\r
+//\r
+//--\r
+//----------------------------------------------------------------------------------\r
+.text\r
+.type AsmReadKr6, @function\r
+.proc AsmReadKr6\r
+\r
+AsmReadKr6::\r
+ mov r8 = ar.k6;;\r
+ br.ret.dpnt b0;;\r
+.endp AsmReadKr6\r
+\r
+//---------------------------------------------------------------------------------\r
+//++\r
+// AsmWriteKr6\r
+//\r
+// This routine is used to write KR6.\r
+//\r
+// Arguments :\r
+//\r
+// On Entry : None.\r
+//\r
+// Return Value: The value written to the KR6.\r
+//\r
+//--\r
+//----------------------------------------------------------------------------------\r
+.text\r
+.type AsmWriteKr6, @function\r
+.proc AsmWriteKr6\r
+\r
+AsmWriteKr6::\r
+ mov ar.k6 = in0\r
+ mov r8 = in0;;\r
+ br.ret.dpnt b0;;\r
+.endp AsmWriteKr6\r
+\r
+\r
+//---------------------------------------------------------------------------------\r
+//++\r
+// AsmReadKr7\r
+//\r
+// This routine is used to get KR7.\r
+//\r
+// Arguments :\r
+//\r
+// On Entry : None.\r
+//\r
+// Return Value: The value store in KR7.\r
+//\r
+//--\r
+//----------------------------------------------------------------------------------\r
+.text\r
+.type AsmReadKr7, @function\r
+.proc AsmReadKr7\r
+\r
+AsmReadKr7::\r
+ mov r8 = ar.k7;;\r
+ br.ret.dpnt b0;;\r
+.endp AsmReadKr7\r
+\r
+//---------------------------------------------------------------------------------\r
+//++\r
+// AsmWriteKr7\r
+//\r
+// This routine is used to write KR7.\r
+//\r
+// Arguments :\r
+//\r
+// On Entry : None.\r
+//\r
+// Return Value: The value written to the KR7.\r
+//\r
+//--\r
+//----------------------------------------------------------------------------------\r
+.text\r
+.type AsmWriteKr7, @function\r
+.proc AsmWriteKr7\r
+\r
+AsmWriteKr7::\r
+ mov ar.k7 = in0\r
+ mov r8 = in0;;\r
+ br.ret.dpnt b0;;\r
+.endp AsmWriteKr7\r
--- /dev/null
+/// @file\r
+/// IPF specific Performance Monitor Configuration/Data Registers accessing functions\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: AccessPmr.s\r
+///\r
+///\r
+\r
+//---------------------------------------------------------------------------------\r
+//++\r
+// AsmReadPmc\r
+//\r
+// This routine is used to Reads the current value of Performance Monitor Configuration Register (PMC).\r
+//\r
+// Arguments :\r
+//\r
+// On Entry : The 8-bit PMC index.\r
+//\r
+// Return Value: The current value of PMC by Index.\r
+//\r
+//--\r
+//----------------------------------------------------------------------------------\r
+.text\r
+.type AsmReadPmc, @function\r
+.proc AsmReadPmc\r
+.regstk 1, 0, 0, 0\r
+\r
+AsmReadPmc::\r
+ srlz.i;;\r
+ srlz.d;;\r
+ mov r8 = pmc[in0];;\r
+ br.ret.dpnt b0;;\r
+.endp AsmReadPmc\r
+\r
+//---------------------------------------------------------------------------------\r
+//++\r
+// AsmWritePmc\r
+//\r
+// This routine is used to write the current value to a Performance Monitor Configuration Register (PMC).\r
+//\r
+// Arguments :\r
+//\r
+// On Entry : The 8-bit PMC index.\r
+// The value should be written to PMC\r
+//\r
+// Return Value: The value written to PMC.\r
+//\r
+//--\r
+//----------------------------------------------------------------------------------\r
+.text\r
+.type AsmWritePmc, @function\r
+.proc AsmWritePmc\r
+.regstk 2, 0, 0, 0\r
+\r
+AsmWritePmc::\r
+ mov pmc[in0] = in1\r
+ mov r8 = in1;;\r
+ srlz.i;;\r
+ srlz.d;;\r
+ br.ret.dpnt b0;;\r
+.endp AsmWritePmc\r
+\r
+\r
+//---------------------------------------------------------------------------------\r
+//++\r
+// AsmReadPmd\r
+//\r
+// This routine is used to Reads the current value of Performance Monitor Data Register (PMD).\r
+//\r
+// Arguments :\r
+//\r
+// On Entry : The 8-bit PMD index.\r
+//\r
+// Return Value: The current value of PMD by Index.\r
+//\r
+//--\r
+//----------------------------------------------------------------------------------\r
+.text\r
+.type AsmReadPmd, @function\r
+.proc AsmReadPmd\r
+.regstk 1, 0, 0, 0\r
+\r
+AsmReadPmd::\r
+ srlz.i;;\r
+ srlz.d;;\r
+ mov r8 = pmd[in0];;\r
+ br.ret.dpnt b0;;\r
+.endp AsmReadPmd\r
+\r
+//---------------------------------------------------------------------------------\r
+//++\r
+// AsmWritePmd\r
+//\r
+// This routine is used to write the current value to Performance Monitor Data Register (PMD).\r
+//\r
+// Arguments :\r
+//\r
+// On Entry : The 8-bit PMD index.\r
+// The value should be written to PMD\r
+//\r
+// Return Value: The value written to PMD.\r
+//\r
+//--\r
+//----------------------------------------------------------------------------------\r
+.text\r
+.type AsmWritePmd, @function\r
+.proc AsmWritePmd\r
+.regstk 2, 0, 0, 0\r
+\r
+AsmWritePmd::\r
+ mov pmd[in0] = in1\r
+ mov r8 = in1;;\r
+ srlz.i;;\r
+ srlz.d;;\r
+ br.ret.dpnt b0;;\r
+.endp AsmWritePmd\r
--- /dev/null
+/// @file\r
+/// IPF specific Processor Status Register accessing functions\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: AccessPsr.s\r
+///\r
+///\r
+\r
+#define CpuModeMask 0x0000001008020000\r
+\r
+#define CpuInVirtualMode 0x1\r
+#define CpuInPhysicalMode 0x0\r
+#define CpuInMixMode (0x0 - 0x1)\r
+\r
+//---------------------------------------------------------------------------------\r
+//++\r
+// AsmReadPsr\r
+//\r
+// This routine is used to read the current value of Processor Status Register (PSR).\r
+//\r
+// Arguments :\r
+//\r
+// On Entry :\r
+//\r
+// Return Value: The current PSR value.\r
+//\r
+//--\r
+//----------------------------------------------------------------------------------\r
+.text\r
+.type AsmReadPsr, @function\r
+.proc AsmReadPsr\r
+\r
+AsmReadPsr::\r
+ mov r8 = psr;;\r
+ br.ret.dpnt b0;;\r
+.endp AsmReadPsr\r
+\r
+//---------------------------------------------------------------------------------\r
+//++\r
+// AsmWritePsr\r
+//\r
+// This routine is used to write the value of Processor Status Register (PSR).\r
+//\r
+// Arguments :\r
+//\r
+// On Entry : The value need to be written.\r
+//\r
+// Return Value: The value have been written.\r
+//\r
+//--\r
+//----------------------------------------------------------------------------------\r
+.text\r
+.type AsmWritePsr, @function\r
+.proc AsmWritePsr\r
+.regstk 1, 0, 0, 0\r
+\r
+AsmWritePsr::\r
+ mov psr.l = in0\r
+ mov r8 = in0;;\r
+ srlz.d;;\r
+ srlz.i;;\r
+ br.ret.dpnt b0;;\r
+.endp AsmWritePsr\r
+\r
+//---------------------------------------------------------------------------------\r
+//++\r
+// AsmCpuVirtual\r
+//\r
+// This routine is used to determines if the CPU is currently executing\r
+// in virtual, physical, or mixed mode.\r
+//\r
+// If the CPU is in virtual mode(PSR.RT=1, PSR.DT=1, PSR.IT=1), then 1 is returned.\r
+// If the CPU is in physical mode(PSR.RT=0, PSR.DT=0, PSR.IT=0), then 0 is returned.\r
+// If the CPU is not in physical mode or virtual mode, then it is in mixed mode,\r
+// and -1 is returned.\r
+//\r
+// Arguments:\r
+//\r
+// On Entry: None\r
+//\r
+// Return Value: The CPU mode flag\r
+// return 1 The CPU is in virtual mode.\r
+// return 0 The CPU is in physical mode.\r
+// return -1 The CPU is in mixed mode.\r
+//\r
+//--\r
+//----------------------------------------------------------------------------------\r
+.text\r
+.type AsmCpuVirtual, @function\r
+.proc AsmCpuVirtual\r
+\r
+AsmCpuVirtual::\r
+ mov r29 = psr\r
+ movl r30 = CpuModeMask;;\r
+ and r28 = r30, r29;;\r
+ cmp.eq p6, p7 = r30, r28;;\r
+(p6) mov r8 = CpuInVirtualMode;;\r
+(p7) cmp.eq p6, p7 = 0x0, r28;;\r
+(p6) mov r8 = CpuInPhysicalMode;;\r
+(p7) mov r8 = CpuInMixMode;;\r
+ br.ret.dpnt b0;;\r
+.endp AsmCpuVirtual
\ No newline at end of file
--- /dev/null
+/// @file\r
+/// Contains an implementation of CallPalProcStacked on Itanium-based\r
+/// architecture.\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: AsmPalCall.s\r
+///\r
+///\r
+\r
+\r
+//-----------------------------------------------------------------------------\r
+//++\r
+// AsmPalCall\r
+//\r
+// Makes a PAL procedure call.\r
+// This is function to make a PAL procedure call. Based on the Index\r
+// value this API will make static or stacked PAL call. The following table\r
+// describes the usage of PAL Procedure Index Assignment. Architected procedures\r
+// may be designated as required or optional. If a PAL procedure is specified\r
+// as optional, a unique return code of 0xFFFFFFFFFFFFFFFF is returned in the\r
+// Status field of the PAL_CALL_RETURN structure.\r
+// This indicates that the procedure is not present in this PAL implementation.\r
+// It is the caller¡¯s responsibility to check for this return code after calling\r
+// any optional PAL procedure.\r
+// No parameter checking is performed on the 5 input parameters, but there are\r
+// some common rules that the caller should follow when making a PAL call. Any\r
+// address passed to PAL as buffers for return parameters must be 8-byte aligned.\r
+// Unaligned addresses may cause undefined results. For those parameters defined\r
+// as reserved or some fields defined as reserved must be zero filled or the invalid\r
+// argument return value may be returned or undefined result may occur during the\r
+// execution of the procedure. If the PalEntryPoint does not point to a valid\r
+// PAL entry point then the system behavior is undefined. This function is only\r
+// available on IPF.\r
+//\r
+// On Entry :\r
+// in0: PAL_PROC entrypoint\r
+// in1-in4 : PAL_PROC arguments\r
+//\r
+// Return Value:\r
+//\r
+// As per stacked calling conventions.\r
+//\r
+//--\r
+//---------------------------------------------------------------------------\r
+\r
+//\r
+// PAL function calls\r
+//\r
+#define PAL_MC_CLEAR_LOG 0x0015\r
+#define PAL_MC_DYNAMIC_STATE 0x0018\r
+#define PAL_MC_ERROR_INFO 0x0019\r
+#define PAL_MC_RESUME 0x001a\r
+\r
+\r
+.text\r
+.proc AsmPalCall\r
+.type AsmPalCall, @function\r
+\r
+AsmPalCall::\r
+ alloc loc1 = ar.pfs,5,8,4,0\r
+ mov loc0 = b0\r
+ mov loc3 = b5\r
+ mov loc4 = r2\r
+ mov loc7 = r1\r
+ mov r2 = psr;;\r
+ mov r28 = in1\r
+ mov loc5 = r2;;\r
+\r
+ movl loc6 = 0x100;;\r
+ cmp.ge p6,p7 = r28,loc6;;\r
+\r
+(p6) movl loc6 = 0x1FF;;\r
+(p7) br.dpnt.few PalCallStatic;; // 0 ~ 255 make a static Pal Call\r
+(p6) cmp.le p6,p7 = r28,loc6;;\r
+(p6) br.dpnt.few PalCallStacked;; // 256 ~ 511 make a stacked Pal Call\r
+(p7) movl loc6 = 0x300;;\r
+(p7) cmp.ge p6,p7 = r28,loc6;;\r
+(p7) br.dpnt.few PalCallStatic;; // 512 ~ 767 make a static Pal Call\r
+(p6) movl loc6 = 0x3FF;;\r
+(p6) cmp.le p6,p7 = r28,loc6;;\r
+(p6) br.dpnt.few PalCallStacked;; // 768 ~ 1023 make a stacked Pal Call\r
+\r
+(p7) mov r8 = 0xFFFFFFFFFFFFFFFF;; // > 1024 return invalid\r
+(p7) br.dpnt.few ComeBackFromPALCall;;\r
+\r
+PalCallStatic:\r
+ movl loc6 = PAL_MC_CLEAR_LOG;;\r
+ cmp.eq p6,p7 = r28,loc6;;\r
+\r
+(p7) movl loc6 = PAL_MC_DYNAMIC_STATE;;\r
+(p7) cmp.eq p6,p7 = r28,loc6;;\r
+\r
+(p7) movl loc6 = PAL_MC_ERROR_INFO;;\r
+(p7) cmp.eq p6,p7 = r28,loc6;;\r
+\r
+(p7) movl loc6 = PAL_MC_RESUME;;\r
+(p7) cmp.eq p6,p7 = r28,loc6 ;;\r
+\r
+ mov loc6 = 0x1;;\r
+(p7) dep r2 = loc6,r2,13,1;; // psr.ic = 1\r
+\r
+// p6 will be true, if it is one of the MCHK calls. There has been lots of debate\r
+// on psr.ic for these values. For now, do not do any thing to psr.ic\r
+\r
+ dep r2 = r0,r2,14,1;; // psr.i = 0\r
+\r
+ mov psr.l = r2\r
+ srlz.d // Needs data serailization.\r
+ srlz.i // Needs instruction serailization.\r
+\r
+StaticGetPALLocalIP:\r
+ mov loc2 = ip;;\r
+ add loc2 = ComeBackFromPALCall - StaticGetPALLocalIP,loc2;;\r
+ mov b0 = loc2 // return address after Pal call\r
+\r
+ mov r29 = in2\r
+ mov r30 = in3\r
+ mov r31 = in4\r
+ mov b5 = in0;; // get the PalProcEntrypt from input\r
+ br.sptk b5;; // Take the plunge.\r
+\r
+PalCallStacked:\r
+ dep r2 = r0,r2,14,1;; // psr.i = 0\r
+ mov psr.l = r2;;\r
+ srlz.d // Needs data serailization.\r
+ srlz.i // Needs instruction serailization.\r
+\r
+StackedGetPALLocalIP:\r
+ mov out0 = in1\r
+ mov out1 = in2\r
+ mov out2 = in3\r
+ mov out3 = in4\r
+ mov b5 = in0 ;; // get the PalProcEntrypt from input\r
+ br.call.dpnt b0 = b5 ;; // Take the plunge.\r
+\r
+ComeBackFromPALCall:\r
+ mov psr.l = loc5 ;;\r
+ srlz.d // Needs data serailization.\r
+ srlz.i // Needs instruction serailization.\r
+\r
+ mov b5 = loc3\r
+ mov r2 = loc4\r
+ mov r1 = loc7\r
+\r
+ mov b0 = loc0\r
+ mov ar.pfs = loc1;;\r
+ br.ret.dpnt b0;;\r
+\r
+.endp AsmPalCall\r
+\r
--- /dev/null
+/** @file\r
+ Base Library CPU functions for Itanium\r
+\r
+ Copyright (c) 2006, Intel Corporation<BR>\r
+ All rights reserved. This program and the accompanying materials\r
+ are licensed and made available under the terms and conditions of the BSD License\r
+ which accompanies this distribution. The full text of the license may be found at\r
+ http://opensource.org/licenses/bsd-license.php\r
+\r
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+**/\r
+\r
+//\r
+// Include common header file for this module.\r
+//\r
+#include <BaseLibInternals.h>\r
+\r
+//void __mfa (void);\r
+\r
+#pragma intrinsic (_enable)\r
+#pragma intrinsic (_disable)\r
+#pragma intrinsic (__break)\r
+#pragma intrinsic (__mfa)\r
+\r
+\r
+/**\r
+ Generates a breakpoint on the CPU.\r
+\r
+ Generates a breakpoint on the CPU. The breakpoint must be implemented such\r
+ that code can resume normal execution after the breakpoint.\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+CpuBreakpoint (\r
+ VOID\r
+ )\r
+{\r
+ __break (0);\r
+}\r
+\r
+/**\r
+ Used to serialize load and store operations.\r
+\r
+ All loads and stores that proceed calls to this function are guaranteed to be\r
+ globally visible when this function returns.\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+MemoryFence (\r
+ VOID\r
+ )\r
+{\r
+ __mfa ();\r
+}\r
+\r
+/**\r
+ Disables CPU interrupts.\r
+\r
+ Disables CPU interrupts.\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+DisableInterrupts (\r
+ VOID\r
+ )\r
+{\r
+ _disable ();\r
+}\r
+\r
+/**\r
+ Enables CPU interrupts.\r
+\r
+ Enables CPU interrupts.\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+EnableInterrupts (\r
+ VOID\r
+ )\r
+{\r
+ _enable ();\r
+}\r
+\r
+/**\r
+ Enables CPU interrupts for the smallest window required to capture any\r
+ pending interrupts.\r
+\r
+ Enables CPU interrupts for the smallest window required to capture any\r
+ pending interrupts.\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+EnableDisableInterrupts (\r
+ VOID\r
+ )\r
+{\r
+ EnableInterrupts ();\r
+ DisableInterrupts ();\r
+}\r
+\r
+/**\r
+ Places the CPU in a sleep state until an interrupt is received.\r
+\r
+ Places the CPU in a sleep state until an interrupt is received. If interrupts\r
+ are disabled prior to calling this function, then the CPU will be placed in a\r
+ sleep state indefinitely.\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+CpuSleep (\r
+ VOID\r
+ )\r
+{\r
+ PalCallStatic (NULL, 29, 0, 0, 0);\r
+}\r
--- /dev/null
+/// @file\r
+/// CpuFlushTlb() function for Itanium-based architecture.\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: CpuFlushTlb.s\r
+///\r
+///\r
+\r
+.auto\r
+.text\r
+\r
+.globl PalCallStatic\r
+.type PalCallStatic, @function\r
+\r
+.proc CpuFlushTlb\r
+.type CpuFlushTlb, @function\r
+CpuFlushTlb::\r
+ alloc loc0 = ar.pfs, 0, 3, 5, 0\r
+ mov out0 = 0\r
+ mov out1 = 6\r
+ mov out2 = 0\r
+ mov out3 = 0\r
+ mov loc1 = b0\r
+ mov out4 = 0\r
+ brl.call.sptk b0 = PalCallStatic\r
+ mov loc2 = psr // save PSR\r
+ mov ar.pfs = loc0\r
+ extr.u r14 = r10, 32, 32 // r14 <- count1\r
+ rsm 1 << 14 // Disable interrupts\r
+ extr.u r15 = r11, 32, 32 // r15 <- stride1\r
+ extr.u r10 = r10, 0, 32 // r10 <- count2\r
+ add r10 = -1, r10\r
+ extr.u r11 = r11, 0, 32 // r11 <- stride2\r
+ br.cond.sptk LoopPredicate\r
+LoopOuter:\r
+ mov ar.lc = r10 // LC <- count2\r
+ mov ar.ec = r0 // EC <- 0\r
+Loop:\r
+ ptc.e r9\r
+ add r9 = r11, r9 // r9 += stride2\r
+ br.ctop.sptk Loop\r
+ add r9 = r15, r9 // r9 += stride1\r
+LoopPredicate:\r
+ cmp.ne p6 = r0, r14 // count1 == 0?\r
+ add r14 = -1, r14\r
+(p6) br.cond.sptk LoopOuter\r
+ mov psr.l = loc2\r
+ mov b0 = loc1\r
+ br.ret.sptk.many b0\r
+.endp\r
--- /dev/null
+/// @file\r
+/// CpuPause() function for Itanium-based architecture.\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: CpuPause.s\r
+///\r
+///\r
+\r
+.auto\r
+.text\r
+\r
+.proc CpuPause\r
+.type CpuPause, @function\r
+CpuPause::\r
+ hint @pause\r
+ br.ret.sptk.many b0\r
+.endp\r
--- /dev/null
+/// @file\r
+/// IPF specific AsmFc() and AsmFci () functions\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: ExecFc.s\r
+///\r
+///\r
+\r
+//---------------------------------------------------------------------------------\r
+//++\r
+// AsmFc\r
+//\r
+// This routine is used to execute a FC instruction on the specific address.\r
+//\r
+// Arguments :\r
+//\r
+// On Entry : The specific address need to execute FC instruction.\r
+//\r
+// Return Value: The specific address have been execute FC instruction.\r
+//\r
+//--\r
+//----------------------------------------------------------------------------------\r
+.text\r
+.type AsmFc, @function\r
+.proc AsmFc\r
+.regstk 1, 0, 0, 0\r
+\r
+AsmFc::\r
+ fc in0\r
+ mov r8 = in0;;\r
+ br.ret.dpnt b0;;\r
+.endp AsmFc\r
+\r
+\r
+//---------------------------------------------------------------------------------\r
+//++\r
+// AsmFci\r
+//\r
+// This routine is used to execute a FC.i instruction on the specific address.\r
+//\r
+// Arguments :\r
+//\r
+// On Entry : The specific address need to execute FC.i instruction.\r
+//\r
+// Return Value: The specific address have been execute FC.i instruction.\r
+//\r
+//--\r
+//----------------------------------------------------------------------------------\r
+.text\r
+.type AsmFci, @function\r
+.proc AsmFci\r
+.regstk 1, 0, 0, 0\r
+\r
+AsmFci::\r
+ fc.i in0\r
+ mov r8 = in0;;\r
+ br.ret.dpnt b0;;\r
+.endp AsmFci
\ No newline at end of file
--- /dev/null
+//++\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
+// FlushCacheRange.s \r
+//\r
+// Abstract:\r
+// Assemble routine to flush cache lines \r
+//\r
+// Revision History:\r
+//\r
+//--\r
+.file "IpfCpuCache.s"\r
+\r
+#include "IpfMacro.i"\r
+//#include "IpfDefines.h"\r
+\r
+//\r
+// Invalidates a range of instruction cache lines in the cache coherency domain\r
+// of the calling CPU.\r
+//\r
+// Invalidates the instruction cache lines specified by Address and Length. If\r
+// Address is not aligned on a cache line boundary, then entire instruction\r
+// cache line containing Address is invalidated. If Address + Length is not\r
+// aligned on a cache line boundary, then the entire instruction cache line\r
+// containing Address + Length -1 is invalidated. This function may choose to\r
+// invalidate the entire instruction cache if that is more efficient than\r
+// invalidating the specified range. If Length is 0, the no instruction cache\r
+// lines are invalidated. Address is returned.\r
+//\r
+// If Length is greater than (MAX_ADDRESS - Address + 1), then ASSERT().\r
+//\r
+// @param Address The base address of the instruction cache lines to\r
+// invalidate. If the CPU is in a physical addressing mode, then\r
+// Address is a physical address. If the CPU is in a virtual\r
+// addressing mode, then Address is a virtual address.\r
+//\r
+// @param Length The number of bytes to invalidate from the instruction cache.\r
+//\r
+// @return Address\r
+// \r
+// VOID *\r
+// EFIAPI\r
+// IpfFlushCacheRange (\r
+// IN VOID *Address,\r
+// IN UINTN Length\r
+// );\r
+//\r
+PROCEDURE_ENTRY (IpfFlushCacheRange)\r
+\r
+ NESTED_SETUP (5,8,0,0)\r
+ \r
+ mov loc2 = ar.lc\r
+ \r
+ mov loc3 = in0 // Start address.\r
+ mov loc4 = in1;; // Length in bytes.\r
+ \r
+ cmp.eq p6,p7 = loc4, r0;; // If Length is zero then don't flush any cache\r
+ (p6) br.spnt.many DoneFlushingC;; \r
+ \r
+ add loc4 = loc4,loc3 \r
+ mov loc5 = 1;;\r
+ sub loc4 = loc4, loc5 ;; // the End address to flush\r
+ \r
+ dep loc3 = r0,loc3,0,5 \r
+ dep loc4 = r0,loc4,0,5;; \r
+ shr loc3 = loc3,5 \r
+ shr loc4 = loc4,5;; // 32 byte cache line\r
+ \r
+ sub loc4 = loc4,loc3;; // total flush count, It should be add 1 but \r
+ // the br.cloop will first execute one time \r
+ mov loc3 = in0 \r
+ mov loc5 = 32 \r
+ mov ar.lc = loc4;;\r
+\r
+StillFlushingC:\r
+ fc loc3;; \r
+ sync.i;;\r
+ srlz.i;;\r
+ add loc3 = loc5,loc3;;\r
+ br.cloop.sptk.few StillFlushingC;;\r
+\r
+DoneFlushingC: \r
+ mov ar.lc = loc2 \r
+ mov r8 = in0 // return *Address\r
+ NESTED_RETURN\r
+\r
+PROCEDURE_EXIT (IpfFlushCacheRange)\r
+\r
--- /dev/null
+/// @file\r
+/// Retrieve of the interrupt state of the running processor for the Itanium\r
+/// architecture.\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: GetInterruptState.s\r
+///\r
+///\r
+\r
+.auto\r
+.text\r
+\r
+.proc GetInterruptState\r
+.type GetInterruptState, @function\r
+GetInterruptState::\r
+ mov r8 = psr\r
+ extr.u r8 = r8, 14, 1\r
+ br.ret.sptk.many b0\r
+.endp GetInterruptState\r
--- /dev/null
+/// @file\r
+/// Contains an implementation of InterlockedCompareExchange32 on Itanium-\r
+/// based architecture.\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: InterlockedCompareExchange32.s\r
+///\r
+///\r
+\r
+.auto\r
+.text\r
+\r
+.proc InternalSyncCompareExchange32\r
+.type InternalSyncCompareExchange32, @function\r
+InternalSyncCompareExchange32::\r
+ zxt4 r33 = r33\r
+ mov ar.ccv = r33\r
+ cmpxchg4.rel r8 = [r32], r34\r
+ mf\r
+ br.ret.sptk.many b0\r
+.endp InternalSyncCompareExchange32
\ No newline at end of file
--- /dev/null
+/// @file\r
+/// Contains an implementation of InterlockedCompareExchange64 on Itanium-\r
+/// based architecture.\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: InterlockedCompareExchange64.s\r
+///\r
+///\r
+\r
+.auto\r
+.text\r
+\r
+.proc InternalSyncCompareExchange64\r
+.type InternalSyncCompareExchange64, @function\r
+InternalSyncCompareExchange64::\r
+ mov ar.ccv = r33\r
+ cmpxchg8.rel r8 = [r32], r34\r
+ mf\r
+ br.ret.sptk.many b0\r
+.endp InternalSyncCompareExchange64
\ No newline at end of file
--- /dev/null
+/** @file\r
+ SwitchStack() function for IPF.\r
+\r
+ Copyright (c) 2007, Intel Corporation<BR>\r
+ All rights reserved. This program and the accompanying materials\r
+ are licensed and made available under the terms and conditions of the BSD License\r
+ which accompanies this distribution. The full text of the license may be found at\r
+ http://opensource.org/licenses/bsd-license.php\r
+\r
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+ Module Name: InternalSwitchStack.c\r
+\r
+**/\r
+\r
+#include <BaseLibInternals.h>\r
+\r
+/**
+ Transfers control to a function starting with a new stack.
+
+ Transfers control to the function specified by EntryPoint using the
+ new stack specified by NewStack and passing in the parameters specified
+ by Context1 and Context2. Context1 and Context2 are optional and may
+ be NULL. The function EntryPoint must never return.
+ Marker will be ignored on IA-32, x64, and EBC.
+ IPF CPUs expect one additional parameter of type VOID * that specifies
+ the new backing store pointer.\r
+
+ If EntryPoint is NULL, then ASSERT().\r
+ If NewStack is NULL, then ASSERT().\r
+
+ @param EntryPoint A pointer to function to call with the new stack.
+ @param Context1 A pointer to the context to pass into the EntryPoint
+ function.
+ @param Context2 A pointer to the context to pass into the EntryPoint
+ function.
+ @param NewStack A pointer to the new stack to use for the EntryPoint
+ function.\r
+ @param Marker VA_LIST marker for the variable argument list.
+
+**/\r
+VOID
+EFIAPI
+InternalSwitchStack (
+ IN SWITCH_STACK_ENTRY_POINT EntryPoint,
+ IN VOID *Context1, OPTIONAL
+ IN VOID *Context2, OPTIONAL
+ IN VOID *NewStack,
+ IN VA_LIST Marker
+ )\r
+\r
+{\r
+ VOID *NewBsp;\r
+\r
+ //\r
+ // Get new backing store pointer from variable list\r
+ //\r
+ NewBsp = VA_ARG (Marker, VOID *);\r
+\r
+ //\r
+ // Stack should be aligned with CPU_STACK_ALIGNMENT\r
+ //\r
+ ASSERT (((UINTN)NewStack & (CPU_STACK_ALIGNMENT - 1)) == 0);\r
+ ASSERT (((UINTN)NewBsp & (CPU_STACK_ALIGNMENT - 1)) == 0);\r
+\r
+ AsmSwitchStackAndBackingStore (EntryPoint, Context1, Context2, NewStack, NewBsp);\r
+}\r
--- /dev/null
+/// @file\r
+/// Contains an implementation of CallPalProcStatic on Itanium-based\r
+/// architecture.\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: PalCallStatic.s\r
+///\r
+///\r
+\r
+.auto\r
+.text\r
+\r
+.proc PalCallStatic\r
+.type PalCallStatic, @function\r
+.regstk 5, 0, 0, 0\r
+PalCallStatic::\r
+ cmp.eq p15 = in0, r0\r
+ mov r31 = in4\r
+ mov r8 = ip\r
+\r
+(p15) mov in0 = ar.k5\r
+ add r8 = (_PalProcReturn - PalCallStatic), r8\r
+ mov r30 = in3\r
+\r
+ mov in4 = psr\r
+ mov in3 = b0\r
+ mov b7 = in0\r
+\r
+ rsm 1 << 14 // Disable interrupts\r
+ mov r29 = in2\r
+ mov r28 = in1\r
+\r
+ mov b0 = r8\r
+ br.cond.sptk.many b7\r
+\r
+_PalProcReturn:\r
+ mov psr.l = in4\r
+ mov b0 = in3\r
+ br.ret.sptk.many b0\r
+.endp PalCallStatic\r
--- /dev/null
+/// @file\r
+/// IPF specific AsmReadCpuid()function\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: ReadCpuid.s\r
+///\r
+///\r
+\r
+//---------------------------------------------------------------------------------\r
+//++\r
+// AsmReadCpuid\r
+//\r
+// This routine is used to Reads the current value of Processor Identifier Register (CPUID).\r
+//\r
+// Arguments :\r
+//\r
+// On Entry : The 8-bit Processor Identifier Register index to read.\r
+//\r
+// Return Value: The current value of Processor Identifier Register specified by Index.\r
+//\r
+//--\r
+//----------------------------------------------------------------------------------\r
+.text\r
+.type AsmReadCpuid, @function\r
+.proc AsmReadCpuid\r
+.regstk 1, 0, 0, 0\r
+\r
+AsmReadCpuid::\r
+ mov r8 = cpuid[in0];;\r
+ br.ret.dpnt b0;;\r
+.endp AsmReadCpuid\r
+\r
--- /dev/null
+/// @file\r
+/// IPF specific SwitchStack() function\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: SwitchStack.s\r
+///\r
+///\r
+\r
+.auto\r
+.text\r
+\r
+.proc AsmSwitchStackAndBackingStore\r
+.type AsmSwitchStackAndBackingStore, @function\r
+.regstk 5, 0, 0, 0\r
+AsmSwitchStackAndBackingStore::\r
+ mov r14 = ar.rsc\r
+ movl r2 = ~((((1 << 14) - 1) << 16) | 3)\r
+\r
+ mov r17 = in1\r
+ mov r18 = in2\r
+ and r2 = r14, r2\r
+\r
+ mov ar.rsc = r2\r
+ mov sp = in3\r
+ mov r19 = in4\r
+\r
+ ld8.nt1 r16 = [in0], 8\r
+ ld8.nta gp = [in0]\r
+ mov r3 = -1\r
+\r
+ loadrs\r
+ mov ar.bspstore = r19\r
+ mov b7 = r16\r
+\r
+ alloc r2 = ar.pfs, 0, 0, 2, 0\r
+ mov out0 = r17\r
+ mov out1 = r18\r
+\r
+ mov ar.rnat = r3\r
+ mov ar.rsc = r14\r
+ br.call.sptk.many b0 = b7\r
+.endp AsmSwitchStackAndBackingStore\r
--- /dev/null
+/** @file\r
+ Implementation of synchronization functions on Itanium.\r
+\r
+ Copyright (c) 2006, Intel Corporation<BR>\r
+ All rights reserved. This program and the accompanying materials\r
+ are licensed and made available under the terms and conditions of the BSD License\r
+ which accompanies this distribution. The full text of the license may be found at\r
+ http://opensource.org/licenses/bsd-license.php\r
+\r
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+ Module Name: Synchronization.c\r
+\r
+**/\r
+\r
+#include "BaseLibInternals.h"\r
+\r
+/**\r
+ Performs an atomic increment of an 32-bit unsigned integer.\r
+\r
+ Performs an atomic increment of the 32-bit unsigned integer specified by\r
+ Value and returns the incremented value. The increment operation must be\r
+ performed using MP safe mechanisms. The state of the return value is not\r
+ guaranteed to be MP safe.\r
+\r
+ @param Value A pointer to the 32-bit value to increment.\r
+\r
+ @return The incremented value.\r
+\r
+**/\r
+UINT32\r
+EFIAPI\r
+InternalSyncIncrement (\r
+ IN volatile UINT32 *Value\r
+ )\r
+{\r
+ UINT32 OriginalValue;\r
+\r
+ do {\r
+ OriginalValue = *Value;\r
+ } while (OriginalValue != InternalSyncCompareExchange32 (\r
+ Value,\r
+ OriginalValue,\r
+ OriginalValue + 1\r
+ ));\r
+ return OriginalValue + 1;\r
+}\r
+\r
+/**\r
+ Performs an atomic decrement of an 32-bit unsigned integer.\r
+\r
+ Performs an atomic decrement of the 32-bit unsigned integer specified by\r
+ Value and returns the decrement value. The decrement operation must be\r
+ performed using MP safe mechanisms. The state of the return value is not\r
+ guaranteed to be MP safe.\r
+\r
+ @param Value A pointer to the 32-bit value to decrement.\r
+\r
+ @return The decrement value.\r
+\r
+**/\r
+UINT32\r
+EFIAPI\r
+InternalSyncDecrement (\r
+ IN volatile UINT32 *Value\r
+ )\r
+{\r
+ UINT32 OriginalValue;\r
+\r
+ do {\r
+ OriginalValue = *Value;\r
+ } while (OriginalValue != InternalSyncCompareExchange32 (\r
+ Value,\r
+ OriginalValue,\r
+ OriginalValue - 1\r
+ ));\r
+ return OriginalValue - 1;\r
+}\r
--- /dev/null
+/** @file\r
+ Unaligned access functions of BaseLib for IPF.\r
+\r
+ Copyright (c) 2006, Intel Corporation<BR>\r
+ All rights reserved. This program and the accompanying materials\r
+ are licensed and made available under the terms and conditions of the BSD License\r
+ which accompanies this distribution. The full text of the license may be found at\r
+ http://opensource.org/licenses/bsd-license.php\r
+\r
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+ Module Name: Unaligned.c\r
+\r
+**/\r
+\r
+//\r
+// Include common header file for this module.\r
+//\r
+#include <BaseLibInternals.h>\r
+\r
+/**\r
+ Reads a 16-bit value from memory that may be unaligned.\r
+\r
+ This function returns the 16-bit value pointed to by Buffer. The function\r
+ guarantees that the read operation does not produce an alignment fault.\r
+\r
+ If the Buffer is NULL, then ASSERT().\r
+\r
+ @param Buffer Pointer to a 16-bit value that may be unaligned.\r
+\r
+ @return *Uint16\r
+\r
+**/\r
+UINT16\r
+EFIAPI\r
+ReadUnaligned16 (\r
+ IN CONST UINT16 *Buffer\r
+ )\r
+{\r
+ ASSERT (Buffer != NULL);\r
+\r
+ return (UINT16)(((UINT8*)Buffer)[0] | (((UINT8*)Buffer)[1] << 8));\r
+}\r
+\r
+/**\r
+ Writes a 16-bit value to memory that may be unaligned.\r
+\r
+ This function writes the 16-bit value specified by Value to Buffer. Value is\r
+ returned. The function guarantees that the write operation does not produce\r
+ an alignment fault.\r
+\r
+ If the Buffer is NULL, then ASSERT().\r
+\r
+ @param Buffer Pointer to a 16-bit value that may be unaligned.\r
+ @param Value 16-bit value to write to Buffer.\r
+\r
+ @return Value\r
+\r
+**/\r
+UINT16\r
+EFIAPI\r
+WriteUnaligned16 (\r
+ OUT UINT16 *Buffer,\r
+ IN UINT16 Value\r
+ )\r
+{\r
+ ASSERT (Buffer != NULL);\r
+\r
+ ((UINT8*)Buffer)[0] = (UINT8)Value;\r
+ ((UINT8*)Buffer)[1] = (UINT8)(Value >> 8);\r
+\r
+ return Value;\r
+}\r
+\r
+/**\r
+ Reads a 24-bit value from memory that may be unaligned.\r
+\r
+ This function returns the 24-bit value pointed to by Buffer. The function\r
+ guarantees that the read operation does not produce an alignment fault.\r
+\r
+ If the Buffer is NULL, then ASSERT().\r
+\r
+ @param Buffer Pointer to a 24-bit value that may be unaligned.\r
+\r
+ @return The value read.\r
+\r
+**/\r
+UINT32\r
+EFIAPI\r
+ReadUnaligned24 (\r
+ IN CONST UINT32 *Buffer\r
+ )\r
+{\r
+ ASSERT (Buffer != NULL);\r
+\r
+ return (UINT32)(\r
+ ReadUnaligned16 ((UINT16*)Buffer) |\r
+ (((UINT8*)Buffer)[2] << 16)\r
+ );\r
+}\r
+\r
+/**\r
+ Writes a 24-bit value to memory that may be unaligned.\r
+\r
+ This function writes the 24-bit value specified by Value to Buffer. Value is\r
+ returned. The function guarantees that the write operation does not produce\r
+ an alignment fault.\r
+\r
+ If the Buffer is NULL, then ASSERT().\r
+\r
+ @param Buffer Pointer to a 24-bit value that may be unaligned.\r
+ @param Value 24-bit value to write to Buffer.\r
+\r
+ @return The value written.\r
+\r
+**/\r
+UINT32\r
+EFIAPI\r
+WriteUnaligned24 (\r
+ OUT UINT32 *Buffer,\r
+ IN UINT32 Value\r
+ )\r
+{\r
+ ASSERT (Buffer != NULL);\r
+\r
+ WriteUnaligned16 ((UINT16*)Buffer, (UINT16)Value);\r
+ *(UINT8*)((UINT16*)Buffer + 1) = (UINT8)(Value >> 16);\r
+ return Value;\r
+}\r
+\r
+/**\r
+ Reads a 32-bit value from memory that may be unaligned.\r
+\r
+ This function returns the 32-bit value pointed to by Buffer. The function\r
+ guarantees that the read operation does not produce an alignment fault.\r
+\r
+ If the Buffer is NULL, then ASSERT().\r
+\r
+ @param Buffer Pointer to a 32-bit value that may be unaligned.\r
+\r
+ @return *Uint32\r
+\r
+**/\r
+UINT32\r
+EFIAPI\r
+ReadUnaligned32 (\r
+ IN CONST UINT32 *Buffer\r
+ )\r
+{\r
+ UINT16 LowerBytes;\r
+ UINT16 HigherBytes;\r
+\r
+ ASSERT (Buffer != NULL);\r
+\r
+ LowerBytes = ReadUnaligned16 ((UINT16*) Buffer);\r
+ HigherBytes = ReadUnaligned16 ((UINT16*) Buffer + 1);\r
+\r
+ return (UINT32) (LowerBytes | (HigherBytes << 16));\r
+}\r
+\r
+/**\r
+ Writes a 32-bit value to memory that may be unaligned.\r
+\r
+ This function writes the 32-bit value specified by Value to Buffer. Value is\r
+ returned. The function guarantees that the write operation does not produce\r
+ an alignment fault.\r
+\r
+ If the Buffer is NULL, then ASSERT().\r
+\r
+ @param Buffer Pointer to a 32-bit value that may be unaligned.\r
+ @param Value 32-bit value to write to Buffer.\r
+\r
+ @return Value\r
+\r
+**/\r
+UINT32\r
+EFIAPI\r
+WriteUnaligned32 (\r
+ OUT UINT32 *Buffer,\r
+ IN UINT32 Value\r
+ )\r
+{\r
+ ASSERT (Buffer != NULL);\r
+\r
+ WriteUnaligned16 ((UINT16*)Buffer, (UINT16)Value);\r
+ WriteUnaligned16 ((UINT16*)Buffer + 1, (UINT16)(Value >> 16));\r
+ return Value;\r
+}\r
+\r
+/**\r
+ Reads a 64-bit value from memory that may be unaligned.\r
+\r
+ This function returns the 64-bit value pointed to by Buffer. The function\r
+ guarantees that the read operation does not produce an alignment fault.\r
+\r
+ If the Buffer is NULL, then ASSERT().\r
+\r
+ @param Buffer Pointer to a 64-bit value that may be unaligned.\r
+\r
+ @return *Uint64\r
+\r
+**/\r
+UINT64\r
+EFIAPI\r
+ReadUnaligned64 (\r
+ IN CONST UINT64 *Buffer\r
+ )\r
+{\r
+ UINT32 LowerBytes;\r
+ UINT32 HigherBytes;\r
+\r
+ ASSERT (Buffer != NULL);\r
+\r
+ LowerBytes = ReadUnaligned32 ((UINT32*) Buffer);\r
+ HigherBytes = ReadUnaligned32 ((UINT32*) Buffer + 1);\r
+\r
+ return (UINT64) (LowerBytes | LShiftU64 (HigherBytes, 32));\r
+}\r
+\r
+/**\r
+ Writes a 64-bit value to memory that may be unaligned.\r
+\r
+ This function writes the 64-bit value specified by Value to Buffer. Value is\r
+ returned. The function guarantees that the write operation does not produce\r
+ an alignment fault.\r
+\r
+ If the Buffer is NULL, then ASSERT().\r
+\r
+ @param Buffer Pointer to a 64-bit value that may be unaligned.\r
+ @param Value 64-bit value to write to Buffer.\r
+\r
+ @return Value\r
+\r
+**/\r
+UINT64\r
+EFIAPI\r
+WriteUnaligned64 (\r
+ OUT UINT64 *Buffer,\r
+ IN UINT64 Value\r
+ )\r
+{\r
+ ASSERT (Buffer != NULL);\r
+\r
+ WriteUnaligned32 ((UINT32*)Buffer, (UINT32)Value);\r
+ WriteUnaligned32 ((UINT32*)Buffer + 1, (UINT32)RShiftU64 (Value, 32));\r
+ return Value;\r
+}\r
--- /dev/null
+/// @file\r
+/// This module contains generic macros for an assembly writer.\r
+///\r
+/// Copyright (c) 2006, Intel Corporation<BR>\r
+/// All rights reserved. This program and the accompanying materials\r
+/// are licensed and made available under the terms and conditions of the BSD License\r
+/// which accompanies this distribution. The full text of the license may be found at\r
+/// http://opensource.org/licenses/bsd-license.php\r
+///\r
+/// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+/// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+///\r
+/// Module Name: asm.h\r
+///\r
+#ifndef _ASM_H\r
+#define _ASM_H\r
+\r
+#define TRUE 1\r
+#define FALSE 0\r
+#define PROCEDURE_ENTRY(name) .##text; \\r
+ .##type name, @function; \\r
+ .##proc name; \\r
+ name::\r
+\r
+#define PROCEDURE_EXIT(name) .##endp name\r
+\r
+#endif // _ASM_H\r
--- /dev/null
+/// @file\r
+/// \r
+/// \r
+/// Copyright (c) 2006, Intel Corporation<BR>\r
+/// All rights reserved. This program and the accompanying materials\r
+/// are licensed and made available under the terms and conditions of the BSD License\r
+/// which accompanies this distribution. The full text of the license may be found at\r
+/// http://opensource.org/licenses/bsd-license.php\r
+///\r
+/// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+/// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
+/// \r
+/// Module Name: ia_64gen.h\r
+///\r
+#ifndef _IA64GEN_H\r
+#define _IA64GEN_H\r
+\r
+#define TT_UNAT 0\r
+#define C_PSR 0\r
+#define J_UNAT 0\r
+#define T_TYPE 0\r
+#define T_IPSR 0x8\r
+#define T_ISR 0x10\r
+#define T_IIP 0x18\r
+#define T_IFA 0x20\r
+#define T_IIPA 0x28\r
+#define T_IFS 0x30\r
+#define T_IIM 0x38\r
+#define T_RSC 0x40\r
+#define T_BSP 0x48\r
+#define T_BSPSTORE 0x50\r
+#define T_RNAT 0x58\r
+#define T_PFS 0x60\r
+#define T_KBSPSTORE 0x68\r
+#define T_UNAT 0x70\r
+#define T_CCV 0x78\r
+#define T_DCR 0x80\r
+#define T_PREDS 0x88\r
+#define T_NATS 0x90\r
+#define T_R1 0x98\r
+#define T_GP 0x98\r
+#define T_R2 0xa0\r
+#define T_R3 0xa8\r
+#define T_R4 0xb0\r
+#define T_R5 0xb8\r
+#define T_R6 0xc0\r
+#define T_R7 0xc8\r
+#define T_R8 0xd0\r
+#define T_R9 0xd8\r
+#define T_R10 0xe0\r
+#define T_R11 0xe8\r
+#define T_R12 0xf0\r
+#define T_SP 0xf0\r
+#define T_R13 0xf8\r
+#define T_R14 0x100\r
+#define T_R15 0x108\r
+#define T_R16 0x110\r
+#define T_R17 0x118\r
+#define T_R18 0x120\r
+#define T_R19 0x128\r
+#define T_R20 0x130\r
+#define T_R21 0x138\r
+#define T_R22 0x140\r
+#define T_R23 0x148\r
+#define T_R24 0x150\r
+#define T_R25 0x158\r
+#define T_R26 0x160\r
+#define T_R27 0x168\r
+#define T_R28 0x170\r
+#define T_R29 0x178\r
+#define T_R30 0x180\r
+#define T_R31 0x188\r
+#define T_F2 0x1f0\r
+#define T_F3 0x200\r
+#define T_F4 0x210\r
+#define T_F5 0x220\r
+#define T_F6 0x230\r
+#define T_F7 0x240\r
+#define T_F8 0x250\r
+#define T_F9 0x260\r
+#define T_F10 0x270\r
+#define T_F11 0x280\r
+#define T_F12 0x290\r
+#define T_F13 0x2a0\r
+#define T_F14 0x2b0\r
+#define T_F15 0x2c0\r
+#define T_F16 0x2d0\r
+#define T_F17 0x2e0\r
+#define T_F18 0x2f0\r
+#define T_F19 0x300\r
+#define T_F20 0x310\r
+#define T_F21 0x320\r
+#define T_F22 0x330\r
+#define T_F23 0x340\r
+#define T_F24 0x350\r
+#define T_F25 0x360\r
+#define T_F26 0x370\r
+#define T_F27 0x380\r
+#define T_F28 0x390\r
+#define T_F29 0x3a0\r
+#define T_F30 0x3b0\r
+#define T_F31 0x3c0\r
+#define T_FPSR 0x1e0\r
+#define T_B0 0x190\r
+#define T_B1 0x198\r
+#define T_B2 0x1a0\r
+#define T_B3 0x1a8\r
+#define T_B4 0x1b0\r
+#define T_B5 0x1b8\r
+#define T_B6 0x1c0\r
+#define T_B7 0x1c8\r
+#define T_EC 0x1d0\r
+#define T_LC 0x1d8\r
+#define J_NATS 0x8\r
+#define J_PFS 0x10\r
+#define J_BSP 0x18\r
+#define J_RNAT 0x20\r
+#define J_PREDS 0x28\r
+#define J_LC 0x30\r
+#define J_R4 0x38\r
+#define J_R5 0x40\r
+#define J_R6 0x48\r
+#define J_R7 0x50\r
+#define J_SP 0x58\r
+#define J_F2 0x60\r
+#define J_F3 0x70\r
+#define J_F4 0x80\r
+#define J_F5 0x90\r
+#define J_F16 0xa0\r
+#define J_F17 0xb0\r
+#define J_F18 0xc0\r
+#define J_F19 0xd0\r
+#define J_F20 0xe0\r
+#define J_F21 0xf0\r
+#define J_F22 0x100\r
+#define J_F23 0x110\r
+#define J_F24 0x120\r
+#define J_F25 0x130\r
+#define J_F26 0x140\r
+#define J_F27 0x150\r
+#define J_F28 0x160\r
+#define J_F29 0x170\r
+#define J_F30 0x180\r
+#define J_F31 0x190\r
+#define J_FPSR 0x1a0\r
+#define J_B0 0x1a8\r
+#define J_B1 0x1b0\r
+#define J_B2 0x1b8\r
+#define J_B3 0x1c0\r
+#define J_B4 0x1c8\r
+#define J_B5 0x1d0\r
+#define TRAP_FRAME_LENGTH 0x3d0\r
+#define C_UNAT 0x28\r
+#define C_NATS 0x30\r
+#define C_PFS 0x8\r
+#define C_BSPSTORE 0x10\r
+#define C_RNAT 0x18\r
+#define C_RSC 0x20\r
+#define C_PREDS 0x38\r
+#define C_LC 0x40\r
+#define C_DCR 0x48\r
+#define C_R1 0x50\r
+#define C_GP 0x50\r
+#define C_R4 0x58\r
+#define C_R5 0x60\r
+#define C_R6 0x68\r
+#define C_R7 0x70\r
+#define C_SP 0x78\r
+#define C_R13 0x80\r
+#define C_F2 0x90\r
+#define C_F3 0xa0\r
+#define C_F4 0xb0\r
+#define C_F5 0xc0\r
+#define C_F16 0xd0\r
+#define C_F17 0xe0\r
+#define C_F18 0xf0\r
+#define C_F19 0x100\r
+#define C_F20 0x110\r
+#define C_F21 0x120\r
+#define C_F22 0x130\r
+#define C_F23 0x140\r
+#define C_F24 0x150\r
+#define C_F25 0x160\r
+#define C_F26 0x170\r
+#define C_F27 0x180\r
+#define C_F28 0x190\r
+#define C_F29 0x1a0\r
+#define C_F30 0x1b0\r
+#define C_F31 0x1c0\r
+#define C_FPSR 0x1d0\r
+#define C_B0 0x1d8\r
+#define C_B1 0x1e0\r
+#define C_B2 0x1e8\r
+#define C_B3 0x1f0\r
+#define C_B4 0x1f8\r
+#define C_B5 0x200\r
+#define TT_R2 0x8\r
+#define TT_R3 0x10\r
+#define TT_R8 0x18\r
+#define TT_R9 0x20\r
+#define TT_R10 0x28\r
+#define TT_R11 0x30\r
+#define TT_R14 0x38\r
+\r
+#endif _IA64GEN_H\r
--- /dev/null
+/// @file\r
+/// Contains an implementation of longjmp for the Itanium-based architecture.\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: longjmp.s\r
+///\r
+///\r
+\r
+.auto\r
+.text\r
+\r
+.proc InternalLongJump\r
+.type InternalLongJump, @function\r
+.regstk 2, 0, 0, 0\r
+InternalLongJump::\r
+ add r10 = 0x10*20 + 8*14, in0\r
+ movl r2 = ~((((1 << 14) - 1) << 16) | 3)\r
+\r
+ ld8.nt1 r14 = [r10], -8*2 // BSP, skip PFS\r
+ mov r15 = ar.bspstore // BSPSTORE\r
+\r
+ ld8.nt1 r17 = [r10], -8 // UNAT after spill\r
+ mov r16 = ar.rsc // RSC\r
+ cmp.leu p6 = r14, r15\r
+\r
+ ld8.nt1 r18 = [r10], -8 // UNAT\r
+ ld8.nt1 r25 = [r10], -8 // b5\r
+ and r2 = r16, r2\r
+\r
+ ldf.fill.nt1 f2 = [in0], 0x10\r
+ ld8.nt1 r24 = [r10], -8 // b4\r
+ mov b5 = r25\r
+\r
+ mov ar.rsc = r2\r
+ ld8.nt1 r23 = [r10], -8 // b3\r
+ mov b4 = r24\r
+\r
+ ldf.fill.nt1 f3 = [in0], 0x10\r
+ mov ar.unat = r17\r
+(p6) br.spnt.many _skip_flushrs\r
+\r
+ flushrs\r
+ mov r15 = ar.bsp // New BSPSTORE\r
+\r
+_skip_flushrs:\r
+ mov r31 = ar.rnat // RNAT\r
+ loadrs\r
+\r
+ ldf.fill.nt1 f4 = [in0], 0x10\r
+ ld8.nt1 r22 = [r10], -8\r
+ dep r2 = -1, r14, 3, 6\r
+\r
+ ldf.fill.nt1 f5 = [in0], 0x10\r
+ ld8.nt1 r21 = [r10], -8\r
+ cmp.ltu p6 = r2, r15\r
+\r
+ ld8.nt1 r20 = [r10], -0x10 // skip sp\r
+(p6) ld8.nta r31 = [r2]\r
+ mov b3 = r23\r
+\r
+ ldf.fill.nt1 f16 = [in0], 0x10\r
+ ld8.fill.nt1 r7 = [r10], -8\r
+ mov b2 = r22\r
+\r
+ ldf.fill.nt1 f17 = [in0], 0x10\r
+ ld8.fill.nt1 r6 = [r10], -8\r
+ mov b1 = r21\r
+\r
+ ldf.fill.nt1 f18 = [in0], 0x10\r
+ ld8.fill.nt1 r5 = [r10], -8\r
+ mov b0 = r20\r
+\r
+ ldf.fill.nt1 f19 = [in0], 0x10\r
+ ld8.fill.nt1 r4 = [r10], 8*13\r
+\r
+ ldf.fill.nt1 f20 = [in0], 0x10\r
+ ld8.nt1 r19 = [r10], 0x10 // PFS\r
+\r
+ ldf.fill.nt1 f21 = [in0], 0x10\r
+ ld8.nt1 r26 = [r10], 8 // Predicate\r
+ mov ar.pfs = r19\r
+\r
+ ldf.fill.nt1 f22 = [in0], 0x10\r
+ ld8.nt1 r27 = [r10], 8 // LC\r
+ mov pr = r26, -1\r
+\r
+ ldf.fill.nt1 f23 = [in0], 0x10\r
+ ld8.nt1 r28 = [r10], -17*8 - 0x10\r
+ mov ar.lc = r27\r
+\r
+ ldf.fill.nt1 f24 = [in0], 0x10\r
+ ldf.fill.nt1 f25 = [in0], 0x10\r
+ mov r8 = in1\r
+\r
+ ldf.fill.nt1 f26 = [in0], 0x10\r
+ ldf.fill.nt1 f31 = [r10], -0x10\r
+\r
+ ldf.fill.nt1 f27 = [in0], 0x10\r
+ ldf.fill.nt1 f30 = [r10], -0x10\r
+\r
+ ldf.fill.nt1 f28 = [in0]\r
+ ldf.fill.nt1 f29 = [r10], 0x10*3 + 8*4\r
+\r
+ ld8.fill.nt1 sp = [r10]\r
+ mov ar.unat = r18\r
+\r
+ mov ar.bspstore = r14\r
+ mov ar.rnat = r31\r
+\r
+ invala\r
+ mov ar.rsc = r16\r
+ br.ret.sptk b0\r
+.endp\r
--- /dev/null
+/// @file\r
+/// Contains an implementation of longjmp for the Itanium-based architecture.\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: longjmp.s\r
+///\r
+///\r
+\r
+.auto\r
+.text\r
+\r
+.globl InternalAssertJumpBuffer\r
+.type InternalAssertJumpBuffer, @function\r
+\r
+.proc SetJump\r
+.type SetJump, @function\r
+SetJump::\r
+ alloc loc0 = ar.pfs, 1, 2, 1, 0\r
+ mov loc1 = b0\r
+ mov out0 = in0\r
+\r
+ brl.call.sptk.many b0 = InternalAssertJumpBuffer\r
+\r
+ mov r14 = ar.unat\r
+ mov r15 = ar.bsp\r
+ add r10 = 0x10*20, in0\r
+\r
+ stf.spill.nta [in0] = f2, 0x10\r
+ st8.spill.nta [r10] = r4, 8\r
+ mov r21 = b1\r
+\r
+ stf.spill.nta [in0] = f3, 0x10\r
+ st8.spill.nta [r10] = r5, 8\r
+ mov r22 = b2\r
+\r
+ stf.spill.nta [in0] = f4, 0x10\r
+ st8.spill.nta [r10] = r6, 8\r
+ mov r23 = b3\r
+\r
+ stf.spill.nta [in0] = f5, 0x10\r
+ st8.spill.nta [r10] = r7, 8\r
+ mov r24 = b4\r
+\r
+ stf.spill.nta [in0] = f16, 0x10\r
+ st8.spill.nta [r10] = sp, 8\r
+ mov r25 = b5\r
+\r
+ stf.spill.nta [in0] = f17, 0x10\r
+ st8.nta [r10] = loc1, 8\r
+ mov r16 = pr\r
+\r
+ stf.spill.nta [in0] = f18, 0x10\r
+ st8.nta [r10] = r21, 8\r
+ mov r17 = ar.lc\r
+\r
+ stf.spill.nta [in0] = f19, 0x10\r
+ st8.nta [r10] = r22, 8\r
+\r
+ stf.spill.nta [in0] = f20, 0x10\r
+ st8.nta [r10] = r23, 8\r
+\r
+ stf.spill.nta [in0] = f21, 0x10\r
+ st8.nta [r10] = r24, 8\r
+\r
+ stf.spill.nta [in0] = f22, 0x10\r
+ st8.nta [r10] = r25, 8\r
+\r
+ stf.spill.nta [in0] = f23, 0x10\r
+ mov r18 = ar.unat\r
+\r
+ stf.spill.nta [in0] = f24, 0x10\r
+ st8.nta [r10] = r14, 8 // UNAT\r
+\r
+ stf.spill.nta [in0] = f25, 0x10\r
+ st8.nta [r10] = r18, 8 // UNAT after spill\r
+\r
+ stf.spill.nta [in0] = f26, 0x10\r
+ st8.nta [r10] = loc0, 8 // PFS\r
+\r
+ stf.spill.nta [in0] = f27, 0x10\r
+ st8.nta [r10] = r15, 8 // BSP\r
+ mov r8 = 0\r
+\r
+ stf.spill.nta [in0] = f28, 0x10\r
+ mov r19 = ar.fpsr\r
+\r
+ stf.spill.nta [in0] = f29, 0x10\r
+ st8.nta [r10] = r16, 8 // PR\r
+ mov ar.pfs = loc0\r
+\r
+ stf.spill.nta [in0] = f30, 0x10\r
+ st8.nta [r10] = r17, 8 // LC\r
+ mov b0 = loc1\r
+\r
+ stf.spill.nta [in0] = f31, 0x10\r
+ st8.nta [r10] = r19 // FPSR\r
+\r
+ mov ar.unat = r14\r
+ br.ret.sptk b0\r
+.endp SetJump\r
--- /dev/null
+#------------------------------------------------------------------------------
+#
+# 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
--- /dev/null
+;------------------------------------------------------------------------------ ;\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
+; CpuBreakpoint.Asm\r
+;\r
+; Abstract:\r
+;\r
+; CpuBreakpoint function\r
+;\r
+; Notes:\r
+;\r
+;------------------------------------------------------------------------------\r
+\r
+ .code\r
+\r
+;------------------------------------------------------------------------------\r
+; VOID\r
+; EFIAPI\r
+; CpuBreakpoint (\r
+; VOID\r
+; );\r
+;------------------------------------------------------------------------------\r
+CpuBreakpoint PROC\r
+ int 3\r
+ ret\r
+CpuBreakpoint ENDP\r
+\r
+ END\r
--- /dev/null
+/** @file\r
+ CpuBreakpoint function.\r
+\r
+ Copyright (c) 2006 - 2007, Intel Corporation<BR>\r
+ All rights reserved. This program and the accompanying materials\r
+ are licensed and made available under the terms and conditions of the BSD License\r
+ which accompanies this distribution. The full text of the license may be found at\r
+ http://opensource.org/licenses/bsd-license.php\r
+\r
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+**/\r
+\r
+\r
+//\r
+// Microsoft Visual Studio 7.1 Function Prototypes for I/O Intrinsics\r
+//\r
+void __debugbreak ();\r
+\r
+#pragma intrinsic(__debugbreak)\r
+\r
+VOID\r
+EFIAPI\r
+CpuBreakpoint (\r
+ VOID\r
+ )\r
+{\r
+ __debugbreak ();\r
+}\r
+\r
--- /dev/null
+#------------------------------------------------------------------------------ \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
--- /dev/null
+;------------------------------------------------------------------------------ ;\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
+ .code\r
+\r
+;------------------------------------------------------------------------------\r
+; VOID\r
+; EFIAPI\r
+; CpuFlushTlb (\r
+; VOID\r
+; );\r
+;------------------------------------------------------------------------------\r
+CpuFlushTlb PROC\r
+ mov rax, cr3\r
+ mov cr3, rax\r
+ ret\r
+CpuFlushTlb ENDP\r
+\r
+ END\r
--- /dev/null
+#------------------------------------------------------------------------------
+#
+# 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
--- /dev/null
+;------------------------------------------------------------------------------
+;
+; 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.Asm
+;
+; Abstract:
+;
+; AsmCpuid function
+;
+; Notes:
+;
+;------------------------------------------------------------------------------
+
+ .code
+
+;------------------------------------------------------------------------------
+; VOID
+; EFIAPI
+; AsmCpuid (
+; IN UINT32 RegisterInEax,
+; OUT UINT32 *RegisterOutEax OPTIONAL,
+; OUT UINT32 *RegisterOutEbx OPTIONAL,
+; OUT UINT32 *RegisterOutEcx OPTIONAL,
+; OUT UINT32 *RegisterOutEdx OPTIONAL
+; )
+;------------------------------------------------------------------------------
+AsmCpuid PROC USES rbx
+ mov eax, ecx
+ push rax ; save Index on stack
+ push rdx
+ cpuid
+ test r9, r9
+ jz @F
+ mov [r9], ecx
+@@:
+ pop rcx
+ jrcxz @F
+ mov [rcx], eax
+@@:
+ mov rcx, r8
+ jrcxz @F
+ mov [rcx], ebx
+@@:
+ mov rcx, [rsp + 38h]
+ jrcxz @F
+ mov [rcx], edx
+@@:
+ pop rax ; restore Index to rax as return value
+ ret
+AsmCpuid ENDP
+
+ END
--- /dev/null
+#------------------------------------------------------------------------------
+#
+# 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
--- /dev/null
+;------------------------------------------------------------------------------
+;
+; 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:
+;
+;------------------------------------------------------------------------------
+
+ .code
+
+;------------------------------------------------------------------------------
+; 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
+; )
+;------------------------------------------------------------------------------
+AsmCpuidEx PROC USES rbx
+ mov eax, ecx
+ mov ecx, edx
+ push rax ; save Index on stack
+ cpuid
+ mov r10, [rsp + 38h]
+ test r10, r10
+ jz @F
+ mov [r10], ecx
+@@:
+ mov rcx, r8
+ jrcxz @F
+ mov [rcx], eax
+@@:
+ mov rcx, r9
+ jrcxz @F
+ mov [rcx], ebx
+@@:
+ mov rcx, [rsp + 40h]
+ jrcxz @F
+ mov [rcx], edx
+@@:
+ pop rax ; restore Index to rax as return value
+ ret
+AsmCpuidEx ENDP
+
+ END
--- /dev/null
+#------------------------------------------------------------------------------ ;\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
--- /dev/null
+;------------------------------------------------------------------------------ ;\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.Asm\r
+;\r
+; Abstract:\r
+;\r
+; CpuPause function\r
+;\r
+; Notes:\r
+;\r
+;------------------------------------------------------------------------------\r
+\r
+ .code\r
+\r
+;------------------------------------------------------------------------------\r
+; VOID\r
+; EFIAPI\r
+; CpuPause (\r
+; VOID\r
+; );\r
+;------------------------------------------------------------------------------\r
+CpuPause PROC\r
+ pause\r
+ ret\r
+CpuPause ENDP\r
+\r
+ END\r
--- /dev/null
+#------------------------------------------------------------------------------ ;\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
--- /dev/null
+;------------------------------------------------------------------------------ ;\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.Asm\r
+;\r
+; Abstract:\r
+;\r
+; CpuSleep function\r
+;\r
+; Notes:\r
+;\r
+;------------------------------------------------------------------------------\r
+\r
+ .code\r
+\r
+;------------------------------------------------------------------------------\r
+; VOID\r
+; EFIAPI\r
+; CpuSleep (\r
+; VOID\r
+; );\r
+;------------------------------------------------------------------------------\r
+CpuSleep PROC\r
+ hlt\r
+ ret\r
+CpuSleep ENDP\r
+\r
+ END\r
--- /dev/null
+#------------------------------------------------------------------------------\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
--- /dev/null
+;------------------------------------------------------------------------------\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.Asm\r
+;\r
+; Abstract:\r
+;\r
+; DisableInterrupts function\r
+;\r
+; Notes:\r
+;\r
+;------------------------------------------------------------------------------\r
+\r
+ .code\r
+\r
+;------------------------------------------------------------------------------\r
+; VOID\r
+; EFIAPI\r
+; DisableInterrupts (\r
+; VOID\r
+; );\r
+;------------------------------------------------------------------------------\r
+DisableInterrupts PROC\r
+ cli\r
+ ret\r
+DisableInterrupts ENDP\r
+\r
+ END\r
--- /dev/null
+#------------------------------------------------------------------------------
+#
+# 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 .
+
--- /dev/null
+;------------------------------------------------------------------------------\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
+; DisablePaging64.Asm\r
+;\r
+; Abstract:\r
+;\r
+; AsmDisablePaging64 function\r
+;\r
+; Notes:\r
+;\r
+;------------------------------------------------------------------------------\r
+\r
+ .code\r
+\r
+;------------------------------------------------------------------------------\r
+; VOID\r
+; EFIAPI\r
+; InternalX86DisablePaging64 (\r
+; IN UINT16 Cs,\r
+; IN UINT32 EntryPoint,\r
+; IN UINT32 Context1, OPTIONAL\r
+; IN UINT32 Context2, OPTIONAL\r
+; IN UINT32 NewStack\r
+; );\r
+;------------------------------------------------------------------------------\r
+InternalX86DisablePaging64 PROC\r
+ cli\r
+ shl rcx, 32 ; rcx[32..47] <- Cs\r
+ lea eax, @F\r
+ mov esi, r8d\r
+ or rcx, rax ; rcx[0..47] <- Cs:@F\r
+ mov edi, r9d\r
+ mov eax, [rsp + 28h] ; eax <- New Stack\r
+ push rcx\r
+ retf ; switch to compatibility mode\r
+@@:\r
+ mov esp, eax ; set up new stack\r
+ mov rax, cr0\r
+ btr eax, 31\r
+ mov cr0, rax ; disable paging\r
+ mov ecx, 0c0000080h\r
+ rdmsr\r
+ and ah, NOT 1 ; clear LME\r
+ wrmsr\r
+ mov rax, cr4\r
+ and al, NOT (1 SHL 5) ; clear PAE\r
+ mov cr4, rax\r
+ push rdi ; push Context2\r
+ push rsi ; push Context1\r
+ call rdx ; transfer control to EntryPoint\r
+ hlt ; no one should get here\r
+InternalX86DisablePaging64 ENDP\r
+\r
+ END\r
--- /dev/null
+#------------------------------------------------------------------------------
+#
+# 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
--- /dev/null
+;------------------------------------------------------------------------------\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
+; EnableDisableInterrupts.Asm\r
+;\r
+; Abstract:\r
+;\r
+; EnableDisableInterrupts function\r
+;\r
+; Notes:\r
+;\r
+;------------------------------------------------------------------------------\r
+\r
+ .code\r
+\r
+;------------------------------------------------------------------------------\r
+; VOID\r
+; EFIAPI\r
+; EnableDisableInterrupts (\r
+; VOID\r
+; );\r
+;------------------------------------------------------------------------------\r
+EnableDisableInterrupts PROC\r
+ sti\r
+ cli\r
+ ret\r
+EnableDisableInterrupts ENDP\r
+\r
+ END\r
--- /dev/null
+#------------------------------------------------------------------------------
+#
+# 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
--- /dev/null
+;------------------------------------------------------------------------------\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
+; EnableInterrupts.Asm\r
+;\r
+; Abstract:\r
+;\r
+; EnableInterrupts function\r
+;\r
+; Notes:\r
+;\r
+;------------------------------------------------------------------------------\r
+\r
+ .code\r
+\r
+;------------------------------------------------------------------------------\r
+; VOID\r
+; EFIAPI\r
+; EnableInterrupts (\r
+; VOID\r
+; );\r
+;------------------------------------------------------------------------------\r
+EnableInterrupts PROC\r
+ sti\r
+ ret\r
+EnableInterrupts ENDP\r
+\r
+ END\r
--- /dev/null
+#------------------------------------------------------------------------------
+#
+# 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 .
--- /dev/null
+;------------------------------------------------------------------------------\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
+; EnablePaging64.Asm\r
+;\r
+; Abstract:\r
+;\r
+; AsmEnablePaging64 function\r
+;\r
+; Notes:\r
+;\r
+;------------------------------------------------------------------------------\r
+\r
+ .code\r
+\r
+;------------------------------------------------------------------------------\r
+; VOID\r
+; EFIAPI\r
+; InternalX86EnablePaging64 (\r
+; IN UINT16 Cs,\r
+; IN UINT64 EntryPoint,\r
+; IN UINT64 Context1, OPTIONAL\r
+; IN UINT64 Context2, OPTIONAL\r
+; IN UINT64 NewStack\r
+; );\r
+;------------------------------------------------------------------------------\r
+InternalX86EnablePaging64 PROC\r
+ cli\r
+ pop rax ; skip the return address\r
+ call @Base\r
+@Base:\r
+ add dword ptr [rsp], @F - @Base ; offset for far retf, seg is the 1st arg\r
+ mov rax, cr4 ; mov eax, cr4\r
+ or al, (1 SHL 5)\r
+ mov cr4, rax ; enable PAE\r
+ mov ecx, 0c0000080h\r
+ rdmsr\r
+ or ah, 1 ; set LME\r
+ wrmsr\r
+ mov rax, cr0 ; mov eax, cr0\r
+ bts eax, 31\r
+ mov cr0, rax ; enable paging\r
+ retf\r
+@@: ; long mode starts here\r
+ mov rbx, [esp]\r
+ mov rcx, [esp + 8]\r
+ mov rdx, [esp + 10h]\r
+ mov rsp, [esp + 18h]\r
+ add rsp, -20h\r
+ call rbx\r
+ hlt ; halt processor if EntryPoint() returned\r
+InternalX86EnablePaging64 ENDP\r
+\r
+ END\r
--- /dev/null
+#------------------------------------------------------------------------------
+#
+# 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
--- /dev/null
+;------------------------------------------------------------------------------\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
+; FlushCacheLine.Asm\r
+;\r
+; Abstract:\r
+;\r
+; AsmFlushCacheLine function\r
+;\r
+; Notes:\r
+;\r
+;------------------------------------------------------------------------------\r
+\r
+ .code\r
+\r
+;------------------------------------------------------------------------------\r
+; VOID *\r
+; EFIAPI \r
+; AsmFlushCacheLine (\r
+; IN VOID *LinearAddress\r
+; );\r
+;------------------------------------------------------------------------------\r
+AsmFlushCacheLine PROC\r
+ clflush [rcx]\r
+ mov rax, rcx\r
+ ret\r
+AsmFlushCacheLine ENDP\r
+\r
+ END\r
--- /dev/null
+#------------------------------------------------------------------------------
+#
+# 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
--- /dev/null
+;------------------------------------------------------------------------------\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
+; FxRestore.Asm\r
+;\r
+; Abstract:\r
+;\r
+; AsmFxRestore function\r
+;\r
+; Notes:\r
+;\r
+;------------------------------------------------------------------------------\r
+\r
+ .code\r
+\r
+;------------------------------------------------------------------------------\r
+; VOID\r
+; EFIAPI\r
+; InternalX86FxRestore (\r
+; IN CONST IA32_FX_BUFFER *Buffer\r
+; );\r
+;------------------------------------------------------------------------------\r
+InternalX86FxRestore PROC\r
+ fxrstor [rcx]\r
+ ret\r
+InternalX86FxRestore ENDP\r
+\r
+ END\r
--- /dev/null
+#------------------------------------------------------------------------------
+#
+# 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
--- /dev/null
+;------------------------------------------------------------------------------\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
+; FxSave.Asm\r
+;\r
+; Abstract:\r
+;\r
+; AsmFxSave function\r
+;\r
+; Notes:\r
+;\r
+;------------------------------------------------------------------------------\r
+\r
+ .code\r
+\r
+;------------------------------------------------------------------------------\r
+; VOID\r
+; EFIAPI\r
+; InternalX86FxSave (\r
+; OUT IA32_FX_BUFFER *Buffer\r
+; );\r
+;------------------------------------------------------------------------------\r
+InternalX86FxSave PROC\r
+ fxsave [rcx]\r
+ ret\r
+InternalX86FxSave ENDP\r
+\r
+ END\r
--- /dev/null
+#------------------------------------------------------------------------------\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
--- /dev/null
+;------------------------------------------------------------------------------\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
+ .code\r
+\r
+;------------------------------------------------------------------------------\r
+; UINT32\r
+; EFIAPI\r
+; InterlockedCompareExchange32 (\r
+; IN UINT32 *Value,\r
+; IN UINT32 CompareValue,\r
+; IN UINT32 ExchangeValue\r
+; );\r
+;------------------------------------------------------------------------------\r
+InternalSyncCompareExchange32 PROC\r
+ mov eax, edx\r
+ lock cmpxchg [rcx], r8d\r
+ ret\r
+InternalSyncCompareExchange32 ENDP\r
+\r
+ END\r
--- /dev/null
+/** @file\r
+ InterlockedCompareExchange32 function\r
+\r
+ Copyright (c) 2006 - 2007, Intel Corporation<BR>\r
+ All rights reserved. This program and the accompanying materials\r
+ are licensed and made available under the terms and conditions of the BSD License\r
+ which accompanies this distribution. The full text of the license may be found at\r
+ http://opensource.org/licenses/bsd-license.php\r
+\r
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+**/\r
+\r
+//\r
+// Microsoft Visual Studio 7.1 Function Prototypes for I/O Intrinsics\r
+//\r
+long _InterlockedCompareExchange(\r
+ long volatile * Destination,\r
+ long Exchange,\r
+ long Comperand\r
+);\r
+\r
+#pragma intrinsic(_InterlockedCompareExchange)\r
+\r
+UINT32\r
+EFIAPI\r
+InternalSyncCompareExchange32 (\r
+ IN UINT32 *Value,\r
+ IN UINT32 CompareValue,\r
+ IN UINT32 ExchangeValue\r
+ )\r
+{\r
+ return _InterlockedCompareExchange (Value, ExchangeValue, CompareValue);\r
+}\r
+\r
--- /dev/null
+#------------------------------------------------------------------------------
+#
+# 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
--- /dev/null
+;------------------------------------------------------------------------------\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
+; InterlockedCompareExchange64.Asm\r
+;\r
+; Abstract:\r
+;\r
+; InterlockedCompareExchange64 function\r
+;\r
+; Notes:\r
+;\r
+;------------------------------------------------------------------------------\r
+\r
+ .code\r
+\r
+;------------------------------------------------------------------------------\r
+; UINT64\r
+; EFIAPI\r
+; InterlockedCompareExchange64 (\r
+; IN UINT64 *Value,\r
+; IN UINT64 CompareValue,\r
+; IN UINT64 ExchangeValue\r
+; );\r
+;------------------------------------------------------------------------------\r
+InternalSyncCompareExchange64 PROC\r
+ mov rax, rdx\r
+ lock cmpxchg [rcx], r8\r
+ ret\r
+InternalSyncCompareExchange64 ENDP\r
+\r
+ END\r
--- /dev/null
+/** @file\r
+ InterlockedCompareExchange64 function\r
+\r
+ Copyright (c) 2006 - 2007, Intel Corporation<BR>\r
+ All rights reserved. This program and the accompanying materials\r
+ are licensed and made available under the terms and conditions of the BSD License\r
+ which accompanies this distribution. The full text of the license may be found at\r
+ http://opensource.org/licenses/bsd-license.php\r
+\r
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+**/\r
+\r
+//\r
+// Microsoft Visual Studio 7.1 Function Prototypes for I/O Intrinsics\r
+//\r
+__int64 _InterlockedCompareExchange64(\r
+ __int64 volatile * Destination,\r
+ __int64 Exchange,\r
+ __int64 Comperand\r
+);\r
+\r
+#pragma intrinsic(_InterlockedCompareExchange64)\r
+\r
+UINT64\r
+EFIAPI\r
+InternalSyncCompareExchange64 (\r
+ IN UINT64 *Value,\r
+ IN UINT64 CompareValue,\r
+ IN UINT64 ExchangeValue\r
+ )\r
+{\r
+ return _InterlockedCompareExchange64 (Value, ExchangeValue, CompareValue);\r
+}\r
+\r
--- /dev/null
+#------------------------------------------------------------------------------
+#
+# 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
--- /dev/null
+;------------------------------------------------------------------------------\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
+; InterlockedDecrement.Asm\r
+;\r
+; Abstract:\r
+;\r
+; InterlockedDecrement function\r
+;\r
+; Notes:\r
+;\r
+;------------------------------------------------------------------------------\r
+\r
+ .code\r
+\r
+;------------------------------------------------------------------------------\r
+; UINT32\r
+; EFIAPI\r
+; InterlockedDecrement (\r
+; IN UINT32 *Value\r
+; );\r
+;------------------------------------------------------------------------------\r
+InternalSyncDecrement PROC\r
+ lock dec dword ptr [rcx]\r
+ mov eax, [rcx]\r
+ ret\r
+InternalSyncDecrement ENDP\r
+\r
+ END\r
--- /dev/null
+/** @file\r
+ InterlockedDecrement function\r
+\r
+ Copyright (c) 2006 - 2007, Intel Corporation<BR>\r
+ All rights reserved. This program and the accompanying materials\r
+ are licensed and made available under the terms and conditions of the BSD License\r
+ which accompanies this distribution. The full text of the license may be found at\r
+ http://opensource.org/licenses/bsd-license.php\r
+\r
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+**/\r
+\r
+//\r
+// Microsoft Visual Studio 7.1 Function Prototypes for I/O Intrinsics\r
+//\r
+long _InterlockedDecrement(\r
+ long * lpAddend\r
+);\r
+\r
+#pragma intrinsic(_InterlockedDecrement)\r
+\r
+UINT32\r
+EFIAPI\r
+InternalSyncDecrement (\r
+ IN UINT32 *Value\r
+ )\r
+{\r
+ return _InterlockedDecrement (Value);\r
+}\r
+\r
--- /dev/null
+#------------------------------------------------------------------------------
+#
+# 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
--- /dev/null
+;------------------------------------------------------------------------------\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
+; InterlockedIncrement.Asm\r
+;\r
+; Abstract:\r
+;\r
+; InterlockedIncrement function\r
+;\r
+; Notes:\r
+;\r
+;------------------------------------------------------------------------------\r
+\r
+ .code\r
+\r
+;------------------------------------------------------------------------------\r
+; UINT32\r
+; EFIAPI\r
+; InterlockedIncrement (\r
+; IN UINT32 *Value\r
+; );\r
+;------------------------------------------------------------------------------\r
+InternalSyncIncrement PROC\r
+ lock inc dword ptr [rcx]\r
+ mov eax, [rcx]\r
+ ret\r
+InternalSyncIncrement ENDP\r
+\r
+ END\r
--- /dev/null
+/** @file\r
+ InterLockedIncrement function\r
+\r
+ Copyright (c) 2006 - 2007, Intel Corporation<BR>\r
+ All rights reserved. This program and the accompanying materials\r
+ are licensed and made available under the terms and conditions of the BSD License\r
+ which accompanies this distribution. The full text of the license may be found at\r
+ http://opensource.org/licenses/bsd-license.php\r
+\r
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+**/\r
+\r
+//\r
+// Microsoft Visual Studio 7.1 Function Prototypes for I/O Intrinsics\r
+//\r
+long _InterlockedIncrement(\r
+ long * lpAddend\r
+);\r
+\r
+#pragma intrinsic(_InterlockedIncrement)\r
+\r
+UINT32\r
+EFIAPI\r
+InternalSyncIncrement (\r
+ IN UINT32 *Value\r
+ )\r
+{\r
+ return _InterlockedIncrement (Value);\r
+}\r
+\r
--- /dev/null
+#------------------------------------------------------------------------------
+#
+# 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
--- /dev/null
+;------------------------------------------------------------------------------\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
+; Invd.Asm\r
+;\r
+; Abstract:\r
+;\r
+; AsmInvd function\r
+;\r
+; Notes:\r
+;\r
+;------------------------------------------------------------------------------\r
+\r
+ .code\r
+\r
+;------------------------------------------------------------------------------\r
+; VOID\r
+; EFIAPI\r
+; AsmInvd (\r
+; VOID\r
+; );\r
+;------------------------------------------------------------------------------\r
+AsmInvd PROC\r
+ invd\r
+ ret\r
+AsmInvd ENDP\r
+\r
+ END\r
--- /dev/null
+#------------------------------------------------------------------------------\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
--- /dev/null
+;------------------------------------------------------------------------------\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
+ .code\r
+\r
+;------------------------------------------------------------------------------\r
+; VOID\r
+; EFIAPI\r
+; InternalLongJump (\r
+; IN BASE_LIBRARY_JUMP_BUFFER *JumpBuffer,\r
+; IN UINTN Value\r
+; );\r
+;------------------------------------------------------------------------------\r
+InternalLongJump PROC\r
+ mov rbx, [rcx]\r
+ mov rsp, [rcx + 8]\r
+ mov rbp, [rcx + 10h]\r
+ mov rdi, [rcx + 18h]\r
+ mov rsi, [rcx + 20h]\r
+ mov r12, [rcx + 28h]\r
+ mov r13, [rcx + 30h]\r
+ mov r14, [rcx + 38h]\r
+ mov r15, [rcx + 40h]\r
+ mov rax, rdx ; set return value\r
+ jmp qword ptr [rcx + 48h]\r
+InternalLongJump ENDP\r
+\r
+ END\r
--- /dev/null
+#------------------------------------------------------------------------------
+#
+# 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
--- /dev/null
+;------------------------------------------------------------------------------\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
+; Monitor.Asm\r
+;\r
+; Abstract:\r
+;\r
+; AsmMonitor function\r
+;\r
+; Notes:\r
+;\r
+;------------------------------------------------------------------------------\r
+\r
+ .code\r
+\r
+;------------------------------------------------------------------------------\r
+; UINT64\r
+; EFIAPI\r
+; AsmMonitor (\r
+; IN UINTN Eax,\r
+; IN UINTN Ecx,\r
+; IN UINTN Edx\r
+; );\r
+;------------------------------------------------------------------------------\r
+AsmMonitor PROC\r
+ mov eax, ecx\r
+ mov ecx, edx\r
+ mov edx, r8d\r
+ DB 0fh, 1, 0c8h ; monitor\r
+ ret\r
+AsmMonitor ENDP\r
+\r
+ END\r
--- /dev/null
+#------------------------------------------------------------------------------
+#
+# 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
--- /dev/null
+;------------------------------------------------------------------------------\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
+; Mwait.Asm\r
+;\r
+; Abstract:\r
+;\r
+; AsmMwait function\r
+;\r
+; Notes:\r
+;\r
+;------------------------------------------------------------------------------\r
+\r
+ .code\r
+\r
+;------------------------------------------------------------------------------\r
+; UINT64\r
+; EFIAPI\r
+; AsmMwait (\r
+; IN UINTN Eax,\r
+; IN UINTN Ecx\r
+; );\r
+;------------------------------------------------------------------------------\r
+AsmMwait PROC\r
+ mov eax, ecx\r
+ mov ecx, edx\r
+ DB 0fh, 1, 0c9h ; mwait\r
+ ret\r
+AsmMwait ENDP\r
+\r
+ END\r
--- /dev/null
+/** @file\r
+ Non-existing BaseLib functions on x64\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: Non-existing.c\r
+\r
+**/\r
+\r
+#include "../BaseLibInternals.h"\r
+\r
+/**\r
+ Enables the 32-bit paging mode on the CPU.\r
+\r
+ Enables the 32-bit paging mode on the CPU. CR0, CR3, CR4, and the page tables\r
+ must be properly initialized prior to calling this service. This function\r
+ assumes the current execution mode is 32-bit protected mode. This function is\r
+ only available on IA-32. After the 32-bit paging mode is enabled, control is\r
+ transferred to the function specified by EntryPoint using the new stack\r
+ specified by NewStack and passing in the parameters specified by Context1 and\r
+ Context2. Context1 and Context2 are optional and may be NULL. The function\r
+ EntryPoint must never return.\r
+\r
+ There are a number of constraints that must be followed before calling this\r
+ function:\r
+ 1) Interrupts must be disabled.\r
+ 2) The caller must be in 32-bit protected mode with flat descriptors. This\r
+ means all descriptors must have a base of 0 and a limit of 4GB.\r
+ 3) CR0 and CR4 must be compatible with 32-bit protected mode with flat\r
+ descriptors.\r
+ 4) CR3 must point to valid page tables that will be used once the transition\r
+ is complete, and those page tables must guarantee that the pages for this\r
+ function and the stack are identity mapped.\r
+\r
+ @param EntryPoint A pointer to function to call with the new stack after\r
+ paging is enabled.\r
+ @param Context1 A pointer to the context to pass into the EntryPoint\r
+ function as the first parameter after paging is enabled.\r
+ @param Context2 A pointer to the context to pass into the EntryPoint\r
+ function as the second parameter after paging is enabled.\r
+ @param NewStack A pointer to the new stack to use for the EntryPoint\r
+ function after paging is enabled.\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+InternalX86EnablePaging32 (\r
+ IN SWITCH_STACK_ENTRY_POINT EntryPoint,\r
+ IN VOID *Context1, OPTIONAL\r
+ IN VOID *Context2, OPTIONAL\r
+ IN VOID *NewStack\r
+ )\r
+{\r
+ //\r
+ // This function cannot work on X64 platform\r
+ //\r
+ ASSERT (FALSE);\r
+}\r
+\r
+/**\r
+ Disables the 32-bit paging mode on the CPU.\r
+\r
+ Disables the 32-bit paging mode on the CPU and returns to 32-bit protected\r
+ mode. This function assumes the current execution mode is 32-paged protected\r
+ mode. This function is only available on IA-32. After the 32-bit paging mode\r
+ is disabled, control is transferred to the function specified by EntryPoint\r
+ using the new stack specified by NewStack and passing in the parameters\r
+ specified by Context1 and Context2. Context1 and Context2 are optional and\r
+ may be NULL. The function EntryPoint must never return.\r
+\r
+ There are a number of constraints that must be followed before calling this\r
+ function:\r
+ 1) Interrupts must be disabled.\r
+ 2) The caller must be in 32-bit paged mode.\r
+ 3) CR0, CR3, and CR4 must be compatible with 32-bit paged mode.\r
+ 4) CR3 must point to valid page tables that guarantee that the pages for\r
+ this function and the stack are identity mapped.\r
+\r
+ @param EntryPoint A pointer to function to call with the new stack after\r
+ paging is disabled.\r
+ @param Context1 A pointer to the context to pass into the EntryPoint\r
+ function as the first parameter after paging is disabled.\r
+ @param Context2 A pointer to the context to pass into the EntryPoint\r
+ function as the second parameter after paging is\r
+ disabled.\r
+ @param NewStack A pointer to the new stack to use for the EntryPoint\r
+ function after paging is disabled.\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+InternalX86DisablePaging32 (\r
+ IN SWITCH_STACK_ENTRY_POINT EntryPoint,\r
+ IN VOID *Context1, OPTIONAL\r
+ IN VOID *Context2, OPTIONAL\r
+ IN VOID *NewStack\r
+ )\r
+{\r
+ //\r
+ // This function cannot work on X64 platform\r
+ //\r
+ ASSERT (FALSE);\r
+}\r
--- /dev/null
+#------------------------------------------------------------------------------
+#
+# 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
--- /dev/null
+;------------------------------------------------------------------------------\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
+; ReadCr0.Asm\r
+;\r
+; Abstract:\r
+;\r
+; AsmReadCr0 function\r
+;\r
+; Notes:\r
+;\r
+;------------------------------------------------------------------------------\r
+\r
+ .code\r
+\r
+;------------------------------------------------------------------------------\r
+; UINTN\r
+; EFIAPI\r
+; AsmReadCr0 (\r
+; VOID\r
+; );\r
+;------------------------------------------------------------------------------\r
+AsmReadCr0 PROC\r
+ mov rax, cr0\r
+ ret\r
+AsmReadCr0 ENDP\r
+\r
+ END\r
--- /dev/null
+#------------------------------------------------------------------------------
+#
+# 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
--- /dev/null
+;------------------------------------------------------------------------------\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
+; ReadCr2.Asm\r
+;\r
+; Abstract:\r
+;\r
+; AsmReadCr2 function\r
+;\r
+; Notes:\r
+;\r
+;------------------------------------------------------------------------------\r
+\r
+ .code\r
+\r
+;------------------------------------------------------------------------------\r
+; UINTN\r
+; EFIAPI\r
+; AsmReadCr2 (\r
+; VOID\r
+; );\r
+;------------------------------------------------------------------------------\r
+AsmReadCr2 PROC\r
+ mov rax, cr2\r
+ ret\r
+AsmReadCr2 ENDP\r
+\r
+ END\r
--- /dev/null
+#------------------------------------------------------------------------------
+#
+# 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
--- /dev/null
+;------------------------------------------------------------------------------\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
+; ReadCr3.Asm\r
+;\r
+; Abstract:\r
+;\r
+; AsmReadCr3 function\r
+;\r
+; Notes:\r
+;\r
+;------------------------------------------------------------------------------\r
+\r
+ .code\r
+\r
+;------------------------------------------------------------------------------\r
+; UINTN\r
+; EFIAPI\r
+; AsmReadCr3 (\r
+; VOID\r
+; );\r
+;------------------------------------------------------------------------------\r
+AsmReadCr3 PROC\r
+ mov rax, cr3\r
+ ret\r
+AsmReadCr3 ENDP\r
+\r
+ END\r
--- /dev/null
+#------------------------------------------------------------------------------
+#
+# 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
--- /dev/null
+;------------------------------------------------------------------------------\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
+; ReadCr4.Asm\r
+;\r
+; Abstract:\r
+;\r
+; AsmReadCr4 function\r
+;\r
+; Notes:\r
+;\r
+;------------------------------------------------------------------------------\r
+\r
+ .code\r
+\r
+;------------------------------------------------------------------------------\r
+; UINTN\r
+; EFIAPI\r
+; AsmReadCr4 (\r
+; VOID\r
+; );\r
+;------------------------------------------------------------------------------\r
+AsmReadCr4 PROC\r
+ mov rax, cr4\r
+ ret\r
+AsmReadCr4 ENDP\r
+\r
+ END\r
--- /dev/null
+#------------------------------------------------------------------------------
+#
+# 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
--- /dev/null
+;------------------------------------------------------------------------------\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
+; ReadCs.Asm\r
+;\r
+; Abstract:\r
+;\r
+; AsmReadCs function\r
+;\r
+; Notes:\r
+;\r
+;------------------------------------------------------------------------------\r
+\r
+ .code\r
+\r
+;------------------------------------------------------------------------------\r
+; UINT16\r
+; EFIAPI\r
+; AsmReadCs (\r
+; VOID\r
+; );\r
+;------------------------------------------------------------------------------\r
+AsmReadCs PROC\r
+ mov eax, cs\r
+ ret\r
+AsmReadCs ENDP\r
+\r
+ END\r
--- /dev/null
+#------------------------------------------------------------------------------
+#
+# 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
--- /dev/null
+;------------------------------------------------------------------------------\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
+; ReadDr0.Asm\r
+;\r
+; Abstract:\r
+;\r
+; AsmReadDr0 function\r
+;\r
+; Notes:\r
+;\r
+;------------------------------------------------------------------------------\r
+\r
+ .code\r
+\r
+;------------------------------------------------------------------------------\r
+; UINTN\r
+; EFIAPI\r
+; AsmReadDr0 (\r
+; VOID\r
+; );\r
+;------------------------------------------------------------------------------\r
+AsmReadDr0 PROC\r
+ mov rax, dr0\r
+ ret\r
+AsmReadDr0 ENDP\r
+\r
+ END\r
--- /dev/null
+#------------------------------------------------------------------------------
+#
+# 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
--- /dev/null
+;------------------------------------------------------------------------------\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
+; ReadDr1.Asm\r
+;\r
+; Abstract:\r
+;\r
+; AsmReadDr1 function\r
+;\r
+; Notes:\r
+;\r
+;------------------------------------------------------------------------------\r
+\r
+ .code\r
+\r
+;------------------------------------------------------------------------------\r
+; UINTN\r
+; EFIAPI\r
+; AsmReadDr1 (\r
+; VOID\r
+; );\r
+;------------------------------------------------------------------------------\r
+AsmReadDr1 PROC\r
+ mov rax, dr1\r
+ ret\r
+AsmReadDr1 ENDP\r
+\r
+ END\r
--- /dev/null
+#------------------------------------------------------------------------------
+#
+# 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
--- /dev/null
+;------------------------------------------------------------------------------\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
+; ReadDr2.Asm\r
+;\r
+; Abstract:\r
+;\r
+; AsmReadDr2 function\r
+;\r
+; Notes:\r
+;\r
+;------------------------------------------------------------------------------\r
+\r
+ .code\r
+\r
+;------------------------------------------------------------------------------\r
+; UINTN\r
+; EFIAPI\r
+; AsmReadDr2 (\r
+; VOID\r
+; );\r
+;------------------------------------------------------------------------------\r
+AsmReadDr2 PROC\r
+ mov rax, dr2\r
+ ret\r
+AsmReadDr2 ENDP\r
+\r
+ END\r
--- /dev/null
+#------------------------------------------------------------------------------
+#
+# 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
--- /dev/null
+;------------------------------------------------------------------------------\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
+; ReadDr3.Asm\r
+;\r
+; Abstract:\r
+;\r
+; AsmReadDr3 function\r
+;\r
+; Notes:\r
+;\r
+;------------------------------------------------------------------------------\r
+\r
+ .code\r
+\r
+;------------------------------------------------------------------------------\r
+; UINTN\r
+; EFIAPI\r
+; AsmReadDr3 (\r
+; VOID\r
+; );\r
+;------------------------------------------------------------------------------\r
+AsmReadDr3 PROC\r
+ mov rax, dr3\r
+ ret\r
+AsmReadDr3 ENDP\r
+\r
+ END\r
--- /dev/null
+#------------------------------------------------------------------------------
+#
+# 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
--- /dev/null
+;------------------------------------------------------------------------------\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
+; ReadDr4.Asm\r
+;\r
+; Abstract:\r
+;\r
+; AsmReadDr4 function\r
+;\r
+; Notes:\r
+;\r
+;------------------------------------------------------------------------------\r
+\r
+ .code\r
+\r
+;------------------------------------------------------------------------------\r
+; UINTN\r
+; EFIAPI\r
+; AsmReadDr4 (\r
+; VOID\r
+; );\r
+;------------------------------------------------------------------------------\r
+AsmReadDr4 PROC\r
+ ;\r
+ ; There's no obvious reason to access this register, since it's aliased to\r
+ ; DR7 when DE=0 or an exception generated when DE=1\r
+ ;\r
+ DB 0fh, 21h, 0e0h\r
+ ret\r
+AsmReadDr4 ENDP\r
+\r
+ END\r
--- /dev/null
+#------------------------------------------------------------------------------
+#
+# 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
--- /dev/null
+;------------------------------------------------------------------------------\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
+; ReadDr5.Asm\r
+;\r
+; Abstract:\r
+;\r
+; AsmReadDr5 function\r
+;\r
+; Notes:\r
+;\r
+;------------------------------------------------------------------------------\r
+\r
+ .code\r
+\r
+;------------------------------------------------------------------------------\r
+; UINTN\r
+; EFIAPI\r
+; AsmReadDr5 (\r
+; VOID\r
+; );\r
+;------------------------------------------------------------------------------\r
+AsmReadDr5 PROC\r
+ ;\r
+ ; There's no obvious reason to access this register, since it's aliased to\r
+ ; DR7 when DE=0 or an exception generated when DE=1\r
+ ;\r
+ DB 0fh, 21h, 0e8h\r
+ ret\r
+AsmReadDr5 ENDP\r
+\r
+ END\r
--- /dev/null
+#------------------------------------------------------------------------------
+#
+# 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
--- /dev/null
+;------------------------------------------------------------------------------\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
+; ReadDr6.Asm\r
+;\r
+; Abstract:\r
+;\r
+; AsmReadDr6 function\r
+;\r
+; Notes:\r
+;\r
+;------------------------------------------------------------------------------\r
+\r
+ .code\r
+\r
+;------------------------------------------------------------------------------\r
+; UINTN\r
+; EFIAPI\r
+; AsmReadDr6 (\r
+; VOID\r
+; );\r
+;------------------------------------------------------------------------------\r
+AsmReadDr6 PROC\r
+ mov rax, dr6\r
+ ret\r
+AsmReadDr6 ENDP\r
+\r
+ END\r
--- /dev/null
+#------------------------------------------------------------------------------
+#
+# 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
--- /dev/null
+;------------------------------------------------------------------------------\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
+; ReadDr7.Asm\r
+;\r
+; Abstract:\r
+;\r
+; AsmReadDr7 function\r
+;\r
+; Notes:\r
+;\r
+;------------------------------------------------------------------------------\r
+\r
+ .code\r
+\r
+;------------------------------------------------------------------------------\r
+; UINTN\r
+; EFIAPI\r
+; AsmReadDr7 (\r
+; VOID\r
+; );\r
+;------------------------------------------------------------------------------\r
+AsmReadDr7 PROC\r
+ mov rax, dr7\r
+ ret\r
+AsmReadDr7 ENDP\r
+\r
+ END\r
--- /dev/null
+#------------------------------------------------------------------------------
+#
+# 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
--- /dev/null
+;------------------------------------------------------------------------------\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
+; ReadDs.Asm\r
+;\r
+; Abstract:\r
+;\r
+; AsmReadDs function\r
+;\r
+; Notes:\r
+;\r
+;------------------------------------------------------------------------------\r
+\r
+ .code\r
+\r
+;------------------------------------------------------------------------------\r
+; UINT16\r
+; EFIAPI\r
+; AsmReadDs (\r
+; VOID\r
+; );\r
+;------------------------------------------------------------------------------\r
+AsmReadDs PROC\r
+ mov eax, ds\r
+ ret\r
+AsmReadDs ENDP\r
+\r
+ END\r
--- /dev/null
+#------------------------------------------------------------------------------
+#
+# 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
--- /dev/null
+;------------------------------------------------------------------------------\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
+; ReadEflags.Asm\r
+;\r
+; Abstract:\r
+;\r
+; AsmReadEflags function\r
+;\r
+; Notes:\r
+;\r
+;------------------------------------------------------------------------------\r
+\r
+ .code\r
+\r
+;------------------------------------------------------------------------------\r
+; UINTN\r
+; EFIAPI\r
+; AsmReadEflags (\r
+; VOID\r
+; );\r
+;------------------------------------------------------------------------------\r
+AsmReadEflags PROC\r
+ pushfq\r
+ pop rax\r
+ ret\r
+AsmReadEflags ENDP\r
+\r
+ END\r
--- /dev/null
+#------------------------------------------------------------------------------
+#
+# 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
--- /dev/null
+;------------------------------------------------------------------------------\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
+; ReadEs.Asm\r
+;\r
+; Abstract:\r
+;\r
+; AsmReadEs function\r
+;\r
+; Notes:\r
+;\r
+;------------------------------------------------------------------------------\r
+\r
+ .code\r
+\r
+;------------------------------------------------------------------------------\r
+; UINT16\r
+; EFIAPI\r
+; AsmReadEs (\r
+; VOID\r
+; );\r
+;------------------------------------------------------------------------------\r
+AsmReadEs PROC\r
+ mov eax, es\r
+ ret\r
+AsmReadEs ENDP\r
+\r
+ END\r
--- /dev/null
+#------------------------------------------------------------------------------
+#
+# 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
--- /dev/null
+;------------------------------------------------------------------------------\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
+; ReadFs.Asm\r
+;\r
+; Abstract:\r
+;\r
+; AsmReadFs function\r
+;\r
+; Notes:\r
+;\r
+;------------------------------------------------------------------------------\r
+\r
+ .code\r
+\r
+;------------------------------------------------------------------------------\r
+; UINT16\r
+; EFIAPI\r
+; AsmReadFs (\r
+; VOID\r
+; );\r
+;------------------------------------------------------------------------------\r
+AsmReadFs PROC\r
+ mov eax, fs\r
+ ret\r
+AsmReadFs ENDP\r
+\r
+ END\r
--- /dev/null
+#------------------------------------------------------------------------------
+#
+# 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
--- /dev/null
+;------------------------------------------------------------------------------\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
+; ReadGdtr.Asm\r
+;\r
+; Abstract:\r
+;\r
+; AsmReadGdtr function\r
+;\r
+; Notes:\r
+;\r
+;------------------------------------------------------------------------------\r
+\r
+ .code\r
+\r
+;------------------------------------------------------------------------------\r
+; VOID\r
+; EFIAPI\r
+; InternalX86ReadGdtr (\r
+; OUT IA32_DESCRIPTOR *Gdtr\r
+; );\r
+;------------------------------------------------------------------------------\r
+InternalX86ReadGdtr PROC\r
+ sgdt fword ptr [rcx]\r
+ ret\r
+InternalX86ReadGdtr ENDP\r
+\r
+ END\r
--- /dev/null
+#------------------------------------------------------------------------------
+#
+# 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
--- /dev/null
+;------------------------------------------------------------------------------\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
+; ReadGs.Asm\r
+;\r
+; Abstract:\r
+;\r
+; AsmReadGs function\r
+;\r
+; Notes:\r
+;\r
+;------------------------------------------------------------------------------\r
+\r
+ .code\r
+\r
+;------------------------------------------------------------------------------\r
+; UINT16\r
+; EFIAPI\r
+; AsmReadGs (\r
+; VOID\r
+; );\r
+;------------------------------------------------------------------------------\r
+AsmReadGs PROC\r
+ mov eax, gs\r
+ ret\r
+AsmReadGs ENDP\r
+\r
+ END\r
--- /dev/null
+#------------------------------------------------------------------------------
+#
+# 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
--- /dev/null
+;------------------------------------------------------------------------------\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
+; ReadIdtr.Asm\r
+;\r
+; Abstract:\r
+;\r
+; AsmReadIdtr function\r
+;\r
+; Notes:\r
+;\r
+;------------------------------------------------------------------------------\r
+\r
+ .code\r
+\r
+;------------------------------------------------------------------------------\r
+; VOID\r
+; EFIAPI\r
+; InternalX86ReadIdtr (\r
+; OUT IA32_DESCRIPTOR *Idtr\r
+; );\r
+;------------------------------------------------------------------------------\r
+InternalX86ReadIdtr PROC\r
+ sidt fword ptr [rcx]\r
+ ret\r
+InternalX86ReadIdtr ENDP\r
+\r
+ END\r
--- /dev/null
+#------------------------------------------------------------------------------
+#
+# 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
--- /dev/null
+;------------------------------------------------------------------------------\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
+; ReadLdtr.Asm\r
+;\r
+; Abstract:\r
+;\r
+; AsmReadLdtr function\r
+;\r
+; Notes:\r
+;\r
+;------------------------------------------------------------------------------\r
+\r
+ .code\r
+\r
+;------------------------------------------------------------------------------\r
+; UINT16\r
+; EFIAPI\r
+; AsmReadLdtr (\r
+; VOID\r
+; );\r
+;------------------------------------------------------------------------------\r
+AsmReadLdtr PROC\r
+ sldt eax\r
+ ret\r
+AsmReadLdtr ENDP\r
+\r
+ END\r
--- /dev/null
+#------------------------------------------------------------------------------
+#
+# 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
--- /dev/null
+;------------------------------------------------------------------------------\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
+; ReadMm0.Asm\r
+;\r
+; Abstract:\r
+;\r
+; AsmReadMm0 function\r
+;\r
+; Notes:\r
+;\r
+;------------------------------------------------------------------------------\r
+\r
+ .code\r
+\r
+;------------------------------------------------------------------------------\r
+; UINT64\r
+; EFIAPI\r
+; AsmReadMm0 (\r
+; VOID\r
+; );\r
+;------------------------------------------------------------------------------\r
+AsmReadMm0 PROC\r
+ ;\r
+ ; 64-bit MASM doesn't support MMX instructions, so use opcode here\r
+ ;\r
+ DB 48h, 0fh, 7eh, 0c0h\r
+ ret\r
+AsmReadMm0 ENDP\r
+\r
+ END\r
--- /dev/null
+#------------------------------------------------------------------------------
+#
+# 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
--- /dev/null
+;------------------------------------------------------------------------------\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
+; ReadMm1.Asm\r
+;\r
+; Abstract:\r
+;\r
+; AsmReadMm1 function\r
+;\r
+; Notes:\r
+;\r
+;------------------------------------------------------------------------------\r
+\r
+ .code\r
+\r
+;------------------------------------------------------------------------------\r
+; UINT64\r
+; EFIAPI\r
+; AsmReadMm1 (\r
+; VOID\r
+; );\r
+;------------------------------------------------------------------------------\r
+AsmReadMm1 PROC\r
+ ;\r
+ ; 64-bit MASM doesn't support MMX instructions, so use opcode here\r
+ ;\r
+ DB 48h, 0fh, 7eh, 0c8h\r
+ ret\r
+AsmReadMm1 ENDP\r
+\r
+ END\r
--- /dev/null
+#------------------------------------------------------------------------------
+#
+# 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
--- /dev/null
+;------------------------------------------------------------------------------\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
+; ReadMm2.Asm\r
+;\r
+; Abstract:\r
+;\r
+; AsmReadMm2 function\r
+;\r
+; Notes:\r
+;\r
+;------------------------------------------------------------------------------\r
+\r
+ .code\r
+\r
+;------------------------------------------------------------------------------\r
+; UINT64\r
+; EFIAPI\r
+; AsmReadMm2 (\r
+; VOID\r
+; );\r
+;------------------------------------------------------------------------------\r
+AsmReadMm2 PROC\r
+ ;\r
+ ; 64-bit MASM doesn't support MMX instructions, so use opcode here\r
+ ;\r
+ DB 48h, 0fh, 7eh, 0d0h\r
+ ret\r
+AsmReadMm2 ENDP\r
+\r
+ END\r
--- /dev/null
+#------------------------------------------------------------------------------
+#
+# 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
--- /dev/null
+;------------------------------------------------------------------------------\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
+; ReadMm3.Asm\r
+;\r
+; Abstract:\r
+;\r
+; AsmReadMm3 function\r
+;\r
+; Notes:\r
+;\r
+;------------------------------------------------------------------------------\r
+\r
+ .code\r
+\r
+;------------------------------------------------------------------------------\r
+; UINT64\r
+; EFIAPI\r
+; AsmReadMm3 (\r
+; VOID\r
+; );\r
+;------------------------------------------------------------------------------\r
+AsmReadMm3 PROC\r
+ ;\r
+ ; 64-bit MASM doesn't support MMX instructions, so use opcode here\r
+ ;\r
+ DB 48h, 0fh, 7eh, 0d8h\r
+ ret\r
+AsmReadMm3 ENDP\r
+\r
+ END\r
--- /dev/null
+#------------------------------------------------------------------------------
+#
+# 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
--- /dev/null
+;------------------------------------------------------------------------------\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
+; ReadMm4.Asm\r
+;\r
+; Abstract:\r
+;\r
+; AsmReadMm4 function\r
+;\r
+; Notes:\r
+;\r
+;------------------------------------------------------------------------------\r
+\r
+ .code\r
+\r
+;------------------------------------------------------------------------------\r
+; UINT64\r
+; EFIAPI\r
+; AsmReadMm4 (\r
+; VOID\r
+; );\r
+;------------------------------------------------------------------------------\r
+AsmReadMm4 PROC\r
+ ;\r
+ ; 64-bit MASM doesn't support MMX instructions, so use opcode here\r
+ ;\r
+ DB 48h, 0fh, 7eh, 0e0h\r
+ ret\r
+AsmReadMm4 ENDP\r
+\r
+ END\r
--- /dev/null
+#------------------------------------------------------------------------------
+#
+# 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
--- /dev/null
+;------------------------------------------------------------------------------\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
+; ReadMm5.Asm\r
+;\r
+; Abstract:\r
+;\r
+; AsmReadMm5 function\r
+;\r
+; Notes:\r
+;\r
+;------------------------------------------------------------------------------\r
+\r
+ .code\r
+\r
+;------------------------------------------------------------------------------\r
+; UINT64\r
+; EFIAPI\r
+; AsmReadMm5 (\r
+; VOID\r
+; );\r
+;------------------------------------------------------------------------------\r
+AsmReadMm5 PROC\r
+ ;\r
+ ; 64-bit MASM doesn't support MMX instructions, so use opcode here\r
+ ;\r
+ DB 48h, 0fh, 7eh, 0e8h\r
+ ret\r
+AsmReadMm5 ENDP\r
+\r
+ END\r
--- /dev/null
+#------------------------------------------------------------------------------
+#
+# 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
--- /dev/null
+;------------------------------------------------------------------------------\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
+; ReadMm6.Asm\r
+;\r
+; Abstract:\r
+;\r
+; AsmReadMm6 function\r
+;\r
+; Notes:\r
+;\r
+;------------------------------------------------------------------------------\r
+\r
+ .code\r
+\r
+;------------------------------------------------------------------------------\r
+; UINT64\r
+; EFIAPI\r
+; AsmReadMm6 (\r
+; VOID\r
+; );\r
+;------------------------------------------------------------------------------\r
+AsmReadMm6 PROC\r
+ ;\r
+ ; 64-bit MASM doesn't support MMX instructions, so use opcode here\r
+ ;\r
+ DB 48h, 0fh, 7eh, 0f0h\r
+ ret\r
+AsmReadMm6 ENDP\r
+\r
+ END\r
--- /dev/null
+#------------------------------------------------------------------------------
+#
+# 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
--- /dev/null
+;------------------------------------------------------------------------------\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
+; ReadMm7.Asm\r
+;\r
+; Abstract:\r
+;\r
+; AsmReadMm7 function\r
+;\r
+; Notes:\r
+;\r
+;------------------------------------------------------------------------------\r
+\r
+ .code\r
+\r
+;------------------------------------------------------------------------------\r
+; UINT64\r
+; EFIAPI\r
+; AsmReadMm7 (\r
+; VOID\r
+; );\r
+;------------------------------------------------------------------------------\r
+AsmReadMm7 PROC\r
+ ;\r
+ ; 64-bit MASM doesn't support MMX instructions, so use opcode here\r
+ ;\r
+ DB 48h, 0fh, 7eh, 0f8h\r
+ ret\r
+AsmReadMm7 ENDP\r
+\r
+ END\r
--- /dev/null
+#------------------------------------------------------------------------------
+#
+# 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
--- /dev/null
+;------------------------------------------------------------------------------\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
+; ReadMsr64.Asm\r
+;\r
+; Abstract:\r
+;\r
+; AsmReadMsr64 function\r
+;\r
+; Notes:\r
+;\r
+;------------------------------------------------------------------------------\r
+\r
+ .code\r
+\r
+;------------------------------------------------------------------------------\r
+; UINT64\r
+; EFIAPI\r
+; AsmReadMsr64 (\r
+; IN UINT32 Index\r
+; );\r
+;------------------------------------------------------------------------------\r
+AsmReadMsr64 PROC\r
+ rdmsr ; edx & eax are zero extended\r
+ shl rdx, 20h\r
+ or rax, rdx\r
+ ret\r
+AsmReadMsr64 ENDP\r
+\r
+ END\r
--- /dev/null
+/** @file\r
+ CpuBreakpoint function.\r
+\r
+ Copyright (c) 2006 - 2007, Intel Corporation<BR>\r
+ All rights reserved. This program and the accompanying materials\r
+ are licensed and made available under the terms and conditions of the BSD License\r
+ which accompanies this distribution. The full text of the license may be found at\r
+ http://opensource.org/licenses/bsd-license.php\r
+\r
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+**/\r
+\r
+//\r
+// Microsoft Visual Studio 7.1 Function Prototypes for I/O Intrinsics\r
+//\r
+unsigned __int64 __readmsr (int register);\r
+\r
+#pragma intrinsic(__readmsr)\r
+\r
+\r
+UINT64\r
+EFIAPI\r
+AsmReadMsr64 (\r
+ IN UINT32 Index\r
+ )\r
+{\r
+ return __readmsr (Index);\r
+}\r
+\r
--- /dev/null
+#------------------------------------------------------------------------------
+#
+# 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
--- /dev/null
+;------------------------------------------------------------------------------\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
+; ReadPmc.Asm\r
+;\r
+; Abstract:\r
+;\r
+; AsmReadPmc function\r
+;\r
+; Notes:\r
+;\r
+;------------------------------------------------------------------------------\r
+\r
+ .code\r
+\r
+;------------------------------------------------------------------------------\r
+; UINT64\r
+; EFIAPI\r
+; AsmReadPmc (\r
+; IN UINT32 PmcIndex\r
+; );\r
+;------------------------------------------------------------------------------\r
+AsmReadPmc PROC\r
+ rdpmc\r
+ shl rdx, 20h\r
+ or rax, rdx\r
+ ret\r
+AsmReadPmc ENDP\r
+\r
+ END\r
--- /dev/null
+#------------------------------------------------------------------------------
+#
+# 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
--- /dev/null
+;------------------------------------------------------------------------------\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
+; ReadSs.Asm\r
+;\r
+; Abstract:\r
+;\r
+; AsmReadSs function\r
+;\r
+; Notes:\r
+;\r
+;------------------------------------------------------------------------------\r
+\r
+ .code\r
+\r
+;------------------------------------------------------------------------------\r
+; UINT16\r
+; EFIAPI\r
+; AsmReadSs (\r
+; VOID\r
+; );\r
+;------------------------------------------------------------------------------\r
+AsmReadSs PROC\r
+ mov eax, ss\r
+ ret\r
+AsmReadSs ENDP\r
+\r
+ END\r
--- /dev/null
+#------------------------------------------------------------------------------
+#
+# 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
--- /dev/null
+;------------------------------------------------------------------------------\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
+; ReadTr.Asm\r
+;\r
+; Abstract:\r
+;\r
+; AsmReadTr function\r
+;\r
+; Notes:\r
+;\r
+;------------------------------------------------------------------------------\r
+\r
+ .code\r
+\r
+;------------------------------------------------------------------------------\r
+; UINT16\r
+; EFIAPI\r
+; AsmReadTr (\r
+; VOID\r
+; );\r
+;------------------------------------------------------------------------------\r
+AsmReadTr PROC\r
+ str eax\r
+ ret\r
+AsmReadTr ENDP\r
+\r
+ END\r
--- /dev/null
+#------------------------------------------------------------------------------
+#
+# 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
--- /dev/null
+;------------------------------------------------------------------------------\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
+; ReadTsc.Asm\r
+;\r
+; Abstract:\r
+;\r
+; AsmReadTsc function\r
+;\r
+; Notes:\r
+;\r
+;------------------------------------------------------------------------------\r
+\r
+ .code\r
+\r
+;------------------------------------------------------------------------------\r
+; UINT64\r
+; EFIAPI\r
+; AsmReadTsc (\r
+; VOID\r
+; );\r
+;------------------------------------------------------------------------------\r
+AsmReadTsc PROC\r
+ rdtsc\r
+ shl rdx, 20h\r
+ or rax, rdx\r
+ ret\r
+AsmReadTsc ENDP\r
+\r
+ END\r
--- /dev/null
+#------------------------------------------------------------------------------
+#
+# 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
--- /dev/null
+;------------------------------------------------------------------------------\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
+; SetJump.Asm\r
+;\r
+; Abstract:\r
+;\r
+; Implementation of SetJump() on x64.\r
+;\r
+;------------------------------------------------------------------------------\r
+\r
+ .code\r
+\r
+EXTERNDEF InternalAssertJumpBuffer:PROC\r
+\r
+;------------------------------------------------------------------------------\r
+; UINTN\r
+; EFIAPI\r
+; SetJump (\r
+; OUT BASE_LIBRARY_JUMP_BUFFER *JumpBuffer\r
+; );\r
+;------------------------------------------------------------------------------\r
+SetJump PROC\r
+ push rcx\r
+ add rsp, -20h\r
+ call InternalAssertJumpBuffer\r
+ add rsp, 20h\r
+ pop rcx\r
+ pop rdx\r
+ mov [rcx], rbx\r
+ mov [rcx + 8], rsp\r
+ mov [rcx + 10h], rbp\r
+ mov [rcx + 18h], rdi\r
+ mov [rcx + 20h], rsi\r
+ mov [rcx + 28h], r12\r
+ mov [rcx + 30h], r13\r
+ mov [rcx + 38h], r14\r
+ mov [rcx + 40h], r15\r
+ mov [rcx + 48h], rdx\r
+ xor rax, rax\r
+ jmp rdx\r
+SetJump ENDP\r
+\r
+ END\r
--- /dev/null
+#------------------------------------------------------------------------------
+#
+# 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
--- /dev/null
+;------------------------------------------------------------------------------\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
+; SwitchStack.Asm\r
+;\r
+; Abstract:\r
+;\r
+;------------------------------------------------------------------------------\r
+\r
+ .code\r
+\r
+;------------------------------------------------------------------------------\r
+; Routine Description:\r
+;\r
+; Routine for switching stacks with 1 parameter\r
+;\r
+; Arguments:\r
+;\r
+; (rcx) EntryPoint - Entry point with new stack.\r
+; (rdx) Context - Parameter for entry point.\r
+; (r8) Context2 - Parameter2 for entry point.\r
+; (r9) NewStack - Pointer to new stack.\r
+;\r
+; Returns:\r
+;\r
+; None\r
+;\r
+;------------------------------------------------------------------------------\r
+InternalSwitchStack PROC\r
+ mov rax, rcx\r
+ mov rcx, rdx\r
+ mov rdx, r8\r
+ lea rsp, [r9 - 20h]\r
+ call rax\r
+InternalSwitchStack ENDP\r
+\r
+ END\r
--- /dev/null
+//\r
+// Include common header file for this module.\r
+//\r
+#include <BaseLibInternals.h>\r
+\r
+;------------------------------------------------------------------------------\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
+; Thunk.asm\r
+;\r
+; Abstract:\r
+;\r
+; Real mode thunk\r
+;\r
+;------------------------------------------------------------------------------\r
+\r
+EXTERNDEF m16Start:BYTE\r
+EXTERNDEF m16Size:WORD\r
+EXTERNDEF mThunk16Attr:WORD\r
+EXTERNDEF m16Gdt:WORD\r
+EXTERNDEF m16GdtrBase:WORD\r
+EXTERNDEF mTransition:WORD\r
+\r
+IA32_REGS STRUC 4t\r
+_EDI DD ?\r
+_ESI DD ?\r
+_EBP DD ?\r
+_ESP DD ?\r
+_EBX DD ?\r
+_EDX DD ?\r
+_ECX DD ?\r
+_EAX DD ?\r
+_DS DW ?\r
+_ES DW ?\r
+_FS DW ?\r
+_GS DW ?\r
+_EFLAGS DQ ?\r
+_EIP DD ?\r
+_CS DW ?\r
+_SS DW ?\r
+IA32_REGS ENDS\r
+\r
+ .const\r
+\r
+m16Size DW InternalAsmThunk16 - m16Start\r
+mThunk16Attr DW _ThunkAttr - m16Start\r
+m16Gdt DW _NullSeg - m16Start\r
+m16GdtrBase DW _16GdtrBase - m16Start\r
+mTransition DW _EntryPoint - m16Start\r
+\r
+ .code\r
+\r
+m16Start LABEL BYTE\r
+\r
+SavedGdt LABEL FWORD\r
+ DW ?\r
+ DQ ?\r
+\r
+;------------------------------------------------------------------------------\r
+; _BackFromUserCode() takes control in real mode after 'retf' has been executed\r
+; by user code. It will be shadowed to somewhere in memory below 1MB.\r
+;------------------------------------------------------------------------------\r
+_BackFromUserCode PROC\r
+ ;\r
+ ; The order of saved registers on the stack matches the order they appears\r
+ ; in IA32_REGS structure. This facilitates wrapper function to extract them\r
+ ; into that structure.\r
+ ;\r
+ ; Some instructions for manipulation of segment registers have to be written\r
+ ; in opcode since 64-bit MASM prevents accesses to those registers.\r
+ ;\r
+ DB 16h ; push ss\r
+ DB 0eh ; push cs\r
+ DB 66h\r
+ call @Base ; push eip\r
+@Base:\r
+ DB 66h\r
+ push 0 ; reserved high order 32 bits of EFlags\r
+ pushf ; pushfd actually\r
+ cli ; disable interrupts\r
+ push gs\r
+ push fs\r
+ DB 6 ; push es\r
+ DB 1eh ; push ds\r
+ DB 66h, 60h ; pushad\r
+ DB 66h, 0bah ; mov edx, imm32\r
+_ThunkAttr DD ?\r
+ test dl, THUNK_ATTRIBUTE_DISABLE_A20_MASK_INT_15\r
+ jz @1\r
+ mov eax, 15cd2401h ; mov ax, 2401h & int 15h\r
+ cli ; disable interrupts\r
+ jnc @2\r
+@1:\r
+ test dl, THUNK_ATTRIBUTE_DISABLE_A20_MASK_KBD_CTRL\r
+ jz @2\r
+ in al, 92h\r
+ or al, 2\r
+ out 92h, al ; deactivate A20M#\r
+@2:\r
+ mov eax, ss\r
+ lea bp, [esp + sizeof (IA32_REGS)]\r
+ ;\r
+ ; rsi in the following 2 instructions is indeed bp in 16-bit code\r
+ ;\r
+ mov word ptr (IA32_REGS ptr [rsi - sizeof (IA32_REGS)])._ESP, bp\r
+ DB 66h\r
+ mov ebx, (IA32_REGS ptr [rsi - sizeof (IA32_REGS)])._EIP\r
+ shl ax, 4 ; shl eax, 4\r
+ add bp, ax ; add ebp, eax\r
+ mov ax, cs\r
+ shl ax, 4\r
+ lea ax, [eax + ebx + (@64BitCode - @Base)]\r
+ DB 66h, 2eh, 89h, 87h ; mov cs:[bx + (@64Eip - @Base)], eax\r
+ DW @64Eip - @Base\r
+ DB 66h, 0b8h ; mov eax, imm32\r
+SavedCr4 DD ?\r
+ mov cr4, rax\r
+ ;\r
+ ; rdi in the instruction below is indeed bx in 16-bit code\r
+ ;\r
+ DB 66h, 2eh ; 2eh is "cs:" segment override\r
+ lgdt fword ptr [rdi + (SavedGdt - @Base)]\r
+ DB 66h\r
+ mov ecx, 0c0000080h\r
+ rdmsr\r
+ or ah, 1\r
+ wrmsr\r
+ DB 66h, 0b8h ; mov eax, imm32\r
+SavedCr0 DD ?\r
+ mov cr0, rax\r
+ DB 66h, 0eah ; jmp far cs:@64Bit\r
+@64Eip DD ?\r
+SavedCs DW ?\r
+@64BitCode:\r
+ mov rsp, r8 ; restore stack\r
+ ret\r
+_BackFromUserCode ENDP\r
+\r
+_EntryPoint DD _ToUserCode - m16Start\r
+ DW CODE16\r
+_16Gdtr LABEL FWORD\r
+ DW GDT_SIZE - 1\r
+_16GdtrBase DQ _NullSeg\r
+_16Idtr FWORD (1 SHL 10) - 1\r
+\r
+;------------------------------------------------------------------------------\r
+; _ToUserCode() takes control in real mode before passing control to user code.\r
+; It will be shadowed to somewhere in memory below 1MB.\r
+;------------------------------------------------------------------------------\r
+_ToUserCode PROC\r
+ mov ss, edx ; set new segment selectors\r
+ mov ds, edx\r
+ mov es, edx\r
+ mov fs, edx\r
+ mov gs, edx\r
+ DB 66h\r
+ mov ecx, 0c0000080h\r
+ mov cr0, rax ; real mode starts at next instruction\r
+ rdmsr\r
+ and ah, NOT 1\r
+ wrmsr\r
+ mov cr4, rbp\r
+ mov ss, esi ; set up 16-bit stack segment\r
+ mov sp, bx ; set up 16-bit stack pointer\r
+ DB 66h ; make the following call 32-bit\r
+ call @Base ; push eip\r
+@Base:\r
+ pop bp ; ebp <- address of @Base\r
+ push [esp + sizeof (IA32_REGS) + 2]\r
+ lea eax, [rsi + (@RealMode - @Base)] ; rsi is "bp" in 16-bit code\r
+ push rax\r
+ retf ; execution begins at next instruction\r
+@RealMode:\r
+ DB 66h, 2eh ; CS and operand size override\r
+ lidt fword ptr [rsi + (_16Idtr - @Base)]\r
+ DB 66h, 61h ; popad\r
+ DB 1fh ; pop ds\r
+ DB 07h ; pop es\r
+ pop fs\r
+ pop gs\r
+ popf ; popfd\r
+ lea sp, [esp + 4] ; skip high order 32 bits of EFlags\r
+ DB 66h ; make the following retf 32-bit\r
+ retf ; transfer control to user code\r
+_ToUserCode ENDP\r
+\r
+CODE16 = _16Code - $\r
+DATA16 = _16Data - $\r
+DATA32 = _32Data - $\r
+\r
+_NullSeg DQ 0\r
+_16Code LABEL QWORD\r
+ DW -1\r
+ DW 0\r
+ DB 0\r
+ DB 9bh\r
+ DB 8fh ; 16-bit segment, 4GB limit\r
+ DB 0\r
+_16Data LABEL QWORD\r
+ DW -1\r
+ DW 0\r
+ DB 0\r
+ DB 93h\r
+ DB 8fh ; 16-bit segment, 4GB limit\r
+ DB 0\r
+_32Data LABEL QWORD\r
+ DW -1\r
+ DW 0\r
+ DB 0\r
+ DB 93h\r
+ DB 0cfh ; 16-bit segment, 4GB limit\r
+ DB 0\r
+\r
+GDT_SIZE = $ - _NullSeg\r
+\r
+;------------------------------------------------------------------------------\r
+; IA32_REGISTER_SET *\r
+; EFIAPI\r
+; InternalAsmThunk16 (\r
+; IN IA32_REGISTER_SET *RegisterSet,\r
+; IN OUT VOID *Transition\r
+; );\r
+;------------------------------------------------------------------------------\r
+InternalAsmThunk16 PROC USES rbp rbx rsi rdi\r
+ mov r10d, ds ; r9 ~ r11 are not accessible in 16-bit\r
+ mov r11d, es ; so use them for saving seg registers\r
+ mov r9d, ss\r
+ push fs\r
+ push gs\r
+ mov rsi, rcx\r
+ movzx r8d, (IA32_REGS ptr [rsi])._SS\r
+ mov edi, (IA32_REGS ptr [rsi])._ESP\r
+ lea rdi, [edi - (sizeof (IA32_REGS) + 4)]\r
+ imul eax, r8d, 16 ; eax <- r8d(stack segment) * 16\r
+ mov ebx, edi ; ebx <- stack for 16-bit code\r
+ push sizeof (IA32_REGS) / 4\r
+ add edi, eax ; edi <- linear address of 16-bit stack\r
+ pop rcx\r
+ rep movsd ; copy RegSet\r
+ lea ecx, [rdx + (SavedCr4 - m16Start)]\r
+ mov eax, edx ; eax <- transition code address\r
+ and edx, 0fh\r
+ shl eax, 12 ; segment address in high order 16 bits\r
+ lea ax, [rdx + (_BackFromUserCode - m16Start)] ; offset address\r
+ stosd ; [edi] <- return address of user code\r
+ sgdt fword ptr [rcx + (SavedGdt - SavedCr4)]\r
+ sidt fword ptr [rsp + 38h] ; save IDT stack in argument space\r
+ mov rax, cr0\r
+ mov [rcx + (SavedCr0 - SavedCr4)], eax\r
+ and eax, 7ffffffeh ; clear PE, PG bits\r
+ mov rbp, cr4\r
+ mov [rcx], ebp ; save CR4 in SavedCr4\r
+ and ebp, 300h ; clear all but PCE and OSFXSR bits\r
+ mov esi, r8d ; esi <- 16-bit stack segment\r
+ DB 6ah, DATA32 ; push DATA32\r
+ pop rdx ; rdx <- 32-bit data segment selector\r
+ lgdt fword ptr [rcx + (_16Gdtr - SavedCr4)]\r
+ mov ss, edx\r
+ pushfq\r
+ lea edx, [rdx + DATA16 - DATA32]\r
+ lea r8, @RetFromRealMode\r
+ push r8\r
+ mov r8d, cs\r
+ mov [rcx + (SavedCs - SavedCr4)], r8w\r
+ mov r8, rsp\r
+ jmp fword ptr [rcx + (_EntryPoint - SavedCr4)]\r
+@RetFromRealMode:\r
+ popfq\r
+ lidt fword ptr [rsp + 38h] ; restore protected mode IDTR\r
+ lea eax, [rbp - sizeof (IA32_REGS)]\r
+ pop gs\r
+ pop fs\r
+ mov ss, r9d\r
+ mov es, r11d\r
+ mov ds, r10d\r
+ ret\r
+InternalAsmThunk16 ENDP\r
+\r
+ END\r
--- /dev/null
+#------------------------------------------------------------------------------
+#
+# 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
--- /dev/null
+;------------------------------------------------------------------------------\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
+; Wbinvd.Asm\r
+;\r
+; Abstract:\r
+;\r
+; AsmWbinvd function\r
+;\r
+; Notes:\r
+;\r
+;------------------------------------------------------------------------------\r
+\r
+ .code\r
+\r
+;------------------------------------------------------------------------------\r
+; VOID\r
+; EFIAPI\r
+; AsmWbinvd (\r
+; VOID\r
+; );\r
+;------------------------------------------------------------------------------\r
+AsmWbinvd PROC\r
+ wbinvd\r
+ ret\r
+AsmWbinvd ENDP\r
+\r
+ END\r
--- /dev/null
+#------------------------------------------------------------------------------
+#
+# 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
--- /dev/null
+;------------------------------------------------------------------------------\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
+; WriteCr0.Asm\r
+;\r
+; Abstract:\r
+;\r
+; AsmWriteCr0 function\r
+;\r
+; Notes:\r
+;\r
+;------------------------------------------------------------------------------\r
+\r
+ .code\r
+\r
+;------------------------------------------------------------------------------\r
+; UINTN\r
+; EFIAPI\r
+; AsmWriteCr0 (\r
+; UINTN Cr0\r
+; );\r
+;------------------------------------------------------------------------------\r
+AsmWriteCr0 PROC\r
+ mov cr0, rcx\r
+ mov rax, rcx\r
+ ret\r
+AsmWriteCr0 ENDP\r
+\r
+ END\r
--- /dev/null
+#------------------------------------------------------------------------------
+#
+# 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
--- /dev/null
+;------------------------------------------------------------------------------\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
+; WriteCr2.Asm\r
+;\r
+; Abstract:\r
+;\r
+; AsmWriteCr2 function\r
+;\r
+; Notes:\r
+;\r
+;------------------------------------------------------------------------------\r
+\r
+ .code\r
+\r
+;------------------------------------------------------------------------------\r
+; UINTN\r
+; EFIAPI\r
+; AsmWriteCr2 (\r
+; UINTN Cr2\r
+; );\r
+;------------------------------------------------------------------------------\r
+AsmWriteCr2 PROC\r
+ mov cr2, rcx\r
+ mov rax, rcx\r
+ ret\r
+AsmWriteCr2 ENDP\r
+\r
+ END\r
--- /dev/null
+#------------------------------------------------------------------------------
+#
+# 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
--- /dev/null
+;------------------------------------------------------------------------------\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
+; WriteCr3.Asm\r
+;\r
+; Abstract:\r
+;\r
+; AsmWriteCr3 function\r
+;\r
+; Notes:\r
+;\r
+;------------------------------------------------------------------------------\r
+\r
+ .code\r
+\r
+;------------------------------------------------------------------------------\r
+; UINTN\r
+; EFIAPI\r
+; AsmWriteCr3 (\r
+; UINTN Cr3\r
+; );\r
+;------------------------------------------------------------------------------\r
+AsmWriteCr3 PROC\r
+ mov cr3, rcx\r
+ mov rax, rcx\r
+ ret\r
+AsmWriteCr3 ENDP\r
+\r
+ END\r
--- /dev/null
+#------------------------------------------------------------------------------
+#
+# 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
--- /dev/null
+;------------------------------------------------------------------------------\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
+; WriteCr4.Asm\r
+;\r
+; Abstract:\r
+;\r
+; AsmWriteCr4 function\r
+;\r
+; Notes:\r
+;\r
+;------------------------------------------------------------------------------\r
+\r
+ .code\r
+\r
+;------------------------------------------------------------------------------\r
+; UINTN\r
+; EFIAPI\r
+; AsmWriteCr4 (\r
+; UINTN Cr4\r
+; );\r
+;------------------------------------------------------------------------------\r
+AsmWriteCr4 PROC\r
+ mov cr4, rcx\r
+ mov rax, rcx\r
+ ret\r
+AsmWriteCr4 ENDP\r
+\r
+ END\r
--- /dev/null
+#------------------------------------------------------------------------------
+#
+# 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
--- /dev/null
+;------------------------------------------------------------------------------\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
+; WriteDr0.Asm\r
+;\r
+; Abstract:\r
+;\r
+; AsmWriteDr0 function\r
+;\r
+; Notes:\r
+;\r
+;------------------------------------------------------------------------------\r
+\r
+ .code\r
+\r
+;------------------------------------------------------------------------------\r
+; UINTN\r
+; EFIAPI\r
+; AsmWriteDr0 (\r
+; IN UINTN Value\r
+; );\r
+;------------------------------------------------------------------------------\r
+AsmWriteDr0 PROC\r
+ mov dr0, rcx\r
+ mov rax, rcx\r
+ ret\r
+AsmWriteDr0 ENDP\r
+\r
+ END\r
--- /dev/null
+#------------------------------------------------------------------------------
+#
+# 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
--- /dev/null
+;------------------------------------------------------------------------------\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
+; WriteDr1.Asm\r
+;\r
+; Abstract:\r
+;\r
+; AsmWriteDr1 function\r
+;\r
+; Notes:\r
+;\r
+;------------------------------------------------------------------------------\r
+\r
+ .code\r
+\r
+;------------------------------------------------------------------------------\r
+; UINTN\r
+; EFIAPI\r
+; AsmWriteDr1 (\r
+; IN UINTN Value\r
+; );\r
+;------------------------------------------------------------------------------\r
+AsmWriteDr1 PROC\r
+ mov dr1, rcx\r
+ mov rax, rcx\r
+ ret\r
+AsmWriteDr1 ENDP\r
+\r
+ END\r
--- /dev/null
+#------------------------------------------------------------------------------
+#
+# 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
--- /dev/null
+;------------------------------------------------------------------------------\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
+; WriteDr2.Asm\r
+;\r
+; Abstract:\r
+;\r
+; AsmWriteDr2 function\r
+;\r
+; Notes:\r
+;\r
+;------------------------------------------------------------------------------\r
+\r
+ .code\r
+\r
+;------------------------------------------------------------------------------\r
+; UINTN\r
+; EFIAPI\r
+; AsmWriteDr2 (\r
+; IN UINTN Value\r
+; );\r
+;------------------------------------------------------------------------------\r
+AsmWriteDr2 PROC\r
+ mov dr2, rcx\r
+ mov rax, rcx\r
+ ret\r
+AsmWriteDr2 ENDP\r
+\r
+ END\r
--- /dev/null
+#------------------------------------------------------------------------------
+#
+# 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
--- /dev/null
+;------------------------------------------------------------------------------\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
+; WriteDr3.Asm\r
+;\r
+; Abstract:\r
+;\r
+; AsmWriteDr3 function\r
+;\r
+; Notes:\r
+;\r
+;------------------------------------------------------------------------------\r
+\r
+ .code\r
+\r
+;------------------------------------------------------------------------------\r
+; UINTN\r
+; EFIAPI\r
+; AsmWriteDr3 (\r
+; IN UINTN Value\r
+; );\r
+;------------------------------------------------------------------------------\r
+AsmWriteDr3 PROC\r
+ mov dr3, rcx\r
+ mov rax, rcx\r
+ ret\r
+AsmWriteDr3 ENDP\r
+\r
+ END\r
--- /dev/null
+#------------------------------------------------------------------------------
+#
+# 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
--- /dev/null
+;------------------------------------------------------------------------------\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
+; WriteDr4.Asm\r
+;\r
+; Abstract:\r
+;\r
+; AsmWriteDr4 function\r
+;\r
+; Notes:\r
+;\r
+;------------------------------------------------------------------------------\r
+\r
+ .code\r
+\r
+;------------------------------------------------------------------------------\r
+; UINTN\r
+; EFIAPI\r
+; AsmWriteDr4 (\r
+; IN UINTN Value\r
+; );\r
+;------------------------------------------------------------------------------\r
+AsmWriteDr4 PROC\r
+ ;\r
+ ; There's no obvious reason to access this register, since it's aliased to\r
+ ; DR6 when DE=0 or an exception generated when DE=1\r
+ ;\r
+ DB 0fh, 23h, 0e1h\r
+ mov rax, rcx\r
+ ret\r
+AsmWriteDr4 ENDP\r
+\r
+ END\r
--- /dev/null
+#------------------------------------------------------------------------------
+#
+# 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
--- /dev/null
+;------------------------------------------------------------------------------\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
+; WriteDr5.Asm\r
+;\r
+; Abstract:\r
+;\r
+; AsmWriteDr5 function\r
+;\r
+; Notes:\r
+;\r
+;------------------------------------------------------------------------------\r
+\r
+ .code\r
+\r
+;------------------------------------------------------------------------------\r
+; UINTN\r
+; EFIAPI\r
+; AsmWriteDr6 (\r
+; IN UINTN Value\r
+; );\r
+;------------------------------------------------------------------------------\r
+AsmWriteDr5 PROC\r
+ ;\r
+ ; There's no obvious reason to access this register, since it's aliased to\r
+ ; DR7 when DE=0 or an exception generated when DE=1\r
+ ;\r
+ DB 0fh, 23h, 0e9h\r
+ mov rax, rcx\r
+ ret\r
+AsmWriteDr5 ENDP\r
+\r
+ END\r
--- /dev/null
+#------------------------------------------------------------------------------
+#
+# 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
--- /dev/null
+;------------------------------------------------------------------------------\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
+; WriteDr6.Asm\r
+;\r
+; Abstract:\r
+;\r
+; AsmWriteDr6 function\r
+;\r
+; Notes:\r
+;\r
+;------------------------------------------------------------------------------\r
+\r
+ .code\r
+\r
+;------------------------------------------------------------------------------\r
+; UINTN\r
+; EFIAPI\r
+; AsmWriteDr6 (\r
+; IN UINTN Value\r
+; );\r
+;------------------------------------------------------------------------------\r
+AsmWriteDr6 PROC\r
+ mov dr6, rcx\r
+ mov rax, rcx\r
+ ret\r
+AsmWriteDr6 ENDP\r
+\r
+ END\r
--- /dev/null
+#------------------------------------------------------------------------------
+#
+# 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
--- /dev/null
+;------------------------------------------------------------------------------\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
+; WriteDr7.Asm\r
+;\r
+; Abstract:\r
+;\r
+; AsmWriteDr7 function\r
+;\r
+; Notes:\r
+;\r
+;------------------------------------------------------------------------------\r
+\r
+ .code\r
+\r
+;------------------------------------------------------------------------------\r
+; UINTN\r
+; EFIAPI\r
+; AsmWriteDr7 (\r
+; IN UINTN Value\r
+; );\r
+;------------------------------------------------------------------------------\r
+AsmWriteDr7 PROC\r
+ mov dr7, rcx\r
+ mov rax, rcx\r
+ ret\r
+AsmWriteDr7 ENDP\r
+\r
+ END\r
--- /dev/null
+#------------------------------------------------------------------------------
+#
+# 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
--- /dev/null
+;------------------------------------------------------------------------------\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
+; WriteGdtr.Asm\r
+;\r
+; Abstract:\r
+;\r
+; AsmWriteGdtr function\r
+;\r
+; Notes:\r
+;\r
+;------------------------------------------------------------------------------\r
+\r
+ .code\r
+\r
+;------------------------------------------------------------------------------\r
+; VOID\r
+; EFIAPI\r
+; InternalX86WriteGdtr (\r
+; IN CONST IA32_DESCRIPTOR *Idtr\r
+; );\r
+;------------------------------------------------------------------------------\r
+InternalX86WriteGdtr PROC\r
+ lgdt fword ptr [rcx]\r
+ ret\r
+InternalX86WriteGdtr ENDP\r
+\r
+ END\r
--- /dev/null
+#------------------------------------------------------------------------------
+#
+# 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
--- /dev/null
+;------------------------------------------------------------------------------\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
+; WriteIdtr.Asm\r
+;\r
+; Abstract:\r
+;\r
+; AsmWriteIdtr function\r
+;\r
+; Notes:\r
+;\r
+;------------------------------------------------------------------------------\r
+\r
+ .code\r
+\r
+;------------------------------------------------------------------------------\r
+; VOID\r
+; EFIAPI\r
+; InternalX86WriteIdtr (\r
+; IN CONST IA32_DESCRIPTOR *Idtr\r
+; );\r
+;------------------------------------------------------------------------------\r
+InternalX86WriteIdtr PROC\r
+ lidt fword ptr [rcx]\r
+ ret\r
+InternalX86WriteIdtr ENDP\r
+\r
+ END\r
--- /dev/null
+#------------------------------------------------------------------------------
+#
+# 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
--- /dev/null
+;------------------------------------------------------------------------------\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
+; WriteLdtr.Asm\r
+;\r
+; Abstract:\r
+;\r
+; AsmWriteLdtr function\r
+;\r
+; Notes:\r
+;\r
+;------------------------------------------------------------------------------\r
+\r
+ .code\r
+\r
+;------------------------------------------------------------------------------\r
+; VOID\r
+; EFIAPI\r
+; AsmWriteLdtr (\r
+; IN UINT16 Ldtr\r
+; );\r
+;------------------------------------------------------------------------------\r
+AsmWriteLdtr PROC\r
+ lldt cx\r
+ ret\r
+AsmWriteLdtr ENDP\r
+\r
+ END\r
--- /dev/null
+#------------------------------------------------------------------------------
+#
+# 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
--- /dev/null
+;------------------------------------------------------------------------------\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
+; WriteMm0.Asm\r
+;\r
+; Abstract:\r
+;\r
+; AsmWriteMm0 function\r
+;\r
+; Notes:\r
+;\r
+;------------------------------------------------------------------------------\r
+\r
+ .code\r
+\r
+;------------------------------------------------------------------------------\r
+; VOID\r
+; EFIAPI\r
+; AsmWriteMm0 (\r
+; IN UINT64 Value\r
+; );\r
+;------------------------------------------------------------------------------\r
+AsmWriteMm0 PROC\r
+ ;\r
+ ; 64-bit MASM doesn't support MMX instructions, so use opcode here\r
+ ;\r
+ DB 48h, 0fh, 6eh, 0c1h\r
+ ret\r
+AsmWriteMm0 ENDP\r
+\r
+ END\r
--- /dev/null
+#------------------------------------------------------------------------------
+#
+# 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
--- /dev/null
+;------------------------------------------------------------------------------\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
+; WriteMm1.Asm\r
+;\r
+; Abstract:\r
+;\r
+; AsmWriteMm1 function\r
+;\r
+; Notes:\r
+;\r
+;------------------------------------------------------------------------------\r
+\r
+ .code\r
+\r
+;------------------------------------------------------------------------------\r
+; VOID\r
+; EFIAPI\r
+; AsmWriteMm1 (\r
+; IN UINT64 Value\r
+; );\r
+;------------------------------------------------------------------------------\r
+AsmWriteMm1 PROC\r
+ ;\r
+ ; 64-bit MASM doesn't support MMX instructions, so use opcode here\r
+ ;\r
+ DB 48h, 0fh, 6eh, 0c9h\r
+ ret\r
+AsmWriteMm1 ENDP\r
+\r
+ END\r
--- /dev/null
+#------------------------------------------------------------------------------
+#
+# 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
--- /dev/null
+;------------------------------------------------------------------------------\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
+; WriteMm2.Asm\r
+;\r
+; Abstract:\r
+;\r
+; AsmWriteMm2 function\r
+;\r
+; Notes:\r
+;\r
+;------------------------------------------------------------------------------\r
+\r
+ .code\r
+\r
+;------------------------------------------------------------------------------\r
+; VOID\r
+; EFIAPI\r
+; AsmWriteMm2 (\r
+; IN UINT64 Value\r
+; );\r
+;------------------------------------------------------------------------------\r
+AsmWriteMm2 PROC\r
+ ;\r
+ ; 64-bit MASM doesn't support MMX instructions, so use opcode here\r
+ ;\r
+ DB 48h, 0fh, 6eh, 0d1h\r
+ ret\r
+AsmWriteMm2 ENDP\r
+\r
+ END\r
--- /dev/null
+#------------------------------------------------------------------------------
+#
+# 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
--- /dev/null
+;------------------------------------------------------------------------------\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
+; WriteMm3.Asm\r
+;\r
+; Abstract:\r
+;\r
+; AsmWriteMm3 function\r
+;\r
+; Notes:\r
+;\r
+;------------------------------------------------------------------------------\r
+\r
+ .code\r
+\r
+;------------------------------------------------------------------------------\r
+; VOID\r
+; EFIAPI\r
+; AsmWriteMm3 (\r
+; IN UINT64 Value\r
+; );\r
+;------------------------------------------------------------------------------\r
+AsmWriteMm3 PROC\r
+ ;\r
+ ; 64-bit MASM doesn't support MMX instructions, so use opcode here\r
+ ;\r
+ DB 48h, 0fh, 6eh, 0d9h\r
+ ret\r
+AsmWriteMm3 ENDP\r
+\r
+ END\r
--- /dev/null
+#------------------------------------------------------------------------------
+#
+# 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
--- /dev/null
+;------------------------------------------------------------------------------\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
+; WriteMm4.Asm\r
+;\r
+; Abstract:\r
+;\r
+; AsmWriteMm4 function\r
+;\r
+; Notes:\r
+;\r
+;------------------------------------------------------------------------------\r
+\r
+ .code\r
+\r
+;------------------------------------------------------------------------------\r
+; VOID\r
+; EFIAPI\r
+; AsmWriteMm4 (\r
+; IN UINT64 Value\r
+; );\r
+;------------------------------------------------------------------------------\r
+AsmWriteMm4 PROC\r
+ ;\r
+ ; 64-bit MASM doesn't support MMX instructions, so use opcode here\r
+ ;\r
+ DB 48h, 0fh, 6eh, 0e1h\r
+ ret\r
+AsmWriteMm4 ENDP\r
+\r
+ END\r
--- /dev/null
+#------------------------------------------------------------------------------
+#
+# 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
--- /dev/null
+;------------------------------------------------------------------------------\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
+; WriteMm5.Asm\r
+;\r
+; Abstract:\r
+;\r
+; AsmWriteMm5 function\r
+;\r
+; Notes:\r
+;\r
+;------------------------------------------------------------------------------\r
+\r
+ .code\r
+\r
+;------------------------------------------------------------------------------\r
+; VOID\r
+; EFIAPI\r
+; AsmWriteMm5 (\r
+; IN UINT64 Value\r
+; );\r
+;------------------------------------------------------------------------------\r
+AsmWriteMm5 PROC\r
+ ;\r
+ ; 64-bit MASM doesn't support MMX instructions, so use opcode here\r
+ ;\r
+ DB 48h, 0fh, 6eh, 0e9h\r
+ ret\r
+AsmWriteMm5 ENDP\r
+\r
+ END\r
--- /dev/null
+#------------------------------------------------------------------------------
+#
+# 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
--- /dev/null
+;------------------------------------------------------------------------------\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
+; WriteMm6.Asm\r
+;\r
+; Abstract:\r
+;\r
+; AsmWriteMm6 function\r
+;\r
+; Notes:\r
+;\r
+;------------------------------------------------------------------------------\r
+\r
+ .code\r
+\r
+;------------------------------------------------------------------------------\r
+; VOID\r
+; EFIAPI\r
+; AsmWriteMm6 (\r
+; IN UINT64 Value\r
+; );\r
+;------------------------------------------------------------------------------\r
+AsmWriteMm6 PROC\r
+ ;\r
+ ; 64-bit MASM doesn't support MMX instructions, so use opcode here\r
+ ;\r
+ DB 48h, 0fh, 6eh, 0f1h\r
+ ret\r
+AsmWriteMm6 ENDP\r
+\r
+ END\r
--- /dev/null
+#------------------------------------------------------------------------------
+#
+# 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
--- /dev/null
+;------------------------------------------------------------------------------\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
+; WriteMm7.Asm\r
+;\r
+; Abstract:\r
+;\r
+; AsmWriteMm7 function\r
+;\r
+; Notes:\r
+;\r
+;------------------------------------------------------------------------------\r
+\r
+ .code\r
+\r
+;------------------------------------------------------------------------------\r
+; VOID\r
+; EFIAPI\r
+; AsmWriteMm7 (\r
+; IN UINT64 Value\r
+; );\r
+;------------------------------------------------------------------------------\r
+AsmWriteMm7 PROC\r
+ ;\r
+ ; 64-bit MASM doesn't support MMX instructions, so use opcode here\r
+ ;\r
+ DB 48h, 0fh, 6eh, 0f9h\r
+ ret\r
+AsmWriteMm7 ENDP\r
+\r
+ END\r
--- /dev/null
+#------------------------------------------------------------------------------
+#
+# 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
--- /dev/null
+;------------------------------------------------------------------------------\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
+; WriteMsr64.Asm\r
+;\r
+; Abstract:\r
+;\r
+; AsmWriteMsr64 function\r
+;\r
+; Notes:\r
+;\r
+;------------------------------------------------------------------------------\r
+\r
+ .code\r
+\r
+;------------------------------------------------------------------------------\r
+; UINT64\r
+; EFIAPI\r
+; AsmWriteMsr64 (\r
+; IN UINT32 Index,\r
+; IN UINT64 Value\r
+; );\r
+;------------------------------------------------------------------------------\r
+AsmWriteMsr64 PROC\r
+ mov rax, rdx ; meanwhile, rax <- return value\r
+ shr rdx, 20h ; edx:eax contains the value to write\r
+ wrmsr\r
+ ret\r
+AsmWriteMsr64 ENDP\r
+\r
+ END\r
--- /dev/null
+/** @file\r
+ CpuBreakpoint function.\r
+\r
+ Copyright (c) 2006 - 2007, Intel Corporation<BR>\r
+ All rights reserved. This program and the accompanying materials\r
+ are licensed and made available under the terms and conditions of the BSD License\r
+ which accompanies this distribution. The full text of the license may be found at\r
+ http://opensource.org/licenses/bsd-license.php\r
+\r
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+**/\r
+\r
+//\r
+// Microsoft Visual Studio 7.1 Function Prototypes for I/O Intrinsics\r
+//\r
+void __writemsr (unsigned long Register, unsigned __int64 Value);\r
+\r
+#pragma intrinsic(__writemsr)\r
+\r
+UINT64\r
+EFIAPI\r
+AsmWriteMsr64 (\r
+ IN UINT32 Index,\r
+ IN UINT64 Value\r
+ )\r
+{\r
+ __writemsr (Index, Value);\r
+ return Value;\r
+}\r
+\r
-//\r
-// Include common header file for this module.\r
-//\r
-#include "CommonHeader.h"\r
-\r
-#------------------------------------------------------------------------------\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
-# CompareMem.Asm\r
-#\r
-# Abstract:\r
-#\r
-# CompareMem function\r
-#\r
-# Notes:\r
-#\r
-# The following BaseMemoryLib instances share the same version of this file:\r
-#\r
-# BaseMemoryLibRepStr\r
-# BaseMemoryLibMmx\r
-# BaseMemoryLibSse2\r
-#\r
-#------------------------------------------------------------------------------\r
-\r
-.globl _InternalMemCompareMem\r
-\r
-#------------------------------------------------------------------------------\r
-# INTN\r
-# EFIAPI\r
-# InternalMemCompareMem (\r
-# IN CONST VOID *DestinationBuffer,\r
-# IN CONST VOID *SourceBuffer,\r
-# IN UINTN Length\r
-# );\r
-#------------------------------------------------------------------------------\r
-_InternalMemCompareMem:\r
- push %esi\r
- push %edi\r
- movl 12(%esp), %esi\r
- movl 16(%esp), %edi\r
- movl 20(%esp), %ecx\r
- repe cmpsb\r
- movzbl -1(%esi), %eax\r
- movzbl -1(%edi), %edx\r
- subl %edx, %eax\r
- pop %edi\r
- pop %esi\r
- ret\r
+#------------------------------------------------------------------------------
+#
+# 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:
+#
+# CompareMem.Asm
+#
+# Abstract:
+#
+# CompareMem function
+#
+# Notes:
+#
+# The following BaseMemoryLib instances share the same version of this file:
+#
+# BaseMemoryLibRepStr
+# BaseMemoryLibMmx
+# BaseMemoryLibSse2
+#
+#------------------------------------------------------------------------------
+
+.globl _InternalMemCompareMem
+
+#------------------------------------------------------------------------------
+# INTN
+# EFIAPI
+# InternalMemCompareMem (
+# IN CONST VOID *DestinationBuffer,
+# IN CONST VOID *SourceBuffer,
+# IN UINTN Length
+# );
+#------------------------------------------------------------------------------
+_InternalMemCompareMem:
+ push %esi
+ push %edi
+ movl 12(%esp), %esi
+ movl 16(%esp), %edi
+ movl 20(%esp), %ecx
+ repe cmpsb
+ movzbl -1(%esi), %eax
+ movzbl -1(%edi), %edx
+ subl %edx, %eax
+ pop %edi
+ pop %esi
+ ret
-//\r
-// Include common header file for this module.\r
-//\r
-\r
-\r
;------------------------------------------------------------------------------\r
;\r
; Copyright (c) 2006, Intel Corporation\r
-//\r
-// Include common header file for this module.\r
-//\r
-#include "CommonHeader.h"\r
-\r
-#------------------------------------------------------------------------------\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
-# CopyMem.Asm\r
-#\r
-# Abstract:\r
-#\r
-# CopyMem function\r
-#\r
-# Notes:\r
-#\r
-#------------------------------------------------------------------------------\r
-\r
-.globl _InternalMemCopyMem\r
-\r
-#------------------------------------------------------------------------------\r
-# VOID *\r
-# EFIAPI\r
-# InternalMemCopyMem (\r
-# IN VOID *Destination,\r
-# IN VOID *Source,\r
-# IN UINTN Count\r
-# );\r
-#------------------------------------------------------------------------------\r
-_InternalMemCopyMem:\r
- push %esi\r
- push %edi\r
- movl 16(%esp), %esi # esi <- Source\r
- movl 12(%esp), %edi # edi <- Destination\r
- movl 20(%esp), %edx # edx <- Count\r
- leal -1(%esi, %edx), %eax # eax <- End of Source\r
- cmpl %edi, %esi\r
- jae L0\r
- cmpl %edi, %eax\r
- jae L_CopyBackward # Copy backward if overlapped\r
-L0:\r
- movl %edx, %ecx\r
- andl $3, %edx\r
- shrl $2, %ecx\r
- rep\r
- movsl # Copy as many Dwords as possible\r
- jmp L_CopyBytes\r
-L_CopyBackward:\r
- movl %eax, %esi # esi <- End of Source\r
- leal -1(%edi, %edx), %edi # edi <- End of Destination\r
- std\r
-L_CopyBytes:\r
- movl %edx, %ecx\r
- rep\r
- movsb # Copy bytes backward\r
- cld\r
- movl 12(%esp), %eax # eax <- Destination as return value\r
- pop %edi\r
- pop %esi\r
- ret\r
+#------------------------------------------------------------------------------
+#
+# 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:
+#
+# CopyMem.Asm
+#
+# Abstract:
+#
+# CopyMem function
+#
+# Notes:
+#
+#------------------------------------------------------------------------------
+
+.globl _InternalMemCopyMem
+
+#------------------------------------------------------------------------------
+# VOID *
+# EFIAPI
+# InternalMemCopyMem (
+# IN VOID *Destination,
+# IN VOID *Source,
+# IN UINTN Count
+# );
+#------------------------------------------------------------------------------
+_InternalMemCopyMem:
+ push %esi
+ push %edi
+ movl 16(%esp), %esi # esi <- Source
+ movl 12(%esp), %edi # edi <- Destination
+ movl 20(%esp), %edx # edx <- Count
+ leal -1(%esi, %edx), %eax # eax <- End of Source
+ cmpl %edi, %esi
+ jae L0
+ cmpl %edi, %eax
+ jae L_CopyBackward # Copy backward if overlapped
+L0:
+ movl %edx, %ecx
+ andl $3, %edx
+ shrl $2, %ecx
+ rep
+ movsl # Copy as many Dwords as possible
+ jmp L_CopyBytes
+L_CopyBackward:
+ movl %eax, %esi # esi <- End of Source
+ leal -1(%edi, %edx), %edi # edi <- End of Destination
+ std
+L_CopyBytes:
+ movl %edx, %ecx
+ rep
+ movsb # Copy bytes backward
+ cld
+ movl 12(%esp), %eax # eax <- Destination as return value
+ pop %edi
+ pop %esi
+ ret
-//\r
-// Include common header file for this module.\r
-//\r
-\r
-\r
;------------------------------------------------------------------------------\r
;\r
; Copyright (c) 2006, Intel Corporation\r
-//\r
-// Include common header file for this module.\r
-//\r
-#include "CommonHeader.h"\r
-\r
-#------------------------------------------------------------------------------\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
-# ScanMem16.Asm\r
-#\r
-# Abstract:\r
-#\r
-# ScanMem16 function\r
-#\r
-# Notes:\r
-#\r
-# The following BaseMemoryLib instances share the same version of this file:\r
-#\r
-# BaseMemoryLibRepStr\r
-# BaseMemoryLibMmx\r
-# BaseMemoryLibSse2\r
-#\r
-#------------------------------------------------------------------------------\r
-\r
-.globl _InternalMemScanMem16\r
-\r
-#------------------------------------------------------------------------------\r
-# CONST VOID *\r
-# EFIAPI\r
-# InternalMemScanMem16 (\r
-# IN CONST VOID *Buffer,\r
-# IN UINTN Length,\r
-# IN UINT16 Value\r
-# );\r
-#------------------------------------------------------------------------------\r
-_InternalMemScanMem16:\r
- push %edi\r
- movl 12(%esp), %ecx\r
- movl 8(%esp), %edi\r
- movl 16(%esp), %eax\r
- repne scasw\r
- leal -2(%edi), %eax\r
- cmovnz %ecx, %eax\r
- pop %edi\r
- ret\r
+#------------------------------------------------------------------------------
+#
+# 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:
+#
+# ScanMem16.Asm
+#
+# Abstract:
+#
+# ScanMem16 function
+#
+# Notes:
+#
+# The following BaseMemoryLib instances share the same version of this file:
+#
+# BaseMemoryLibRepStr
+# BaseMemoryLibMmx
+# BaseMemoryLibSse2
+#
+#------------------------------------------------------------------------------
+
+.globl _InternalMemScanMem16
+
+#------------------------------------------------------------------------------
+# CONST VOID *
+# EFIAPI
+# InternalMemScanMem16 (
+# IN CONST VOID *Buffer,
+# IN UINTN Length,
+# IN UINT16 Value
+# );
+#------------------------------------------------------------------------------
+_InternalMemScanMem16:
+ push %edi
+ movl 12(%esp), %ecx
+ movl 8(%esp), %edi
+ movl 16(%esp), %eax
+ repne scasw
+ leal -2(%edi), %eax
+ cmovnz %ecx, %eax
+ pop %edi
+ ret
-//\r
-// Include common header file for this module.\r
-//\r
-\r
-\r
;------------------------------------------------------------------------------\r
;\r
; Copyright (c) 2006, Intel Corporation\r
-//\r
-// Include common header file for this module.\r
-//\r
-#include "CommonHeader.h"\r
-\r
-#------------------------------------------------------------------------------\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
-# ScanMem32.Asm\r
-#\r
-# Abstract:\r
-#\r
-# ScanMem32 function\r
-#\r
-# Notes:\r
-#\r
-# The following BaseMemoryLib instances share the same version of this file:\r
-#\r
-# BaseMemoryLibRepStr\r
-# BaseMemoryLibMmx\r
-# BaseMemoryLibSse2\r
-#\r
-#------------------------------------------------------------------------------\r
-\r
-.globl _InternalMemScanMem32\r
-\r
-#------------------------------------------------------------------------------\r
-# CONST VOID *\r
-# EFIAPI\r
-# InternalMemScanMem32 (\r
-# IN CONST VOID *Buffer,\r
-# IN UINTN Length,\r
-# IN UINT32 Value\r
-# );\r
-#------------------------------------------------------------------------------\r
-_InternalMemScanMem32:\r
- push %edi\r
- movl 12(%esp), %ecx\r
- movl 8(%esp), %edi\r
- movl 16(%esp), %eax\r
- repne scasl\r
- leal -4(%edi), %eax\r
- cmovnz %ecx, %eax\r
- pop %edi\r
- ret\r
+#------------------------------------------------------------------------------
+#
+# 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:
+#
+# ScanMem32.Asm
+#
+# Abstract:
+#
+# ScanMem32 function
+#
+# Notes:
+#
+# The following BaseMemoryLib instances share the same version of this file:
+#
+# BaseMemoryLibRepStr
+# BaseMemoryLibMmx
+# BaseMemoryLibSse2
+#
+#------------------------------------------------------------------------------
+
+.globl _InternalMemScanMem32
+
+#------------------------------------------------------------------------------
+# CONST VOID *
+# EFIAPI
+# InternalMemScanMem32 (
+# IN CONST VOID *Buffer,
+# IN UINTN Length,
+# IN UINT32 Value
+# );
+#------------------------------------------------------------------------------
+_InternalMemScanMem32:
+ push %edi
+ movl 12(%esp), %ecx
+ movl 8(%esp), %edi
+ movl 16(%esp), %eax
+ repne scasl
+ leal -4(%edi), %eax
+ cmovnz %ecx, %eax
+ pop %edi
+ ret
-//\r
-// Include common header file for this module.\r
-//\r
-\r
-\r
;------------------------------------------------------------------------------\r
;\r
; Copyright (c) 2006, Intel Corporation\r
-//\r
-// Include common header file for this module.\r
-//\r
-#include "CommonHeader.h"\r
-\r
-#------------------------------------------------------------------------------\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
-# ScanMem64.Asm\r
-#\r
-# Abstract:\r
-#\r
-# ScanMem64 function\r
-#\r
-# Notes:\r
-#\r
-# The following BaseMemoryLib instances share the same version of this file:\r
-#\r
-# BaseMemoryLibRepStr\r
-# BaseMemoryLibMmx\r
-# BaseMemoryLibSse2\r
-#\r
-#------------------------------------------------------------------------------\r
-\r
-.globl _InternalMemScanMem64\r
-\r
-#------------------------------------------------------------------------------\r
-# CONST VOID *\r
-# EFIAPI\r
-# InternalMemScanMem64 (\r
-# IN CONST VOID *Buffer,\r
-# IN UINTN Length,\r
-# IN UINT64 Value\r
-# );\r
-#------------------------------------------------------------------------------\r
-_InternalMemScanMem64:\r
- push %edi\r
- movl 12(%esp), %ecx\r
- movl 16(%esp), %eax\r
- movl 20(%esp), %edx\r
- movl 8(%esp), %edi\r
-L0:\r
- cmpl (%edi), %eax\r
- leal 8(%edi), %edi\r
- loopne L0\r
- jne L1\r
- cmpl -4(%edi), %edx\r
- jecxz L1\r
- jne L0\r
-L1:\r
- leal -8(%edi), %eax\r
- cmovne %ecx, %eax\r
- pop %edi\r
- ret\r
+#------------------------------------------------------------------------------
+#
+# 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:
+#
+# ScanMem64.Asm
+#
+# Abstract:
+#
+# ScanMem64 function
+#
+# Notes:
+#
+# The following BaseMemoryLib instances share the same version of this file:
+#
+# BaseMemoryLibRepStr
+# BaseMemoryLibMmx
+# BaseMemoryLibSse2
+#
+#------------------------------------------------------------------------------
+
+.globl _InternalMemScanMem64
+
+#------------------------------------------------------------------------------
+# CONST VOID *
+# EFIAPI
+# InternalMemScanMem64 (
+# IN CONST VOID *Buffer,
+# IN UINTN Length,
+# IN UINT64 Value
+# );
+#------------------------------------------------------------------------------
+_InternalMemScanMem64:
+ push %edi
+ movl 12(%esp), %ecx
+ movl 16(%esp), %eax
+ movl 20(%esp), %edx
+ movl 8(%esp), %edi
+L0:
+ cmpl (%edi), %eax
+ leal 8(%edi), %edi
+ loopne L0
+ jne L1
+ cmpl -4(%edi), %edx
+ jecxz L1
+ jne L0
+L1:
+ leal -8(%edi), %eax
+ cmovne %ecx, %eax
+ pop %edi
+ ret
-//\r
-// Include common header file for this module.\r
-//\r
-\r
-\r
;------------------------------------------------------------------------------\r
;\r
; Copyright (c) 2006, Intel Corporation\r
-//\r
-// Include common header file for this module.\r
-//\r
-#include "CommonHeader.h"\r
-\r
-#------------------------------------------------------------------------------\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
-# ScanMem8.Asm\r
-#\r
-# Abstract:\r
-#\r
-# ScanMem8 function\r
-#\r
-# Notes:\r
-#\r
-# The following BaseMemoryLib instances share the same version of this file:\r
-#\r
-# BaseMemoryLibRepStr\r
-# BaseMemoryLibMmx\r
-# BaseMemoryLibSse2\r
-#\r
-#------------------------------------------------------------------------------\r
-\r
-.globl _InternalMemScanMem8\r
-\r
-#------------------------------------------------------------------------------\r
-# CONST VOID *\r
-# EFIAPI\r
-# InternalMemScanMem8 (\r
-# IN CONST VOID *Buffer,\r
-# IN UINTN Length,\r
-# IN UINT8 Value\r
-# );\r
-#------------------------------------------------------------------------------\r
-_InternalMemScanMem8:\r
- push %edi\r
- movl 12(%esp), %ecx\r
- movl 8(%esp), %edi\r
- movb 16(%esp), %al\r
- repne scasb\r
- leal -1(%edi), %eax\r
- cmovnz %ecx, %eax\r
- pop %edi\r
- ret\r
+#------------------------------------------------------------------------------
+#
+# 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:
+#
+# ScanMem8.Asm
+#
+# Abstract:
+#
+# ScanMem8 function
+#
+# Notes:
+#
+# The following BaseMemoryLib instances share the same version of this file:
+#
+# BaseMemoryLibRepStr
+# BaseMemoryLibMmx
+# BaseMemoryLibSse2
+#
+#------------------------------------------------------------------------------
+
+.globl _InternalMemScanMem8
+
+#------------------------------------------------------------------------------
+# CONST VOID *
+# EFIAPI
+# InternalMemScanMem8 (
+# IN CONST VOID *Buffer,
+# IN UINTN Length,
+# IN UINT8 Value
+# );
+#------------------------------------------------------------------------------
+_InternalMemScanMem8:
+ push %edi
+ movl 12(%esp), %ecx
+ movl 8(%esp), %edi
+ movb 16(%esp), %al
+ repne scasb
+ leal -1(%edi), %eax
+ cmovnz %ecx, %eax
+ pop %edi
+ ret
-//\r
-// Include common header file for this module.\r
-//\r
-\r
-\r
;------------------------------------------------------------------------------\r
;\r
; Copyright (c) 2006, Intel Corporation\r
-//\r
-// Include common header file for this module.\r
-//\r
-#include "CommonHeader.h"\r
-\r
-#------------------------------------------------------------------------------\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
-# SetMem.Asm\r
-#\r
-# Abstract:\r
-#\r
-# SetMem function\r
-#\r
-# Notes:\r
-#\r
-#------------------------------------------------------------------------------\r
-\r
- .386:\r
- .code:\r
-\r
-.globl _InternalMemSetMem\r
-\r
-#------------------------------------------------------------------------------\r
-# VOID *\r
-# InternalMemSetMem (\r
-# IN VOID *Buffer,\r
-# IN UINTN Count,\r
-# IN UINT8 Value\r
-# )\r
-#------------------------------------------------------------------------------\r
-_InternalMemSetMem:\r
- push %edi\r
- movl 16(%esp),%eax\r
- movl 8(%esp),%edi\r
- movl 12(%esp),%ecx\r
- rep\r
- stosb\r
- movl 8(%esp),%eax\r
- pop %edi\r
- ret\r
+#------------------------------------------------------------------------------
+#
+# 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:
+#
+# SetMem.Asm
+#
+# Abstract:
+#
+# SetMem function
+#
+# Notes:
+#
+#------------------------------------------------------------------------------
+
+ .386:
+ .code:
+
+.globl _InternalMemSetMem
+
+#------------------------------------------------------------------------------
+# VOID *
+# InternalMemSetMem (
+# IN VOID *Buffer,
+# IN UINTN Count,
+# IN UINT8 Value
+# )
+#------------------------------------------------------------------------------
+_InternalMemSetMem:
+ push %edi
+ movl 16(%esp),%eax
+ movl 8(%esp),%edi
+ movl 12(%esp),%ecx
+ rep
+ stosb
+ movl 8(%esp),%eax
+ pop %edi
+ ret
-//\r
-// Include common header file for this module.\r
-//\r
-\r
-\r
;------------------------------------------------------------------------------\r
;\r
; Copyright (c) 2006, Intel Corporation\r
-//\r
-// Include common header file for this module.\r
-//\r
-#include "CommonHeader.h"\r
-\r
-#------------------------------------------------------------------------------\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
-# SetMem16.Asm\r
-#\r
-# Abstract:\r
-#\r
-# SetMem16 function\r
-#\r
-# Notes:\r
-#\r
-#------------------------------------------------------------------------------\r
-\r
-.globl _InternalMemSetMem16\r
-\r
-#------------------------------------------------------------------------------\r
-# VOID *\r
-# InternalMemSetMem16 (\r
-# IN VOID *Buffer,\r
-# IN UINTN Count,\r
-# IN UINT16 Value\r
-# )\r
-#------------------------------------------------------------------------------\r
-_InternalMemSetMem16:\r
- push %edi\r
- movl 16(%esp), %eax\r
- movl 8(%esp), %edi\r
- movl 12(%esp), %ecx\r
- rep\r
- stosw\r
- movl 8(%esp), %eax\r
- pop %edi\r
- ret\r
+#------------------------------------------------------------------------------
+#
+# 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:
+#
+# SetMem16.Asm
+#
+# Abstract:
+#
+# SetMem16 function
+#
+# Notes:
+#
+#------------------------------------------------------------------------------
+
+.globl _InternalMemSetMem16
+
+#------------------------------------------------------------------------------
+# VOID *
+# InternalMemSetMem16 (
+# IN VOID *Buffer,
+# IN UINTN Count,
+# IN UINT16 Value
+# )
+#------------------------------------------------------------------------------
+_InternalMemSetMem16:
+ push %edi
+ movl 16(%esp), %eax
+ movl 8(%esp), %edi
+ movl 12(%esp), %ecx
+ rep
+ stosw
+ movl 8(%esp), %eax
+ pop %edi
+ ret
-//\r
-// Include common header file for this module.\r
-//\r
-\r
-\r
;------------------------------------------------------------------------------\r
;\r
; Copyright (c) 2006, Intel Corporation\r
-//\r
-// Include common header file for this module.\r
-//\r
-#include "CommonHeader.h"\r
-\r
-#------------------------------------------------------------------------------\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
-# SetMem32.Asm\r
-#\r
-# Abstract:\r
-#\r
-# SetMem32 function\r
-#\r
-# Notes:\r
-#\r
-#------------------------------------------------------------------------------\r
-\r
-.globl _InternalMemSetMem32\r
-\r
-#------------------------------------------------------------------------------\r
-# VOID *\r
-# InternalMemSetMem32 (\r
-# IN VOID *Buffer,\r
-# IN UINTN Count,\r
-# IN UINT32 Value\r
-# )\r
-#------------------------------------------------------------------------------\r
-_InternalMemSetMem32:\r
- push %edi\r
- movl 16(%esp),%eax\r
- movl 8(%esp),%edi\r
- movl 12(%esp),%ecx\r
- rep\r
- stosl\r
- movl 8(%esp),%eax\r
- pop %edi\r
- ret\r
+#------------------------------------------------------------------------------
+#
+# 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:
+#
+# SetMem32.Asm
+#
+# Abstract:
+#
+# SetMem32 function
+#
+# Notes:
+#
+#------------------------------------------------------------------------------
+
+.globl _InternalMemSetMem32
+
+#------------------------------------------------------------------------------
+# VOID *
+# InternalMemSetMem32 (
+# IN VOID *Buffer,
+# IN UINTN Count,
+# IN UINT32 Value
+# )
+#------------------------------------------------------------------------------
+_InternalMemSetMem32:
+ push %edi
+ movl 16(%esp),%eax
+ movl 8(%esp),%edi
+ movl 12(%esp),%ecx
+ rep
+ stosl
+ movl 8(%esp),%eax
+ pop %edi
+ ret
-//\r
-// Include common header file for this module.\r
-//\r
-\r
-\r
;------------------------------------------------------------------------------\r
;\r
; Copyright (c) 2006, Intel Corporation\r
-//\r
-// Include common header file for this module.\r
-//\r
-#include "CommonHeader.h"\r
-\r
-#------------------------------------------------------------------------------\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
-# SetMem64.Asm\r
-#\r
-# Abstract:\r
-#\r
-# SetMem64 function\r
-#\r
-# Notes:\r
-#\r
-#------------------------------------------------------------------------------\r
-\r
-.globl _InternalMemSetMem64\r
-\r
-#------------------------------------------------------------------------------\r
-# VOID *\r
-# InternalMemSetMem64 (\r
-# IN VOID *Buffer,\r
-# IN UINTN Count,\r
-# IN UINT64 Value\r
-# )\r
-#------------------------------------------------------------------------------\r
-_InternalMemSetMem64:\r
- push %edi\r
- movl 12(%esp), %ecx\r
- movl 16(%esp), %eax\r
- movl 20(%esp), %edx\r
- movl 8(%esp), %edi\r
-L0:\r
- mov %eax, -8(%edi, %ecx, 8)\r
- mov %edx, -4(%edi, %ecx, 8)\r
- loop L0\r
- movl %edi, %eax\r
- pop %edi\r
- ret\r
+#------------------------------------------------------------------------------
+#
+# 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:
+#
+# SetMem64.Asm
+#
+# Abstract:
+#
+# SetMem64 function
+#
+# Notes:
+#
+#------------------------------------------------------------------------------
+
+.globl _InternalMemSetMem64
+
+#------------------------------------------------------------------------------
+# VOID *
+# InternalMemSetMem64 (
+# IN VOID *Buffer,
+# IN UINTN Count,
+# IN UINT64 Value
+# )
+#------------------------------------------------------------------------------
+_InternalMemSetMem64:
+ push %edi
+ movl 12(%esp), %ecx
+ movl 16(%esp), %eax
+ movl 20(%esp), %edx
+ movl 8(%esp), %edi
+L0:
+ mov %eax, -8(%edi, %ecx, 8)
+ mov %edx, -4(%edi, %ecx, 8)
+ loop L0
+ movl %edi, %eax
+ pop %edi
+ ret
-//\r
-// Include common header file for this module.\r
-//\r
-\r
-\r
;------------------------------------------------------------------------------\r
;\r
; Copyright (c) 2006, Intel Corporation\r
-//\r
-// Include common header file for this module.\r
-//\r
-#include "CommonHeader.h"\r
-\r
-#------------------------------------------------------------------------------\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
-# ZeroMem.Asm\r
-#\r
-# Abstract:\r
-#\r
-# ZeroMem function\r
-#\r
-# Notes:\r
-#\r
-#------------------------------------------------------------------------------\r
-\r
-.globl _InternalMemZeroMem\r
-\r
-#------------------------------------------------------------------------------\r
-# VOID *\r
-# InternalMemZeroMem (\r
-# IN VOID *Buffer,\r
-# IN UINTN Count\r
-# );\r
-#------------------------------------------------------------------------------\r
-_InternalMemZeroMem:\r
- push %edi\r
- xorl %eax,%eax\r
- movl 8(%esp),%edi\r
- movl 12(%esp),%ecx\r
- movl %ecx,%edx\r
- shrl $2,%ecx\r
- andl $3,%edx\r
- pushl %edi\r
- rep\r
- stosl\r
- movl %edx,%ecx\r
- rep\r
- stosb\r
- popl %eax\r
- pop %edi\r
- ret\r
+#------------------------------------------------------------------------------
+#
+# 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:
+#
+# ZeroMem.Asm
+#
+# Abstract:
+#
+# ZeroMem function
+#
+# Notes:
+#
+#------------------------------------------------------------------------------
+
+.globl _InternalMemZeroMem
+
+#------------------------------------------------------------------------------
+# VOID *
+# InternalMemZeroMem (
+# IN VOID *Buffer,
+# IN UINTN Count
+# );
+#------------------------------------------------------------------------------
+_InternalMemZeroMem:
+ push %edi
+ xorl %eax,%eax
+ movl 8(%esp),%edi
+ movl 12(%esp),%ecx
+ movl %ecx,%edx
+ shrl $2,%ecx
+ andl $3,%edx
+ pushl %edi
+ rep
+ stosl
+ movl %edx,%ecx
+ rep
+ stosb
+ popl %eax
+ pop %edi
+ ret
-//\r
-// Include common header file for this module.\r
-//\r
-\r
-\r
;------------------------------------------------------------------------------\r
;\r
; Copyright (c) 2006, Intel Corporation\r
--- /dev/null
+;------------------------------------------------------------------------------\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
+; CompareMem.Asm\r
+;\r
+; Abstract:\r
+;\r
+; CompareMem function\r
+;\r
+; Notes:\r
+;\r
+; The following BaseMemoryLib instances share the same version of this file:\r
+;\r
+; BaseMemoryLibRepStr\r
+; BaseMemoryLibMmx\r
+; BaseMemoryLibSse2\r
+;\r
+;------------------------------------------------------------------------------\r
+\r
+ .code\r
+\r
+;------------------------------------------------------------------------------\r
+; INTN\r
+; EFIAPI\r
+; InternalMemCompareMem (\r
+; IN CONST VOID *DestinationBuffer,\r
+; IN CONST VOID *SourceBuffer,\r
+; IN UINTN Length\r
+; );\r
+;------------------------------------------------------------------------------\r
+InternalMemCompareMem PROC USES rsi rdi\r
+ mov rsi, rcx\r
+ mov rdi, rdx\r
+ mov rcx, r8\r
+ repe cmpsb\r
+ movzx rax, byte ptr [rsi - 1]\r
+ movzx rdx, byte ptr [rdi - 1]\r
+ sub rax, rdx\r
+ ret\r
+InternalMemCompareMem ENDP\r
+\r
+ END\r
--- /dev/null
+;------------------------------------------------------------------------------\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
+; CopyMem.Asm\r
+;\r
+; Abstract:\r
+;\r
+; CopyMem function\r
+;\r
+; Notes:\r
+;\r
+;------------------------------------------------------------------------------\r
+\r
+ .code\r
+\r
+;------------------------------------------------------------------------------\r
+; VOID *\r
+; EFIAPI\r
+; InternalMemCopyMem (\r
+; IN VOID *Destination,\r
+; IN VOID *Source,\r
+; IN UINTN Count\r
+; )\r
+;------------------------------------------------------------------------------\r
+InternalMemCopyMem PROC USES rsi rdi\r
+ mov rsi, rdx ; rsi <- Source\r
+ mov rdi, rcx ; rdi <- Destination\r
+ lea r9, [rsi + r8 - 1] ; r9 <- End of Source\r
+ cmp rsi, rdi\r
+ mov rax, rdi ; rax <- Destination as return value\r
+ jae @F\r
+ cmp r9, rsi\r
+ jae @CopyBackward ; Copy backward if overlapped\r
+@@:\r
+ mov rcx, r8\r
+ and r8, 7\r
+ shr rcx, 3\r
+ rep movsq ; Copy as many Qwords as possible\r
+ jmp @CopyBytes\r
+@CopyBackward:\r
+ mov rsi, r9 ; rsi <- End of Source\r
+ lea rdi, [rdi + r8 - 1] ; esi <- End of Destination\r
+ std ; set direction flag\r
+@CopyBytes:\r
+ mov rcx, r8\r
+ rep movsb ; Copy bytes backward\r
+ cld\r
+ ret\r
+InternalMemCopyMem ENDP\r
+\r
+ END\r
--- /dev/null
+;------------------------------------------------------------------------------\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
+; ScanMem16.Asm\r
+;\r
+; Abstract:\r
+;\r
+; ScanMem16 function\r
+;\r
+; Notes:\r
+;\r
+; The following BaseMemoryLib instances share the same version of this file:\r
+;\r
+; BaseMemoryLibRepStr\r
+; BaseMemoryLibMmx\r
+; BaseMemoryLibSse2\r
+;\r
+;------------------------------------------------------------------------------\r
+\r
+ .code\r
+\r
+;------------------------------------------------------------------------------\r
+; CONST VOID *\r
+; EFIAPI\r
+; InternalMemScanMem16 (\r
+; IN CONST VOID *Buffer,\r
+; IN UINTN Length,\r
+; IN UINT16 Value\r
+; );\r
+;------------------------------------------------------------------------------\r
+InternalMemScanMem16 PROC USES rdi\r
+ mov rdi, rcx\r
+ mov rax, r8\r
+ mov rcx, rdx\r
+ repne scasw\r
+ lea rax, [rdi - 2]\r
+ cmovnz rax, rcx\r
+ ret\r
+InternalMemScanMem16 ENDP\r
+\r
+ END\r
--- /dev/null
+;------------------------------------------------------------------------------\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
+; ScanMem32.Asm\r
+;\r
+; Abstract:\r
+;\r
+; ScanMem32 function\r
+;\r
+; Notes:\r
+;\r
+; The following BaseMemoryLib instances share the same version of this file:\r
+;\r
+; BaseMemoryLibRepStr\r
+; BaseMemoryLibMmx\r
+; BaseMemoryLibSse2\r
+;\r
+;------------------------------------------------------------------------------\r
+\r
+ .code\r
+\r
+;------------------------------------------------------------------------------\r
+; CONST VOID *\r
+; EFIAPI\r
+; InternalMemScanMem32 (\r
+; IN CONST VOID *Buffer,\r
+; IN UINTN Length,\r
+; IN UINT32 Value\r
+; );\r
+;------------------------------------------------------------------------------\r
+InternalMemScanMem32 PROC USES rdi\r
+ mov rdi, rcx\r
+ mov rax, r8\r
+ mov rcx, rdx\r
+ repne scasd\r
+ lea rax, [rdi - 4]\r
+ cmovnz rax, rcx\r
+ ret\r
+InternalMemScanMem32 ENDP\r
+\r
+ END\r
--- /dev/null
+;------------------------------------------------------------------------------\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
+; ScanMem64.Asm\r
+;\r
+; Abstract:\r
+;\r
+; ScanMem64 function\r
+;\r
+; Notes:\r
+;\r
+; The following BaseMemoryLib instances share the same version of this file:\r
+;\r
+; BaseMemoryLibRepStr\r
+; BaseMemoryLibMmx\r
+; BaseMemoryLibSse2\r
+;\r
+;------------------------------------------------------------------------------\r
+\r
+ .code\r
+\r
+;------------------------------------------------------------------------------\r
+; CONST VOID *\r
+; EFIAPI\r
+; InternalMemScanMem64 (\r
+; IN CONST VOID *Buffer,\r
+; IN UINTN Length,\r
+; IN UINT64 Value\r
+; );\r
+;------------------------------------------------------------------------------\r
+InternalMemScanMem64 PROC USES rdi\r
+ mov rdi, rcx\r
+ mov rax, r8\r
+ mov rcx, rdx\r
+ repne scasq\r
+ lea rax, [rdi - 8]\r
+ cmovnz rax, rcx\r
+ ret\r
+InternalMemScanMem64 ENDP\r
+\r
+ END\r
--- /dev/null
+;------------------------------------------------------------------------------\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
+; ScanMem8.Asm\r
+;\r
+; Abstract:\r
+;\r
+; ScanMem8 function\r
+;\r
+; Notes:\r
+;\r
+; The following BaseMemoryLib instances share the same version of this file:\r
+;\r
+; BaseMemoryLibRepStr\r
+; BaseMemoryLibMmx\r
+; BaseMemoryLibSse2\r
+;\r
+;------------------------------------------------------------------------------\r
+\r
+ .code\r
+\r
+;------------------------------------------------------------------------------\r
+; CONST VOID *\r
+; EFIAPI\r
+; InternalMemScanMem8 (\r
+; IN CONST VOID *Buffer,\r
+; IN UINTN Length,\r
+; IN UINT8 Value\r
+; );\r
+;------------------------------------------------------------------------------\r
+InternalMemScanMem8 PROC USES rdi\r
+ mov rdi, rcx\r
+ mov rcx, rdx\r
+ mov rax, r8\r
+ repne scasb\r
+ lea rax, [rdi - 1]\r
+ cmovnz rax, rcx ; set rax to 0 if not found\r
+ ret\r
+InternalMemScanMem8 ENDP\r
+\r
+ END\r
--- /dev/null
+;------------------------------------------------------------------------------\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
+; SetMem.Asm\r
+;\r
+; Abstract:\r
+;\r
+; SetMem function\r
+;\r
+; Notes:\r
+;\r
+;------------------------------------------------------------------------------\r
+\r
+ .code\r
+\r
+;------------------------------------------------------------------------------\r
+; VOID *\r
+; EFIAPI\r
+; InternalMemSetMem (\r
+; IN VOID *Buffer,\r
+; IN UINTN Count,\r
+; IN UINT8 Value\r
+; )\r
+;------------------------------------------------------------------------------\r
+InternalMemSetMem PROC USES rdi\r
+ mov rax, r8\r
+ mov rdi, rcx\r
+ xchg rcx, rdx\r
+ rep stosb\r
+ mov rax, rdx\r
+ ret\r
+InternalMemSetMem ENDP\r
+\r
+ END\r
--- /dev/null
+;------------------------------------------------------------------------------\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
+; SetMem16.Asm\r
+;\r
+; Abstract:\r
+;\r
+; SetMem16 function\r
+;\r
+; Notes:\r
+;\r
+;------------------------------------------------------------------------------\r
+\r
+ .code\r
+\r
+;------------------------------------------------------------------------------\r
+; VOID *\r
+; EFIAPI\r
+; InternalMemSetMem16 (\r
+; IN VOID *Buffer,\r
+; IN UINTN Count,\r
+; IN UINT16 Value\r
+; )\r
+;------------------------------------------------------------------------------\r
+InternalMemSetMem16 PROC USES rdi\r
+ mov rdi, rcx\r
+ mov rax, r8\r
+ xchg rcx, rdx\r
+ rep stosw\r
+ mov rax, rdx\r
+ ret\r
+InternalMemSetMem16 ENDP\r
+\r
+ END\r
--- /dev/null
+;------------------------------------------------------------------------------\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
+; SetMem32.Asm\r
+;\r
+; Abstract:\r
+;\r
+; SetMem32 function\r
+;\r
+; Notes:\r
+;\r
+;------------------------------------------------------------------------------\r
+\r
+ .code\r
+\r
+;------------------------------------------------------------------------------\r
+; VOID *\r
+; EFIAPI\r
+; InternalMemSetMem32 (\r
+; IN VOID *Buffer,\r
+; IN UINTN Count,\r
+; IN UINT32 Value\r
+; );\r
+;------------------------------------------------------------------------------\r
+InternalMemSetMem32 PROC USES rdi\r
+ mov rdi, rcx\r
+ mov rax, r8\r
+ xchg rcx, rdx\r
+ rep stosd\r
+ mov rax, rdx\r
+ ret\r
+InternalMemSetMem32 ENDP\r
+\r
+ END\r
--- /dev/null
+;------------------------------------------------------------------------------\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
+; SetMem64.Asm\r
+;\r
+; Abstract:\r
+;\r
+; SetMem64 function\r
+;\r
+; Notes:\r
+;\r
+;------------------------------------------------------------------------------\r
+\r
+ .code\r
+\r
+;------------------------------------------------------------------------------\r
+; VOID *\r
+; InternalMemSetMem64 (\r
+; IN VOID *Buffer,\r
+; IN UINTN Count,\r
+; IN UINT64 Value\r
+; )\r
+;------------------------------------------------------------------------------\r
+InternalMemSetMem64 PROC USES rdi\r
+ mov rdi, rcx\r
+ mov rax, r8\r
+ xchg rcx, rdx\r
+ rep stosq\r
+ mov rax, rdx\r
+ ret\r
+InternalMemSetMem64 ENDP\r
+\r
+ END\r
--- /dev/null
+;------------------------------------------------------------------------------\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
+; ZeroMem.Asm\r
+;\r
+; Abstract:\r
+;\r
+; ZeroMem function\r
+;\r
+; Notes:\r
+;\r
+;------------------------------------------------------------------------------\r
+\r
+ .code\r
+\r
+;------------------------------------------------------------------------------\r
+; VOID *\r
+; InternalMemZeroMem (\r
+; IN VOID *Buffer,\r
+; IN UINTN Count\r
+; );\r
+;------------------------------------------------------------------------------\r
+InternalMemZeroMem PROC USES rdi\r
+ push rcx\r
+ xor rax, rax\r
+ mov rdi, rcx\r
+ mov rcx, rdx\r
+ shr rcx, 3\r
+ and rdx, 7\r
+ rep stosq\r
+ mov ecx, edx\r
+ rep stosb\r
+ pop rax\r
+ ret\r
+InternalMemZeroMem ENDP\r
+\r
+ END\r
-//\r
-// Include common header file for this module.\r
-//\r
-#include "CommonHeader.h"\r
-\r
-#------------------------------------------------------------------------------\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
-# CompareMem.Asm\r
-#\r
-# Abstract:\r
-#\r
-# CompareMem function\r
-#\r
-# Notes:\r
-#\r
-# The following BaseMemoryLib instances share the same version of this file:\r
-#\r
-# BaseMemoryLibRepStr\r
-# BaseMemoryLibMmx\r
-# BaseMemoryLibSse2\r
-#\r
-#------------------------------------------------------------------------------\r
-\r
-.globl _InternalMemCompareMem\r
-\r
-#------------------------------------------------------------------------------\r
-# INTN\r
-# EFIAPI\r
-# InternalMemCompareMem (\r
-# IN CONST VOID *DestinationBuffer,\r
-# IN CONST VOID *SourceBuffer,\r
-# IN UINTN Length\r
-# );\r
-#------------------------------------------------------------------------------\r
-_InternalMemCompareMem:\r
- push %esi\r
- push %edi\r
- movl 12(%esp), %esi\r
- movl 16(%esp), %edi\r
- movl 20(%esp), %ecx\r
- repe cmpsb\r
- movzbl -1(%esi), %eax\r
- movzbl -1(%edi), %edx\r
- subl %edx, %eax\r
- pop %edi\r
- pop %esi\r
- ret\r
+#------------------------------------------------------------------------------
+#
+# 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:
+#
+# CompareMem.Asm
+#
+# Abstract:
+#
+# CompareMem function
+#
+# Notes:
+#
+# The following BaseMemoryLib instances share the same version of this file:
+#
+# BaseMemoryLibRepStr
+# BaseMemoryLibMmx
+# BaseMemoryLibSse2
+#
+#------------------------------------------------------------------------------
+
+.globl _InternalMemCompareMem
+
+#------------------------------------------------------------------------------
+# INTN
+# EFIAPI
+# InternalMemCompareMem (
+# IN CONST VOID *DestinationBuffer,
+# IN CONST VOID *SourceBuffer,
+# IN UINTN Length
+# );
+#------------------------------------------------------------------------------
+_InternalMemCompareMem:
+ push %esi
+ push %edi
+ movl 12(%esp), %esi
+ movl 16(%esp), %edi
+ movl 20(%esp), %ecx
+ repe cmpsb
+ movzbl -1(%esi), %eax
+ movzbl -1(%edi), %edx
+ subl %edx, %eax
+ pop %edi
+ pop %esi
+ ret
-//\r
-// Include common header file for this module.\r
-//\r
-\r
-\r
;------------------------------------------------------------------------------\r
;\r
; Copyright (c) 2006, Intel Corporation\r
-//\r
-// Include common header file for this module.\r
-//\r
-#include "CommonHeader.h"\r
-\r
-#------------------------------------------------------------------------------\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
-# CopyMem.asm\r
-#\r
-# Abstract:\r
-#\r
-# CopyMem function\r
-#\r
-# Notes:\r
-#\r
-#------------------------------------------------------------------------------\r
-\r
-.globl _InternalMemCopyMem\r
-\r
-#------------------------------------------------------------------------------\r
-# VOID *\r
-# EFIAPI\r
-# InternalMemCopyMem (\r
-# IN VOID *Destination,\r
-# IN VOID *Source,\r
-# IN UINTN Count\r
-# );\r
-#------------------------------------------------------------------------------\r
-_InternalMemCopyMem:\r
- push %esi\r
- push %edi\r
- movl 16(%esp), %esi # esi <- Source\r
- movl 12(%esp), %edi # edi <- Destination\r
- movl 20(%esp), %edx # edx <- Count\r
- leal -1(%esi,%edx,), %eax # eax <- End of Source\r
- cmpl %edi, %esi\r
- jae L0\r
- cmpl %edi, %eax # Overlapped?\r
- jae L_CopyBackward # Copy backward if overlapped\r
-L0:\r
- xorl %ecx, %ecx\r
- subl %edi, %ecx\r
- andl $15, %ecx # ecx + edi aligns on 16-byte boundary\r
- jz L1\r
- cmpl %edx, %ecx\r
- cmova %edx, %ecx\r
- subl %ecx, %edx # edx <- remaining bytes to copy\r
- rep\r
- movsb\r
-L1:\r
- movl %edx, %ecx\r
- andl $15, %edx\r
- shrl $4, %ecx # ecx <- # of DQwords to copy\r
- jz L_CopyBytes\r
- addl $-16, %esp\r
- movdqu %xmm0, (%esp)\r
-L2:\r
- movdqu (%esi), %xmm0\r
- movntdq %xmm0, (%edi)\r
- addl $16, %esi\r
- addl $16, %edi\r
- loop L2\r
- mfence\r
- movdqu (%esp),%xmm0\r
- addl $16, %esp # stack cleanup\r
- jmp L_CopyBytes\r
-L_CopyBackward:\r
- movl %eax, %esi # esi <- Last byte in Source\r
- leal -1(%edi,%edx,), %edi # edi <- Last byte in Destination\r
- std\r
-L_CopyBytes:\r
- movl %edx, %ecx\r
- rep\r
- movsb\r
- cld\r
- movl 12(%esp), %eax # eax <- Destination as return value\r
- pop %edi\r
- pop %esi\r
- ret\r
+#------------------------------------------------------------------------------
+#
+# 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:
+#
+# CopyMem.asm
+#
+# Abstract:
+#
+# CopyMem function
+#
+# Notes:
+#
+#------------------------------------------------------------------------------
+
+.globl _InternalMemCopyMem
+
+#------------------------------------------------------------------------------
+# VOID *
+# EFIAPI
+# InternalMemCopyMem (
+# IN VOID *Destination,
+# IN VOID *Source,
+# IN UINTN Count
+# );
+#------------------------------------------------------------------------------
+_InternalMemCopyMem:
+ push %esi
+ push %edi
+ movl 16(%esp), %esi # esi <- Source
+ movl 12(%esp), %edi # edi <- Destination
+ movl 20(%esp), %edx # edx <- Count
+ leal -1(%esi,%edx,), %eax # eax <- End of Source
+ cmpl %edi, %esi
+ jae L0
+ cmpl %edi, %eax # Overlapped?
+ jae L_CopyBackward # Copy backward if overlapped
+L0:
+ xorl %ecx, %ecx
+ subl %edi, %ecx
+ andl $15, %ecx # ecx + edi aligns on 16-byte boundary
+ jz L1
+ cmpl %edx, %ecx
+ cmova %edx, %ecx
+ subl %ecx, %edx # edx <- remaining bytes to copy
+ rep
+ movsb
+L1:
+ movl %edx, %ecx
+ andl $15, %edx
+ shrl $4, %ecx # ecx <- # of DQwords to copy
+ jz L_CopyBytes
+ addl $-16, %esp
+ movdqu %xmm0, (%esp)
+L2:
+ movdqu (%esi), %xmm0
+ movntdq %xmm0, (%edi)
+ addl $16, %esi
+ addl $16, %edi
+ loop L2
+ mfence
+ movdqu (%esp),%xmm0
+ addl $16, %esp # stack cleanup
+ jmp L_CopyBytes
+L_CopyBackward:
+ movl %eax, %esi # esi <- Last byte in Source
+ leal -1(%edi,%edx,), %edi # edi <- Last byte in Destination
+ std
+L_CopyBytes:
+ movl %edx, %ecx
+ rep
+ movsb
+ cld
+ movl 12(%esp), %eax # eax <- Destination as return value
+ pop %edi
+ pop %esi
+ ret
-//\r
-// Include common header file for this module.\r
-//\r
-\r
-\r
;------------------------------------------------------------------------------\r
;\r
; Copyright (c) 2006, Intel Corporation\r
-//\r
-// Include common header file for this module.\r
-//\r
-#include "CommonHeader.h"\r
-\r
-#------------------------------------------------------------------------------\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
-# ScanMem16.Asm\r
-#\r
-# Abstract:\r
-#\r
-# ScanMem16 function\r
-#\r
-# Notes:\r
-#\r
-# The following BaseMemoryLib instances share the same version of this file:\r
-#\r
-# BaseMemoryLibRepStr\r
-# BaseMemoryLibMmx\r
-# BaseMemoryLibSse2\r
-#\r
-#------------------------------------------------------------------------------\r
-\r
-.globl _InternalMemScanMem16\r
-\r
-#------------------------------------------------------------------------------\r
-# CONST VOID *\r
-# EFIAPI\r
-# InternalMemScanMem16 (\r
-# IN CONST VOID *Buffer,\r
-# IN UINTN Length,\r
-# IN UINT16 Value\r
-# );\r
-#------------------------------------------------------------------------------\r
-_InternalMemScanMem16:\r
- push %edi\r
- movl 12(%esp), %ecx\r
- movl 8(%esp), %edi\r
- movl 16(%esp), %eax\r
- repne scasw\r
- leal -2(%edi), %eax\r
- cmovnz %ecx, %eax\r
- pop %edi\r
- ret\r
+#------------------------------------------------------------------------------
+#
+# 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:
+#
+# ScanMem16.Asm
+#
+# Abstract:
+#
+# ScanMem16 function
+#
+# Notes:
+#
+# The following BaseMemoryLib instances share the same version of this file:
+#
+# BaseMemoryLibRepStr
+# BaseMemoryLibMmx
+# BaseMemoryLibSse2
+#
+#------------------------------------------------------------------------------
+
+.globl _InternalMemScanMem16
+
+#------------------------------------------------------------------------------
+# CONST VOID *
+# EFIAPI
+# InternalMemScanMem16 (
+# IN CONST VOID *Buffer,
+# IN UINTN Length,
+# IN UINT16 Value
+# );
+#------------------------------------------------------------------------------
+_InternalMemScanMem16:
+ push %edi
+ movl 12(%esp), %ecx
+ movl 8(%esp), %edi
+ movl 16(%esp), %eax
+ repne scasw
+ leal -2(%edi), %eax
+ cmovnz %ecx, %eax
+ pop %edi
+ ret
-//\r
-// Include common header file for this module.\r
-//\r
-\r
-\r
;------------------------------------------------------------------------------\r
;\r
; Copyright (c) 2006, Intel Corporation\r
-//\r
-// Include common header file for this module.\r
-//\r
-#include "CommonHeader.h"\r
-\r
-#------------------------------------------------------------------------------\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
-# ScanMem32.Asm\r
-#\r
-# Abstract:\r
-#\r
-# ScanMem32 function\r
-#\r
-# Notes:\r
-#\r
-# The following BaseMemoryLib instances share the same version of this file:\r
-#\r
-# BaseMemoryLibRepStr\r
-# BaseMemoryLibMmx\r
-# BaseMemoryLibSse2\r
-#\r
-#------------------------------------------------------------------------------\r
-\r
-.globl _InternalMemScanMem32\r
-\r
-#------------------------------------------------------------------------------\r
-# CONST VOID *\r
-# EFIAPI\r
-# InternalMemScanMem32 (\r
-# IN CONST VOID *Buffer,\r
-# IN UINTN Length,\r
-# IN UINT32 Value\r
-# );\r
-#------------------------------------------------------------------------------\r
-_InternalMemScanMem32:\r
- push %edi\r
- movl 12(%esp), %ecx\r
- movl 8(%esp), %edi\r
- movl 16(%esp), %eax\r
- repne scasl\r
- leal -4(%edi), %eax\r
- cmovnz %ecx, %eax\r
- pop %edi\r
- ret\r
+#------------------------------------------------------------------------------
+#
+# 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:
+#
+# ScanMem32.Asm
+#
+# Abstract:
+#
+# ScanMem32 function
+#
+# Notes:
+#
+# The following BaseMemoryLib instances share the same version of this file:
+#
+# BaseMemoryLibRepStr
+# BaseMemoryLibMmx
+# BaseMemoryLibSse2
+#
+#------------------------------------------------------------------------------
+
+.globl _InternalMemScanMem32
+
+#------------------------------------------------------------------------------
+# CONST VOID *
+# EFIAPI
+# InternalMemScanMem32 (
+# IN CONST VOID *Buffer,
+# IN UINTN Length,
+# IN UINT32 Value
+# );
+#------------------------------------------------------------------------------
+_InternalMemScanMem32:
+ push %edi
+ movl 12(%esp), %ecx
+ movl 8(%esp), %edi
+ movl 16(%esp), %eax
+ repne scasl
+ leal -4(%edi), %eax
+ cmovnz %ecx, %eax
+ pop %edi
+ ret
-//\r
-// Include common header file for this module.\r
-//\r
-\r
-\r
;------------------------------------------------------------------------------\r
;\r
; Copyright (c) 2006, Intel Corporation\r
-//\r
-// Include common header file for this module.\r
-//\r
-#include "CommonHeader.h"\r
-\r
-#------------------------------------------------------------------------------\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
-# ScanMem64.Asm\r
-#\r
-# Abstract:\r
-#\r
-# ScanMem64 function\r
-#\r
-# Notes:\r
-#\r
-# The following BaseMemoryLib instances share the same version of this file:\r
-#\r
-# BaseMemoryLibRepStr\r
-# BaseMemoryLibMmx\r
-# BaseMemoryLibSse2\r
-#\r
-#------------------------------------------------------------------------------\r
-\r
-.globl _InternalMemScanMem64\r
-\r
-#------------------------------------------------------------------------------\r
-# CONST VOID *\r
-# EFIAPI\r
-# InternalMemScanMem64 (\r
-# IN CONST VOID *Buffer,\r
-# IN UINTN Length,\r
-# IN UINT64 Value\r
-# );\r
-#------------------------------------------------------------------------------\r
-_InternalMemScanMem64:\r
- push %edi\r
- movl 12(%esp), %ecx\r
- movl 16(%esp), %eax\r
- movl 20(%esp), %edx\r
- movl 8(%esp), %edi\r
-L0:\r
- cmpl (%edi), %eax\r
- leal 8(%edi), %edi\r
- loopne L0\r
- jne L1\r
- cmpl -4(%edi), %edx\r
- jecxz L1\r
- jne L0\r
-L1:\r
- leal -8(%edi), %eax\r
- cmovne %ecx, %eax\r
- pop %edi\r
- ret\r
+#------------------------------------------------------------------------------
+#
+# 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:
+#
+# ScanMem64.Asm
+#
+# Abstract:
+#
+# ScanMem64 function
+#
+# Notes:
+#
+# The following BaseMemoryLib instances share the same version of this file:
+#
+# BaseMemoryLibRepStr
+# BaseMemoryLibMmx
+# BaseMemoryLibSse2
+#
+#------------------------------------------------------------------------------
+
+.globl _InternalMemScanMem64
+
+#------------------------------------------------------------------------------
+# CONST VOID *
+# EFIAPI
+# InternalMemScanMem64 (
+# IN CONST VOID *Buffer,
+# IN UINTN Length,
+# IN UINT64 Value
+# );
+#------------------------------------------------------------------------------
+_InternalMemScanMem64:
+ push %edi
+ movl 12(%esp), %ecx
+ movl 16(%esp), %eax
+ movl 20(%esp), %edx
+ movl 8(%esp), %edi
+L0:
+ cmpl (%edi), %eax
+ leal 8(%edi), %edi
+ loopne L0
+ jne L1
+ cmpl -4(%edi), %edx
+ jecxz L1
+ jne L0
+L1:
+ leal -8(%edi), %eax
+ cmovne %ecx, %eax
+ pop %edi
+ ret
-//\r
-// Include common header file for this module.\r
-//\r
-\r
-\r
;------------------------------------------------------------------------------\r
;\r
; Copyright (c) 2006, Intel Corporation\r
-//\r
-// Include common header file for this module.\r
-//\r
-#include "CommonHeader.h"\r
-\r
-#------------------------------------------------------------------------------\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
-# ScanMem8.Asm\r
-#\r
-# Abstract:\r
-#\r
-# ScanMem8 function\r
-#\r
-# Notes:\r
-#\r
-# The following BaseMemoryLib instances share the same version of this file:\r
-#\r
-# BaseMemoryLibRepStr\r
-# BaseMemoryLibMmx\r
-# BaseMemoryLibSse2\r
-#\r
-#------------------------------------------------------------------------------\r
-\r
-.globl _InternalMemScanMem8\r
-\r
-#------------------------------------------------------------------------------\r
-# CONST VOID *\r
-# EFIAPI\r
-# InternalMemScanMem8 (\r
-# IN CONST VOID *Buffer,\r
-# IN UINTN Length,\r
-# IN UINT8 Value\r
-# );\r
-#------------------------------------------------------------------------------\r
-_InternalMemScanMem8:\r
- push %edi\r
- movl 12(%esp), %ecx\r
- movl 8(%esp), %edi\r
- movb 16(%esp), %al\r
- repne scasb\r
- leal -1(%edi), %eax\r
- cmovnz %ecx, %eax\r
- pop %edi\r
- ret\r
+#------------------------------------------------------------------------------
+#
+# 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:
+#
+# ScanMem8.Asm
+#
+# Abstract:
+#
+# ScanMem8 function
+#
+# Notes:
+#
+# The following BaseMemoryLib instances share the same version of this file:
+#
+# BaseMemoryLibRepStr
+# BaseMemoryLibMmx
+# BaseMemoryLibSse2
+#
+#------------------------------------------------------------------------------
+
+.globl _InternalMemScanMem8
+
+#------------------------------------------------------------------------------
+# CONST VOID *
+# EFIAPI
+# InternalMemScanMem8 (
+# IN CONST VOID *Buffer,
+# IN UINTN Length,
+# IN UINT8 Value
+# );
+#------------------------------------------------------------------------------
+_InternalMemScanMem8:
+ push %edi
+ movl 12(%esp), %ecx
+ movl 8(%esp), %edi
+ movb 16(%esp), %al
+ repne scasb
+ leal -1(%edi), %eax
+ cmovnz %ecx, %eax
+ pop %edi
+ ret
-//\r
-// Include common header file for this module.\r
-//\r
-\r
-\r
;------------------------------------------------------------------------------\r
;\r
; Copyright (c) 2006, Intel Corporation\r
-//\r
-// Include common header file for this module.\r
-//\r
-#include "CommonHeader.h"\r
-\r
-#------------------------------------------------------------------------------\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
-# SetMem.asm\r
-#\r
-# Abstract:\r
-#\r
-# SetMem function\r
-#\r
-# Notes:\r
-#\r
-#------------------------------------------------------------------------------\r
-\r
- .686:\r
- #.MODEL flat,C\r
- .xmm:\r
- .code:\r
-\r
-#------------------------------------------------------------------------------\r
-# VOID *\r
-# _mem_SetMem (\r
-# IN VOID *Buffer,\r
-# IN UINTN Count,\r
-# IN UINT8 Value\r
-# );\r
-#------------------------------------------------------------------------------\r
-.globl _InternalMemSetMem\r
-_InternalMemSetMem:\r
- push %edi\r
- movl 12(%esp), %edx # edx <- Count\r
- movl 8(%esp), %edi # edi <- Buffer\r
- movb 16(%esp), %al # al <- Value\r
- xorl %ecx, %ecx\r
- subl %edi, %ecx\r
- andl $15, %ecx # ecx + edi aligns on 16-byte boundary\r
- jz L0\r
- cmpl %edx, %ecx\r
- cmova %edx, %ecx\r
- subl %ecx, %edx\r
- rep\r
- stosb\r
-L0:\r
- movl %edx, %ecx\r
- andl $15, %edx\r
- shrl $4, %ecx # ecx <- # of DQwords to set\r
- jz L_SetBytes\r
- movb %al, %ah # ax <- Value | (Value << 8)\r
- addl $-16, %esp\r
- movdqu %xmm0, (%esp)\r
- movd %eax, %xmm0\r
- pshuflw $0, %xmm0, %xmm0\r
- movlhps %xmm0, %xmm0\r
-L1:\r
- movntdq %xmm0, (%edi)\r
- addl $16, %edi\r
- loop L1\r
- mfence\r
- movdqu (%esp), %xmm0\r
- addl $16, %esp # stack cleanup\r
-L_SetBytes:\r
- movl %edx, %ecx\r
- rep\r
- stosb\r
- movl 8(%esp), %eax # eax <- Buffer as return value\r
- pop %edi\r
- ret\r
+#------------------------------------------------------------------------------
+#
+# 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:
+#
+# SetMem.asm
+#
+# Abstract:
+#
+# SetMem function
+#
+# Notes:
+#
+#------------------------------------------------------------------------------
+
+ .686:
+ #.MODEL flat,C
+ .xmm:
+ .code:
+
+#------------------------------------------------------------------------------
+# VOID *
+# _mem_SetMem (
+# IN VOID *Buffer,
+# IN UINTN Count,
+# IN UINT8 Value
+# );
+#------------------------------------------------------------------------------
+.globl _InternalMemSetMem
+_InternalMemSetMem:
+ push %edi
+ movl 12(%esp), %edx # edx <- Count
+ movl 8(%esp), %edi # edi <- Buffer
+ movb 16(%esp), %al # al <- Value
+ xorl %ecx, %ecx
+ subl %edi, %ecx
+ andl $15, %ecx # ecx + edi aligns on 16-byte boundary
+ jz L0
+ cmpl %edx, %ecx
+ cmova %edx, %ecx
+ subl %ecx, %edx
+ rep
+ stosb
+L0:
+ movl %edx, %ecx
+ andl $15, %edx
+ shrl $4, %ecx # ecx <- # of DQwords to set
+ jz L_SetBytes
+ movb %al, %ah # ax <- Value | (Value << 8)
+ addl $-16, %esp
+ movdqu %xmm0, (%esp)
+ movd %eax, %xmm0
+ pshuflw $0, %xmm0, %xmm0
+ movlhps %xmm0, %xmm0
+L1:
+ movntdq %xmm0, (%edi)
+ addl $16, %edi
+ loop L1
+ mfence
+ movdqu (%esp), %xmm0
+ addl $16, %esp # stack cleanup
+L_SetBytes:
+ movl %edx, %ecx
+ rep
+ stosb
+ movl 8(%esp), %eax # eax <- Buffer as return value
+ pop %edi
+ ret
-//\r
-// Include common header file for this module.\r
-//\r
-\r
-\r
;------------------------------------------------------------------------------\r
;\r
; Copyright (c) 2006, Intel Corporation\r
-//\r
-// Include common header file for this module.\r
-//\r
-#include "CommonHeader.h"\r
-\r
-#------------------------------------------------------------------------------\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
-# SetMem16.asm\r
-#\r
-# Abstract:\r
-#\r
-# SetMem16 function\r
-#\r
-# Notes:\r
-#\r
-#------------------------------------------------------------------------------\r
-\r
-.globl _InternalMemSetMem16\r
-\r
-#------------------------------------------------------------------------------\r
-# VOID *\r
-# EFIAPI\r
-# InternalMemSetMem16 (\r
-# IN VOID *Buffer,\r
-# IN UINTN Count,\r
-# IN UINT16 Value\r
-# )\r
-#------------------------------------------------------------------------------\r
-_InternalMemSetMem16:\r
- push %edi\r
- movl 12(%esp), %edx\r
- movl 8(%esp), %edi\r
- xorl %ecx, %ecx\r
- subl %edi, %ecx\r
- andl $15, %ecx # ecx + edi aligns on 16-byte boundary\r
- movl 16(%esp), %eax\r
- jz L0\r
- shrl %ecx\r
- cmpl %edx, %ecx\r
- cmova %edx, %ecx\r
- subl %ecx, %edx\r
- rep\r
- stosw\r
-L0:\r
- movl %edx, %ecx\r
- andl $7, %edx\r
- shrl $3, %ecx\r
- jz L_SetWords\r
- movd %eax, %xmm0\r
- pshuflw $0, %xmm0, %xmm0\r
- movlhps %xmm0, %xmm0\r
-L1:\r
- movntdq %xmm0, (%edi)\r
- addl $16, %edi\r
- loop L1\r
- mfence\r
-L_SetWords:\r
- movl %edx, %ecx\r
- rep\r
- stosw\r
- movl 8(%esp), %eax\r
- pop %edi\r
- ret\r
+#------------------------------------------------------------------------------
+#
+# 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:
+#
+# SetMem16.asm
+#
+# Abstract:
+#
+# SetMem16 function
+#
+# Notes:
+#
+#------------------------------------------------------------------------------
+
+.globl _InternalMemSetMem16
+
+#------------------------------------------------------------------------------
+# VOID *
+# EFIAPI
+# InternalMemSetMem16 (
+# IN VOID *Buffer,
+# IN UINTN Count,
+# IN UINT16 Value
+# )
+#------------------------------------------------------------------------------
+_InternalMemSetMem16:
+ push %edi
+ movl 12(%esp), %edx
+ movl 8(%esp), %edi
+ xorl %ecx, %ecx
+ subl %edi, %ecx
+ andl $15, %ecx # ecx + edi aligns on 16-byte boundary
+ movl 16(%esp), %eax
+ jz L0
+ shrl %ecx
+ cmpl %edx, %ecx
+ cmova %edx, %ecx
+ subl %ecx, %edx
+ rep
+ stosw
+L0:
+ movl %edx, %ecx
+ andl $7, %edx
+ shrl $3, %ecx
+ jz L_SetWords
+ movd %eax, %xmm0
+ pshuflw $0, %xmm0, %xmm0
+ movlhps %xmm0, %xmm0
+L1:
+ movntdq %xmm0, (%edi)
+ addl $16, %edi
+ loop L1
+ mfence
+L_SetWords:
+ movl %edx, %ecx
+ rep
+ stosw
+ movl 8(%esp), %eax
+ pop %edi
+ ret
-//\r
-// Include common header file for this module.\r
-//\r
-\r
-\r
;------------------------------------------------------------------------------\r
;\r
; Copyright (c) 2006, Intel Corporation\r
-//\r
-// Include common header file for this module.\r
-//\r
-#include "CommonHeader.h"\r
-\r
-#------------------------------------------------------------------------------\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
-# SetMem32.asm\r
-#\r
-# Abstract:\r
-#\r
-# SetMem32 function\r
-#\r
-# Notes:\r
-#\r
-#------------------------------------------------------------------------------\r
-\r
-.globl _InternalMemSetMem32\r
-\r
-#------------------------------------------------------------------------------\r
-# VOID *\r
-# EFIAPI\r
-# InternalMemSetMem32 (\r
-# IN VOID *Buffer,\r
-# IN UINTN Count,\r
-# IN UINT32 Value\r
-# );\r
-#------------------------------------------------------------------------------\r
-_InternalMemSetMem32:\r
- push %edi\r
- movl 12(%esp), %edx\r
- movl 8(%esp), %edi\r
- xorl %ecx, %ecx\r
- subl %edi, %ecx\r
- andl $15, %ecx # ecx + edi aligns on 16-byte boundary\r
- movl 16(%esp), %eax\r
- jz L0\r
- shrl $2, %ecx\r
- cmpl %edx, %ecx\r
- cmova %edx, %ecx\r
- subl %ecx, %edx\r
- rep\r
- stosl\r
-L0:\r
- movl %edx, %ecx\r
- andl $3, %edx\r
- shrl $2, %ecx\r
- jz L_SetDwords\r
- movd %eax, %xmm0\r
- pshufd $0, %xmm0, %xmm0\r
-L1:\r
- movntdq %xmm0, (%edi)\r
- addl $16, %edi\r
- loop L1\r
- mfence\r
-L_SetDwords:\r
- movl %edx, %ecx\r
- rep\r
- stosl\r
- movl 8(%esp), %eax\r
- pop %edi\r
- ret\r
+#------------------------------------------------------------------------------
+#
+# 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:
+#
+# SetMem32.asm
+#
+# Abstract:
+#
+# SetMem32 function
+#
+# Notes:
+#
+#------------------------------------------------------------------------------
+
+.globl _InternalMemSetMem32
+
+#------------------------------------------------------------------------------
+# VOID *
+# EFIAPI
+# InternalMemSetMem32 (
+# IN VOID *Buffer,
+# IN UINTN Count,
+# IN UINT32 Value
+# );
+#------------------------------------------------------------------------------
+_InternalMemSetMem32:
+ push %edi
+ movl 12(%esp), %edx
+ movl 8(%esp), %edi
+ xorl %ecx, %ecx
+ subl %edi, %ecx
+ andl $15, %ecx # ecx + edi aligns on 16-byte boundary
+ movl 16(%esp), %eax
+ jz L0
+ shrl $2, %ecx
+ cmpl %edx, %ecx
+ cmova %edx, %ecx
+ subl %ecx, %edx
+ rep
+ stosl
+L0:
+ movl %edx, %ecx
+ andl $3, %edx
+ shrl $2, %ecx
+ jz L_SetDwords
+ movd %eax, %xmm0
+ pshufd $0, %xmm0, %xmm0
+L1:
+ movntdq %xmm0, (%edi)
+ addl $16, %edi
+ loop L1
+ mfence
+L_SetDwords:
+ movl %edx, %ecx
+ rep
+ stosl
+ movl 8(%esp), %eax
+ pop %edi
+ ret
-//\r
-// Include common header file for this module.\r
-//\r
-\r
-\r
;------------------------------------------------------------------------------\r
;\r
; Copyright (c) 2006, Intel Corporation\r
-//\r
-// Include common header file for this module.\r
-//\r
-#include "CommonHeader.h"\r
-\r
#------------------------------------------------------------------------------\r
#\r
# Copyright (c) 2006, Intel Corporation\r
-//\r
-// Include common header file for this module.\r
-//\r
-\r
-\r
;------------------------------------------------------------------------------\r
;\r
; Copyright (c) 2006, Intel Corporation\r
-//\r
-// Include common header file for this module.\r
-//\r
-#include "CommonHeader.h"\r
-\r
-#------------------------------------------------------------------------------\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
-# ZeroMem.asm\r
-#\r
-# Abstract:\r
-#\r
-# ZeroMem function\r
-#\r
-# Notes:\r
-#\r
-#------------------------------------------------------------------------------\r
-\r
-.globl _InternalMemZeroMem\r
-\r
-#------------------------------------------------------------------------------\r
-# VOID *\r
-# EFIAPI\r
-# InternalMemZeroMem (\r
-# IN VOID *Buffer,\r
-# IN UINTN Count\r
-# );\r
-#------------------------------------------------------------------------------\r
-_InternalMemZeroMem:\r
- push %edi\r
- movl 8(%esp), %edi\r
- movl 12(%esp), %edx\r
- xorl %ecx, %ecx\r
- subl %edi, %ecx\r
- xorl %eax, %eax\r
- andl $15, %ecx\r
- jz L0\r
- cmpl %edx, %ecx\r
- cmova %edx, %ecx\r
- subl %ecx, %edx\r
- rep\r
- stosb\r
-L0:\r
- movl %edx, %ecx\r
- andl $15, %edx\r
- shrl $4, %ecx\r
- jz L_ZeroBytes\r
- pxor %xmm0, %xmm0\r
-L1:\r
- movntdq %xmm0, (%edi)\r
- addl $16, %edi\r
- loop L1\r
- mfence\r
-L_ZeroBytes:\r
- movl %edx, %ecx\r
- rep\r
- stosb\r
- movl 8(%esp), %eax\r
- pop %edi\r
- ret\r
+#------------------------------------------------------------------------------
+#
+# 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:
+#
+# ZeroMem.asm
+#
+# Abstract:
+#
+# ZeroMem function
+#
+# Notes:
+#
+#------------------------------------------------------------------------------
+
+.globl _InternalMemZeroMem
+
+#------------------------------------------------------------------------------
+# VOID *
+# EFIAPI
+# InternalMemZeroMem (
+# IN VOID *Buffer,
+# IN UINTN Count
+# );
+#------------------------------------------------------------------------------
+_InternalMemZeroMem:
+ push %edi
+ movl 8(%esp), %edi
+ movl 12(%esp), %edx
+ xorl %ecx, %ecx
+ subl %edi, %ecx
+ xorl %eax, %eax
+ andl $15, %ecx
+ jz L0
+ cmpl %edx, %ecx
+ cmova %edx, %ecx
+ subl %ecx, %edx
+ rep
+ stosb
+L0:
+ movl %edx, %ecx
+ andl $15, %edx
+ shrl $4, %ecx
+ jz L_ZeroBytes
+ pxor %xmm0, %xmm0
+L1:
+ movntdq %xmm0, (%edi)
+ addl $16, %edi
+ loop L1
+ mfence
+L_ZeroBytes:
+ movl %edx, %ecx
+ rep
+ stosb
+ movl 8(%esp), %eax
+ pop %edi
+ ret
-//\r
-// Include common header file for this module.\r
-//\r
-\r
-\r
;------------------------------------------------------------------------------\r
;\r
; Copyright (c) 2006, Intel Corporation\r
--- /dev/null
+;------------------------------------------------------------------------------\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
+; CompareMem.Asm\r
+;\r
+; Abstract:\r
+;\r
+; CompareMem function\r
+;\r
+; Notes:\r
+;\r
+; The following BaseMemoryLib instances share the same version of this file:\r
+;\r
+; BaseMemoryLibRepStr\r
+; BaseMemoryLibMmx\r
+; BaseMemoryLibSse2\r
+;\r
+;------------------------------------------------------------------------------\r
+\r
+ .code\r
+\r
+;------------------------------------------------------------------------------\r
+; INTN\r
+; EFIAPI\r
+; InternalMemCompareMem (\r
+; IN CONST VOID *DestinationBuffer,\r
+; IN CONST VOID *SourceBuffer,\r
+; IN UINTN Length\r
+; );\r
+;------------------------------------------------------------------------------\r
+InternalMemCompareMem PROC USES rsi rdi\r
+ mov rsi, rcx\r
+ mov rdi, rdx\r
+ mov rcx, r8\r
+ repe cmpsb\r
+ movzx rax, byte ptr [rsi - 1]\r
+ movzx rdx, byte ptr [rdi - 1]\r
+ sub rax, rdx\r
+ ret\r
+InternalMemCompareMem ENDP\r
+\r
+ END\r
--- /dev/null
+;------------------------------------------------------------------------------\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
+; CopyMem.asm\r
+;\r
+; Abstract:\r
+;\r
+; CopyMem function\r
+;\r
+; Notes:\r
+;\r
+;------------------------------------------------------------------------------\r
+\r
+ .code\r
+\r
+;------------------------------------------------------------------------------\r
+; VOID *\r
+; EFIAPI\r
+; InternalMemCopyMem (\r
+; IN VOID *Destination,\r
+; IN VOID *Source,\r
+; IN UINTN Count\r
+; );\r
+;------------------------------------------------------------------------------\r
+InternalMemCopyMem PROC USES rsi rdi\r
+ mov rsi, rdx ; rsi <- Source\r
+ mov rdi, rcx ; rdi <- Destination\r
+ lea r9, [rsi + r8 - 1] ; r9 <- Last byte of Source\r
+ cmp rsi, rdi\r
+ mov rax, rdi ; rax <- Destination as return value\r
+ jae @F ; Copy forward if Source > Destination\r
+ cmp r9, rdi ; Overlapped?\r
+ jae @CopyBackward ; Copy backward if overlapped\r
+@@:\r
+ xor rcx, rcx\r
+ sub rcx, rdi ; rcx <- -rdi\r
+ and rcx, 15 ; rcx + rsi should be 16 bytes aligned\r
+ jz @F ; skip if rcx == 0\r
+ cmp rcx, r8\r
+ cmova rcx, r8\r
+ sub r8, rcx\r
+ rep movsb\r
+@@:\r
+ mov rcx, r8\r
+ and r8, 15\r
+ shr rcx, 4 ; rcx <- # of DQwords to copy\r
+ jz @CopyBytes\r
+ movdqa [rsp + 18h], xmm0 ; save xmm0 on stack\r
+@@:\r
+ movdqu xmm0, [rsi] ; rsi may not be 16-byte aligned\r
+ movntdq [rdi], xmm0 ; rdi should be 16-byte aligned\r
+ add rsi, 16\r
+ add rdi, 16\r
+ loop @B\r
+ mfence\r
+ movdqa xmm0, [rsp + 18h] ; restore xmm0\r
+ jmp @CopyBytes ; copy remaining bytes\r
+@CopyBackward:\r
+ mov rsi, r9 ; rsi <- Last byte of Source\r
+ lea rdi, [rdi + r8 - 1] ; rdi <- Last byte of Destination\r
+ std\r
+@CopyBytes:\r
+ mov rcx, r8\r
+ rep movsb\r
+ cld\r
+ ret\r
+InternalMemCopyMem ENDP\r
+\r
+ END\r
--- /dev/null
+;------------------------------------------------------------------------------\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
+; ScanMem16.Asm\r
+;\r
+; Abstract:\r
+;\r
+; ScanMem16 function\r
+;\r
+; Notes:\r
+;\r
+; The following BaseMemoryLib instances share the same version of this file:\r
+;\r
+; BaseMemoryLibRepStr\r
+; BaseMemoryLibMmx\r
+; BaseMemoryLibSse2\r
+;\r
+;------------------------------------------------------------------------------\r
+\r
+ .code\r
+\r
+;------------------------------------------------------------------------------\r
+; CONST VOID *\r
+; EFIAPI\r
+; InternalMemScanMem16 (\r
+; IN CONST VOID *Buffer,\r
+; IN UINTN Length,\r
+; IN UINT16 Value\r
+; );\r
+;------------------------------------------------------------------------------\r
+InternalMemScanMem16 PROC USES rdi\r
+ mov rdi, rcx\r
+ mov rax, r8\r
+ mov rcx, rdx\r
+ repne scasw\r
+ lea rax, [rdi - 2]\r
+ cmovnz rax, rcx\r
+ ret\r
+InternalMemScanMem16 ENDP\r
+\r
+ END\r
--- /dev/null
+;------------------------------------------------------------------------------\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
+; ScanMem32.Asm\r
+;\r
+; Abstract:\r
+;\r
+; ScanMem32 function\r
+;\r
+; Notes:\r
+;\r
+; The following BaseMemoryLib instances share the same version of this file:\r
+;\r
+; BaseMemoryLibRepStr\r
+; BaseMemoryLibMmx\r
+; BaseMemoryLibSse2\r
+;\r
+;------------------------------------------------------------------------------\r
+\r
+ .code\r
+\r
+;------------------------------------------------------------------------------\r
+; CONST VOID *\r
+; EFIAPI\r
+; InternalMemScanMem32 (\r
+; IN CONST VOID *Buffer,\r
+; IN UINTN Length,\r
+; IN UINT32 Value\r
+; );\r
+;------------------------------------------------------------------------------\r
+InternalMemScanMem32 PROC USES rdi\r
+ mov rdi, rcx\r
+ mov rax, r8\r
+ mov rcx, rdx\r
+ repne scasd\r
+ lea rax, [rdi - 4]\r
+ cmovnz rax, rcx\r
+ ret\r
+InternalMemScanMem32 ENDP\r
+\r
+ END\r
--- /dev/null
+;------------------------------------------------------------------------------\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
+; ScanMem64.Asm\r
+;\r
+; Abstract:\r
+;\r
+; ScanMem64 function\r
+;\r
+; Notes:\r
+;\r
+; The following BaseMemoryLib instances share the same version of this file:\r
+;\r
+; BaseMemoryLibRepStr\r
+; BaseMemoryLibMmx\r
+; BaseMemoryLibSse2\r
+;\r
+;------------------------------------------------------------------------------\r
+\r
+ .code\r
+\r
+;------------------------------------------------------------------------------\r
+; CONST VOID *\r
+; EFIAPI\r
+; InternalMemScanMem64 (\r
+; IN CONST VOID *Buffer,\r
+; IN UINTN Length,\r
+; IN UINT64 Value\r
+; );\r
+;------------------------------------------------------------------------------\r
+InternalMemScanMem64 PROC USES rdi\r
+ mov rdi, rcx\r
+ mov rax, r8\r
+ mov rcx, rdx\r
+ repne scasq\r
+ lea rax, [rdi - 8]\r
+ cmovnz rax, rcx\r
+ ret\r
+InternalMemScanMem64 ENDP\r
+\r
+ END\r
--- /dev/null
+;------------------------------------------------------------------------------\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
+; ScanMem8.Asm\r
+;\r
+; Abstract:\r
+;\r
+; ScanMem8 function\r
+;\r
+; Notes:\r
+;\r
+; The following BaseMemoryLib instances share the same version of this file:\r
+;\r
+; BaseMemoryLibRepStr\r
+; BaseMemoryLibMmx\r
+; BaseMemoryLibSse2\r
+;\r
+;------------------------------------------------------------------------------\r
+\r
+ .code\r
+\r
+;------------------------------------------------------------------------------\r
+; CONST VOID *\r
+; EFIAPI\r
+; InternalMemScanMem8 (\r
+; IN CONST VOID *Buffer,\r
+; IN UINTN Length,\r
+; IN UINT8 Value\r
+; );\r
+;------------------------------------------------------------------------------\r
+InternalMemScanMem8 PROC USES rdi\r
+ mov rdi, rcx\r
+ mov rcx, rdx\r
+ mov rax, r8\r
+ repne scasb\r
+ lea rax, [rdi - 1]\r
+ cmovnz rax, rcx ; set rax to 0 if not found\r
+ ret\r
+InternalMemScanMem8 ENDP\r
+\r
+ END\r
--- /dev/null
+;------------------------------------------------------------------------------\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
+; SetMem.asm\r
+;\r
+; Abstract:\r
+;\r
+; SetMem function\r
+;\r
+; Notes:\r
+;\r
+;------------------------------------------------------------------------------\r
+\r
+ .code\r
+\r
+;------------------------------------------------------------------------------\r
+; VOID *\r
+; InternalMemSetMem (\r
+; IN VOID *Buffer,\r
+; IN UINTN Count,\r
+; IN UINT8 Value\r
+; )\r
+;------------------------------------------------------------------------------\r
+InternalMemSetMem PROC USES rdi\r
+ mov rdi, rcx ; rdi <- Buffer\r
+ mov al, r8b ; al <- Value\r
+ mov r9, rdi ; r9 <- Buffer as return value\r
+ xor rcx, rcx\r
+ sub rcx, rdi\r
+ and rcx, 15 ; rcx + rdi aligns on 16-byte boundary\r
+ jz @F\r
+ cmp rcx, rdx\r
+ cmova rcx, rdx\r
+ sub rdx, rcx\r
+ rep stosb\r
+@@:\r
+ mov rcx, rdx\r
+ and rdx, 15\r
+ shr rcx, 4\r
+ jz @SetBytes\r
+ mov ah, al ; ax <- Value repeats twice\r
+ movdqa [rsp + 10h], xmm0 ; save xmm0\r
+ movd xmm0, eax ; xmm0[0..16] <- Value repeats twice\r
+ pshuflw xmm0, xmm0, 0 ; xmm0[0..63] <- Value repeats 8 times\r
+ movlhps xmm0, xmm0 ; xmm0 <- Value repeats 16 times\r
+@@:\r
+ movntdq [rdi], xmm0 ; rdi should be 16-byte aligned\r
+ add rdi, 16\r
+ loop @B\r
+ mfence\r
+ movdqa xmm0, [rsp + 10h] ; restore xmm0\r
+@SetBytes:\r
+ mov ecx, edx ; high 32 bits of rcx are always zero\r
+ rep stosb\r
+ mov rax, r9 ; rax <- Return value\r
+ ret\r
+InternalMemSetMem ENDP\r
+\r
+ END\r
--- /dev/null
+;------------------------------------------------------------------------------\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
+; SetMem16.asm\r
+;\r
+; Abstract:\r
+;\r
+; SetMem16 function\r
+;\r
+; Notes:\r
+;\r
+;------------------------------------------------------------------------------\r
+\r
+ .code\r
+\r
+;------------------------------------------------------------------------------\r
+; VOID *\r
+; InternalMemSetMem16 (\r
+; IN VOID *Buffer,\r
+; IN UINTN Count,\r
+; IN UINT16 Value\r
+; )\r
+;------------------------------------------------------------------------------\r
+InternalMemSetMem16 PROC USES rdi\r
+ mov rdi, rcx\r
+ mov r9, rdi\r
+ xor rcx, rcx\r
+ sub rcx, rdi\r
+ and rcx, 15\r
+ mov rax, r8\r
+ jz @F\r
+ shr rcx, 1\r
+ cmp rcx, rdx\r
+ cmova rcx, rdx\r
+ sub rdx, rcx\r
+ rep stosw\r
+@@:\r
+ mov rcx, rdx\r
+ and edx, 7\r
+ shr rcx, 3\r
+ jz @SetWords\r
+ movd xmm0, eax\r
+ pshuflw xmm0, xmm0, 0\r
+ movlhps xmm0, xmm0\r
+@@:\r
+ movntdq [rdi], xmm0\r
+ add rdi, 16\r
+ loop @B\r
+ mfence\r
+@SetWords:\r
+ mov ecx, edx\r
+ rep stosw\r
+ mov rax, r9\r
+ ret\r
+InternalMemSetMem16 ENDP\r
+\r
+ END\r
--- /dev/null
+;------------------------------------------------------------------------------\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
+; SetMem32.asm\r
+;\r
+; Abstract:\r
+;\r
+; SetMem32 function\r
+;\r
+; Notes:\r
+;\r
+;------------------------------------------------------------------------------\r
+\r
+ .code\r
+\r
+;------------------------------------------------------------------------------\r
+; VOID *\r
+; InternalMemSetMem32 (\r
+; IN VOID *Buffer,\r
+; IN UINTN Count,\r
+; IN UINT8 Value\r
+; )\r
+;------------------------------------------------------------------------------\r
+InternalMemSetMem32 PROC USES rdi\r
+ mov rdi, rcx\r
+ mov r9, rdi\r
+ xor rcx, rcx\r
+ sub rcx, rdi\r
+ and rcx, 15\r
+ mov rax, r8\r
+ jz @F\r
+ shr rcx, 2\r
+ cmp rcx, rdx\r
+ cmova rcx, rdx\r
+ sub rdx, rcx\r
+ rep stosd\r
+@@:\r
+ mov rcx, rdx\r
+ and edx, 3\r
+ shr rcx, 2\r
+ jz @SetDwords\r
+ movd xmm0, eax\r
+ pshufd xmm0, xmm0, 0\r
+@@:\r
+ movntdq [rdi], xmm0\r
+ add rdi, 16\r
+ loop @B\r
+ mfence\r
+@SetDwords:\r
+ mov ecx, edx\r
+ rep stosd\r
+ mov rax, r9\r
+ ret\r
+InternalMemSetMem32 ENDP\r
+\r
+ END\r
--- /dev/null
+;------------------------------------------------------------------------------\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
+; SetMem64.asm\r
+;\r
+; Abstract:\r
+;\r
+; SetMem64 function\r
+;\r
+; Notes:\r
+;\r
+;------------------------------------------------------------------------------\r
+\r
+ .code\r
+\r
+;------------------------------------------------------------------------------\r
+; VOID *\r
+; InternalMemSetMem64 (\r
+; IN VOID *Buffer,\r
+; IN UINTN Count,\r
+; IN UINT64 Value\r
+; )\r
+;------------------------------------------------------------------------------\r
+InternalMemSetMem64 PROC\r
+ mov rax, rcx ; rax <- Buffer\r
+ xchg rcx, rdx ; rcx <- Count & rdx <- Buffer\r
+ test dl, 8\r
+ movd xmm0, r8\r
+ jz @F\r
+ mov [rdx], r8\r
+ add rdx, 8\r
+ dec rcx\r
+@@:\r
+ shr rcx, 1\r
+ jz @SetQwords\r
+ movlhps xmm0, xmm0\r
+@@:\r
+ movntdq [rdx], xmm0\r
+ lea rdx, [rdx + 16]\r
+ loop @B\r
+ mfence\r
+@SetQwords:\r
+ jnc @F\r
+ mov [rdx], r8\r
+@@:\r
+ ret\r
+InternalMemSetMem64 ENDP\r
+\r
+ END\r
--- /dev/null
+;------------------------------------------------------------------------------\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
+; ZeroMem.asm\r
+;\r
+; Abstract:\r
+;\r
+; ZeroMem function\r
+;\r
+; Notes:\r
+;\r
+;------------------------------------------------------------------------------\r
+\r
+ .code\r
+\r
+;------------------------------------------------------------------------------\r
+; VOID *\r
+; InternalMemZeroMem (\r
+; IN VOID *Buffer,\r
+; IN UINTN Count\r
+; )\r
+;------------------------------------------------------------------------------\r
+InternalMemZeroMem PROC USES rdi\r
+ mov rdi, rcx\r
+ xor rcx, rcx\r
+ xor eax, eax\r
+ sub rcx, rdi\r
+ and rcx, 15\r
+ mov r8, rdi\r
+ jz @F\r
+ cmp rcx, rdx\r
+ cmova rcx, rdx\r
+ sub rdx, rcx\r
+ rep stosb\r
+@@:\r
+ mov rcx, rdx\r
+ and edx, 15\r
+ shr rcx, 4\r
+ jz @ZeroBytes\r
+ pxor xmm0, xmm0\r
+@@:\r
+ movntdq [rdi], xmm0 ; rdi should be 16-byte aligned\r
+ add rdi, 16\r
+ loop @B\r
+ mfence\r
+@ZeroBytes:\r
+ mov ecx, edx\r
+ rep stosb\r
+ mov rax, r8\r
+ ret\r
+InternalMemZeroMem ENDP\r
+\r
+ END\r
#/** @file\r
# Runtime driver library\r
#\r
-# Instance of runtime driver library, Hook VitualAddressChange and \r
+# Instance of runtime driver library, Hook VitualAddressChange and\r
# BooterviceExit event and provide runtime service.\r
# Copyright (c) 2006 - 2007, Intel Corporation.\r
#\r
################################################################################\r
[Defines]\r
INF_VERSION = 0x00010005\r
- BASE_NAME = EdkUefiRuntimeLib\r
+ BASE_NAME = UefiRuntimeLib\r
FILE_GUID = b1ee6c28-54aa-4d17-b705-3e28ccb27b2e\r
MODULE_TYPE = DXE_RUNTIME_DRIVER\r
VERSION_STRING = 1.0\r
- LIBRARY_CLASS = UefiRuntimeLib|DXE_RUNTIME_DRIVER DXE_SAL_DRIVER \r
+ LIBRARY_CLASS = UefiRuntimeLib|DXE_RUNTIME_DRIVER DXE_SAL_DRIVER\r
EDK_RELEASE_VERSION = 0x00020000\r
EFI_SPECIFICATION_VERSION = 0x00020000\r
\r
#\r
# The following information is for reference only and not required by the build tools.\r
#\r
-# VALID_ARCHITECTURES = IA32 X64 EBC\r
+ VALID_ARCHITECTURES = IA32 X64 EBC\r
#\r
\r
################################################################################\r
${WORKSPACE}/MdePkg/Library/DxeServicesTableLib/DxeServicesTableLib.inf\r
# ${WORKSPACE}/MdePkg/Library/DxeSmbusLib/DxeSmbusLib.inf\r
${WORKSPACE}/MdePkg/Library/PeiCoreEntryPoint/PeiCoreEntryPoint.inf\r
-# ${WORKSPACE}/MdePkg/Library/PeiHobLib/PeiHobLib.inf\r
+ ${WORKSPACE}/MdePkg/Library/PeiHobLib/PeiHobLib.inf\r
${WORKSPACE}/MdePkg/Library/PeiMemoryAllocationLib/PeiMemoryAllocationLib.inf\r
${WORKSPACE}/MdePkg/Library/PeimEntryPoint/PeimEntryPoint.inf\r
${WORKSPACE}/MdePkg/Library/PeiPcdLib/PeiPcdLib.inf\r
${WORKSPACE}/MdePkg/Library/PeiServicesLib/PeiServicesLib.inf\r
${WORKSPACE}/MdePkg/Library/PeiServicesTablePointerLib/PeiServicesTablePointerLib.inf\r
# ${WORKSPACE}/MdePkg/Library/PeiSmbusLib/PeiSmbusLib.inf\r
- ${WORKSPACE}/MdePkg/Library/SecPeiDxeTimerLibCpu/SecPeiDxeTimerLibCpu.inf\r
${WORKSPACE}/MdePkg/Library/SerialPortLibNull/SerialPortLibNull.inf\r
${WORKSPACE}/MdePkg/Library/UefiApplicationEntryPoint/UefiApplicationEntryPoint.inf\r
${WORKSPACE}/MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.inf\r
${WORKSPACE}/MdePkg/Library/UefiDevicePathLibDevicePathProtocol/UefiDevicePathLibDevicePathProtocol.inf\r
${WORKSPACE}/MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf\r
${WORKSPACE}/MdePkg/Library/UefiLib/UefiLib.inf\r
- ${WORKSPACE}/MdePkg/Library/UefiRuntimeLib/UefiRuntimeLib.inf\r
${WORKSPACE}/MdePkg/Library/UefiRuntimeServicesTableLib/UefiRuntimeServicesTableLib.inf\r
${WORKSPACE}\MdePkg\Library/UefiScsiLib/UefiScsiLib.inf\r
\r
[Components.IA32]\r
${WORKSPACE}\MdePkg\Library/BaseMemoryLibSse2/BaseMemoryLibSse2.inf\r
${WORKSPACE}\MdePkg\Library/BaseMemoryLibRepStr/BaseMemoryLibRepStr.inf\r
+ ${WORKSPACE}/MdePkg/Library/UefiRuntimeLib/UefiRuntimeLib.inf\r
+ ${WORKSPACE}/MdePkg/Library/SecPeiDxeTimerLibCpu/SecPeiDxeTimerLibCpu.inf\r
\r
[Components.X64]\r
${WORKSPACE}\MdePkg\Library/BaseMemoryLibSse2/BaseMemoryLibSse2.inf\r
${WORKSPACE}\MdePkg\Library/BaseMemoryLibRepStr/BaseMemoryLibRepStr.inf\r
+ ${WORKSPACE}/MdePkg/Library/UefiRuntimeLib/UefiRuntimeLib.inf\r
+ ${WORKSPACE}/MdePkg/Library/SecPeiDxeTimerLibCpu/SecPeiDxeTimerLibCpu.inf\r
\r
-\r
+[Components.IPF]\r
+ ${WORKSPACE}/MdePkg/Library/SecPeiDxeTimerLibCpu/SecPeiDxeTimerLibCpu.inf\r