]> git.proxmox.com Git - mirror_edk2.git/blobdiff - EdkCompatibilityPkg/Foundation/Library/EfiCommonLib/Ia32/EfiZeroMemRep4.c
1) Sync EdkCompatibilityPkg with EDK 1.04. The changes includes:
[mirror_edk2.git] / EdkCompatibilityPkg / Foundation / Library / EfiCommonLib / Ia32 / EfiZeroMemRep4.c
diff --git a/EdkCompatibilityPkg/Foundation/Library/EfiCommonLib/Ia32/EfiZeroMemRep4.c b/EdkCompatibilityPkg/Foundation/Library/EfiCommonLib/Ia32/EfiZeroMemRep4.c
new file mode 100644 (file)
index 0000000..48936a8
--- /dev/null
@@ -0,0 +1,59 @@
+/*++\r
+\r
+Copyright (c) 2007, Intel Corporation                                                         \r
+All rights reserved. This program and the accompanying materials                          \r
+are licensed and made available under the terms and conditions of the BSD License         \r
+which accompanies this distribution.  The full text of the license may be found at        \r
+http://opensource.org/licenses/bsd-license.php                                            \r
+                                                                                          \r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
+\r
+Module Name:\r
+\r
+  EfiZeroMemRep4.c\r
+\r
+Abstract:\r
+\r
+  This is the code that uses rep stosd ZeroMem service\r
+\r
+--*/\r
+\r
+#include "Tiano.h"\r
+\r
+VOID\r
+EfiCommonLibZeroMem (\r
+  IN VOID   *Buffer,\r
+  IN UINTN  Count\r
+  )\r
+/*++\r
+\r
+Input:  VOID   *Buffer - Pointer to buffer to clear\r
+        UINTN  Count  - Number of bytes to clear\r
+\r
+Output: None.\r
+\r
+Saves:\r
+\r
+Modifies:\r
+\r
+Description:  This function uses rep stosd to zero memory.\r
+\r
+--*/\r
+{\r
+  __asm {\r
+    mov         ecx, Count\r
+    test        ecx, ecx\r
+    je          Exit\r
+    xor         eax, eax\r
+    mov         edi, Buffer\r
+    mov         edx, ecx\r
+    shr         ecx, 2\r
+    and         edx, 3\r
+    rep         stosd\r
+    mov         ecx, edx\r
+    rep         stosb\r
+Exit:\r
+  }\r
+}\r
+\r