summaryrefslogtreecommitdiff
path: root/MdeModulePkg/Core
diff options
context:
space:
mode:
authorklu2 <klu2@6f19259b-4bc3-4df7-8a09-765794883524>2008-03-06 08:41:22 +0000
committerklu2 <klu2@6f19259b-4bc3-4df7-8a09-765794883524>2008-03-06 08:41:22 +0000
commita7715e7327d1d37db16858f2a967ceea36ad9fcf (patch)
treed9029b376bbecd1b219bf91a14e602b42c31c478 /MdeModulePkg/Core
parentff33b87dd84157e943d74e9e1ec7ce70a8dfd6c1 (diff)
downloadedk2-a7715e7327d1d37db16858f2a967ceea36ad9fcf.zip
edk2-a7715e7327d1d37db16858f2a967ceea36ad9fcf.tar.gz
edk2-a7715e7327d1d37db16858f2a967ceea36ad9fcf.tar.bz2
The calculating action for CAR usage should be put before calling temporary ram support PPI, because the CAR is unvaiable after switch stack from temporary memory to permenent memory.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@4795 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg/Core')
-rw-r--r--MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c25
-rw-r--r--MdeModulePkg/Core/Pei/PeiMain/PeiMain.c28
2 files changed, 24 insertions, 29 deletions
diff --git a/MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c b/MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c
index cf9ea5d..bb6c1c8 100644
--- a/MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c
+++ b/MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c
@@ -23,6 +23,8 @@ Revision History
#include <PeiMain.h>
+#define INIT_CAR_VALUE 0x5AA55AA5
+
typedef struct {
EFI_STATUS_CODE_DATA DataHeader;
EFI_HANDLE Handle;
@@ -437,7 +439,28 @@ Returns:
}
if (Private->SwitchStackSignal) {
-
+ //
+ // Before switch stack from CAR to permenent memory, caculate the heap and stack
+ // usage in temporary memory for debuging.
+ //
+ DEBUG_CODE_BEGIN ();
+ UINTN *StackPointer;
+
+ for (StackPointer = (UINTN*)SecCoreData->StackBase;
+ (StackPointer < (UINTN*)((UINTN)SecCoreData->StackBase + SecCoreData->StackSize)) \
+ && (*StackPointer == INIT_CAR_VALUE);
+ StackPointer ++);
+
+ DEBUG ((EFI_D_INFO, "Total Cache as RAM: %d bytes.\n", SecCoreData->TemporaryRamSize));
+ DEBUG ((EFI_D_INFO, " CAR stack ever used: %d bytes.\n",
+ (SecCoreData->StackSize - ((UINTN) StackPointer - (UINTN)SecCoreData->StackBase))
+ ));
+ DEBUG ((EFI_D_INFO, " CAR heap used: %d bytes.\n",
+ ((UINTN) Private->HobList.HandoffInformationTable->EfiFreeMemoryBottom -
+ (UINTN) Private->HobList.Raw)
+ ));
+ DEBUG_CODE_END ();
+
//
// Reserve the size of new stack at bottom of physical memory
//
diff --git a/MdeModulePkg/Core/Pei/PeiMain/PeiMain.c b/MdeModulePkg/Core/Pei/PeiMain/PeiMain.c
index a6feaeb..693aa4b 100644
--- a/MdeModulePkg/Core/Pei/PeiMain/PeiMain.c
+++ b/MdeModulePkg/Core/Pei/PeiMain/PeiMain.c
@@ -182,34 +182,6 @@ Returns:
PERF_START (NULL,"PostMem", NULL, 0);
//
- // The following code dumps out interesting cache as RAM usage information
- // so we can keep tabs on how the cache as RAM is being utilized. The
- // DEBUG_CODE_BEGIN macro is used to prevent this code from being compiled
- // on a debug build.
- //
- DEBUG_CODE_BEGIN ();
- UINTN *StackPointer;
- UINTN StackValue;
-
- StackValue = INIT_CAR_VALUE;
- for (StackPointer = (UINTN *) OldCoreData->MaxTopOfCarHeap;
- ((UINTN) StackPointer < ((UINTN) OldCoreData->BottomOfCarHeap + OldCoreData->SizeOfCacheAsRam))
- && StackValue == INIT_CAR_VALUE;
- StackPointer++) {
- StackValue = *StackPointer;
- }
-
- DEBUG ((EFI_D_INFO, "Total Cache as RAM: %d bytes.\n", OldCoreData->SizeOfCacheAsRam));
- DEBUG ((EFI_D_INFO, " CAR stack ever used: %d bytes.\n",
- ((UINTN) OldCoreData->TopOfCarHeap - (UINTN) StackPointer)
- ));
- DEBUG ((EFI_D_INFO, " CAR heap used: %d bytes.\n",
- ((UINTN) OldCoreData->HobList.HandoffInformationTable->EfiFreeMemoryBottom -
- (UINTN) OldCoreData->HobList.Raw)
- ));
- DEBUG_CODE_END ();
-
- //
// Alert any listeners that there is permanent memory available
//