Revision: 16216
http://sourceforge.net/p/edk2/code/16216
Author: ydong10
Date: 2014-10-15 05:17:41 +0000 (Wed, 15 Oct 2014)
Log Message:
-----------
Prevent EBDA area being overwritten, get the size info from the address 0x40E.
If can?\226?\128?\153t get the size info, then use the default value for it.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Eric Dong <[email protected]>
Reviewed-by: Ruiyu Ni <[email protected]>
Modified Paths:
--------------
trunk/edk2/DuetPkg/DxeIpl/HobGeneration.c
Modified: trunk/edk2/DuetPkg/DxeIpl/HobGeneration.c
===================================================================
--- trunk/edk2/DuetPkg/DxeIpl/HobGeneration.c 2014-10-15 04:49:04 UTC (rev
16215)
+++ trunk/edk2/DuetPkg/DxeIpl/HobGeneration.c 2014-10-15 05:17:41 UTC (rev
16216)
@@ -1,6 +1,6 @@
/** @file
-Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD
License
which accompanies this distribution. The full text of the license may be
found at
@@ -25,6 +25,7 @@
#define EFI_CPUID_EXTENDED_FUNCTION 0x80000000
#define CPUID_EXTENDED_ADD_SIZE 0x80000008
+#define EBDA_VALUE_ADDRESS 0x40E
HOB_TEMPLATE gHobTemplate = {
{ // Phit
@@ -602,12 +603,21 @@
--*/
{
UINTN Index;
+ UINT64 EbdaAddress;
//
// Prepare Low Memory
// 0x18 pages is 72 KB.
//
- gHob->MemoryFreeUnder1MB.ResourceLength = EFI_MEMORY_BELOW_1MB_END -
EFI_MEMORY_BELOW_1MB_START;
+ EbdaAddress = ((UINT64)(*(UINT16 *)(UINTN)(EBDA_VALUE_ADDRESS))) << 4;
+ if (EbdaAddress < 0x9A000 || EbdaAddress > EFI_MEMORY_BELOW_1MB_END) {
+ //
+ // EBDA should not go below 0x9A000 in any implementation,
+ // so add check here to make sure EBDA_VALUE_ADDRESS has a valid value.
+ //
+ EbdaAddress = EFI_MEMORY_BELOW_1MB_END;
+ }
+ gHob->MemoryFreeUnder1MB.ResourceLength = EbdaAddress -
EFI_MEMORY_BELOW_1MB_START;
gHob->MemoryFreeUnder1MB.PhysicalStart = EFI_MEMORY_BELOW_1MB_START;
//
------------------------------------------------------------------------------
Comprehensive Server Monitoring with Site24x7.
Monitor 10 servers for $9/Month.
Get alerted through email, SMS, voice calls or mobile push notifications.
Take corrective actions from your mobile device.
http://p.sf.net/sfu/Zoho
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits