VirtualBox

Changeset 3650 in vbox for trunk/src


Ignore:
Timestamp:
Jul 16, 2007 3:46:38 PM (18 years ago)
Author:
vboxsync
Message:

Don't allow the guest to set status bits of the PCI status register to 1, writing a 1 has to clear the corresponding bit. Though fixes no known issue. And don't depend on vl_vbox.h anymore.

File:
1 edited

Legend:

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

    r2981 r3650  
    5252/* Hack to get PCIDEVICEINT declare at the right point - include "PCIInternal.h". */
    5353#define PCI_INCLUDE_PRIVATE
    54 #include "vl_vbox.h"
    5554#include <VBox/pci.h>
    5655#include <VBox/pdm.h>
     
    5958#include <VBox/log.h>
    6059#include <iprt/assert.h>
     60#include <iprt/string.h>
    6161
    6262#include "Builtins.h"
     
    226226    uint32_t last_addr, new_addr, config_ofs;
    227227
    228     cmd = le16_to_cpu(*(uint16_t *)(d->config + PCI_COMMAND));
     228    cmd = RT_LE2H_U16(*(uint16_t *)(d->config + PCI_COMMAND));
    229229    for(i = 0; i < PCI_NUM_REGIONS; i++) {
    230230        r = &d->Int.s.aIORegions[i];
     
    237237            if (r->type & PCI_ADDRESS_SPACE_IO) {
    238238                if (cmd & PCI_COMMAND_IO) {
    239                     new_addr = le32_to_cpu(*(uint32_t *)(d->config +
     239                    new_addr = RT_LE2H_U32(*(uint32_t *)(d->config +
    240240                                                         config_ofs));
    241241                    new_addr = new_addr & ~(r->size - 1);
     
    251251            } else {
    252252                if (cmd & PCI_COMMAND_MEMORY) {
    253                     new_addr = le32_to_cpu(*(uint32_t *)(d->config +
     253                    new_addr = RT_LE2H_U32(*(uint32_t *)(d->config +
    254254                                                         config_ofs));
    255255                    /* the ROM slot has a specific enable bit */
     
    318318        break;
    319319    case 2:
    320         val = le16_to_cpu(*(uint16_t *)(d->config + address));
     320        val = RT_LE2H_U16(*(uint16_t *)(d->config + address));
    321321        break;
    322322    default:
    323323    case 4:
    324         val = le32_to_cpu(*(uint32_t *)(d->config + address));
     324        val = RT_LE2H_U32(*(uint32_t *)(d->config + address));
    325325        break;
    326326    }
     
    355355            val |= r->type;
    356356        }
    357         *(uint32_t *)(d->config + address) = cpu_to_le32(val);
     357        *(uint32_t *)(d->config + address) = RT_H2LE_U32(val);
    358358        pci_update_mappings(d);
    359359        return;
     
    411411            break;
    412412        }
     413#ifdef VBOX
     414        /* status register: only clear bits by writing a '1' at the corresponding bit */
     415        if (addr == 0x06)
     416        {
     417            d->config[addr] &= ~val;
     418            d->config[addr] |= 0x08; /* interrupt status */
     419        }
     420        else if (addr == 0x07)
     421        {
     422            d->config[addr] &= ~val;
     423        }
     424        else
     425#endif
    413426        if (can_write) {
    414427            d->config[addr] = val;
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