]> git.proxmox.com Git - mirror_edk2.git/blobdiff - EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/PeiServicesTablePointerLibMm7/PeiServicesTablePointer.c
Update the copyright notice format
[mirror_edk2.git] / EdkCompatibilityPkg / Foundation / Library / EdkIIGlueLib / Library / PeiServicesTablePointerLibMm7 / PeiServicesTablePointer.c
index f91a2f582a1814e11044998771af782cef7a7267..622f8b9c69f9845dd73ce235bb194376c814bf3c 100644 (file)
@@ -1,7 +1,7 @@
 /*++\r
 \r
-Copyright (c) 2004 - 2006, Intel Corporation                                                         \r
-All rights reserved. This program and the accompanying materials                          \r
+Copyright (c) 2004 - 2006, Intel Corporation. All rights reserved.<BR>\r
+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
@@ -37,11 +37,19 @@ GetPeiServicesTablePointer (
   VOID\r
   )\r
 {\r
+  IA32_DESCRIPTOR   Idtr;\r
   EFI_PEI_SERVICES  **PeiServices;\r
 \r
-  PeiServices = (EFI_PEI_SERVICES **)(UINTN)AsmReadMm7 ();\r
-  ASSERT (PeiServices != NULL);\r
-  return PeiServices;\r
+  AsmReadIdtr (&Idtr);\r
+  PeiServices = (EFI_PEI_SERVICES **)(UINTN)(*(UINTN*)(Idtr.Base - sizeof (UINTN)));\r
+  \r
+  if ((*PeiServices)->Hdr.Signature == PEI_SERVICES_SIGNATURE) {\r
+    return PeiServices;\r
+  } else {\r
+    PeiServices = (EFI_PEI_SERVICES **)(UINTN)AsmReadMm7 ();\r
+    ASSERT (PeiServices != NULL);\r
+    return PeiServices;\r
+  }\r
 }\r
 \r
 /**\r
@@ -63,6 +71,8 @@ PeiServicesTablePointerLibConstructor (
   IN EFI_PEI_SERVICES     **PeiServices\r
   )\r
 {\r
+#if (PI_SPECIFICATION_VERSION < 0x00010000)\r
   AsmWriteMm7 ((UINT64)(UINTN)PeiServices);\r
+#endif\r
   return EFI_SUCCESS;\r
 }\r