diff options
author | qwang12 <qwang12@6f19259b-4bc3-4df7-8a09-765794883524> | 2008-11-26 11:28:02 +0000 |
---|---|---|
committer | qwang12 <qwang12@6f19259b-4bc3-4df7-8a09-765794883524> | 2008-11-26 11:28:02 +0000 |
commit | 35d297c7acce7d72863c22ddae95eb39827f3cd3 (patch) | |
tree | 84d5ead6f27a451c9c157a3628be7c3dbf87a3e4 | |
parent | b6228a086faf4c4a3f68a9d9b83822414fd0b4ce (diff) | |
download | edk2-platforms-35d297c7acce7d72863c22ddae95eb39827f3cd3.tar.xz |
PI defines the architectural way to get PeiServicesTablePointer from sizeof (UINTN) bytes before the IDT table base. Add the runtime detection of PI version so that Mm7 Library instance is usable under PI 1.0 system.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@6739 6f19259b-4bc3-4df7-8a09-765794883524
-rw-r--r-- | EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/PeiServicesTablePointerLibMm7/PeiServicesTablePointer.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/PeiServicesTablePointerLibMm7/PeiServicesTablePointer.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/PeiServicesTablePointerLibMm7/PeiServicesTablePointer.c index ca75a9493d..6c6f07c353 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/PeiServicesTablePointerLibMm7/PeiServicesTablePointer.c +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/PeiServicesTablePointerLibMm7/PeiServicesTablePointer.c @@ -37,19 +37,19 @@ GetPeiServicesTablePointer ( VOID
)
{
- EFI_PEI_SERVICES **PeiServices;
-#if (PI_SPECIFICATION_VERSION >= 0x00010000)
IA32_DESCRIPTOR Idtr;
-#endif
+ EFI_PEI_SERVICES **PeiServices;
-#if (PI_SPECIFICATION_VERSION < 0x00010000)
- PeiServices = (EFI_PEI_SERVICES **)(UINTN)AsmReadMm7 ();
-#else
AsmReadIdtr (&Idtr);
PeiServices = (EFI_PEI_SERVICES **)(UINTN)(*(UINTN*)(Idtr.Base - sizeof (UINTN)));
-#endif
- ASSERT (PeiServices != NULL);
- return PeiServices;
+
+ if ((*PeiServices)->Hdr.Signature == PEI_SERVICES_SIGNATURE) {
+ return PeiServices;
+ } else {
+ PeiServices = (EFI_PEI_SERVICES **)(UINTN)AsmReadMm7 ();
+ ASSERT (PeiServices != NULL);
+ return PeiServices;
+ }
}
/**
|