VirtualBox

Ignore:
Timestamp:
Apr 11, 2016 5:14:35 PM (9 years ago)
Author:
vboxsync
Message:

PCBIOS: 286 fixes, improved the BIOSORG checking as overflows in this area are hard to figure out.

File:
1 edited

Legend:

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

    r56292 r60433  
    4545
    4646
     47#if VBOX_BIOS_CPU >= 80386
    4748/* Warning: Destroys high bits of ECX. */
    4849uint16_t pci_find_class(uint16_t op, uint32_t dev_class, uint16_t start_bdf);
    49 #pragma aux pci_find_class =    \
     50# pragma aux pci_find_class =    \
    5051    ".386"                  \
    5152    "shl    ecx, 16"        \
     
    5758    "found:"                \
    5859    parm [ax] [cx dx] [si] value [bx];
     60#endif
    5961
    6062uint16_t pci_find_dev(uint16_t op, uint16_t dev_id, uint16_t ven_id, uint16_t start_bdf);
     
    7779    parm [ax] [bx] [di] value [cx];
    7880
     81#if VBOX_BIOS_CPU >= 80386
    7982/* Warning: Destroys high bits of ECX. */
    8083uint32_t pci_read_cfgd(uint16_t op, uint16_t bus_dev_fn, uint16_t reg);
    81 #pragma aux pci_read_cfgd = \
     84# pragma aux pci_read_cfgd = \
    8285    ".386"                  \
    8386    "int    0x1a"           \
     
    8588    "shr    ecx, 16"        \
    8689    parm [ax] [bx] [di] value [cx ax];
     90#endif
    8791
    8892uint8_t pci_write_cfgb(uint16_t op, uint16_t bus_dev_fn, uint16_t reg, uint8_t val);
     
    96100    parm [ax] [bx] [di] [cx];
    97101
     102#if VBOX_BIOS_CPU >= 80386
    98103/* Warning: Destroys high bits of ECX. */
    99104uint8_t pci_write_cfgd(uint16_t op, uint16_t bus_dev_fn, uint16_t reg, uint32_t val);
    100 #pragma aux pci_write_cfgd = \
     105# pragma aux pci_write_cfgd = \
    101106    ".386"                  \
    102107    "xchg   cx, dx"         \
     
    105110    "int    0x1a"           \
    106111    parm [ax] [bx] [di] [dx cx];
     112#endif
    107113
    108114
     
    119125uint16_t pci_find_classcode(uint32_t dev_class)
    120126{
     127#if VBOX_BIOS_CPU >= 80386
    121128    return pci_find_class((PCIBIOS_ID << 8) | PCIBIOS_FIND_CLASS_CODE, dev_class, 0);
     129#else
     130    return UINT16_C(0xffff);
     131#endif
    122132}
    123133
     
    134144uint32_t pci_read_config_dword(uint8_t bus, uint8_t dev_fn, uint8_t reg)
    135145{
     146#if VBOX_BIOS_CPU >= 80386
    136147    return pci_read_cfgd((PCIBIOS_ID << 8) | PCIBIOS_READ_CONFIG_DWORD, (bus << 8) | dev_fn, reg);
     148#else
     149    return pci_read_cfgw((PCIBIOS_ID << 8) | PCIBIOS_READ_CONFIG_WORD, (bus << 8) | dev_fn, reg)
     150        || ((uint32_t)pci_read_cfgw((PCIBIOS_ID << 8) | PCIBIOS_READ_CONFIG_WORD, (bus << 8) | dev_fn, reg + 2) << 16);
     151#endif
    137152}
    138153
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