clean up all of eight BaseMemoryLib instances in MdePkg with the following updates:

1.	Remove .intel_syntax directives in GCC assembly files. All these assembly files have been updated to use the preferred syntax for GAS
2.	Correct the incorrect comments for internal worker functions for SetMemXX() and ScanMemXX(). The Length parameter is actually the counter of 16-bit, 32-bit or 64-bit value. 
3.	Simplify the logic in ZeroMemoryWrapper.c for BaseMemoryLibOptPei instance to remove the conditional statement for zero length. This logic is already covered by worker function InternalMemZeroMem(). 
4.	Cleanup all the Wrapper C files in BaseMemoryLib instances. They are supposed to be shared by all these 8 BaseMemoryLib instances, but are out-of-sync after some maintenance. This patch re-syncs them and makes them exactly the same.
5.	Cleanup MemLibInternal.h so that it is shared by 6 BaseMemoryLib instance except for PeiMemoryLib and UefiMemoryLib.


git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9041 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
qhuang8
2009-08-11 15:32:16 +00:00
parent ba19956ac3
commit 1fef058f4b
162 changed files with 1087 additions and 1252 deletions

View File

@@ -1,6 +1,6 @@
/** @file /** @file
CompareMem() implementation. CompareMem() implementation.
The following BaseMemoryLib instances contain the same copy of this file: The following BaseMemoryLib instances contain the same copy of this file:
BaseMemoryLib BaseMemoryLib
BaseMemoryLibMmx BaseMemoryLibMmx
@@ -9,9 +9,9 @@
BaseMemoryLibOptDxe BaseMemoryLibOptDxe
BaseMemoryLibOptPei BaseMemoryLibOptPei
PeiMemoryLib PeiMemoryLib
DxeMemoryLib UefiMemoryLib
Copyright (c) 2006 - 2008, Intel Corporation Copyright (c) 2006 - 2009, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at

View File

@@ -10,9 +10,9 @@
BaseMemoryLibOptDxe BaseMemoryLibOptDxe
BaseMemoryLibOptPei BaseMemoryLibOptPei
PeiMemoryLib PeiMemoryLib
DxeMemoryLib UefiMemoryLib
Copyright (c) 2006 - 2008, Intel Corporation<BR> Copyright (c) 2006 - 2009, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at

View File

@@ -4,9 +4,9 @@
The following BaseMemoryLib instances contain the same copy of this file: The following BaseMemoryLib instances contain the same copy of this file:
BaseMemoryLib BaseMemoryLib
PeiMemoryLib PeiMemoryLib
DxeMemoryLib UefiMemoryLib
Copyright (c) 2006 - 2008, Intel Corporation<BR> Copyright (c) 2006 - 2009, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at
@@ -17,16 +17,13 @@
**/ **/
#include "MemLibInternals.h" #include "MemLibInternals.h"
/** /**
Fills a target buffer with a 16-bit value, and returns the target buffer. Fills a target buffer with a 16-bit value, and returns the target buffer.
@param Buffer Pointer to the target buffer to fill. @param Buffer Pointer to the target buffer to fill.
@param Length Number of bytes in Buffer to fill. @param Length Count of 16-bit value to fill.
@param Value Value with which to fill Length bytes of Buffer. @param Value Value with which to fill Length bytes of Buffer.
@return Buffer @return Buffer
@@ -50,7 +47,7 @@ InternalMemSetMem16 (
Fills a target buffer with a 32-bit value, and returns the target buffer. Fills a target buffer with a 32-bit value, and returns the target buffer.
@param Buffer Pointer to the target buffer to fill. @param Buffer Pointer to the target buffer to fill.
@param Length Number of bytes in Buffer to fill. @param Length Count of 32-bit value to fill.
@param Value Value with which to fill Length bytes of Buffer. @param Value Value with which to fill Length bytes of Buffer.
@return Buffer @return Buffer
@@ -74,7 +71,7 @@ InternalMemSetMem32 (
Fills a target buffer with a 64-bit value, and returns the target buffer. Fills a target buffer with a 64-bit value, and returns the target buffer.
@param Buffer Pointer to the target buffer to fill. @param Buffer Pointer to the target buffer to fill.
@param Length Number of bytes in Buffer to fill. @param Length Count of 64-bit value to fill.
@param Value Value with which to fill Length bytes of Buffer. @param Value Value with which to fill Length bytes of Buffer.
@return Buffer @return Buffer
@@ -147,7 +144,7 @@ InternalMemCompareMem (
matching 8-bit value in the target buffer. matching 8-bit value in the target buffer.
@param Buffer Pointer to the target buffer to scan. @param Buffer Pointer to the target buffer to scan.
@param Length Number of bytes in Buffer to scan. Must be non-zero. @param Length Count of 8-bit value to scan. Must be non-zero.
@param Value Value to search for in the target buffer. @param Value Value to search for in the target buffer.
@return Pointer to the first occurrence or NULL if not found. @return Pointer to the first occurrence or NULL if not found.
@@ -177,7 +174,7 @@ InternalMemScanMem8 (
matching 16-bit value in the target buffer. matching 16-bit value in the target buffer.
@param Buffer Pointer to the target buffer to scan. @param Buffer Pointer to the target buffer to scan.
@param Length Number of bytes in Buffer to scan. Must be non-zero. @param Length Count of 16-bit value to scan. Must be non-zero.
@param Value Value to search for in the target buffer. @param Value Value to search for in the target buffer.
@return Pointer to the first occurrence or NULL if not found. @return Pointer to the first occurrence or NULL if not found.
@@ -207,7 +204,7 @@ InternalMemScanMem16 (
matching 32-bit value in the target buffer. matching 32-bit value in the target buffer.
@param Buffer Pointer to the target buffer to scan. @param Buffer Pointer to the target buffer to scan.
@param Length Number of bytes in Buffer to scan. Must be non-zero. @param Length Count of 32-bit value to scan. Must be non-zero.
@param Value Value to search for in the target buffer. @param Value Value to search for in the target buffer.
@return Pointer to the first occurrence or NULL if not found. @return Pointer to the first occurrence or NULL if not found.
@@ -237,7 +234,7 @@ InternalMemScanMem32 (
matching 64-bit value in the target buffer. matching 64-bit value in the target buffer.
@param Buffer Pointer to the target buffer to scan. @param Buffer Pointer to the target buffer to scan.
@param Length Number of bytes in Buffer to scan. Must be non-zero. @param Length Count of 64-bit value to scan. Must be non-zero.
@param Value Value to search for in the target buffer. @param Value Value to search for in the target buffer.
@return Pointer to the first occurrence or NULL if not found. @return Pointer to the first occurrence or NULL if not found.

View File

@@ -10,9 +10,9 @@
BaseMemoryLibOptDxe BaseMemoryLibOptDxe
BaseMemoryLibOptPei BaseMemoryLibOptPei
PeiMemoryLib PeiMemoryLib
DxeMemoryLib UefiMemoryLib
Copyright (c) 2006 - 2008, Intel Corporation<BR> Copyright (c) 2006 - 2009, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at

View File

@@ -8,10 +8,8 @@
BaseMemoryLibRepStr BaseMemoryLibRepStr
BaseMemoryLibOptDxe BaseMemoryLibOptDxe
BaseMemoryLibOptPei BaseMemoryLibOptPei
PeiMemoryLib
DxeMemoryLib
Copyright (c) 2006 - 2008, Intel Corporation<BR> Copyright (c) 2006 - 2009, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at
@@ -30,7 +28,6 @@
#include <Library/BaseLib.h> #include <Library/BaseLib.h>
#include <Library/DebugLib.h> #include <Library/DebugLib.h>
/** /**
Copy Length bytes from Source to Destination. Copy Length bytes from Source to Destination.
@@ -62,7 +59,7 @@ InternalMemCopyMem (
VOID * VOID *
EFIAPI EFIAPI
InternalMemSetMem ( InternalMemSetMem (
IN VOID *Buffer, OUT VOID *Buffer,
IN UINTN Length, IN UINTN Length,
IN UINT8 Value IN UINT8 Value
); );
@@ -71,7 +68,7 @@ InternalMemSetMem (
Fills a target buffer with a 16-bit value, and returns the target buffer. Fills a target buffer with a 16-bit value, and returns the target buffer.
@param Buffer Pointer to the target buffer to fill. @param Buffer Pointer to the target buffer to fill.
@param Length Number of bytes in Buffer to fill. @param Length Count of 16-bit value to fill.
@param Value Value with which to fill Length bytes of Buffer. @param Value Value with which to fill Length bytes of Buffer.
@return Buffer @return Buffer
@@ -89,7 +86,7 @@ InternalMemSetMem16 (
Fills a target buffer with a 32-bit value, and returns the target buffer. Fills a target buffer with a 32-bit value, and returns the target buffer.
@param Buffer Pointer to the target buffer to fill. @param Buffer Pointer to the target buffer to fill.
@param Length Number of bytes in Buffer to fill. @param Length Count of 32-bit value to fill.
@param Value Value with which to fill Length bytes of Buffer. @param Value Value with which to fill Length bytes of Buffer.
@return Buffer @return Buffer
@@ -107,7 +104,7 @@ InternalMemSetMem32 (
Fills a target buffer with a 64-bit value, and returns the target buffer. Fills a target buffer with a 64-bit value, and returns the target buffer.
@param Buffer Pointer to the target buffer to fill. @param Buffer Pointer to the target buffer to fill.
@param Length Number of bytes in Buffer to fill. @param Length Count of 64-bit value to fill.
@param Value Value with which to fill Length bytes of Buffer. @param Value Value with which to fill Length bytes of Buffer.
@return Buffer @return Buffer
@@ -163,7 +160,7 @@ InternalMemCompareMem (
matching 8-bit value in the target buffer. matching 8-bit value in the target buffer.
@param Buffer Pointer to the target buffer to scan. @param Buffer Pointer to the target buffer to scan.
@param Length Number of bytes in Buffer to scan. Must be non-zero. @param Length Count of 8-bit value to scan. Must be non-zero.
@param Value Value to search for in the target buffer. @param Value Value to search for in the target buffer.
@return Pointer to the first occurrence or NULL if not found. @return Pointer to the first occurrence or NULL if not found.
@@ -182,7 +179,7 @@ InternalMemScanMem8 (
matching 16-bit value in the target buffer. matching 16-bit value in the target buffer.
@param Buffer Pointer to the target buffer to scan. @param Buffer Pointer to the target buffer to scan.
@param Length Number of bytes in Buffer to scan. Must be non-zero. @param Length Count of 16-bit value to scan. Must be non-zero.
@param Value Value to search for in the target buffer. @param Value Value to search for in the target buffer.
@return Pointer to the first occurrence or NULL if not found. @return Pointer to the first occurrence or NULL if not found.
@@ -201,7 +198,7 @@ InternalMemScanMem16 (
matching 32-bit value in the target buffer. matching 32-bit value in the target buffer.
@param Buffer Pointer to the target buffer to scan. @param Buffer Pointer to the target buffer to scan.
@param Length Number of bytes in Buffer to scan. Must be non-zero. @param Length Count of 32-bit value to scan. Must be non-zero.
@param Value Value to search for in the target buffer. @param Value Value to search for in the target buffer.
@return Pointer to the first occurrence or NULL if not found. @return Pointer to the first occurrence or NULL if not found.
@@ -220,7 +217,7 @@ InternalMemScanMem32 (
matching 64-bit value in the target buffer. matching 64-bit value in the target buffer.
@param Buffer Pointer to the target buffer to scan. @param Buffer Pointer to the target buffer to scan.
@param Length Number of bytes in Buffer to scan. Must be non-zero. @param Length Count of 64-bit value to scan. Must be non-zero.
@param Value Value to search for in the target buffer. @param Value Value to search for in the target buffer.
@return Pointer to the first occurrence or NULL if not found. @return Pointer to the first occurrence or NULL if not found.

View File

@@ -10,9 +10,9 @@
BaseMemoryLibOptDxe BaseMemoryLibOptDxe
BaseMemoryLibOptPei BaseMemoryLibOptPei
PeiMemoryLib PeiMemoryLib
DxeMemoryLib UefiMemoryLib
Copyright (c) 2006 - 2008, Intel Corporation<BR> Copyright (c) 2006 - 2009, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at

View File

@@ -9,9 +9,9 @@
BaseMemoryLibOptDxe BaseMemoryLibOptDxe
BaseMemoryLibOptPei BaseMemoryLibOptPei
PeiMemoryLib PeiMemoryLib
DxeMemoryLib UefiMemoryLib
Copyright (c) 2006 - 2008, Intel Corporation<BR> Copyright (c) 2006 - 2009, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at

View File

@@ -10,9 +10,9 @@
BaseMemoryLibOptDxe BaseMemoryLibOptDxe
BaseMemoryLibOptPei BaseMemoryLibOptPei
PeiMemoryLib PeiMemoryLib
DxeMemoryLib UefiMemoryLib
Copyright (c) 2006 - 2008, Intel Corporation<BR> Copyright (c) 2006 - 2009, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at

View File

@@ -10,9 +10,9 @@
BaseMemoryLibOptDxe BaseMemoryLibOptDxe
BaseMemoryLibOptPei BaseMemoryLibOptPei
PeiMemoryLib PeiMemoryLib
DxeMemoryLib UefiMemoryLib
Copyright (c) 2006 - 2008, Intel Corporation<BR> Copyright (c) 2006 - 2009, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at

View File

@@ -9,9 +9,9 @@
BaseMemoryLibOptDxe BaseMemoryLibOptDxe
BaseMemoryLibOptPei BaseMemoryLibOptPei
PeiMemoryLib PeiMemoryLib
DxeMemoryLib UefiMemoryLib
Copyright (c) 2006 - 2008, Intel Corporation<BR> Copyright (c) 2006 - 2009, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at
@@ -22,9 +22,6 @@
**/ **/
#include "MemLibInternals.h" #include "MemLibInternals.h"
/** /**

View File

@@ -9,9 +9,9 @@
BaseMemoryLibOptDxe BaseMemoryLibOptDxe
BaseMemoryLibOptPei BaseMemoryLibOptPei
PeiMemoryLib PeiMemoryLib
DxeMemoryLib UefiMemoryLib
Copyright (c) 2006 - 2008, Intel Corporation<BR> Copyright (c) 2006 - 2009, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at
@@ -22,9 +22,6 @@
**/ **/
#include "MemLibInternals.h" #include "MemLibInternals.h"
/** /**

View File

@@ -9,9 +9,9 @@
BaseMemoryLibOptDxe BaseMemoryLibOptDxe
BaseMemoryLibOptPei BaseMemoryLibOptPei
PeiMemoryLib PeiMemoryLib
DxeMemoryLib UefiMemoryLib
Copyright (c) 2006 - 2008, Intel Corporation<BR> Copyright (c) 2006 - 2009, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at
@@ -22,9 +22,6 @@
**/ **/
#include "MemLibInternals.h" #include "MemLibInternals.h"
/** /**

View File

@@ -2,7 +2,7 @@
SetMem() implementation. SetMem() implementation.
The following BaseMemoryLib instances contain the same copy of this file: The following BaseMemoryLib instances contain the same copy of this file:
BaseMemoryLib BaseMemoryLib
BaseMemoryLibMmx BaseMemoryLibMmx
BaseMemoryLibSse2 BaseMemoryLibSse2
@@ -10,9 +10,9 @@
BaseMemoryLibOptDxe BaseMemoryLibOptDxe
BaseMemoryLibOptPei BaseMemoryLibOptPei
PeiMemoryLib PeiMemoryLib
DxeMemoryLib UefiMemoryLib
Copyright (c) 2006 - 2008, Intel Corporation<BR> Copyright (c) 2006 - 2009, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at

View File

@@ -10,9 +10,9 @@
BaseMemoryLibOptDxe BaseMemoryLibOptDxe
BaseMemoryLibOptPei BaseMemoryLibOptPei
PeiMemoryLib PeiMemoryLib
DxeMemoryLib UefiMemoryLib
Copyright (c) 2006 - 2008 , Intel Corporation<BR> Copyright (c) 2006 - 2009 , Intel Corporation<BR>
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at

View File

@@ -9,9 +9,9 @@
BaseMemoryLibOptDxe BaseMemoryLibOptDxe
BaseMemoryLibOptPei BaseMemoryLibOptPei
PeiMemoryLib PeiMemoryLib
DxeMemoryLib UefiMemoryLib
Copyright (c) 2006 - 2008, Intel Corporation Copyright (c) 2006 - 2009, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at

View File

@@ -10,9 +10,9 @@
BaseMemoryLibOptDxe BaseMemoryLibOptDxe
BaseMemoryLibOptPei BaseMemoryLibOptPei
PeiMemoryLib PeiMemoryLib
DxeMemoryLib UefiMemoryLib
Copyright (c) 2006 - 2008, Intel Corporation<BR> Copyright (c) 2006 - 2009, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at

View File

@@ -10,9 +10,9 @@
BaseMemoryLibOptDxe BaseMemoryLibOptDxe
BaseMemoryLibOptPei BaseMemoryLibOptPei
PeiMemoryLib PeiMemoryLib
DxeMemoryLib UefiMemoryLib
Copyright (c) 2006 - 2008, Intel Corporation<BR> Copyright (c) 2006 - 2009, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at

View File

@@ -8,10 +8,8 @@
BaseMemoryLibRepStr BaseMemoryLibRepStr
BaseMemoryLibOptDxe BaseMemoryLibOptDxe
BaseMemoryLibOptPei BaseMemoryLibOptPei
PeiMemoryLib
DxeMemoryLib
Copyright (c) 2006 - 2008, Intel Corporation<BR> Copyright (c) 2006 - 2009, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at
@@ -34,8 +32,8 @@
Copy Length bytes from Source to Destination. Copy Length bytes from Source to Destination.
@param DestinationBuffer Target of copy @param DestinationBuffer Target of copy
@param SourceBuffer Place to copy from @param SourceBuffer Place to copy from
@param Length Number of bytes to copy @param Length Number of bytes to copy
@return Destination @return Destination
@@ -51,9 +49,9 @@ InternalMemCopyMem (
/** /**
Set Buffer to Value for Size bytes. Set Buffer to Value for Size bytes.
@param Buffer Memory to set. @param Buffer Memory to set.
@param Length Number of bytes to set @param Length Number of bytes to set
@param Value Value of the set operation. @param Value Value of the set operation.
@return Buffer @return Buffer
@@ -70,7 +68,7 @@ InternalMemSetMem (
Fills a target buffer with a 16-bit value, and returns the target buffer. Fills a target buffer with a 16-bit value, and returns the target buffer.
@param Buffer Pointer to the target buffer to fill. @param Buffer Pointer to the target buffer to fill.
@param Length Number of bytes in Buffer to fill. @param Length Count of 16-bit value to fill.
@param Value Value with which to fill Length bytes of Buffer. @param Value Value with which to fill Length bytes of Buffer.
@return Buffer @return Buffer
@@ -88,7 +86,7 @@ InternalMemSetMem16 (
Fills a target buffer with a 32-bit value, and returns the target buffer. Fills a target buffer with a 32-bit value, and returns the target buffer.
@param Buffer Pointer to the target buffer to fill. @param Buffer Pointer to the target buffer to fill.
@param Length Number of bytes in Buffer to fill. @param Length Count of 32-bit value to fill.
@param Value Value with which to fill Length bytes of Buffer. @param Value Value with which to fill Length bytes of Buffer.
@return Buffer @return Buffer
@@ -106,7 +104,7 @@ InternalMemSetMem32 (
Fills a target buffer with a 64-bit value, and returns the target buffer. Fills a target buffer with a 64-bit value, and returns the target buffer.
@param Buffer Pointer to the target buffer to fill. @param Buffer Pointer to the target buffer to fill.
@param Length Number of bytes in Buffer to fill. @param Length Count of 64-bit value to fill.
@param Value Value with which to fill Length bytes of Buffer. @param Value Value with which to fill Length bytes of Buffer.
@return Buffer @return Buffer
@@ -162,7 +160,7 @@ InternalMemCompareMem (
matching 8-bit value in the target buffer. matching 8-bit value in the target buffer.
@param Buffer Pointer to the target buffer to scan. @param Buffer Pointer to the target buffer to scan.
@param Length Number of bytes in Buffer to scan. Must be non-zero. @param Length Count of 8-bit value to scan. Must be non-zero.
@param Value Value to search for in the target buffer. @param Value Value to search for in the target buffer.
@return Pointer to the first occurrence or NULL if not found. @return Pointer to the first occurrence or NULL if not found.
@@ -181,7 +179,7 @@ InternalMemScanMem8 (
matching 16-bit value in the target buffer. matching 16-bit value in the target buffer.
@param Buffer Pointer to the target buffer to scan. @param Buffer Pointer to the target buffer to scan.
@param Length Number of bytes in Buffer to scan. Must be non-zero. @param Length Count of 16-bit value to scan. Must be non-zero.
@param Value Value to search for in the target buffer. @param Value Value to search for in the target buffer.
@return Pointer to the first occurrence or NULL if not found. @return Pointer to the first occurrence or NULL if not found.
@@ -200,7 +198,7 @@ InternalMemScanMem16 (
matching 32-bit value in the target buffer. matching 32-bit value in the target buffer.
@param Buffer Pointer to the target buffer to scan. @param Buffer Pointer to the target buffer to scan.
@param Length Number of bytes in Buffer to scan. Must be non-zero. @param Length Count of 32-bit value to scan. Must be non-zero.
@param Value Value to search for in the target buffer. @param Value Value to search for in the target buffer.
@return Pointer to the first occurrence or NULL if not found. @return Pointer to the first occurrence or NULL if not found.
@@ -219,7 +217,7 @@ InternalMemScanMem32 (
matching 64-bit value in the target buffer. matching 64-bit value in the target buffer.
@param Buffer Pointer to the target buffer to scan. @param Buffer Pointer to the target buffer to scan.
@param Length Number of bytes in Buffer to scan. Must be non-zero. @param Length Count of 64-bit value to scan. Must be non-zero.
@param Value Value to search for in the target buffer. @param Value Value to search for in the target buffer.
@return Pointer to the first occurrence or NULL if not found. @return Pointer to the first occurrence or NULL if not found.

View File

@@ -10,9 +10,9 @@
BaseMemoryLibOptDxe BaseMemoryLibOptDxe
BaseMemoryLibOptPei BaseMemoryLibOptPei
PeiMemoryLib PeiMemoryLib
DxeMemoryLib UefiMemoryLib
Copyright (c) 2006 - 2008, Intel Corporation<BR> Copyright (c) 2006 - 2009, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at

View File

@@ -9,9 +9,9 @@
BaseMemoryLibOptDxe BaseMemoryLibOptDxe
BaseMemoryLibOptPei BaseMemoryLibOptPei
PeiMemoryLib PeiMemoryLib
DxeMemoryLib UefiMemoryLib
Copyright (c) 2006 - 2008, Intel Corporation<BR> Copyright (c) 2006 - 2009, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at

View File

@@ -10,9 +10,9 @@
BaseMemoryLibOptDxe BaseMemoryLibOptDxe
BaseMemoryLibOptPei BaseMemoryLibOptPei
PeiMemoryLib PeiMemoryLib
DxeMemoryLib UefiMemoryLib
Copyright (c) 2006 - 2008, Intel Corporation<BR> Copyright (c) 2006 - 2009, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at

View File

@@ -10,9 +10,9 @@
BaseMemoryLibOptDxe BaseMemoryLibOptDxe
BaseMemoryLibOptPei BaseMemoryLibOptPei
PeiMemoryLib PeiMemoryLib
DxeMemoryLib UefiMemoryLib
Copyright (c) 2006 - 2008, Intel Corporation<BR> Copyright (c) 2006 - 2009, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at

View File

@@ -9,9 +9,9 @@
BaseMemoryLibOptDxe BaseMemoryLibOptDxe
BaseMemoryLibOptPei BaseMemoryLibOptPei
PeiMemoryLib PeiMemoryLib
DxeMemoryLib UefiMemoryLib
Copyright (c) 2006 - 2008, Intel Corporation<BR> Copyright (c) 2006 - 2009, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at

View File

@@ -9,9 +9,9 @@
BaseMemoryLibOptDxe BaseMemoryLibOptDxe
BaseMemoryLibOptPei BaseMemoryLibOptPei
PeiMemoryLib PeiMemoryLib
DxeMemoryLib UefiMemoryLib
Copyright (c) 2006 - 2008, Intel Corporation<BR> Copyright (c) 2006 - 2009, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at

View File

@@ -9,9 +9,9 @@
BaseMemoryLibOptDxe BaseMemoryLibOptDxe
BaseMemoryLibOptPei BaseMemoryLibOptPei
PeiMemoryLib PeiMemoryLib
DxeMemoryLib UefiMemoryLib
Copyright (c) 2006 - 2008, Intel Corporation<BR> Copyright (c) 2006 - 2009, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at

View File

@@ -10,9 +10,9 @@
BaseMemoryLibOptDxe BaseMemoryLibOptDxe
BaseMemoryLibOptPei BaseMemoryLibOptPei
PeiMemoryLib PeiMemoryLib
DxeMemoryLib UefiMemoryLib
Copyright (c) 2006 - 2008, Intel Corporation<BR> Copyright (c) 2006 - 2009, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at

View File

@@ -3,7 +3,7 @@
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# #
# Copyright (c) 2006 - 2008, Intel Corporation # Copyright (c) 2006 - 2009, Intel Corporation
# All rights reserved. This program and the accompanying materials # All rights reserved. This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License # are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at # which accompanies this distribution. The full text of the license may be found at
@@ -42,19 +42,18 @@
# IN UINTN Length # IN UINTN Length
# ); # );
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
.intel_syntax noprefix
ASM_GLOBAL ASM_PFX(InternalMemCompareMem) ASM_GLOBAL ASM_PFX(InternalMemCompareMem)
ASM_PFX(InternalMemCompareMem): ASM_PFX(InternalMemCompareMem):
push rsi pushq %rsi
push rdi pushq %rdi
mov rsi, rcx movq %rcx, %rsi
mov rdi, rdx movq %rdx, %rdi
mov rcx, r8 movq %r8, %rcx
repe cmpsb repe cmpsb
movzx rax, byte ptr [rsi - 1] movzbq -1(%rsi), %rax
movzx rdx, byte ptr [rdi - 1] movzbq -1(%rdi), %rdx
sub rax, rdx subq %rdx, %rax
pop rdi popq %rdi
pop rsi popq %rsi
ret ret

View File

@@ -3,7 +3,7 @@
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# #
# Copyright (c) 2006 - 2008, Intel Corporation # Copyright (c) 2006 - 2009, Intel Corporation
# All rights reserved. This program and the accompanying materials # All rights reserved. This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License # are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at # which accompanies this distribution. The full text of the license may be found at
@@ -34,42 +34,41 @@
# IN UINTN Count # IN UINTN Count
# ) # )
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
.intel_syntax noprefix
ASM_GLOBAL ASM_PFX(InternalMemCopyMem) ASM_GLOBAL ASM_PFX(InternalMemCopyMem)
ASM_PFX(InternalMemCopyMem): ASM_PFX(InternalMemCopyMem):
push rsi pushq %rsi
push rdi pushq %rdi
mov rsi, rdx # rsi <- Source movq %rdx, %rsi # rsi <- Source
mov rdi, rcx # rdi <- Destination movq %rcx, %rdi # rdi <- Destination
lea r9, [rsi + r8 - 1] # r9 <- End of Source leaq -1(%rsi, %r8,), %r9 # r9 <- End of Source
cmp rsi, rdi cmpq %rdi, %rsi
mov rax, rdi # rax <- Destination as return value movq %rdi, %rax # rax <- Destination as return value
jae L0 jae L0
cmp r9, rdi cmpq %rdi, %r9
jae L_CopyBackward # Copy backward if overlapped jae L_CopyBackward # Copy backward if overlapped
L0: L0:
mov rcx, r8 movq %r8, %rcx
and r8, 7 andq $7, %r8
shr rcx, 3 # rcx <- # of Qwords to copy shrq $3, %rcx # rcx <- # of Qwords to copy
jz L_CopyBytes jz L_CopyBytes
movd r10, mm0 # (Save mm0 in r10) movq %mm0, %r10 # (Save mm0 in r10) ; Why just save 32 bits?
L1: L1:
movq mm0, [rsi] movq (%rsi), %mm0
movntq [rdi], mm0 movntq %mm0, (%rdi)
add rsi, 8 addq $8, %rsi
add rdi, 8 addq $8, %rdi
loop L1 loop L1
mfence mfence
movd mm0, r10 # (Restore mm0) movd %r10, %mm0 # (Restore mm0)
jmp L_CopyBytes jmp L_CopyBytes
L_CopyBackward: L_CopyBackward:
mov rsi, r9 # rsi <- End of Source movq %r9, %rsi # rsi <- End of Source
lea rdi, [rdi + r8 - 1] # rdi <- End of Destination leaq -1(%rdi, %r8,), %rdi # rdi <- End of Destination
std # set direction flag std # set direction flag
L_CopyBytes: L_CopyBytes:
mov rcx, r8 movq %r8, %rcx
rep movsb # Copy bytes backward rep movsb # Copy bytes backward
cld cld
pop rdi popq %rdi
pop rsi popq %rsi
ret ret

View File

@@ -3,7 +3,7 @@
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# #
# Copyright (c) 2006 - 2008, Intel Corporation # Copyright (c) 2006 - 2009, Intel Corporation
# All rights reserved. This program and the accompanying materials # All rights reserved. This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License # are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at # which accompanies this distribution. The full text of the license may be found at
@@ -42,16 +42,15 @@
# IN UINT16 Value # IN UINT16 Value
# ); # );
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
.intel_syntax noprefix
ASM_GLOBAL ASM_PFX(InternalMemScanMem16) ASM_GLOBAL ASM_PFX(InternalMemScanMem16)
ASM_PFX(InternalMemScanMem16): ASM_PFX(InternalMemScanMem16):
push rdi pushq %rdi
mov rdi, rcx movq %rcx, %rdi
mov rax, r8 movq %r8, %rax
mov rcx, rdx movq %rdx, %rcx
repne scasw repne scasw
lea rax, [rdi - 2] leaq -2(%rdi), %rax
cmovnz rax, rcx cmovnz %rcx, %rax
pop rdi popq %rdi
ret ret

View File

@@ -3,7 +3,7 @@
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# #
# Copyright (c) 2006 - 2008, Intel Corporation # Copyright (c) 2006 - 2009, Intel Corporation
# All rights reserved. This program and the accompanying materials # All rights reserved. This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License # are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at # which accompanies this distribution. The full text of the license may be found at
@@ -42,16 +42,15 @@
# IN UINT32 Value # IN UINT32 Value
# ); # );
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
.intel_syntax noprefix
ASM_GLOBAL ASM_PFX(InternalMemScanMem32) ASM_GLOBAL ASM_PFX(InternalMemScanMem32)
ASM_PFX(InternalMemScanMem32): ASM_PFX(InternalMemScanMem32):
push rdi pushq %rdi
mov rdi, rcx movq %rcx, %rdi
mov rax, r8 movq %r8, %rax
mov rcx, rdx movq %rdx, %rcx
repne scasd repne scasl
lea rax, [rdi - 4] leaq -4(%rdi), %rax
cmovnz rax, rcx cmovnz %rcx, %rax
pop rdi popq %rdi
ret ret

View File

@@ -3,7 +3,7 @@
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# #
# Copyright (c) 2006 - 2008, Intel Corporation # Copyright (c) 2006 - 2009, Intel Corporation
# All rights reserved. This program and the accompanying materials # All rights reserved. This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License # are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at # which accompanies this distribution. The full text of the license may be found at
@@ -42,15 +42,14 @@
# IN UINT64 Value # IN UINT64 Value
# ); # );
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
.intel_syntax noprefix
ASM_GLOBAL ASM_PFX(InternalMemScanMem64) ASM_GLOBAL ASM_PFX(InternalMemScanMem64)
ASM_PFX(InternalMemScanMem64): ASM_PFX(InternalMemScanMem64):
push rdi pushq %rdi
mov rdi, rcx movq %rcx, %rdi
mov rax, r8 movq %r8, %rax
mov rcx, rdx movq %rdx, %rcx
repne scasq repne scasq
lea rax, [rdi - 8] leaq -8(%rdi), %rax
cmovnz rax, rcx cmovnz %rcx, %rax
pop rdi popq %rdi
ret ret

View File

@@ -3,7 +3,7 @@
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# #
# Copyright (c) 2006 - 2008, Intel Corporation # Copyright (c) 2006 - 2009, Intel Corporation
# All rights reserved. This program and the accompanying materials # All rights reserved. This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License # are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at # which accompanies this distribution. The full text of the license may be found at
@@ -42,16 +42,15 @@
# IN UINT8 Value # IN UINT8 Value
# ); # );
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
.intel_syntax noprefix
ASM_GLOBAL ASM_PFX(InternalMemScanMem8) ASM_GLOBAL ASM_PFX(InternalMemScanMem8)
ASM_PFX(InternalMemScanMem8): ASM_PFX(InternalMemScanMem8):
push rdi pushq %rdi
mov rdi, rcx movq %rcx, %rdi
mov rcx, rdx movq %rdx, %rcx
mov rax, r8 movq %r8, %rax
repne scasb repne scasb
lea rax, [rdi - 1] leaq -1(%rdi), %rax
cmovnz rax, rcx # set rax to 0 if not found cmovnz %rcx, %rax # set rax to 0 if not found
pop rdi popq %rdi
ret ret

View File

@@ -3,7 +3,7 @@
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# #
# Copyright (c) 2006 - 2008, Intel Corporation # Copyright (c) 2006 - 2009, Intel Corporation
# All rights reserved. This program and the accompanying materials # All rights reserved. This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License # are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at # which accompanies this distribution. The full text of the license may be found at
@@ -34,29 +34,28 @@
# IN UINT8 Value # IN UINT8 Value
# ) # )
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
.intel_syntax noprefix
ASM_GLOBAL ASM_PFX(InternalMemSetMem) ASM_GLOBAL ASM_PFX(InternalMemSetMem)
ASM_PFX(InternalMemSetMem): ASM_PFX(InternalMemSetMem):
push rdi push %rdi
mov rax, r8 movq %r8, %rax
mov ah, al movb %al, %ah
movq mm0, rax movq %rax, %mm0
mov r8, rcx movq %rcx, %r8
mov rdi, r8 # rdi <- Buffer movq %r8, %rdi # rdi <- Buffer
mov rcx, rdx movq %rdx, %rcx
and edx, 7 andq $7, %rdx
shr rcx, 3 shrq $3, %rcx
jz L_SetBytes jz L_SetBytes
pshufw mm0, mm0, 0x0 .byte 0x0f, 0x70, 0x0C0, 0x00
L0: L0:
movntq [rdi], mm0 movntq %mm0, (%rdi)
add rdi, 8 addq $8, %rdi
loop L0 loop L0
mfence mfence
L_SetBytes: L_SetBytes:
mov ecx, edx movl %edx, %ecx
rep stosb rep stosb
mov rax, r8 movq %r8, %rax
pop rdi pop %rdi
ret ret

View File

@@ -3,7 +3,7 @@
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# #
# Copyright (c) 2006 - 2008, Intel Corporation # Copyright (c) 2006 - 2009, Intel Corporation
# All rights reserved. This program and the accompanying materials # All rights reserved. This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License # are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at # which accompanies this distribution. The full text of the license may be found at
@@ -34,28 +34,27 @@
# IN UINT16 Value # IN UINT16 Value
# ) # )
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
.intel_syntax noprefix
ASM_GLOBAL ASM_PFX(InternalMemSetMem16) ASM_GLOBAL ASM_PFX(InternalMemSetMem16)
ASM_PFX(InternalMemSetMem16): ASM_PFX(InternalMemSetMem16):
push rdi pushq %rdi
mov rax, r8 movq %r8, %rax
movq mm0, rax movq %rax, %mm0
mov r8, rcx movq %rcx, %r8
mov rdi, r8 movq %r8, %rdi
mov rcx, rdx movq %rdx, %rcx
and edx, 3 andl $3, %edx
shr rcx, 2 shrq $2, %rcx
jz L_SetWords jz L_SetWords
pshufw mm0, mm0, 0x0 .byte 0x0f, 0x70, 0x0C0, 0x00
L0: L0:
movntq [rdi], mm0 movntq %mm0, (%rdi)
add rdi, 8 addq $8, %rdi
loop L0 loop L0
mfence mfence
L_SetWords: L_SetWords:
mov ecx, edx movl %edx, %ecx
rep stosw rep stosw
mov rax, r8 movq %r8, %rax
pop rdi popq %rdi
ret ret

View File

@@ -3,7 +3,7 @@
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# #
# Copyright (c) 2006 - 2008, Intel Corporation # Copyright (c) 2006 - 2009, Intel Corporation
# All rights reserved. This program and the accompanying materials # All rights reserved. This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License # are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at # which accompanies this distribution. The full text of the license may be found at
@@ -34,23 +34,22 @@
# IN UINT32 Value # IN UINT32 Value
# ); # );
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
.intel_syntax noprefix
ASM_GLOBAL ASM_PFX(InternalMemSetMem32) ASM_GLOBAL ASM_PFX(InternalMemSetMem32)
ASM_PFX(InternalMemSetMem32): ASM_PFX(InternalMemSetMem32):
movq mm0, r8 # mm0 <- Value movq %r8, %mm0 # mm0 <- Value
mov rax, rcx # rax <- Buffer movq %rcx, %rax # rax <- Buffer
xchg rcx, rdx # rcx <- Count rdx <- Buffer xchgq %rdx, %rcx # rcx <- Count rdx <- Buffer
shr rcx, 1 # rcx <- # of qwords to set shrq $1, % rcx # rcx <- # of qwords to set
jz L_SetDwords jz L_SetDwords
pshufw mm0, mm0, 0x44 .byte 0x0f, 0x70, 0x0C0, 0x44
L0: L0:
movntq [rdx], mm0 movntq %mm0, (%rdx)
lea rdx, [rdx + 8] # use "lea" to avoid flag changes leaq 8(%rdx), %rdx # use "lea" to avoid flag changes
loop L0 loop L0
mfence mfence
L_SetDwords: L_SetDwords:
jnc L1 jnc L1
movd [rdx], mm0 movd %mm0, (%rdx)
L1: L1:
ret ret

View File

@@ -3,7 +3,7 @@
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# #
# Copyright (c) 2006 - 2008, Intel Corporation # Copyright (c) 2006 - 2009, Intel Corporation
# All rights reserved. This program and the accompanying materials # All rights reserved. This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License # are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at # which accompanies this distribution. The full text of the license may be found at
@@ -33,15 +33,14 @@
# IN UINT64 Value # IN UINT64 Value
# ) # )
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
.intel_syntax noprefix
ASM_GLOBAL ASM_PFX(InternalMemSetMem64) ASM_GLOBAL ASM_PFX(InternalMemSetMem64)
ASM_PFX(InternalMemSetMem64): ASM_PFX(InternalMemSetMem64):
movq mm0, r8 #Value movq %r8, %mm0 #Value
mov rax, rcx #rax <- Buffer movw %rcx, %rax #rax <- Buffer
xchg rcx, rdx #rcx <- Count xchg %rdx, %rcx #rcx <- Count
L0: L0:
movntq [rdx], mm0 movntq %mm0, (%rdx)
add rdx, 8 addq $8, %rdx
loop L0 loop L0
mfence mfence
ret ret

View File

@@ -3,7 +3,7 @@
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# #
# Copyright (c) 2006 - 2008, Intel Corporation # Copyright (c) 2006 - 2009, Intel Corporation
# All rights reserved. This program and the accompanying materials # All rights reserved. This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License # are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at # which accompanies this distribution. The full text of the license may be found at
@@ -32,27 +32,26 @@
# IN UINTN Count # IN UINTN Count
# ); # );
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
.intel_syntax noprefix
ASM_GLOBAL ASM_PFX(InternalMemZeroMem) ASM_GLOBAL ASM_PFX(InternalMemZeroMem)
ASM_PFX(InternalMemZeroMem): ASM_PFX(InternalMemZeroMem):
push rdi pushq %rdi
mov rdi, rcx movq %rcx, %rdi
mov rcx, rdx movq %rdx, %rcx
mov r8, rdi movq %rdi, %r8
and edx, 7 andq $7, %rdx
shr rcx, 3 shrq $3, %rcx
jz L_ZeroBytes jz L_ZeroBytes
pxor mm0, mm0 pxor %mm0, %mm0
L0: L0:
movntq [rdi], mm0 movntq %mm0, (%rdi)
add rdi, 8 addq $8, %rdi
loop L0 loop L0
mfence mfence
L_ZeroBytes: L_ZeroBytes:
xor eax, eax xorl %eax, %eax
mov ecx, edx movl %edx, %ecx
rep stosb rep stosb
mov rax, r8 movq %r8, %rax
pop rdi popq %rdi
ret ret

View File

@@ -10,9 +10,9 @@
BaseMemoryLibOptDxe BaseMemoryLibOptDxe
BaseMemoryLibOptPei BaseMemoryLibOptPei
PeiMemoryLib PeiMemoryLib
DxeMemoryLib UefiMemoryLib
Copyright (c) 2006 - 2008 , Intel Corporation<BR> Copyright (c) 2006 - 2009 , Intel Corporation<BR>
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at

View File

@@ -9,9 +9,9 @@
BaseMemoryLibOptDxe BaseMemoryLibOptDxe
BaseMemoryLibOptPei BaseMemoryLibOptPei
PeiMemoryLib PeiMemoryLib
DxeMemoryLib UefiMemoryLib
Copyright (c) 2006 - 2008, Intel Corporation Copyright (c) 2006 - 2009, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at

View File

@@ -10,9 +10,9 @@
BaseMemoryLibOptDxe BaseMemoryLibOptDxe
BaseMemoryLibOptPei BaseMemoryLibOptPei
PeiMemoryLib PeiMemoryLib
DxeMemoryLib UefiMemoryLib
Copyright (c) 2006 - 2008, Intel Corporation<BR> Copyright (c) 2006 - 2009, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at

View File

@@ -10,9 +10,9 @@
BaseMemoryLibOptDxe BaseMemoryLibOptDxe
BaseMemoryLibOptPei BaseMemoryLibOptPei
PeiMemoryLib PeiMemoryLib
DxeMemoryLib UefiMemoryLib
Copyright (c) 2006 - 2008, Intel Corporation<BR> Copyright (c) 2006 - 2009, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at

View File

@@ -8,10 +8,8 @@
BaseMemoryLibRepStr BaseMemoryLibRepStr
BaseMemoryLibOptDxe BaseMemoryLibOptDxe
BaseMemoryLibOptPei BaseMemoryLibOptPei
PeiMemoryLib
DxeMemoryLib
Copyright (c) 2006 - 2008, Intel Corporation<BR> Copyright (c) 2006 - 2009, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at
@@ -30,7 +28,6 @@
#include <Library/BaseLib.h> #include <Library/BaseLib.h>
#include <Library/DebugLib.h> #include <Library/DebugLib.h>
/** /**
Copy Length bytes from Source to Destination. Copy Length bytes from Source to Destination.
@@ -52,9 +49,9 @@ InternalMemCopyMem (
/** /**
Set Buffer to Value for Size bytes. Set Buffer to Value for Size bytes.
@param Buffer Memory to set. @param Buffer Memory to set.
@param Length Number of bytes to set @param Length Number of bytes to set
@param Value Value of the set operation. @param Value Value of the set operation.
@return Buffer @return Buffer
@@ -71,7 +68,7 @@ InternalMemSetMem (
Fills a target buffer with a 16-bit value, and returns the target buffer. Fills a target buffer with a 16-bit value, and returns the target buffer.
@param Buffer Pointer to the target buffer to fill. @param Buffer Pointer to the target buffer to fill.
@param Length Number of bytes in Buffer to fill. @param Length Count of 16-bit value to fill.
@param Value Value with which to fill Length bytes of Buffer. @param Value Value with which to fill Length bytes of Buffer.
@return Buffer @return Buffer
@@ -89,7 +86,7 @@ InternalMemSetMem16 (
Fills a target buffer with a 32-bit value, and returns the target buffer. Fills a target buffer with a 32-bit value, and returns the target buffer.
@param Buffer Pointer to the target buffer to fill. @param Buffer Pointer to the target buffer to fill.
@param Length Number of bytes in Buffer to fill. @param Length Count of 32-bit value to fill.
@param Value Value with which to fill Length bytes of Buffer. @param Value Value with which to fill Length bytes of Buffer.
@return Buffer @return Buffer
@@ -107,7 +104,7 @@ InternalMemSetMem32 (
Fills a target buffer with a 64-bit value, and returns the target buffer. Fills a target buffer with a 64-bit value, and returns the target buffer.
@param Buffer Pointer to the target buffer to fill. @param Buffer Pointer to the target buffer to fill.
@param Length Number of bytes in Buffer to fill. @param Length Count of 64-bit value to fill.
@param Value Value with which to fill Length bytes of Buffer. @param Value Value with which to fill Length bytes of Buffer.
@return Buffer @return Buffer
@@ -163,7 +160,7 @@ InternalMemCompareMem (
matching 8-bit value in the target buffer. matching 8-bit value in the target buffer.
@param Buffer Pointer to the target buffer to scan. @param Buffer Pointer to the target buffer to scan.
@param Length Number of bytes in Buffer to scan. Must be non-zero. @param Length Count of 8-bit value to scan. Must be non-zero.
@param Value Value to search for in the target buffer. @param Value Value to search for in the target buffer.
@return Pointer to the first occurrence or NULL if not found. @return Pointer to the first occurrence or NULL if not found.
@@ -182,7 +179,7 @@ InternalMemScanMem8 (
matching 16-bit value in the target buffer. matching 16-bit value in the target buffer.
@param Buffer Pointer to the target buffer to scan. @param Buffer Pointer to the target buffer to scan.
@param Length Number of bytes in Buffer to scan. Must be non-zero. @param Length Count of 16-bit value to scan. Must be non-zero.
@param Value Value to search for in the target buffer. @param Value Value to search for in the target buffer.
@return Pointer to the first occurrence or NULL if not found. @return Pointer to the first occurrence or NULL if not found.
@@ -201,7 +198,7 @@ InternalMemScanMem16 (
matching 32-bit value in the target buffer. matching 32-bit value in the target buffer.
@param Buffer Pointer to the target buffer to scan. @param Buffer Pointer to the target buffer to scan.
@param Length Number of bytes in Buffer to scan. Must be non-zero. @param Length Count of 32-bit value to scan. Must be non-zero.
@param Value Value to search for in the target buffer. @param Value Value to search for in the target buffer.
@return Pointer to the first occurrence or NULL if not found. @return Pointer to the first occurrence or NULL if not found.
@@ -220,7 +217,7 @@ InternalMemScanMem32 (
matching 64-bit value in the target buffer. matching 64-bit value in the target buffer.
@param Buffer Pointer to the target buffer to scan. @param Buffer Pointer to the target buffer to scan.
@param Length Number of bytes in Buffer to scan. Must be non-zero. @param Length Count of 64-bit value to scan. Must be non-zero.
@param Value Value to search for in the target buffer. @param Value Value to search for in the target buffer.
@return Pointer to the first occurrence or NULL if not found. @return Pointer to the first occurrence or NULL if not found.

View File

@@ -10,9 +10,9 @@
BaseMemoryLibOptDxe BaseMemoryLibOptDxe
BaseMemoryLibOptPei BaseMemoryLibOptPei
PeiMemoryLib PeiMemoryLib
DxeMemoryLib UefiMemoryLib
Copyright (c) 2006 - 2008, Intel Corporation<BR> Copyright (c) 2006 - 2009, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at

View File

@@ -9,9 +9,9 @@
BaseMemoryLibOptDxe BaseMemoryLibOptDxe
BaseMemoryLibOptPei BaseMemoryLibOptPei
PeiMemoryLib PeiMemoryLib
DxeMemoryLib UefiMemoryLib
Copyright (c) 2006 - 2008, Intel Corporation<BR> Copyright (c) 2006 - 2009, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at

View File

@@ -10,9 +10,9 @@
BaseMemoryLibOptDxe BaseMemoryLibOptDxe
BaseMemoryLibOptPei BaseMemoryLibOptPei
PeiMemoryLib PeiMemoryLib
DxeMemoryLib UefiMemoryLib
Copyright (c) 2006 - 2008, Intel Corporation<BR> Copyright (c) 2006 - 2009, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at

View File

@@ -10,9 +10,9 @@
BaseMemoryLibOptDxe BaseMemoryLibOptDxe
BaseMemoryLibOptPei BaseMemoryLibOptPei
PeiMemoryLib PeiMemoryLib
DxeMemoryLib UefiMemoryLib
Copyright (c) 2006 - 2008, Intel Corporation<BR> Copyright (c) 2006 - 2009, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at

View File

@@ -1,7 +1,17 @@
/** @file /** @file
SetMem16() implementation. SetMem16() implementation.
Copyright (c) 2006 - 2008, Intel Corporation<BR> The following BaseMemoryLib instances contain the same copy of this file:
BaseMemoryLib
BaseMemoryLibMmx
BaseMemoryLibSse2
BaseMemoryLibRepStr
BaseMemoryLibOptDxe
BaseMemoryLibOptPei
PeiMemoryLib
UefiMemoryLib
Copyright (c) 2006 - 2009, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at
@@ -10,22 +20,8 @@
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
The following BaseMemoryLib instances contains the same copy of this file:
BaseMemoryLib
BaseMemoryLibMmx
BaseMemoryLibSse2
BaseMemoryLibRepStr
BaseMemoryLibOptDxe
BaseMemoryLibOptPei
PeiMemoryLib
DxeMemoryLib
**/ **/
#include "MemLibInternals.h" #include "MemLibInternals.h"
/** /**

View File

@@ -1,7 +1,17 @@
/** @file /** @file
SetMem32() implementation. SetMem32() implementation.
Copyright (c) 2006 - 2008, Intel Corporation<BR> The following BaseMemoryLib instances contain the same copy of this file:
BaseMemoryLib
BaseMemoryLibMmx
BaseMemoryLibSse2
BaseMemoryLibRepStr
BaseMemoryLibOptDxe
BaseMemoryLibOptPei
PeiMemoryLib
UefiMemoryLib
Copyright (c) 2006 - 2009, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at
@@ -10,22 +20,8 @@
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
The following BaseMemoryLib instances contain the same copy of this file:
BaseMemoryLib
BaseMemoryLibMmx
BaseMemoryLibSse2
BaseMemoryLibRepStr
BaseMemoryLibOptDxe
BaseMemoryLibOptPei
PeiMemoryLib
DxeMemoryLib
**/ **/
#include "MemLibInternals.h" #include "MemLibInternals.h"
/** /**

View File

@@ -1,7 +1,17 @@
/** @file /** @file
SetMem64() implementation. SetMem64() implementation.
Copyright (c) 2006 - 2008, Intel Corporation<BR> The following BaseMemoryLib instances contain the same copy of this file:
BaseMemoryLib
BaseMemoryLibMmx
BaseMemoryLibSse2
BaseMemoryLibRepStr
BaseMemoryLibOptDxe
BaseMemoryLibOptPei
PeiMemoryLib
UefiMemoryLib
Copyright (c) 2006 - 2009, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at
@@ -10,22 +20,8 @@
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
The following BaseMemoryLib instances contain the same copy of this file:
BaseMemoryLib
BaseMemoryLibMmx
BaseMemoryLibSse2
BaseMemoryLibRepStr
BaseMemoryLibOptDxe
BaseMemoryLibOptPei
PeiMemoryLib
DxeMemoryLib
**/ **/
#include "MemLibInternals.h" #include "MemLibInternals.h"
/** /**

View File

@@ -10,9 +10,9 @@
BaseMemoryLibOptDxe BaseMemoryLibOptDxe
BaseMemoryLibOptPei BaseMemoryLibOptPei
PeiMemoryLib PeiMemoryLib
DxeMemoryLib UefiMemoryLib
Copyright (c) 2006 - 2008, Intel Corporation<BR> Copyright (c) 2006 - 2009, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at

View File

@@ -3,7 +3,7 @@
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# #
# Copyright (c) 2006 - 2008, Intel Corporation # Copyright (c) 2006 - 2009, Intel Corporation
# All rights reserved. This program and the accompanying materials # All rights reserved. This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License # are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at # which accompanies this distribution. The full text of the license may be found at
@@ -41,20 +41,19 @@
# IN CONST VOID *SourceBuffer, # IN CONST VOID *SourceBuffer,
# IN UINTN Length # IN UINTN Length
# ); # );
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
.intel_syntax noprefix
ASM_GLOBAL ASM_PFX(InternalMemCompareMem) ASM_GLOBAL ASM_PFX(InternalMemCompareMem)
ASM_PFX(InternalMemCompareMem): ASM_PFX(InternalMemCompareMem):
push rsi pushq %rsi
push rdi pushq %rdi
mov rsi, rcx movq %rcx, %rsi
mov rdi, rdx movq %rdx, %rdi
mov rcx, r8 movq %r8, %rcx
repe cmpsb repe cmpsb
movzx rax, byte ptr [rsi - 1] movzbq -1(%rsi) , %rax
movzx rdx, byte ptr [rdi - 1] movzbq -1(%rdi) , %rdx
sub rax, rdx sub %dl, %al
pop rdi popq %rdi
pop rsi popq %rsi
ret ret

View File

@@ -3,7 +3,7 @@
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# #
# Copyright (c) 2006 - 2008, Intel Corporation # Copyright (c) 2006 - 2009, Intel Corporation
# All rights reserved. This program and the accompanying materials # All rights reserved. This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License # are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at # which accompanies this distribution. The full text of the license may be found at
@@ -33,51 +33,50 @@
# IN UINTN Count # IN UINTN Count
# ) # )
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
.intel_syntax noprefix
ASM_GLOBAL ASM_PFX(InternalMemCopyMem) ASM_GLOBAL ASM_PFX(InternalMemCopyMem)
ASM_PFX(InternalMemCopyMem): ASM_PFX(InternalMemCopyMem):
push rsi pushq %rsi
push rdi pushq %rdi
mov rsi, rdx # rsi <- Source movq %rdx, %rsi # rsi <- Source
mov rdi, rcx # rdi <- Destination movq %rcx, %rdi # rdi <- Destination
lea r9, [rsi + r8 - 1] # r9 <- Last byte of Source leaq -1(%rsi,%r8,), %r9 # r9 <- Last byte of Source
cmp rsi, rdi cmpq %rdi, %rsi
mov rax, rdi # rax <- Destination as return value movq %rdi, %rax # rax <- Destination as return value
jae L0 # Copy forward if Source > Destination jae L0 # Copy forward if Source > Destination
cmp r9, rdi # Overlapped? cmpq %rdi, %r9 # Overlapped?
jae L_CopyBackward # Copy backward if overlapped jae L_CopyBackward # Copy backward if overlapped
L0: L0:
xor rcx, rcx xorq %rcx, %rcx
sub rcx, rdi # rcx <- -rdi subq %rdi, %rcx # rcx <- -rdi
and rcx, 15 # rcx + rsi should be 16 bytes aligned andq $15, %rcx # rcx + rsi should be 16 bytes aligned
jz L1 # skip if rcx == 0 jz L1 # skip if rcx == 0
cmp rcx, r8 cmpq %r8, %rcx
cmova rcx, r8 cmova %r8, %rcx
sub r8, rcx subq %rcx, %r8
rep movsb rep movsb
L1: L1:
mov rcx, r8 movq %r8, %rcx
and r8, 15 andq $15, %r8
shr rcx, 4 # rcx <- # of DQwords to copy shrq $4, %rcx # rcx <- # of DQwords to copy
jz L_CopyBytes jz L_CopyBytes
movdqa [rsp + 0x18], xmm0 # save xmm0 on stack movdqu %xmm0, 0x18(%rsp) # save xmm0 on stack
L2: L2:
movdqu xmm0, [rsi] # rsi may not be 16-byte aligned movdqu (%rsi), %xmm0 # rsi may not be 16-byte aligned
movntdq [rdi], xmm0 # rdi should be 16-byte aligned movntdq %xmm0, (%rdi) # rdi should be 16-byte aligned
add rsi, 16 addq $16, %rsi
add rdi, 16 addq $16, %rdi
loop L2 loop L2
mfence mfence
movdqa xmm0, [rsp + 0x18] # restore xmm0 movdqa 0x18(%rsp), %xmm0 # restore xmm0
jmp L_CopyBytes # copy remaining bytes jmp L_CopyBytes # copy remaining bytes
L_CopyBackward: L_CopyBackward:
mov rsi, r9 # rsi <- Last byte of Source movq %r9, %rsi # rsi <- Last byte of Source
lea rdi, [rdi + r8 - 1] # rdi <- Last byte of Destination leaq -1(%rdi, %r8,), %rdi # rdi <- Last byte of Destination
std std
L_CopyBytes: L_CopyBytes:
mov rcx, r8 movq %r8, %rcx
rep movsb rep movsb
cld cld
pop rdi popq %rdi
pop rsi popq %rsi
ret ret

View File

@@ -3,7 +3,7 @@
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# #
# Copyright (c) 2006 - 2008, Intel Corporation # Copyright (c) 2006 - 2009, Intel Corporation
# All rights reserved. This program and the accompanying materials # All rights reserved. This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License # are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at # which accompanies this distribution. The full text of the license may be found at
@@ -37,21 +37,20 @@
# CONST VOID * # CONST VOID *
# EFIAPI # EFIAPI
# InternalMemScanMem16 ( # InternalMemScanMem16 (
# IN CONST VOID *Buffer, # IN CONST VOID *Buffer,
# IN UINTN Length, # IN UINTN Length,
# IN UINT16 Value # IN UINT16 Value
# ); # );
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
.intel_syntax noprefix
ASM_GLOBAL ASM_PFX(InternalMemScanMem16) ASM_GLOBAL ASM_PFX(InternalMemScanMem16)
ASM_PFX(InternalMemScanMem16): ASM_PFX(InternalMemScanMem16):
push rdi pushq %rdi
mov rdi, rcx movq %rcx, %rdi
mov rax, r8 movq %r8, %rax
mov rcx, rdx movq %rdx, %rcx
repne scasw repne scasw
lea rax, [rdi - 2] leaq -2(%rdi), %rax
cmovnz rax, rcx cmovnz %rcx, %rax
pop rdi popq %rdi
ret ret

View File

@@ -3,7 +3,7 @@
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# #
# Copyright (c) 2006 - 2008, Intel Corporation # Copyright (c) 2006 - 2009, Intel Corporation
# All rights reserved. This program and the accompanying materials # All rights reserved. This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License # are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at # which accompanies this distribution. The full text of the license may be found at
@@ -42,16 +42,15 @@
# IN UINT32 Value # IN UINT32 Value
# ); # );
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
.intel_syntax noprefix
ASM_GLOBAL ASM_PFX(InternalMemScanMem32) ASM_GLOBAL ASM_PFX(InternalMemScanMem32)
ASM_PFX(InternalMemScanMem32): ASM_PFX(InternalMemScanMem32):
push rdi pushq %rdi
mov rdi, rcx movq %rcx, %rdi
mov rax, r8 movq %r8, %rax
mov rcx, rdx movq %rdx, %rcx
repne scasd repne scasl
lea rax, [rdi - 4] leaq -4(%rdi), %rax
cmovnz rax, rcx cmovnz %rcx, %rax
pop rdi popq %rdi
ret ret

View File

@@ -3,7 +3,7 @@
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# #
# Copyright (c) 2006 - 2008, Intel Corporation # Copyright (c) 2006 - 2009, Intel Corporation
# All rights reserved. This program and the accompanying materials # All rights reserved. This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License # are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at # which accompanies this distribution. The full text of the license may be found at
@@ -37,20 +37,19 @@
# CONST VOID * # CONST VOID *
# EFIAPI # EFIAPI
# InternalMemScanMem64 ( # InternalMemScanMem64 (
# IN CONST VOID *Buffer, # IN CONST VOID *Buffer,
# IN UINTN Length, # IN UINTN Length,
# IN UINT64 Value # IN UINT64 Value
# ); # );
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
.intel_syntax noprefix
ASM_GLOBAL ASM_PFX(InternalMemScanMem64) ASM_GLOBAL ASM_PFX(InternalMemScanMem64)
ASM_PFX(InternalMemScanMem64): ASM_PFX(InternalMemScanMem64):
push rdi pushq %rdi
mov rdi, rcx movq %rcx, %rdi
mov rax, r8 movq %r8, %rax
mov rcx, rdx movq %rdx, %rcx
repne scasq repne scasq
lea rax, [rdi - 8] leaq -8(%rdi), %rax
cmovnz rax, rcx cmovnz %rcx, %rax
pop rdi popq %rdi
ret ret

View File

@@ -3,7 +3,7 @@
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# #
# Copyright (c) 2006 - 2008, Intel Corporation # Copyright (c) 2006 - 2009, Intel Corporation
# All rights reserved. This program and the accompanying materials # All rights reserved. This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License # are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at # which accompanies this distribution. The full text of the license may be found at
@@ -37,21 +37,20 @@
# CONST VOID * # CONST VOID *
# EFIAPI # EFIAPI
# InternalMemScanMem8 ( # InternalMemScanMem8 (
# IN CONST VOID *Buffer, # IN CONST VOID *Buffer,
# IN UINTN Length, # IN UINTN Length,
# IN UINT8 Value # IN UINT8 Value
# ); # );
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
.intel_syntax noprefix
ASM_GLOBAL ASM_PFX(InternalMemScanMem8) ASM_GLOBAL ASM_PFX(InternalMemScanMem8)
ASM_PFX(InternalMemScanMem8): ASM_PFX(InternalMemScanMem8):
push rdi pushq %rdi
mov rdi, rcx movq %rcx, %rdi
mov rcx, rdx movq %rdx, %rcx
mov rax, r8 movq %r8, %rax
repne scasb repne scasb
lea rax, [rdi - 1] leaq -1(%rdi), %rax
cmovnz rax, rcx # set rax to 0 if not found cmovnz %rcx, %rax # set rax to 0 if not found
pop rdi popq %rdi
ret ret

View File

@@ -1,6 +1,6 @@
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# #
# Copyright (c) 2006 - 2008, Intel Corporation # Copyright (c) 2006 - 2009, Intel Corporation
# All rights reserved. This program and the accompanying materials # All rights reserved. This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License # are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at # which accompanies this distribution. The full text of the license may be found at
@@ -29,30 +29,29 @@
# IN UINT8 Value # IN UINT8 Value
# ) # )
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
.intel_syntax noprefix
ASM_GLOBAL ASM_PFX(InternalMemSetMem) ASM_GLOBAL ASM_PFX(InternalMemSetMem)
ASM_PFX(InternalMemSetMem): ASM_PFX(InternalMemSetMem):
push rdi pushq %rdi
push rbx pushq %rbx
push rcx # push Buffer pushq %rcx # push Buffer
mov rax, r8 # rax = Value movq %r8, %rax # rax = Value
and rax, 0xff # rax = lower 8 bits of r8, upper 56 bits are 0 andq $0xff, %rax # rax = lower 8 bits of r8, upper 56 bits are 0
mov ah, al # ah = al movb %al, %ah # ah = al
mov bx, ax # bx = ax movw %ax, %bx # bx = ax
shl rax, 0x10 # rax = ax << 16 shlq $0x10, %rax # rax = ax << 16
mov ax, bx # ax = bx movw %bx, %ax # ax = bx
mov rbx, rax # ebx = eax movq %rax, %rbx # ebx = eax
shl rax, 0x20 # rax = rax << 32 shlq $0x20, %rax # rax = rax << 32
or rax, rbx # eax = ebx orq %rbx, %rax # eax = ebx
mov rdi, rcx # rdi = Buffer movq %rcx, %rdi # rdi = Buffer
mov rcx, rdx # rcx = Count movq %rdx, %rcx # rcx = Count
shr rcx, 3 # rcx = rcx / 8 shrq $3, %rcx # rcx = rcx / 8
cld cld
rep stosq rep stosq
mov rcx, rdx # rcx = rdx movq %rdx, %rcx # rcx = rdx
and rcx, 7 # rcx = rcx & 7 andq $7, %rcx # rcx = rcx & 7
rep stosb rep stosb
pop rax # rax = Buffer popq %rax # rax = Buffer
pop rbx popq %rbx
pop rdi popq %rdi
ret ret

View File

@@ -3,7 +3,7 @@
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# #
# Copyright (c) 2006 - 2008, Intel Corporation # Copyright (c) 2006 - 2009, Intel Corporation
# All rights reserved. This program and the accompanying materials # All rights reserved. This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License # are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at # which accompanies this distribution. The full text of the license may be found at
@@ -34,15 +34,14 @@
# IN UINT16 Value # IN UINT16 Value
# ) # )
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
.intel_syntax noprefix
ASM_GLOBAL ASM_PFX(InternalMemSetMem16) ASM_GLOBAL ASM_PFX(InternalMemSetMem16)
ASM_PFX(InternalMemSetMem16): ASM_PFX(InternalMemSetMem16):
push rdi pushq %rdi
mov rdi, rcx movq %rcx, %rdi
mov rax, r8 movq %r8, %rax
xchg rcx, rdx xchg %rdx, %rcx
rep stosw rep stosw
mov rax, rdx movq %rdx, %rax
pop rdi popq %rdi
ret ret

View File

@@ -3,7 +3,7 @@
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# #
# Copyright (c) 2006 - 2008, Intel Corporation # Copyright (c) 2006 - 2009, Intel Corporation
# All rights reserved. This program and the accompanying materials # All rights reserved. This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License # are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at # which accompanies this distribution. The full text of the license may be found at
@@ -34,15 +34,14 @@
# IN UINT32 Value # IN UINT32 Value
# ); # );
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
.intel_syntax noprefix
ASM_GLOBAL ASM_PFX(InternalMemSetMem32) ASM_GLOBAL ASM_PFX(InternalMemSetMem32)
ASM_PFX(InternalMemSetMem32): ASM_PFX(InternalMemSetMem32):
push rdi pushq %rdi
mov rdi, rcx movq %rcx, %rdi
mov rax, r8 movq %r8, %rax
xchg rcx, rdx xchgq %rdx, %rcx
rep stosd rep stosl
mov rax, rdx movq %rdx, %rax
pop rdi popq %rdi
ret ret

View File

@@ -3,7 +3,7 @@
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# #
# Copyright (c) 2006 - 2008, Intel Corporation # Copyright (c) 2006 - 2009, Intel Corporation
# All rights reserved. This program and the accompanying materials # All rights reserved. This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License # are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at # which accompanies this distribution. The full text of the license may be found at
@@ -33,15 +33,14 @@
# IN UINT64 Value # IN UINT64 Value
# ) # )
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
.intel_syntax noprefix
ASM_GLOBAL ASM_PFX(InternalMemSetMem64) ASM_GLOBAL ASM_PFX(InternalMemSetMem64)
ASM_PFX(InternalMemSetMem64): ASM_PFX(InternalMemSetMem64):
push rdi pushq %rdi
mov rdi, rcx movq %rcx, %rdi
mov rax, r8 movq %r8, %rax
xchg rcx, rdx xchg %rdx, %rcx
rep stosq rep stosq
mov rax, rdx movq %rdx, %rax
pop rdi popq %rdi
ret ret

View File

@@ -3,7 +3,7 @@
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# #
# Copyright (c) 2006 - 2008, Intel Corporation # Copyright (c) 2006 - 2009, Intel Corporation
# All rights reserved. This program and the accompanying materials # All rights reserved. This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License # are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at # which accompanies this distribution. The full text of the license may be found at
@@ -32,21 +32,20 @@
# IN UINTN Count # IN UINTN Count
# ); # );
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
.intel_syntax noprefix
ASM_GLOBAL ASM_PFX(InternalMemZeroMem) ASM_GLOBAL ASM_PFX(InternalMemZeroMem)
ASM_PFX(InternalMemZeroMem): ASM_PFX(InternalMemZeroMem):
push rdi pushq %rdi
push rcx pushq %rcx
xor rax, rax xorq %rax, %rax
mov rdi, rcx movq %rcx, %rdi
mov rcx, rdx movq %rdx, %rcx
shr rcx, 3 shrq $3, %rcx
and rdx, 7 andq $7, %rdx
cld cld
rep stosq rep stosq
mov rcx, rdx movq %rdx, %rcx
rep stosb rep stosb
pop rax popq %rax
pop rdi popq %rdi
ret ret

View File

@@ -10,9 +10,9 @@
BaseMemoryLibOptDxe BaseMemoryLibOptDxe
BaseMemoryLibOptPei BaseMemoryLibOptPei
PeiMemoryLib PeiMemoryLib
DxeMemoryLib UefiMemoryLib
Copyright (c) 2006 - 2008 , Intel Corporation<BR> Copyright (c) 2006 - 2009 , Intel Corporation<BR>
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at
@@ -48,8 +48,5 @@ ZeroMem (
{ {
ASSERT (!(Buffer == NULL && Length > 0)); ASSERT (!(Buffer == NULL && Length > 0));
ASSERT (Length <= (MAX_ADDRESS - (UINTN)Buffer + 1)); ASSERT (Length <= (MAX_ADDRESS - (UINTN)Buffer + 1));
if (Length == 0) {
return Buffer;
}
return InternalMemZeroMem (Buffer, Length); return InternalMemZeroMem (Buffer, Length);
} }

View File

@@ -2,7 +2,6 @@
CompareMem() implementation. CompareMem() implementation.
The following BaseMemoryLib instances contain the same copy of this file: The following BaseMemoryLib instances contain the same copy of this file:
BaseMemoryLib BaseMemoryLib
BaseMemoryLibMmx BaseMemoryLibMmx
BaseMemoryLibSse2 BaseMemoryLibSse2
@@ -10,9 +9,9 @@
BaseMemoryLibOptDxe BaseMemoryLibOptDxe
BaseMemoryLibOptPei BaseMemoryLibOptPei
PeiMemoryLib PeiMemoryLib
DxeMemoryLib UefiMemoryLib
Copyright (c) 2006 - 2008, Intel Corporation Copyright (c) 2006 - 2009, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at

View File

@@ -10,9 +10,9 @@
BaseMemoryLibOptDxe BaseMemoryLibOptDxe
BaseMemoryLibOptPei BaseMemoryLibOptPei
PeiMemoryLib PeiMemoryLib
DxeMemoryLib UefiMemoryLib
Copyright (c) 2006 - 2008, Intel Corporation<BR> Copyright (c) 2006 - 2009, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at

View File

@@ -10,9 +10,9 @@
BaseMemoryLibOptDxe BaseMemoryLibOptDxe
BaseMemoryLibOptPei BaseMemoryLibOptPei
PeiMemoryLib PeiMemoryLib
DxeMemoryLib UefiMemoryLib
Copyright (c) 2006 - 2008, Intel Corporation<BR> Copyright (c) 2006 - 2009, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at

View File

@@ -8,10 +8,8 @@
BaseMemoryLibRepStr BaseMemoryLibRepStr
BaseMemoryLibOptDxe BaseMemoryLibOptDxe
BaseMemoryLibOptPei BaseMemoryLibOptPei
PeiMemoryLib
DxeMemoryLib
Copyright (c) 2006 - 2008, Intel Corporation<BR> Copyright (c) 2006 - 2009, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at
@@ -30,13 +28,12 @@
#include <Library/BaseLib.h> #include <Library/BaseLib.h>
#include <Library/DebugLib.h> #include <Library/DebugLib.h>
/** /**
Copy Length bytes from Source to Destination. Copy Length bytes from Source to Destination.
@param DestinationBuffer Target of copy @param DestinationBuffer Target of copy
@param SourceBuffer Place to copy from @param SourceBuffer Place to copy from
@param Length Number of bytes to copy @param Length Number of bytes to copy
@return Destination @return Destination
@@ -52,9 +49,9 @@ InternalMemCopyMem (
/** /**
Set Buffer to Value for Size bytes. Set Buffer to Value for Size bytes.
@param Buffer Memory to set. @param Buffer Memory to set.
@param Length Number of bytes to set @param Length Number of bytes to set
@param Value Value of the set operation. @param Value Value of the set operation.
@return Buffer @return Buffer
@@ -71,7 +68,7 @@ InternalMemSetMem (
Fills a target buffer with a 16-bit value, and returns the target buffer. Fills a target buffer with a 16-bit value, and returns the target buffer.
@param Buffer Pointer to the target buffer to fill. @param Buffer Pointer to the target buffer to fill.
@param Length Number of bytes in Buffer to fill. @param Length Count of 16-bit value to fill.
@param Value Value with which to fill Length bytes of Buffer. @param Value Value with which to fill Length bytes of Buffer.
@return Buffer @return Buffer
@@ -89,7 +86,7 @@ InternalMemSetMem16 (
Fills a target buffer with a 32-bit value, and returns the target buffer. Fills a target buffer with a 32-bit value, and returns the target buffer.
@param Buffer Pointer to the target buffer to fill. @param Buffer Pointer to the target buffer to fill.
@param Length Number of bytes in Buffer to fill. @param Length Count of 32-bit value to fill.
@param Value Value with which to fill Length bytes of Buffer. @param Value Value with which to fill Length bytes of Buffer.
@return Buffer @return Buffer
@@ -107,7 +104,7 @@ InternalMemSetMem32 (
Fills a target buffer with a 64-bit value, and returns the target buffer. Fills a target buffer with a 64-bit value, and returns the target buffer.
@param Buffer Pointer to the target buffer to fill. @param Buffer Pointer to the target buffer to fill.
@param Length Number of bytes in Buffer to fill. @param Length Count of 64-bit value to fill.
@param Value Value with which to fill Length bytes of Buffer. @param Value Value with which to fill Length bytes of Buffer.
@return Buffer @return Buffer
@@ -163,7 +160,7 @@ InternalMemCompareMem (
matching 8-bit value in the target buffer. matching 8-bit value in the target buffer.
@param Buffer Pointer to the target buffer to scan. @param Buffer Pointer to the target buffer to scan.
@param Length Number of bytes in Buffer to scan. Must be non-zero. @param Length Count of 8-bit value to scan. Must be non-zero.
@param Value Value to search for in the target buffer. @param Value Value to search for in the target buffer.
@return Pointer to the first occurrence or NULL if not found. @return Pointer to the first occurrence or NULL if not found.
@@ -182,7 +179,7 @@ InternalMemScanMem8 (
matching 16-bit value in the target buffer. matching 16-bit value in the target buffer.
@param Buffer Pointer to the target buffer to scan. @param Buffer Pointer to the target buffer to scan.
@param Length Number of bytes in Buffer to scan. Must be non-zero. @param Length Count of 16-bit value to scan. Must be non-zero.
@param Value Value to search for in the target buffer. @param Value Value to search for in the target buffer.
@return Pointer to the first occurrence or NULL if not found. @return Pointer to the first occurrence or NULL if not found.
@@ -201,7 +198,7 @@ InternalMemScanMem16 (
matching 32-bit value in the target buffer. matching 32-bit value in the target buffer.
@param Buffer Pointer to the target buffer to scan. @param Buffer Pointer to the target buffer to scan.
@param Length Number of bytes in Buffer to scan. Must be non-zero. @param Length Count of 32-bit value to scan. Must be non-zero.
@param Value Value to search for in the target buffer. @param Value Value to search for in the target buffer.
@return Pointer to the first occurrence or NULL if not found. @return Pointer to the first occurrence or NULL if not found.
@@ -220,7 +217,7 @@ InternalMemScanMem32 (
matching 64-bit value in the target buffer. matching 64-bit value in the target buffer.
@param Buffer Pointer to the target buffer to scan. @param Buffer Pointer to the target buffer to scan.
@param Length Number of bytes in Buffer to scan. Must be non-zero. @param Length Count of 64-bit value to scan. Must be non-zero.
@param Value Value to search for in the target buffer. @param Value Value to search for in the target buffer.
@return Pointer to the first occurrence or NULL if not found. @return Pointer to the first occurrence or NULL if not found.

View File

@@ -10,9 +10,9 @@
BaseMemoryLibOptDxe BaseMemoryLibOptDxe
BaseMemoryLibOptPei BaseMemoryLibOptPei
PeiMemoryLib PeiMemoryLib
DxeMemoryLib UefiMemoryLib
Copyright (c) 2006 - 2008, Intel Corporation<BR> Copyright (c) 2006 - 2009, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at

View File

@@ -9,9 +9,9 @@
BaseMemoryLibOptDxe BaseMemoryLibOptDxe
BaseMemoryLibOptPei BaseMemoryLibOptPei
PeiMemoryLib PeiMemoryLib
DxeMemoryLib UefiMemoryLib
Copyright (c) 2006 - 2008, Intel Corporation<BR> Copyright (c) 2006 - 2009, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at

View File

@@ -10,9 +10,9 @@
BaseMemoryLibOptDxe BaseMemoryLibOptDxe
BaseMemoryLibOptPei BaseMemoryLibOptPei
PeiMemoryLib PeiMemoryLib
DxeMemoryLib UefiMemoryLib
Copyright (c) 2006 - 2008, Intel Corporation<BR> Copyright (c) 2006 - 2009, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at

View File

@@ -10,9 +10,9 @@
BaseMemoryLibOptDxe BaseMemoryLibOptDxe
BaseMemoryLibOptPei BaseMemoryLibOptPei
PeiMemoryLib PeiMemoryLib
DxeMemoryLib UefiMemoryLib
Copyright (c) 2006 - 2008, Intel Corporation<BR> Copyright (c) 2006 - 2009, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at

View File

@@ -1,7 +1,17 @@
/** @file /** @file
SetMem16() implementation. SetMem16() implementation.
Copyright (c) 2006 - 2008, Intel Corporation<BR> The following BaseMemoryLib instances contain the same copy of this file:
BaseMemoryLib
BaseMemoryLibMmx
BaseMemoryLibSse2
BaseMemoryLibRepStr
BaseMemoryLibOptDxe
BaseMemoryLibOptPei
PeiMemoryLib
UefiMemoryLib
Copyright (c) 2006 - 2009, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at
@@ -10,22 +20,8 @@
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
The following BaseMemoryLib instances contain the same copy of this file:
BaseMemoryLib
BaseMemoryLibMmx
BaseMemoryLibSse2
BaseMemoryLibRepStr
BaseMemoryLibOptDxe
BaseMemoryLibOptPei
PeiMemoryLib
DxeMemoryLib
**/ **/
#include "MemLibInternals.h" #include "MemLibInternals.h"
/** /**

View File

@@ -1,7 +1,17 @@
/** @file /** @file
SetMem32() implementation. SetMem32() implementation.
Copyright (c) 2006 - 2008, Intel Corporation<BR> The following BaseMemoryLib instances contain the same copy of this file:
BaseMemoryLib
BaseMemoryLibMmx
BaseMemoryLibSse2
BaseMemoryLibRepStr
BaseMemoryLibOptDxe
BaseMemoryLibOptPei
PeiMemoryLib
UefiMemoryLib
Copyright (c) 2006 - 2009, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at
@@ -10,22 +20,8 @@
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
The following BaseMemoryLib instances contain the same copy of this file:
BaseMemoryLib
BaseMemoryLibMmx
BaseMemoryLibSse2
BaseMemoryLibRepStr
BaseMemoryLibOptDxe
BaseMemoryLibOptPei
PeiMemoryLib
DxeMemoryLib
**/ **/
#include "MemLibInternals.h" #include "MemLibInternals.h"
/** /**

View File

@@ -1,7 +1,17 @@
/** @file /** @file
SetMem64() implementation. SetMem64() implementation.
Copyright (c) 2006 - 2008, Intel Corporation<BR> The following BaseMemoryLib instances contain the same copy of this file:
BaseMemoryLib
BaseMemoryLibMmx
BaseMemoryLibSse2
BaseMemoryLibRepStr
BaseMemoryLibOptDxe
BaseMemoryLibOptPei
PeiMemoryLib
UefiMemoryLib
Copyright (c) 2006 - 2009, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at
@@ -10,22 +20,8 @@
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
The following BaseMemoryLib instances contain the same copy of this file:
BaseMemoryLib
BaseMemoryLibMmx
BaseMemoryLibSse2
BaseMemoryLibRepStr
BaseMemoryLibOptDxe
BaseMemoryLibOptPei
PeiMemoryLib
DxeMemoryLib
**/ **/
#include "MemLibInternals.h" #include "MemLibInternals.h"
/** /**

View File

@@ -10,9 +10,9 @@
BaseMemoryLibOptDxe BaseMemoryLibOptDxe
BaseMemoryLibOptPei BaseMemoryLibOptPei
PeiMemoryLib PeiMemoryLib
DxeMemoryLib UefiMemoryLib
Copyright (c) 2006 - 2008, Intel Corporation<BR> Copyright (c) 2006 - 2009, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at

View File

@@ -3,7 +3,7 @@
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# #
# Copyright (c) 2006 - 2008, Intel Corporation # Copyright (c) 2006 - 2009, Intel Corporation
# All rights reserved. This program and the accompanying materials # All rights reserved. This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License # are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at # which accompanies this distribution. The full text of the license may be found at
@@ -42,19 +42,18 @@
# IN UINTN Length # IN UINTN Length
# ); # );
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
.intel_syntax noprefix
ASM_GLOBAL ASM_PFX(InternalMemCompareMem) ASM_GLOBAL ASM_PFX(InternalMemCompareMem)
ASM_PFX(InternalMemCompareMem): ASM_PFX(InternalMemCompareMem):
push rsi pushq %rsi
push rdi pushq %rdi
mov rsi, rcx movq %rcx, %rsi
mov rdi, rdx movq %rdx, %rdi
mov rcx, r8 movq %r8, %rcx
repe cmpsb repe cmpsb
movzx rax, byte ptr [rsi - 1] movzbq -1(%rsi) , %rax
movzx rdx, byte ptr [rdi - 1] movzbq -1(%rdi) , %rdx
sub rax, rdx subq %rdx, %rax
pop rdi popq %rdi
pop rsi popq %rsi
ret ret

View File

@@ -3,7 +3,7 @@
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# #
# Copyright (c) 2006 - 2008, Intel Corporation # Copyright (c) 2006 - 2009, Intel Corporation
# All rights reserved. This program and the accompanying materials # All rights reserved. This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License # are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at # which accompanies this distribution. The full text of the license may be found at
@@ -34,34 +34,33 @@
# IN UINTN Count # IN UINTN Count
# ) # )
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
.intel_syntax noprefix
ASM_GLOBAL ASM_PFX(InternalMemCopyMem) ASM_GLOBAL ASM_PFX(InternalMemCopyMem)
ASM_PFX(InternalMemCopyMem): ASM_PFX(InternalMemCopyMem):
push rsi pushq %rsi
push rdi pushq %rdi
mov rsi, rdx # rsi <- Source movq %rdx, %rsi # rsi <- Source
mov rdi, rcx # rdi <- Destination movq %rcx, %rdi # rdi <- Destination
lea r9, [rsi + r8 - 1] # r9 <- End of Source leaq -1(%rsi, %r8,), %r9 # r9 <- End of Source
cmp rsi, rdi cmpq %rdi, %rsi
mov rax, rdi # rax <- Destination as return value movq %rdi, %rax # rax <- Destination as return value
jae _InternalMemCopyMem_al_0000 jae _InternalMemCopyMem_al_0000
cmp r9, rdi cmpq %rdi, %r9
jae _atSym_CopyBackward # Copy backward if overlapped jae _atSym_CopyBackward # Copy backward if overlapped
_InternalMemCopyMem_al_0000: _InternalMemCopyMem_al_0000:
mov rcx, r8 movq %r8, %rcx
and r8, 7 andq $7, %r8
shr rcx, 3 shrq $3, %rcx
rep movsq # Copy as many Qwords as possible rep movsq # Copy as many Qwords as possible
jmp _atSym_CopyBytes jmp _atSym_CopyBytes
_atSym_CopyBackward: _atSym_CopyBackward:
mov rsi, r9 # rsi <- End of Source movq %r9, %rsi # rsi <- End of Source
lea rdi, [rdi + r8 - 1] # esi <- End of Destination leaq -1(%rdi, %r8), %rdi # rdi <- End of Destination
std # set direction flag std # set direction flag
_atSym_CopyBytes: _atSym_CopyBytes:
mov rcx, r8 movq %r8, %rcx
rep movsb # Copy bytes backward rep movsb # Copy bytes backward
cld cld
pop rdi popq %rdi
pop rsi popq %rsi
ret ret

View File

@@ -3,7 +3,7 @@
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# #
# Copyright (c) 2006 - 2008, Intel Corporation # Copyright (c) 2006 - 2009, Intel Corporation
# All rights reserved. This program and the accompanying materials # All rights reserved. This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License # are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at # which accompanies this distribution. The full text of the license may be found at
@@ -42,16 +42,15 @@
# IN UINT16 Value # IN UINT16 Value
# ); # );
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
.intel_syntax noprefix
ASM_GLOBAL ASM_PFX(InternalMemScanMem16) ASM_GLOBAL ASM_PFX(InternalMemScanMem16)
ASM_PFX(InternalMemScanMem16): ASM_PFX(InternalMemScanMem16):
push rdi pushq %rdi
mov rdi, rcx movq %rcx, %rdi
mov rax, r8 movq %rdx, %rcx
mov rcx, rdx movq %r8, %rax
repne scasw repne scasw
lea rax, [rdi - 2] leaq -2(%rdi), %rax
cmovnz rax, rcx cmovnz %rcx, %rax # set rax to 0 if not found
pop rdi popq %rdi
ret ret

View File

@@ -3,7 +3,7 @@
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# #
# Copyright (c) 2006 - 2008, Intel Corporation # Copyright (c) 2006 - 2009, Intel Corporation
# All rights reserved. This program and the accompanying materials # All rights reserved. This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License # are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at # which accompanies this distribution. The full text of the license may be found at
@@ -42,16 +42,15 @@
# IN UINT32 Value # IN UINT32 Value
# ); # );
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
.intel_syntax noprefix
ASM_GLOBAL ASM_PFX(InternalMemScanMem32) ASM_GLOBAL ASM_PFX(InternalMemScanMem32)
ASM_PFX(InternalMemScanMem32): ASM_PFX(InternalMemScanMem32):
push rdi pushq %rdi
mov rdi, rcx movq %rcx, %rdi
mov rax, r8 movq %rdx, %rcx
mov rcx, rdx movq %r8, %rax
repne scasd repne scasl
lea rax, [rdi - 4] leaq -4(%rdi), %rax
cmovnz rax, rcx cmovnz %rcx, %rax # set rax to 0 if not found
pop rdi popq %rdi
ret ret

View File

@@ -3,7 +3,7 @@
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# #
# Copyright (c) 2006 - 2008, Intel Corporation # Copyright (c) 2006 - 2009, Intel Corporation
# All rights reserved. This program and the accompanying materials # All rights reserved. This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License # are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at # which accompanies this distribution. The full text of the license may be found at
@@ -42,16 +42,15 @@
# IN UINT64 Value # IN UINT64 Value
# ); # );
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
.intel_syntax noprefix
ASM_GLOBAL ASM_PFX(InternalMemScanMem64) ASM_GLOBAL ASM_PFX(InternalMemScanMem64)
ASM_PFX(InternalMemScanMem64): ASM_PFX(InternalMemScanMem64):
push rdi pushq %rdi
mov rdi, rcx movq %rcx, %rdi
mov rax, r8 movq %rdx, %rcx
mov rcx, rdx movq %r8, %rax
repne scasq repne scasq
lea rax, [rdi - 8] leaq -8(%rdi), %rax
cmovnz rax, rcx cmovnz %rcx, %rax # set rax to 0 if not found
pop rdi popq %rdi
ret ret

View File

@@ -3,7 +3,7 @@
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# #
# Copyright (c) 2006 - 2008, Intel Corporation # Copyright (c) 2006 - 2009, Intel Corporation
# All rights reserved. This program and the accompanying materials # All rights reserved. This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License # are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at # which accompanies this distribution. The full text of the license may be found at
@@ -42,16 +42,15 @@
# IN UINT8 Value # IN UINT8 Value
# ); # );
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
.intel_syntax noprefix
ASM_GLOBAL ASM_PFX(InternalMemScanMem8) ASM_GLOBAL ASM_PFX(InternalMemScanMem8)
ASM_PFX(InternalMemScanMem8): ASM_PFX(InternalMemScanMem8):
push rdi pushq %rdi
mov rdi, rcx movq %rcx, %rdi
mov rcx, rdx movq %rdx, %rcx
mov rax, r8 movq %r8, %rax
repne scasb repne scasb
lea rax, [rdi - 1] leaq -1(%rdi), %rax
cmovnz rax, rcx # set rax to 0 if not found cmovnz %rcx, %rax # set rax to 0 if not found
pop rdi popq %rdi
ret ret

View File

@@ -3,7 +3,7 @@
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# #
# Copyright (c) 2006 - 2008, Intel Corporation # Copyright (c) 2006 - 2009, Intel Corporation
# All rights reserved. This program and the accompanying materials # All rights reserved. This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License # are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at # which accompanies this distribution. The full text of the license may be found at
@@ -34,15 +34,14 @@
# IN UINT8 Value # IN UINT8 Value
# ) # )
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
.intel_syntax noprefix
ASM_GLOBAL ASM_PFX(InternalMemSetMem) ASM_GLOBAL ASM_PFX(InternalMemSetMem)
ASM_PFX(InternalMemSetMem): ASM_PFX(InternalMemSetMem):
push rdi pushq %rdi
mov rax, r8 # rax = Value movq %r8, %rax # rax = Value
mov rdi, rcx # rdi = Buffer movq %rcx, %rdi # rdi = Buffer
xchg rcx, rdx # rcx = Count, rdx = Buffer xchgq %rdx, %rcx # rcx = Count, rdx = Buffer
rep stosb rep stosb
mov rax, rdx # rax = Buffer movq %rdx, %rax # rax = Buffer
pop rdi popq %rdi
ret ret

View File

@@ -3,7 +3,7 @@
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# #
# Copyright (c) 2006 - 2008, Intel Corporation # Copyright (c) 2006 - 2009, Intel Corporation
# All rights reserved. This program and the accompanying materials # All rights reserved. This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License # are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at # which accompanies this distribution. The full text of the license may be found at
@@ -34,15 +34,14 @@
# IN UINT16 Value # IN UINT16 Value
# ) # )
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
.intel_syntax noprefix
ASM_GLOBAL ASM_PFX(InternalMemSetMem16) ASM_GLOBAL ASM_PFX(InternalMemSetMem16)
ASM_PFX(InternalMemSetMem16): ASM_PFX(InternalMemSetMem16):
push rdi pushq %rdi
mov rdi, rcx movq %rcx, %rdi
mov rax, r8 movq %r8, %rax
xchg rcx, rdx xchgq %rdx, %rcx
rep stosw rep stosw
mov rax, rdx movq %rdx, %rax
pop rdi popq %rdi
ret ret

View File

@@ -3,7 +3,7 @@
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# #
# Copyright (c) 2006 - 2008, Intel Corporation # Copyright (c) 2006 - 2009, Intel Corporation
# All rights reserved. This program and the accompanying materials # All rights reserved. This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License # are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at # which accompanies this distribution. The full text of the license may be found at
@@ -34,15 +34,14 @@
# IN UINT32 Value # IN UINT32 Value
# ); # );
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
.intel_syntax noprefix
ASM_GLOBAL ASM_PFX(InternalMemSetMem32) ASM_GLOBAL ASM_PFX(InternalMemSetMem32)
ASM_PFX(InternalMemSetMem32): ASM_PFX(InternalMemSetMem32):
push rdi pushq %rdi
mov rdi, rcx movq %rcx, %rdi
mov rax, r8 movq %r8, %rax
xchg rcx, rdx xchgq %rdx, %rcx
rep stosd rep stosl
mov rax, rdx movq %rdx, %rax
pop rdi popq %rdi
ret ret

View File

@@ -3,7 +3,7 @@
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# #
# Copyright (c) 2006 - 2008, Intel Corporation # Copyright (c) 2006 - 2009, Intel Corporation
# All rights reserved. This program and the accompanying materials # All rights reserved. This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License # are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at # which accompanies this distribution. The full text of the license may be found at
@@ -33,15 +33,14 @@
# IN UINT64 Value # IN UINT64 Value
# ) # )
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
.intel_syntax noprefix
ASM_GLOBAL ASM_PFX(InternalMemSetMem64) ASM_GLOBAL ASM_PFX(InternalMemSetMem64)
ASM_PFX(InternalMemSetMem64): ASM_PFX(InternalMemSetMem64):
push rdi pushq %rdi
mov rdi, rcx movq %rcx, %rdi
mov rax, r8 movq %r8, %rax
xchg rcx, rdx xchgq %rdx, %rcx
rep stosq rep stosq
mov rax, rdx movw %rdx, %rax
pop rdi popq %rdi
ret ret

View File

@@ -3,7 +3,7 @@
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# #
# Copyright (c) 2006 - 2008, Intel Corporation # Copyright (c) 2006 - 2009, Intel Corporation
# All rights reserved. This program and the accompanying materials # All rights reserved. This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License # are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at # which accompanies this distribution. The full text of the license may be found at
@@ -32,20 +32,19 @@
# IN UINTN Count # IN UINTN Count
# ); # );
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
.intel_syntax noprefix
ASM_GLOBAL ASM_PFX(InternalMemZeroMem) ASM_GLOBAL ASM_PFX(InternalMemZeroMem)
ASM_PFX(InternalMemZeroMem): ASM_PFX(InternalMemZeroMem):
push rdi pushq %rdi
push rcx pushq %rcx
xor rax, rax xorq %rax, %rax
mov rdi, rcx movq %rcx, %rdi
mov rcx, rdx movq %rdx, %rcx
shr rcx, 3 shrq $3, %rcx
and rdx, 7 andq $7, %rdx
rep stosq rep stosq
mov ecx, edx movl %edx, %ecx
rep stosb rep stosb
pop rax popq %rax
pop rdi popq %rdi
ret ret

View File

@@ -10,9 +10,9 @@
BaseMemoryLibOptDxe BaseMemoryLibOptDxe
BaseMemoryLibOptPei BaseMemoryLibOptPei
PeiMemoryLib PeiMemoryLib
DxeMemoryLib UefiMemoryLib
Copyright (c) 2006 - 2008 , Intel Corporation<BR> Copyright (c) 2006 - 2009 , Intel Corporation<BR>
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at
@@ -48,6 +48,5 @@ ZeroMem (
{ {
ASSERT (!(Buffer == NULL && Length > 0)); ASSERT (!(Buffer == NULL && Length > 0));
ASSERT (Length <= (MAX_ADDRESS - (UINTN)Buffer + 1)); ASSERT (Length <= (MAX_ADDRESS - (UINTN)Buffer + 1));
return InternalMemZeroMem (Buffer, Length); return InternalMemZeroMem (Buffer, Length);
} }

View File

@@ -9,16 +9,16 @@
BaseMemoryLibOptDxe BaseMemoryLibOptDxe
BaseMemoryLibOptPei BaseMemoryLibOptPei
PeiMemoryLib PeiMemoryLib
DxeMemoryLib UefiMemoryLib
Copyright (c) 2006 - 2008, Intel Corporation<BR> Copyright (c) 2006 - 2009, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/ **/

View File

@@ -10,9 +10,9 @@
BaseMemoryLibOptDxe BaseMemoryLibOptDxe
BaseMemoryLibOptPei BaseMemoryLibOptPei
PeiMemoryLib PeiMemoryLib
DxeMemoryLib UefiMemoryLib
Copyright (c) 2006 - 2008, Intel Corporation<BR> Copyright (c) 2006 - 2009, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at

View File

@@ -10,9 +10,9 @@
BaseMemoryLibOptDxe BaseMemoryLibOptDxe
BaseMemoryLibOptPei BaseMemoryLibOptPei
PeiMemoryLib PeiMemoryLib
DxeMemoryLib UefiMemoryLib
Copyright (c) 2006 - 2008, Intel Corporation<BR> Copyright (c) 2006 - 2009, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at

View File

@@ -8,10 +8,8 @@
BaseMemoryLibRepStr BaseMemoryLibRepStr
BaseMemoryLibOptDxe BaseMemoryLibOptDxe
BaseMemoryLibOptPei BaseMemoryLibOptPei
PeiMemoryLib
DxeMemoryLib
Copyright (c) 2006 - 2008, Intel Corporation<BR> Copyright (c) 2006 - 2009, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at
@@ -30,13 +28,12 @@
#include <Library/BaseLib.h> #include <Library/BaseLib.h>
#include <Library/DebugLib.h> #include <Library/DebugLib.h>
/** /**
Copy Length bytes from Source to Destination. Copy Length bytes from Source to Destination.
@param DestinationBuffer Target of copy @param DestinationBuffer Target of copy
@param SourceBuffer Place to copy from @param SourceBuffer Place to copy from
@param Length Number of bytes to copy @param Length Number of bytes to copy
@return Destination @return Destination
@@ -52,9 +49,9 @@ InternalMemCopyMem (
/** /**
Set Buffer to Value for Size bytes. Set Buffer to Value for Size bytes.
@param Buffer Memory to set. @param Buffer Memory to set.
@param Length Number of bytes to set @param Length Number of bytes to set
@param Value Value of the set operation. @param Value Value of the set operation.
@return Buffer @return Buffer
@@ -71,7 +68,7 @@ InternalMemSetMem (
Fills a target buffer with a 16-bit value, and returns the target buffer. Fills a target buffer with a 16-bit value, and returns the target buffer.
@param Buffer Pointer to the target buffer to fill. @param Buffer Pointer to the target buffer to fill.
@param Length Number of bytes in Buffer to fill. @param Length Count of 16-bit value to fill.
@param Value Value with which to fill Length bytes of Buffer. @param Value Value with which to fill Length bytes of Buffer.
@return Buffer @return Buffer
@@ -89,7 +86,7 @@ InternalMemSetMem16 (
Fills a target buffer with a 32-bit value, and returns the target buffer. Fills a target buffer with a 32-bit value, and returns the target buffer.
@param Buffer Pointer to the target buffer to fill. @param Buffer Pointer to the target buffer to fill.
@param Length Number of bytes in Buffer to fill. @param Length Count of 32-bit value to fill.
@param Value Value with which to fill Length bytes of Buffer. @param Value Value with which to fill Length bytes of Buffer.
@return Buffer @return Buffer
@@ -107,7 +104,7 @@ InternalMemSetMem32 (
Fills a target buffer with a 64-bit value, and returns the target buffer. Fills a target buffer with a 64-bit value, and returns the target buffer.
@param Buffer Pointer to the target buffer to fill. @param Buffer Pointer to the target buffer to fill.
@param Length Number of bytes in Buffer to fill. @param Length Count of 64-bit value to fill.
@param Value Value with which to fill Length bytes of Buffer. @param Value Value with which to fill Length bytes of Buffer.
@return Buffer @return Buffer
@@ -163,7 +160,7 @@ InternalMemCompareMem (
matching 8-bit value in the target buffer. matching 8-bit value in the target buffer.
@param Buffer Pointer to the target buffer to scan. @param Buffer Pointer to the target buffer to scan.
@param Length Number of bytes in Buffer to scan. Must be non-zero. @param Length Count of 8-bit value to scan. Must be non-zero.
@param Value Value to search for in the target buffer. @param Value Value to search for in the target buffer.
@return Pointer to the first occurrence or NULL if not found. @return Pointer to the first occurrence or NULL if not found.
@@ -182,7 +179,7 @@ InternalMemScanMem8 (
matching 16-bit value in the target buffer. matching 16-bit value in the target buffer.
@param Buffer Pointer to the target buffer to scan. @param Buffer Pointer to the target buffer to scan.
@param Length Number of bytes in Buffer to scan. Must be non-zero. @param Length Count of 16-bit value to scan. Must be non-zero.
@param Value Value to search for in the target buffer. @param Value Value to search for in the target buffer.
@return Pointer to the first occurrence or NULL if not found. @return Pointer to the first occurrence or NULL if not found.
@@ -201,7 +198,7 @@ InternalMemScanMem16 (
matching 32-bit value in the target buffer. matching 32-bit value in the target buffer.
@param Buffer Pointer to the target buffer to scan. @param Buffer Pointer to the target buffer to scan.
@param Length Number of bytes in Buffer to scan. Must be non-zero. @param Length Count of 32-bit value to scan. Must be non-zero.
@param Value Value to search for in the target buffer. @param Value Value to search for in the target buffer.
@return Pointer to the first occurrence or NULL if not found. @return Pointer to the first occurrence or NULL if not found.
@@ -220,7 +217,7 @@ InternalMemScanMem32 (
matching 64-bit value in the target buffer. matching 64-bit value in the target buffer.
@param Buffer Pointer to the target buffer to scan. @param Buffer Pointer to the target buffer to scan.
@param Length Number of bytes in Buffer to scan. Must be non-zero. @param Length Count of 64-bit value to scan. Must be non-zero.
@param Value Value to search for in the target buffer. @param Value Value to search for in the target buffer.
@return Pointer to the first occurrence or NULL if not found. @return Pointer to the first occurrence or NULL if not found.

View File

@@ -10,9 +10,9 @@
BaseMemoryLibOptDxe BaseMemoryLibOptDxe
BaseMemoryLibOptPei BaseMemoryLibOptPei
PeiMemoryLib PeiMemoryLib
DxeMemoryLib UefiMemoryLib
Copyright (c) 2006 - 2008, Intel Corporation<BR> Copyright (c) 2006 - 2009, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at

View File

@@ -9,9 +9,9 @@
BaseMemoryLibOptDxe BaseMemoryLibOptDxe
BaseMemoryLibOptPei BaseMemoryLibOptPei
PeiMemoryLib PeiMemoryLib
DxeMemoryLib UefiMemoryLib
Copyright (c) 2006 - 2008, Intel Corporation<BR> Copyright (c) 2006 - 2009, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at

View File

@@ -10,9 +10,9 @@
BaseMemoryLibOptDxe BaseMemoryLibOptDxe
BaseMemoryLibOptPei BaseMemoryLibOptPei
PeiMemoryLib PeiMemoryLib
DxeMemoryLib UefiMemoryLib
Copyright (c) 2006 - 2008, Intel Corporation<BR> Copyright (c) 2006 - 2009, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at

View File

@@ -10,9 +10,9 @@
BaseMemoryLibOptDxe BaseMemoryLibOptDxe
BaseMemoryLibOptPei BaseMemoryLibOptPei
PeiMemoryLib PeiMemoryLib
DxeMemoryLib UefiMemoryLib
Copyright (c) 2006 - 2008, Intel Corporation<BR> Copyright (c) 2006 - 2009, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at

View File

@@ -9,9 +9,9 @@
BaseMemoryLibOptDxe BaseMemoryLibOptDxe
BaseMemoryLibOptPei BaseMemoryLibOptPei
PeiMemoryLib PeiMemoryLib
DxeMemoryLib UefiMemoryLib
Copyright (c) 2006 - 2008, Intel Corporation<BR> Copyright (c) 2006 - 2009, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at
@@ -22,9 +22,6 @@
**/ **/
#include "MemLibInternals.h" #include "MemLibInternals.h"
/** /**

View File

@@ -9,9 +9,9 @@
BaseMemoryLibOptDxe BaseMemoryLibOptDxe
BaseMemoryLibOptPei BaseMemoryLibOptPei
PeiMemoryLib PeiMemoryLib
DxeMemoryLib UefiMemoryLib
Copyright (c) 2006 - 2008, Intel Corporation<BR> Copyright (c) 2006 - 2009, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at
@@ -22,9 +22,6 @@
**/ **/
#include "MemLibInternals.h" #include "MemLibInternals.h"
/** /**

View File

@@ -9,9 +9,9 @@
BaseMemoryLibOptDxe BaseMemoryLibOptDxe
BaseMemoryLibOptPei BaseMemoryLibOptPei
PeiMemoryLib PeiMemoryLib
DxeMemoryLib UefiMemoryLib
Copyright (c) 2006 - 2008, Intel Corporation<BR> Copyright (c) 2006 - 2009, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at
@@ -22,9 +22,6 @@
**/ **/
#include "MemLibInternals.h" #include "MemLibInternals.h"
/** /**

View File

@@ -10,9 +10,9 @@
BaseMemoryLibOptDxe BaseMemoryLibOptDxe
BaseMemoryLibOptPei BaseMemoryLibOptPei
PeiMemoryLib PeiMemoryLib
DxeMemoryLib UefiMemoryLib
Copyright (c) 2006 - 2008, Intel Corporation<BR> Copyright (c) 2006 - 2009, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at

View File

@@ -3,7 +3,7 @@
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# #
# Copyright (c) 2006 - 2008, Intel Corporation # Copyright (c) 2006 - 2009, Intel Corporation
# All rights reserved. This program and the accompanying materials # All rights reserved. This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License # are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at # which accompanies this distribution. The full text of the license may be found at
@@ -37,24 +37,23 @@
# INTN # INTN
# EFIAPI # EFIAPI
# InternalMemCompareMem ( # InternalMemCompareMem (
# IN CONST VOID *DestinationBuffer, # IN CONST VOID *DestinationBuffer,
# IN CONST VOID *SourceBuffer, # IN CONST VOID *SourceBuffer,
# IN UINTN Length # IN UINTN Length
# ); # );
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
.intel_syntax noprefix
ASM_GLOBAL ASM_PFX(InternalMemCompareMem) ASM_GLOBAL ASM_PFX(InternalMemCompareMem)
ASM_PFX(InternalMemCompareMem): ASM_PFX(InternalMemCompareMem):
push rsi pushq %rsi
push rdi pushq %rdi
mov rsi, rcx movq %rcx, %rsi
mov rdi, rdx movq %rdx, %rdi
mov rcx, r8 movq %r8, %rcx
repe cmpsb repe cmpsb
movzx rax, byte ptr [rsi - 1] movzbq -1(%rsi) , %rax
movzx rdx, byte ptr [rdi - 1] movzbq -1(%rdi) , %rdx
sub rax, rdx subq %rdx, %rax
pop rdi popq %rdi
pop rsi popq %rsi
ret ret

View File

@@ -3,7 +3,7 @@
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# #
# Copyright (c) 2006 - 2008, Intel Corporation # Copyright (c) 2006 - 2009, Intel Corporation
# All rights reserved. This program and the accompanying materials # All rights reserved. This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License # are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at # which accompanies this distribution. The full text of the license may be found at
@@ -34,34 +34,33 @@
# IN UINTN Count # IN UINTN Count
# ) # )
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
.intel_syntax noprefix
ASM_GLOBAL ASM_PFX(InternalMemCopyMem) ASM_GLOBAL ASM_PFX(InternalMemCopyMem)
ASM_PFX(InternalMemCopyMem): ASM_PFX(InternalMemCopyMem):
push rsi pushq %rsi
push rdi pushq %rdi
mov rsi, rdx # rsi <- Source movq %rdx, %rsi # rsi <- Source
mov rdi, rcx # rdi <- Destination movq %rcx, %rdi # rdi <- Destination
lea r9, [rsi + r8 - 1] # r9 <- End of Source leaq -1(%rsi, %r8,), %r9 # r9 <- End of Source
cmp rsi, rdi cmpq %rdi, %rsi
mov rax, rdi # rax <- Destination as return value movq %rdi, %rax # rax <- Destination as return value
jae L0 jae L0
cmp r9, rdi cmpq %rdi, %r9
jae L_CopyBackward # Copy backward if overlapped jae L_CopyBackward # Copy backward if overlapped
L0: L0:
mov rcx, r8 movq %r8, %rcx
and r8, 7 andq $7, %r8
shr rcx, 3 shrq $3, %rcx
rep movsq # Copy as many Qwords as possible rep movsq # Copy as many Qwords as possible
jmp L_CopyBytes jmp L_CopyBytes
L_CopyBackward: L_CopyBackward:
mov rsi, r9 # rsi <- End of Source movq %r9, %rsi # rsi <- End of Source
lea rdi, [rdi + r8 - 1] # esi <- End of Destination leaq -1(%rdi, %r8), %rdi # esi <- End of Destination
std # set direction flag std # set direction flag
L_CopyBytes: L_CopyBytes:
mov rcx, r8 movq %r8, %rcx
rep movsb # Copy bytes backward rep movsb # Copy bytes backward
cld cld
pop rdi popq %rdi
pop rsi popq %rsi
ret ret

Some files were not shown because too many files have changed in this diff Show More