-/*++\r
+/**@file\r
\r
Copyright (c) 2006, Intel Corporation\r
All rights reserved. This program and the accompanying materials\r
This code produces 128 K of temporary memory for the PEI stack by directly\r
allocate memory space with ReadWrite and Execute attribute.\r
\r
---*/\r
+**/\r
\r
#include "SecMain.h"\r
\r
UINTN Index;\r
UINTN Index1;\r
UINTN Index2;\r
- UINTN PeiIndex;\r
CHAR16 *FileName;\r
CHAR16 *FileNamePtr;\r
BOOLEAN Done;\r
gSystemMemoryCount = CountSeperatorsInString (MemorySizeStr, '!') + 1;\r
gSystemMemory = calloc (gSystemMemoryCount, sizeof (NT_SYSTEM_MEMORY));\r
if (gSystemMemory == NULL) {\r
- printf ("ERROR : Can not allocate memory for %s. Exiting.\n", MemorySizeStr);\r
+ wprintf (L"ERROR : Can not allocate memory for %s. Exiting.\n", MemorySizeStr);\r
exit (1);\r
}\r
//\r
gFdInfoCount = CountSeperatorsInString (FirmwareVolumesStr, '!') + 1;\r
gFdInfo = calloc (gFdInfoCount, sizeof (NT_FD_INFO));\r
if (gFdInfo == NULL) {\r
- printf ("ERROR : Can not allocate memory for %s. Exiting.\n", FirmwareVolumesStr);\r
+ wprintf (L"ERROR : Can not allocate memory for %s. Exiting.\n", FirmwareVolumesStr);\r
exit (1);\r
}\r
//\r
*StackPointer = 0x5AA55AA5;\r
}\r
\r
- printf (" SEC passing in %d bytes of temp RAM to PEI\n", InitialStackMemorySize);\r
+ wprintf (L" SEC passing in %d bytes of temp RAM to PEI\n", InitialStackMemorySize);\r
\r
//\r
// Open All the firmware volumes and remember the info in the gFdInfo global\r
\r
StrCpy (FileNamePtr, (CHAR16*)FirmwareVolumesStr);\r
\r
- for (Done = FALSE, Index = 0, PeiIndex = 0, PeiCoreFile = NULL; !Done; Index++) {\r
+ for (Done = FALSE, Index = 0, PeiCoreFile = NULL; !Done; Index++) {\r
FileName = FileNamePtr;\r
for (Index1 = 0; (FileNamePtr[Index1] != '!') && (FileNamePtr[Index1] != 0); Index1++)\r
;\r
&gFdInfo[Index].Size\r
);\r
if (EFI_ERROR (Status)) {\r
- printf ("ERROR : Can not open Firmware Device File %S (%r). Exiting.\n", FileName, Status);\r
+ printf ("ERROR : Can not open Firmware Device File %S (0x%X). Exiting.\n", FileName, Status);\r
exit (1);\r
}\r
\r
//\r
Status = SecFfsFindPeiCore ((EFI_FIRMWARE_VOLUME_HEADER *) (UINTN) gFdInfo[Index].Address, &PeiCoreFile);\r
if (!EFI_ERROR (Status)) {\r
- PeiIndex = Index;\r
printf (" contains SEC Core");\r
}\r
}\r
//\r
// Processes ASSERT ()\r
//\r
- printf ("ASSERT %s(%d): %s\n", Filename, LineNumber, Description);\r
+ printf ("ASSERT %s(%d): %s\n", Filename, (int)LineNumber, Description);\r
\r
} else if (ReportStatusCodeExtractDebugInfo (Data, &ErrorLevel, &Marker, &Format)) {\r
//\r
--*/\r
{\r
EFI_STATUS Status;\r
- EFI_PHYSICAL_ADDRESS TopOfMemory;\r
VOID *TopOfStack;\r
UINT64 PeiCoreSize;\r
EFI_PHYSICAL_ADDRESS PeiCoreEntryPoint;\r
//\r
// Compute Top Of Memory for Stack and PEI Core Allocations\r
//\r
- TopOfMemory = LargestRegion + LargestRegionSize;\r
PeiStackSize = (UINTN)RShiftU64((UINT64)STACK_SIZE,1);\r
\r
//\r
// |-----------| <---- TemporaryRamBase\r
// \r
TopOfStack = (VOID *)(LargestRegion + PeiStackSize);\r
- TopOfMemory = LargestRegion + PeiStackSize;\r
\r
//\r
// Reservet space for storing PeiCore's parament in stack.\r
SecCoreData->BootFirmwareVolumeSize = FixedPcdGet32(PcdWinNtFirmwareFdSize);\r
SecCoreData->TemporaryRamBase = (VOID*)(UINTN)LargestRegion; \r
SecCoreData->TemporaryRamSize = STACK_SIZE;\r
- SecCoreData->StackBase = (VOID*) ((UINTN) SecCoreData->TemporaryRamBase + PeiStackSize);\r
+ SecCoreData->StackBase = SecCoreData->TemporaryRamBase;\r
SecCoreData->StackSize = PeiStackSize;\r
- SecCoreData->PeiTemporaryRamBase = SecCoreData->StackBase;\r
+ SecCoreData->PeiTemporaryRamBase = (VOID*) ((UINTN) SecCoreData->TemporaryRamBase + PeiStackSize);\r
SecCoreData->PeiTemporaryRamSize = STACK_SIZE - PeiStackSize;\r
\r
//\r
\r
UINTN\r
CountSeperatorsInString (\r
- IN const CHAR16 *String,\r
+ IN CONST CHAR16 *String,\r
IN CHAR16 Seperator\r
)\r
/*++\r