VirtualBox

Changeset 34081 in vbox for trunk/src/VBox/Devices/PC


Ignore:
Timestamp:
Nov 15, 2010 5:18:30 PM (14 years ago)
Author:
vboxsync
Message:

Devices/PC: clean up LAN boot ROM code a bit, do the proper size check and allow files which are not a multiple of 4K in size.

Location:
trunk/src/VBox/Devices/PC
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/PC/DevPcBios.cpp

    r33917 r34081  
    12821282    }
    12831283
    1284     uint64_t cbFileLanBoot;
     1284    uint64_t cbFileLanBoot, cbFileLanBootAlign;
    12851285    const uint8_t *pu8LanBootBinary = NULL;
    12861286    uint64_t cbLanBootBinary;
     
    12991299            if (RT_SUCCESS(rc))
    13001300            {
    1301                 if (    RT_ALIGN(cbFileLanBoot, _4K) != cbFileLanBoot
    1302                     ||  cbFileLanBoot > _64K)
     1301                cbFileLanBootAlign = RT_ALIGN(cbFileLanBoot, _4K);
     1302                if (cbFileLanBootAlign > _64K - (VBOX_LANBOOT_SEG << 4 & 0xffff))
    13031303                    rc = VERR_TOO_MUCH_DATA;
    13041304            }
     
    13251325         * Allocate buffer for the LAN boot ROM data.
    13261326         */
    1327         pThis->pu8LanBoot = (uint8_t *)PDMDevHlpMMHeapAlloc(pDevIns, cbFileLanBoot);
     1327        pThis->pu8LanBoot = (uint8_t *)PDMDevHlpMMHeapAllocZ(pDevIns, cbFileLanBootAlign);
    13281328        if (pThis->pu8LanBoot)
    13291329        {
     
    13581358    {
    13591359        pu8LanBootBinary = pThis->pu8LanBoot;
    1360         cbLanBootBinary  = cbFileLanBoot;
     1360        cbLanBootBinary  = cbFileLanBootAlign;
    13611361    }
    13621362
    13631363    /*
    13641364     * Map the Network Boot ROM into memory.
    1365      * Currently there is a fixed mapping: 0x000c8000 to 0x000cffff contains
    1366      * the (up to) 32 kb ROM image.
     1365     * Currently there is a fixed mapping: 0x000d2000 to 0x000dffff contains
     1366     * the (up to) 56 kb ROM image.
    13671367     */
    13681368    if (pu8LanBootBinary)
  • trunk/src/VBox/Devices/PC/DevPcBios.h

    r28800 r34081  
    55
    66/*
    7  * Copyright (C) 2006-2007 Oracle Corporation
     7 * Copyright (C) 2006-2010 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    2020
    2121/** @def VBOX_DMI_TABLE_BASE */
    22 #define VBOX_DMI_TABLE_BASE          0xe1000
    23 #define VBOX_DMI_TABLE_VER           0x25
    24 #define VBOX_DMI_TABLE_ENTR          5
     22#define VBOX_DMI_TABLE_BASE         0xe1000
     23#define VBOX_DMI_TABLE_VER          0x25
     24#define VBOX_DMI_TABLE_ENTR         5
    2525
    2626/** def VBOX_DMI_TABLE_SIZE
     
    3131 * the MPS table.
    3232 */
    33 #define VBOX_DMI_TABLE_SIZE          352
    34 
    35 /** @def VBOX_VMI_BIOS_BASE
    36  *
    37  * Must be located between 0xC0000 and 0xDEFFF, otherwise it will not be
    38  * recognized as regular BIOS.
    39  */
    40 #define VBOX_VMI_BIOS_BASE           0xdf000
     33#define VBOX_DMI_TABLE_SIZE         352
    4134
    4235
     
    4538 * Should usually start right after the DMI BIOS page
    4639 */
    47 #define VBOX_LANBOOT_SEG             0xe200
     40#define VBOX_LANBOOT_SEG            0xe200
    4841
    49 #define VBOX_SMBIOS_MAJOR_VER        2
    50 #define VBOX_SMBIOS_MINOR_VER        5
    51 #define VBOX_SMBIOS_MAXSS            0xff   /* Not very accurate */
     42#define VBOX_SMBIOS_MAJOR_VER       2
     43#define VBOX_SMBIOS_MINOR_VER       5
     44#define VBOX_SMBIOS_MAXSS           0xff   /* Not very accurate */
    5245
    5346#endif
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