IntelFrameworkModulePkg/LegacyBios: Use macro to enable/disable page 0
Current implementation uses following two methods EnableNullDetection() DisableNullDetection() to enable/disable page 0. These two methods will check PCD PcdNullPointerDetectionPropertyMask to know if the page 0 is disabled or not. This is due to the fact that old GCD service doesn't provide paging related attributes of memory block. Since this issue has been fixed, GCD services can be used to determine the paging status of page 0. This is also make it possible to just use a new macro ACCESS_PAGE0_CODE( <code accessing page 0> ); to replace above methods to do the same job, which also makes code more readability. Cc: Liming Gao <liming.gao@intel.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Ruiyu Ni <ruiyu.ni@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jian J Wang <jian.j.wang@intel.com> Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
This commit is contained in:
@@ -73,10 +73,10 @@ LegacyBiosInt86 (
|
||||
// The base address of legacy interrupt vector table is 0.
|
||||
// We use this base address to get the legacy interrupt handler.
|
||||
//
|
||||
DisableNullDetection ();
|
||||
Segment = (UINT16)(((UINT32 *)0)[BiosInt] >> 16);
|
||||
Offset = (UINT16)((UINT32 *)0)[BiosInt];
|
||||
EnableNullDetection ();
|
||||
ACCESS_PAGE0_CODE (
|
||||
Segment = (UINT16)(((UINT32 *)0)[BiosInt] >> 16);
|
||||
Offset = (UINT16)((UINT32 *)0)[BiosInt];
|
||||
);
|
||||
|
||||
return InternalLegacyBiosFarCall (
|
||||
This,
|
||||
@@ -286,29 +286,6 @@ InternalLegacyBiosFarCall (
|
||||
|
||||
AsmThunk16 (&mThunkContext);
|
||||
|
||||
//
|
||||
// OPROM may allocate EBDA range by itself and change EBDA base and EBDA size.
|
||||
// Get the current EBDA base address, and compared with pre-allocate minimum
|
||||
// EBDA base address, if the current EBDA base address is smaller, it indicates
|
||||
// PcdEbdaReservedMemorySize should be adjusted to larger for more OPROMs.
|
||||
//
|
||||
DEBUG_CODE (
|
||||
{
|
||||
UINTN EbdaBaseAddress;
|
||||
UINTN ReservedEbdaBaseAddress;
|
||||
|
||||
//
|
||||
// Skip this part of debug code if NULL pointer detection is enabled
|
||||
//
|
||||
if ((PcdGet8 (PcdNullPointerDetectionPropertyMask) & BIT0) == 0) {
|
||||
EbdaBaseAddress = (*(UINT16 *) (UINTN) 0x40E) << 4;
|
||||
ReservedEbdaBaseAddress = CONVENTIONAL_MEMORY_TOP
|
||||
- PcdGet32 (PcdEbdaReservedMemorySize);
|
||||
ASSERT (ReservedEbdaBaseAddress <= EbdaBaseAddress);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
if (Stack != NULL && StackSize != 0) {
|
||||
//
|
||||
// Copy low memory stack to Stack
|
||||
@@ -334,6 +311,26 @@ InternalLegacyBiosFarCall (
|
||||
//
|
||||
gBS->RestoreTPL (OriginalTpl);
|
||||
|
||||
//
|
||||
// OPROM may allocate EBDA range by itself and change EBDA base and EBDA size.
|
||||
// Get the current EBDA base address, and compared with pre-allocate minimum
|
||||
// EBDA base address, if the current EBDA base address is smaller, it indicates
|
||||
// PcdEbdaReservedMemorySize should be adjusted to larger for more OPROMs.
|
||||
//
|
||||
DEBUG_CODE (
|
||||
{
|
||||
UINTN EbdaBaseAddress;
|
||||
UINTN ReservedEbdaBaseAddress;
|
||||
|
||||
ACCESS_PAGE0_CODE (
|
||||
EbdaBaseAddress = (*(UINT16 *) (UINTN) 0x40E) << 4;
|
||||
ReservedEbdaBaseAddress = CONVENTIONAL_MEMORY_TOP
|
||||
- PcdGet32 (PcdEbdaReservedMemorySize);
|
||||
ASSERT (ReservedEbdaBaseAddress <= EbdaBaseAddress);
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
//
|
||||
// Restore interrupt of debug timer
|
||||
//
|
||||
|
Reference in New Issue
Block a user