VirtualBox

Ignore:
Timestamp:
Oct 28, 2015 8:34:41 PM (9 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
103763
Message:

EFI/Firmware: Merged in changes from ../UDK2014.SP1/.

Location:
trunk/src/VBox/Devices/EFI/Firmware/IntelFrameworkModulePkg/Library/GenericBdsLib
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/EFI/Firmware/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsBoot.c

    r58459 r58460  
    24202420      if (Handle != NULL) {
    24212421#ifdef VBOX /* We have more options to try out because of apple. */
    2422       //
    2423       // Try parse any config="folder-path/" stuff found in the optional
    2424       // section of the boot option and attempt to load boot.efi it.
    2425       //
    2426       if (Option->LoadOptionsSize) {
    2427         /*
     2422        //
     2423        // Try parse any config="folder-path/" stuff found in the optional
     2424        // section of the boot option and attempt to load boot.efi it.
     2425        //
     2426        if (Option->LoadOptionsSize) {
     2427          /*
    24282428           * First, see the there is a config=folder in the load options.  We
    24292429           * interpret it as a path to the folder containing boot.efi and go
     
    24612461           */
    24622462          VBoxLogFlowFuncMarkVar(Option->LoadOptions, "%s");
    2463         if (StrnCmp(L"config=", (CHAR16 *)Option->LoadOptions, 7) == 0) {
    2464           EFI_SIMPLE_FILE_SYSTEM_PROTOCOL  *Volume;
    2465           CHAR16 *pszConfigValue = &((CHAR16 *)Option->LoadOptions)[7];
    2466           CHAR16 *pszFolder = NULL;
    2467           CHAR16 *pszTemp0 = NULL;
    2468           CHAR16 *pszTemp1 = NULL;
    2469           BOOLEAN fQuoted = (pszConfigValue[0] == L'\"');
    2470           pszTemp0 = &pszConfigValue[fQuoted ? 2 : 1];
    2471           pszTemp1 = pszTemp0;
    2472           VBoxLogFlowFuncMarkVar(pszTemp0, "%s");
    2473           VBoxLogFlowFuncMarkVar(pszTemp1, "%s");
    2474           pszFolder = AllocateZeroPool((StrLen(pszConfigValue) + StrLen(L"\\boot.efi") + 1) * sizeof(UINT16));
    2475           while (pszTemp0) {
    2476               VBoxLogFlowFuncMarkVar(pszTemp0, "%s");
    2477               VBoxLogFlowFuncMarkVar(pszTemp1, "%s");
    2478               pszFolder = StrnCat(pszFolder, pszTemp1, StrLen(pszTemp1) - StrLen(pszTemp0));
    2479               pszTemp1 = pszTemp0;
    2480               pszFolder = StrCat(pszFolder, L"\\");
    2481               VBoxLogFlowFuncMarkVar(pszFolder, "%s");
    2482               VBoxLogFlowFuncMarkVar(pszTemp0, "%s");
    2483               VBoxLogFlowFuncMarkVar(pszTemp1, "%s");
    2484               pszTemp0 = StrStr(&pszTemp0[1], L"\\");
    2485               VBoxLogFlowFuncMarkVar(pszTemp0, "%s");
    2486           }
    2487           pszFolder = StrCat(pszFolder, L"boot.efi");
    2488           VBoxLogFlowFuncMarkVar(pszFolder,"%s");
    2489 
    2490           Status = gBS->HandleProtocol(Handle, &gEfiSimpleFileSystemProtocolGuid, (VOID **)&Volume);
    2491           VBoxLogFlowFuncMarkRC(Status);
    2492           if (!EFI_ERROR(Status)) {
    2493             FilePath = FileDevicePath((EFI_HANDLE)Handle, pszFolder);
    2494             if (FilePath) {
    2495               VBoxLogFlowFuncMarkVar(DevicePathToStr(FilePath), "%s");
    2496               REPORT_STATUS_CODE(EFI_PROGRESS_CODE, PcdGet32 (PcdProgressCodeOsLoaderLoad));
    2497               Status = gBS->LoadImage(TRUE, gImageHandle, FilePath, NULL, 0, &ImageHandle );
    2498               VBoxLogFlowFuncMarkRC(Status);
    2499               /** @todo Probably leaking memory here! */
     2463          if (StrnCmp(L"config=", (CHAR16 *)Option->LoadOptions, 7) == 0) {
     2464            EFI_SIMPLE_FILE_SYSTEM_PROTOCOL  *Volume;
     2465            CHAR16 *pszConfigValue = &((CHAR16 *)Option->LoadOptions)[7];
     2466            CHAR16 *pszFolder = NULL;
     2467            CHAR16 *pszTemp0 = NULL;
     2468            CHAR16 *pszTemp1 = NULL;
     2469            BOOLEAN fQuoted = (pszConfigValue[0] == L'\"');
     2470            pszTemp0 = &pszConfigValue[fQuoted ? 2 : 1];
     2471            pszTemp1 = pszTemp0;
     2472            VBoxLogFlowFuncMarkVar(pszTemp0, "%s");
     2473            VBoxLogFlowFuncMarkVar(pszTemp1, "%s");
     2474            pszFolder = AllocateZeroPool((StrLen(pszConfigValue) + StrLen(L"\\boot.efi") + 1) * sizeof(UINT16));
     2475            while (pszTemp0) {
     2476                VBoxLogFlowFuncMarkVar(pszTemp0, "%s");
     2477                VBoxLogFlowFuncMarkVar(pszTemp1, "%s");
     2478                pszFolder = StrnCat(pszFolder, pszTemp1, StrLen(pszTemp1) - StrLen(pszTemp0));
     2479                pszTemp1 = pszTemp0;
     2480                pszFolder = StrCat(pszFolder, L"\\");
     2481                VBoxLogFlowFuncMarkVar(pszFolder, "%s");
     2482                VBoxLogFlowFuncMarkVar(pszTemp0, "%s");
     2483                VBoxLogFlowFuncMarkVar(pszTemp1, "%s");
     2484                pszTemp0 = StrStr(&pszTemp0[1], L"\\");
     2485                VBoxLogFlowFuncMarkVar(pszTemp0, "%s");
     2486            }
     2487            pszFolder = StrCat(pszFolder, L"boot.efi");
     2488            VBoxLogFlowFuncMarkVar(pszFolder,"%s");
     2489
     2490            Status = gBS->HandleProtocol(Handle, &gEfiSimpleFileSystemProtocolGuid, (VOID **)&Volume);
     2491            VBoxLogFlowFuncMarkRC(Status);
     2492            if (!EFI_ERROR(Status)) {
     2493              FilePath = FileDevicePath((EFI_HANDLE)Handle, pszFolder);
     2494              if (FilePath) {
     2495                VBoxLogFlowFuncMarkVar(DevicePathToStr(FilePath), "%s");
     2496                REPORT_STATUS_CODE(EFI_PROGRESS_CODE, PcdGet32 (PcdProgressCodeOsLoaderLoad));
     2497                Status = gBS->LoadImage(TRUE, gImageHandle, FilePath, NULL, 0, &ImageHandle );
     2498                VBoxLogFlowFuncMarkRC(Status);
     2499                /** @todo Probably leaking memory here! */
     2500              }
    25002501            }
    25012502          }
    25022503        }
    2503       }
    2504 
    2505       //
    2506       // Try load any of the default boot files.
    2507       //
    2508       if (EFI_ERROR(Status)) {
    2509         UINT32 IdxFile;
    2510         for (IdxFile = 0; IdxFile < sizeof(maBdsLibBootFiles) / sizeof(maBdsLibBootFiles[0]); IdxFile++) {
    2511           FilePath = FileDevicePath(Handle, maBdsLibBootFiles[IdxFile]);
    2512           if (FilePath) {
    2513             VBoxLog(("BdsLibBootViaBootOption: Trying to load '%s'...\n", DevicePathToStr(FilePath)));
    2514             REPORT_STATUS_CODE(EFI_PROGRESS_CODE, PcdGet32(PcdProgressCodeOsLoaderLoad));
    2515             Status = gBS->LoadImage(TRUE, gImageHandle, FilePath, NULL, 0, &ImageHandle );
    2516             if (!EFI_ERROR(Status)) {
    2517               VBoxLog(("BdsLibBootViaBootOption: Successfully loaded boot file: %s\n", DevicePathToStr(FilePath)));
    2518               break;
     2504
     2505        //
     2506        // Try load any of the default boot files.
     2507        //
     2508        if (EFI_ERROR(Status)) {
     2509          UINT32 IdxFile;
     2510          for (IdxFile = 0; IdxFile < sizeof(maBdsLibBootFiles) / sizeof(maBdsLibBootFiles[0]); IdxFile++) {
     2511            FilePath = FileDevicePath(Handle, maBdsLibBootFiles[IdxFile]);
     2512            if (FilePath) {
     2513              VBoxLog(("BdsLibBootViaBootOption: Trying to load '%s'...\n", DevicePathToStr(FilePath)));
     2514              REPORT_STATUS_CODE(EFI_PROGRESS_CODE, PcdGet32(PcdProgressCodeOsLoaderLoad));
     2515              Status = gBS->LoadImage(TRUE, gImageHandle, FilePath, NULL, 0, &ImageHandle );
     2516              if (!EFI_ERROR(Status)) {
     2517                VBoxLog(("BdsLibBootViaBootOption: Successfully loaded boot file: %s\n", DevicePathToStr(FilePath)));
     2518                break;
     2519              }
     2520              VBoxLog(("BdsLibBootViaBootOption: Failed loading '%s': 0x%x(%r)\n", DevicePathToStr(FilePath), Status, Status));
     2521              FilePath = NULL; /** @todo Probably leaking memory here! */
    25192522            }
    2520             VBoxLog(("BdsLibBootViaBootOption: Failed loading '%s': 0x%x(%r)\n", DevicePathToStr(FilePath), Status, Status));
    2521             FilePath = NULL; /** @todo Probably leaking memory here! */
    25222523          }
    25232524        }
    2524       }
    25252525#else  /* !VBOX */
    25262526        //
     
    25412541        }
    25422542#endif /* !VBOX */
    2543     }
    2544   }
     2543      }
     2544    }
    25452545  }
    25462546  //
  • trunk/src/VBox/Devices/EFI/Firmware/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsMisc.c

    r58459 r58460  
    565565
    566566  if (TempSize + FilePathSize + sizeof (UINT16) + sizeof (UINT32) > VariableSize) {
    567       VBoxLogFlowFuncLeave();
    568       return FALSE;
     567    VBoxLogFlowFuncLeave();
     568    return FALSE;
    569569  }
    570570
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette