/*++
-Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
-Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
+Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
+Portions copyright (c) 2008 - 2010, Apple Inc. 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
PEI_UNIX_THUNK_PPI mSecUnixThunkPpi = { GasketSecUnixUnixThunkAddress };
EFI_PEI_PROGRESS_CODE_PPI mSecStatusCodePpi = { GasketSecPeiReportStatusCode };
UNIX_FWH_PPI mSecFwhInformationPpi = { GasketSecUnixFdAddress };
-TEMPORARY_RAM_SUPPORT_PPI mSecTemporaryRamSupportPpi = { GasketSecTemporaryRamSupport };
+EFI_PEI_TEMPORARY_RAM_SUPPORT_PPI mSecTemporaryRamSupportPpi = { GasketSecTemporaryRamSupport };
#else
UNIX_PEI_LOAD_FILE_PPI mSecUnixLoadFilePpi = { SecUnixPeiLoadFile };
PEI_UNIX_AUTOSCAN_PPI mSecUnixAutoScanPpi = { SecUnixPeiAutoScan };
PEI_UNIX_THUNK_PPI mSecUnixThunkPpi = { SecUnixUnixThunkAddress };
EFI_PEI_PROGRESS_CODE_PPI mSecStatusCodePpi = { SecPeiReportStatusCode };
UNIX_FWH_PPI mSecFwhInformationPpi = { SecUnixFdAddress };
-TEMPORARY_RAM_SUPPORT_PPI mSecTemporaryRamSupportPpi = { SecTemporaryRamSupport };
+EFI_PEI_TEMPORARY_RAM_SUPPORT_PPI mSecTemporaryRamSupportPpi = { SecTemporaryRamSupport };
#endif
EFI_PEI_PPI_DESCRIPTOR gPrivateDispatchTable[] = {
// Open the FD and remmeber where it got mapped into our processes address space
//
Status = MapFile (
- FileName,
- &gFdInfo[Index].Address,
- &gFdInfo[Index].Size
- );
+ FileName,
+ &gFdInfo[Index].Address,
+ &gFdInfo[Index].Size
+ );
if (EFI_ERROR (Status)) {
printf ("ERROR : Can not open Firmware Device File %s (%x). Exiting.\n", FileName, (unsigned int)Status);
exit (1);
}
printf (" FD loaded from %s at 0x%08lx",
- FileName, (unsigned long)gFdInfo[Index].Address);
+ FileName, (unsigned long)gFdInfo[Index].Address);
if (PeiCoreFile == NULL) {
//
/* Read entry address. */
lseek (fd, FileSize - 0x20, SEEK_SET);
if (read (fd, &EntryAddress, 4) != 4)
- {
- close (fd);
- return EFI_DEVICE_ERROR;
- }
+ {
+ close (fd);
+ return EFI_DEVICE_ERROR;
+ }
}
#endif
*MemoryBase = 0;
res = MapMemory(0, gSystemMemory[Index].Size,
- PROT_READ | PROT_WRITE | PROT_EXEC,
- MAP_PRIVATE | MAP_ANONYMOUS);
+ PROT_READ | PROT_WRITE | PROT_EXEC,
+ MAP_PRIVATE | MAP_ANONYMOUS);
if (res == MAP_FAILED)
return EFI_DEVICE_ERROR;
*MemorySize = gSystemMemory[Index].Size;
Array = mImageContextModHandleArray;
for (Index = 0; Index < mImageContextModHandleArraySize; Index++, Array++) {
- if ((Array->ImageContext == ImageContext)) {
+ if (Array->ImageContext == ImageContext) {
//
// If you find a match return it and delete the entry
//
return FALSE;
}
- if ((PdbFileName[Len - 3] == 'P' || PdbFileName[Len - 3] == 'p') &&
- (PdbFileName[Len - 2] == 'D' || PdbFileName[Len - 2] == 'd') &&
- (PdbFileName[Len - 1] == 'B' || PdbFileName[Len - 1] == 'b')) {
+ if ((PdbFileName[Len - 3] == 'D' || PdbFileName[Len - 3] == 'd') &&
+ (PdbFileName[Len - 2] == 'L' || PdbFileName[Len - 2] == 'l') &&
+ (PdbFileName[Len - 1] == 'L' || PdbFileName[Len - 1] == 'l')) {
return TRUE;
}
{
#ifdef __APPLE__
+ BOOLEAN EnabledOnEntry;
+
+ //
+ // Make sure writting of the file is an atomic operation
+ //
+ if (UnixInterruptEanbled ()) {
+ UnixDisableInterrupt ();
+ EnabledOnEntry = TRUE;
+ } else {
+ EnabledOnEntry = FALSE;
+ }
+
PrintLoadAddress (ImageContext);
//
// Hey what can you say scripting in gdb is not that great....
//
SecGdbScriptBreak ();
+ } else {
+ ASSERT (FALSE);
}
AddHandle (ImageContext, ImageContext->PdbPointer);
+ if (EnabledOnEntry) {
+ UnixEnableInterrupt ();
+ }
+
+
}
#else
#ifdef __APPLE__
FILE *GdbTempFile;
+ BOOLEAN EnabledOnEntry;
if (Handle != NULL) {
//
// Need to skip .PDB files created from VC++
//
if (!IsPdbFile (ImageContext->PdbPointer)) {
+ if (UnixInterruptEanbled ()) {
+ UnixDisableInterrupt ();
+ EnabledOnEntry = TRUE;
+ } else {
+ EnabledOnEntry = FALSE;
+ }
+
//
// Write the file we need for the gdb script
//
// Hey what can you say scripting in gdb is not that great....
//
SecGdbScriptBreak ();
+ } else {
+ ASSERT (FALSE);
+ }
+
+ if (EnabledOnEntry) {
+ UnixEnableInterrupt ();
}
}
}