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
This commit is contained in:
qwang12 2008-11-26 11:28:02 +00:00
parent b6228a086f
commit 35d297c7ac
1 changed files with 9 additions and 9 deletions

View File

@ -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;
}
}
/**