VirtualBox

Changeset 106398 in vbox for trunk


Ignore:
Timestamp:
Oct 16, 2024 8:53:42 PM (6 weeks ago)
Author:
vboxsync
Message:

bldprogs: Add support for arm64 for VBoxEditCoffLib and VBoxPeSetVersion, bugref:10734

Location:
trunk/src/bldprogs
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bldprogs/VBoxEditCoffLib.cpp

    r106061 r106398  
    333333        return error("member too small for COFF\n");
    334334    if (   pHdr->Machine != IMAGE_FILE_MACHINE_AMD64
    335         && pHdr->Machine != IMAGE_FILE_MACHINE_I386)
     335        && pHdr->Machine != IMAGE_FILE_MACHINE_I386
     336        && pHdr->Machine != IMAGE_FILE_MACHINE_ARM64
     337        && pHdr->Machine != IMAGE_FILE_MACHINE_ARM)
    336338        return error("Unsupported COFF machine: %#x\n", pHdr->Machine);
    337339    if (   pHdr->PointerToSymbolTable >= g_cbMember
  • trunk/src/bldprogs/VBoxPeSetVersion.cpp

    r106061 r106398  
    273273        return Error("Invalid PE signature: %#x", NtHdrs.x32.Signature);
    274274    uint32_t cbNewHdrs;
    275     if (NtHdrs.x32.FileHeader.Machine == IMAGE_FILE_MACHINE_AMD64)
     275    if (NtHdrs.x32.FileHeader.Machine == IMAGE_FILE_MACHINE_ARM64)
     276    {
     277        if (NtHdrs.x64.FileHeader.SizeOfOptionalHeader != sizeof(NtHdrs.x64.OptionalHeader))
     278            return Error("Invalid optional header size: %#x", NtHdrs.x64.FileHeader.SizeOfOptionalHeader);
     279        if (NtHdrs.x64.OptionalHeader.Magic != IMAGE_NT_OPTIONAL_HDR64_MAGIC)
     280            return Error("Invalid optional header magic: %#x", NtHdrs.x64.OptionalHeader.Magic);
     281        if (!uNtVersion)
     282            uNtVersion = MK_VER(10, 0);
     283        else if (uNtVersion < MK_VER(10, 0))
     284            return Error("Selected version is too old for ARM64: %u.%u", uNtVersion >> 8, uNtVersion & 0xff);
     285        cbNewHdrs = sizeof(NtHdrsNew.x64);
     286    }
     287    else if (NtHdrs.x32.FileHeader.Machine == IMAGE_FILE_MACHINE_AMD64)
    276288    {
    277289        if (NtHdrs.x64.FileHeader.SizeOfOptionalHeader != sizeof(NtHdrs.x64.OptionalHeader))
     
    286298    }
    287299    else if (NtHdrs.x32.FileHeader.Machine != IMAGE_FILE_MACHINE_I386)
    288         return Error("Not I386 or AMD64 machine: %#x", NtHdrs.x32.FileHeader.Machine);
     300        return Error("Not I386, AMD64 or ARM64 machine: %#x", NtHdrs.x32.FileHeader.Machine);
    289301    else
    290302    {
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