Runtime Library should not use the gRT directly, since it may be converted to virtual address by other library instance.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@4604 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
yshang1 2008-01-22 02:09:25 +00:00
parent 6178919748
commit b13b447355
1 changed files with 15 additions and 6 deletions

View File

@ -32,6 +32,9 @@ EFI_STATUS_CODE_DATA *mStatusCodeData;
STATIC
EFI_SMM_BASE_PROTOCOL *mSmmBase;
STATIC
EFI_RUNTIME_SERVICES *mRT;
STATIC
BOOLEAN mHaveExitedBootServices = FALSE;
@ -56,8 +59,8 @@ InternalGetReportStatusCode (
return (EFI_REPORT_STATUS_CODE) OemHookStatusCodeReport;
}
}
if (gRT->Hdr.Revision < 0x20000) {
return ((FRAMEWORK_EFI_RUNTIME_SERVICES*)gRT)->ReportStatusCode;
if (mRT->Hdr.Revision < 0x20000) {
return ((FRAMEWORK_EFI_RUNTIME_SERVICES*)mRT)->ReportStatusCode;
} else if (!mHaveExitedBootServices) {
Status = gBS->LocateProtocol (&gEfiStatusCodeRuntimeProtocolGuid, NULL, (VOID**)&StatusCodeProtocol);
if (!EFI_ERROR (Status) && StatusCodeProtocol != NULL) {
@ -84,13 +87,13 @@ ReportStatusCodeLibVirtualAddressChange (
)
{
if (NULL != mReportStatusCode) {
gRT->ConvertPointer (0, (VOID **) &mReportStatusCode);
mRT->ConvertPointer (0, (VOID **) &mReportStatusCode);
}
if (NULL != mSmmBase) {
gRT->ConvertPointer (0, (VOID **) &mSmmBase);
mRT->ConvertPointer (0, (VOID **) &mSmmBase);
}
gRT->ConvertPointer (0, (VOID **) &mStatusCodeData);
gRT->ConvertPointer (0, (VOID **) &gRT);
mRT->ConvertPointer (0, (VOID **) &mStatusCodeData);
mRT->ConvertPointer (0, (VOID **) &mRT);
}
/**
@ -149,6 +152,12 @@ ReportStatusCodeLibConstruct (
}
}
//
// Library should not use the gRT directly, since it
// may be converted by other library instance.
//
mRT = gRT;
gBS->AllocatePool (EfiRuntimeServicesData, sizeof (EFI_STATUS_CODE_DATA) + EFI_STATUS_CODE_DATA_MAX_SIZE, (VOID **)&mStatusCodeData);
ASSERT (NULL != mStatusCodeData);
//