VirtualBox

Changeset 89384 in vbox for trunk


Ignore:
Timestamp:
May 31, 2021 9:43:28 AM (4 years ago)
Author:
vboxsync
Message:

Devices/PC/BIOS: Allocate the bounce buffer only when booting from a CD drive to avoid stealing memory always, rename atapi_read to cdrom_read, bugref:4841

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/PC/BIOS/eltorito.c

    r89367 r89384  
    182182    // the only important data is this one for now
    183183    cdemu->active = 0x00;
    184     cdemu->ptr_unaligned = cdemu_bounce_buf_alloc() :> 0;
    185184}
    186185
     
    295294}
    296295
    297 static uint16_t atapi_read(uint8_t device, uint32_t lba, uint16_t nbsectors, void __far *buf)
     296static uint16_t cdrom_read(uint8_t device, uint32_t lba, uint16_t nbsectors, void __far *buf)
    298297{
    299298    uint16_t            ebda_seg=read_word(0x0040,0x000E);
     
    332331        uint16_t xfer_sect = MIN(nbsectors, 4 - before);
    333332
    334         error = atapi_read(device, ilba + slba, 1, cdemu->ptr_unaligned);
     333        error = cdrom_read(device, ilba + slba, 1, cdemu->ptr_unaligned);
    335334        if (error != 0)
    336335            return error;
     
    347346        uint16_t xfer_sect = nbsectors / 4;
    348347
    349         error = atapi_read(device, ilba + slba, xfer_sect, dst);
     348        error = cdrom_read(device, ilba + slba, xfer_sect, dst);
    350349        if (error != 0)
    351350            return error;
     
    358357    if (nbsectors)
    359358    {
    360         error = atapi_read(device, ilba + slba, 1, cdemu->ptr_unaligned);
     359        error = cdrom_read(device, ilba + slba, 1, cdemu->ptr_unaligned);
    361360        if (error != 0)
    362361            return error;
     
    404403    for (read_try = 0; read_try <= 4; ++read_try)
    405404    {
    406         error = atapi_read(device, 0x11, 1, &buffer);
     405        error = cdrom_read(device, 0x11, 1, &buffer);
    407406        if (!error)
    408407            break;
     
    428427
    429428    /* Now we read the Boot Catalog. */
    430     error = atapi_read(device, lba, 1, buffer);
     429    error = cdrom_read(device, lba, 1, buffer);
    431430    if (error != 0)
    432431        return 7;
     
    488487    if (error != 0)
    489488        return 13;
     489
     490    cdemu->ptr_unaligned = cdemu_bounce_buf_alloc() :> 0;
     491    if (cdemu->ptr_unaligned == NULL)
     492        return 14;
    490493
    491494    BX_DEBUG_ELTORITO("Emulate drive %02x, type %02x, LBA %lu\n",
     
    893896                          __func__, count, lba, segment, offset);
    894897
    895         status = atapi_read(device, lba, count, MK_FP(segment,offset));
     898        status = cdrom_read(device, lba, count, MK_FP(segment,offset));
    896899        count = (uint16_t)(bios_dsk->drqp.trsfbytes >> 11);
    897900        i13x->count = count;
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