mirror of https://github.com/acidanthera/audk.git
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:
parent
b6228a086f
commit
35d297c7ac
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue