VirtualBox

Changeset 15787 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Jan 5, 2009 8:17:25 AM (16 years ago)
Author:
vboxsync
Message:

PCI: don't allow to change subsystem ID and vendor ID; mask out read-only bits in the status register

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Bus/DevPCI.cpp

    r15535 r15787  
    396396        /* default read/write accesses */
    397397        switch(d->config[0x0e]) {
    398         case 0x00:
    399         case 0x80:
     398        case 0x00: /* normal device */
     399        case 0x80: /* multi-function device */
    400400            switch(addr) {
    401401            case 0x00:
     
    411411            case 0x18: case 0x19: case 0x1a: case 0x1b: case 0x1c: case 0x1d: case 0x1e: case 0x1f:
    412412            case 0x20: case 0x21: case 0x22: case 0x23: case 0x24: case 0x25: case 0x26: case 0x27:
     413            case 0x2c: case 0x2d:                                                                   /* subsystem ID */
     414            case 0x2e: case 0x2f:                                                                   /* vendor ID */
    413415            case 0x30: case 0x31: case 0x32: case 0x33:                                             /* rom */
    414416            case 0x3d:
     
    421423            break;
    422424        default:
    423         case 0x01:
     425        case 0x01: /* bridge */
    424426            switch(addr) {
    425427            case 0x00:
     
    443445        }
    444446#ifdef VBOX
    445         /* status register: only clear bits by writing a '1' at the corresponding bit */
    446447        if (addr == 0x06)
    447448        {
     449            /* don't change read-only bits => actually all lower bits are read-only */
     450            val &= UINT32_C(~0xff);
     451            /* status register, low part: clear bits by writing a '1' to the corresponding bit */
    448452            d->config[addr] &= ~val;
    449             d->config[addr] |= 0x08; /* interrupt status */
    450453        }
    451454        else if (addr == 0x07)
    452455        {
     456            /* don't change read-only bits */
     457            val &= UINT32_C(~0x06);
     458            /* status register, high part: clear bits by writing a '1' to the corresponding bit */
    453459            d->config[addr] &= ~val;
    454460        }
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