/*++\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
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
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