VirtualBox

Changeset 72500 in vbox


Ignore:
Timestamp:
Jun 11, 2018 11:05:32 AM (6 years ago)
Author:
vboxsync
Message:

EFI: Log EFI module relocations, such as when an OS switches to its own virtual memory map. Needed to know where run-time EFI modules end up.

Location:
trunk/src/VBox/Devices/EFI
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/EFI/DevEFI.cpp

    r71777 r72500  
    12461246        case EFI_IMAGE_EVT_CMD_START_UNLOAD32:
    12471247        case EFI_IMAGE_EVT_CMD_START_UNLOAD64:
     1248        case EFI_IMAGE_EVT_CMD_START_RELOC32:
     1249        case EFI_IMAGE_EVT_CMD_START_RELOC64:
    12481250            AssertBreak(EFI_IMAGE_EVT_GET_PAYLOAD(u32) == 0);
    12491251
     
    12931295                        break;
    12941296                    }
     1297                case EFI_IMAGE_EVT_CMD_START_RELOC32:
     1298                case EFI_IMAGE_EVT_CMD_START_RELOC64:
     1299                {
     1300                    LogRel(("EFI: relocate module to %#llx from %#llx\n",
     1301                            pThis->ImageEvt.uAddr0, pThis->ImageEvt.uAddr1));
     1302                    break;
     1303                }
    12951304                }
    12961305            }
     
    13091318        case EFI_IMAGE_EVT_CMD_ADDR1:
    13101319            AssertBreak(EFI_IMAGE_EVT_GET_PAYLOAD(u32) <= UINT16_MAX);
    1311             pThis->ImageEvt.uAddr0 <<= 16;
    1312             pThis->ImageEvt.uAddr0 |= EFI_IMAGE_EVT_GET_PAYLOAD_U16(u32);
     1320            pThis->ImageEvt.uAddr1 <<= 16;
     1321            pThis->ImageEvt.uAddr1 |= EFI_IMAGE_EVT_GET_PAYLOAD_U16(u32);
    13131322            return VINF_SUCCESS;
    13141323
  • trunk/src/VBox/Devices/EFI/DevEFI.h

    r69500 r72500  
    224224/** Starts a 64-bit unload event. Requires name and address. */
    225225#define EFI_IMAGE_EVT_CMD_START_UNLOAD64        UINT32_C(0x00000005)
     226/** Starts a 32-bit relocation event. RRequires new and old base address. */
     227#define EFI_IMAGE_EVT_CMD_START_RELOC32         UINT32_C(0x0000000A)
     228/** Starts a 64-bit relocation event. Requires new and old base address. */
     229#define EFI_IMAGE_EVT_CMD_START_RELOC64         UINT32_C(0x0000000B)
    226230
    227231/** The command for writing to the second address register (64-bit).
  • trunk/src/VBox/Devices/EFI/Firmware/VBoxPkg/Library/VBoxPeCoffExtraActionLib/VBoxPeCoffExtraActionLib.c

    r69500 r72500  
    101101}
    102102
     103VOID
     104EFIAPI
     105VBoxPeCoffLoaderMoveImageExtraAction(
     106  IN PHYSICAL_ADDRESS OldBase,
     107  IN PHYSICAL_ADDRESS NewBase
     108  )
     109{
     110    ASSERT(ImageContext != NULL);
     111#if ARCH_BITS == 32
     112    ASMOutU32(EFI_PORT_IMAGE_EVENT, EFI_IMAGE_EVT_CMD_START_RELOC32);
     113#else
     114    ASMOutU32(EFI_PORT_IMAGE_EVENT, EFI_IMAGE_EVT_CMD_START_RELOC64);
     115#endif
     116    vboxImageEvtU64(EFI_IMAGE_EVT_CMD_ADDR0, NewBase);
     117    vboxImageEvtU64(EFI_IMAGE_EVT_CMD_ADDR1, OldBase);
     118    ASMOutU32(EFI_PORT_IMAGE_EVENT, EFI_IMAGE_EVT_CMD_COMPLETE);
     119}
  • trunk/src/VBox/Devices/EFI/Firmware/VBoxPkg/Library/VBoxPeCoffLib/BasePeCoff.c

    r69500 r72500  
    13321332}
    13331333
     1334extern VOID EFIAPI VBoxPeCoffLoaderMoveImageExtraAction(IN PHYSICAL_ADDRESS OldBase, IN PHYSICAL_ADDRESS NewBase);
    13341335
    13351336/**
     
    13881389  EFI_FAT_IMAGE_HEADER                *Fat;
    13891390
     1391  VBoxPeCoffLoaderMoveImageExtraAction(ImageBase, VirtImageBase);
     1392
    13901393  OldBase = (CHAR8 *)((UINTN)ImageBase);
    13911394  NewBase = (CHAR8 *)((UINTN)VirtImageBase);
Note: See TracChangeset for help on using the changeset viewer.

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