VirtualBox

Changeset 78571 in vbox for trunk/src


Ignore:
Timestamp:
May 17, 2019 2:24:30 PM (6 years ago)
Author:
vboxsync
Message:

DevACPI: First check input, then take a lock.

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

Legend:

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

    r78423 r78571  
    638638                    fdpt = ebda_seg :> &EbdaData->fdpt1;
    639639
    640 #if 0
     640#if 1
    641641                /* Place the FDPT outside of conventional memory. Needed for
    642642                 * 286 XENIX 2.1.3/2.2.1 because it completely wipes out
  • trunk/src/VBox/Devices/PC/BIOS/disk.c

    r76553 r78571  
    162162            dpt->heads     = bios_dsk->devices[device].pchs.heads;
    163163            dpt->spt       = bios_dsk->devices[device].pchs.spt;
     164#if 1
    164165            lba = bios_dsk->devices[device].sectors;
     166#else
     167            // Makes PC DOS 7.1 FDISK32 happy
     168            lba = (uint32_t)dpt->cylinders * dpt->heads * dpt->spt;
     169#endif
    165170            dpt->sector_count1 = lba;
    166171            dpt->sector_count2 = lba >> 32;
     
    395400        break;
    396401
     402#ifdef VBOX_WITH_SCSIz
     403    case 0x06: /* identify SCSI devices */
     404        if (VBOX_IS_SCSI_DEVICE(device)|| 1) {
     405            BX_INFO("%s: AX=%04x BX=%04x CX=%04x DX=%04x ES=%04x\n", __func__, AX, BX, CX, DX, ES);
     406            BX_INFO("%s: function %02xh detected SCSI drive\n", __func__, GET_AH());
     407            SET_BH(0);
     408            SET_BL(0);
     409            SET_AL(0x80);
     410            goto int13_success;
     411        }
     412        BX_INFO("%s no SCSI drives, returns fail\n", __func__);
     413        goto int13_fail;
     414        break;
     415#endif
    397416    case 0x08: /* read disk drive parameters */
    398417
    399418        /* Get the logical geometry from internal table. */
     419#if 0
     420        /* Windows 3.1 FastDisk (wdctrl) insists on this */
     421        nlc   = bios_dsk->devices[device].lchs.cylinders - 1;
     422#else
    400423        nlc   = bios_dsk->devices[device].lchs.cylinders;
     424#endif
    401425        nlh   = bios_dsk->devices[device].lchs.heads;
    402426        nlspt = bios_dsk->devices[device].lchs.spt;
  • trunk/src/VBox/Devices/PC/BIOS/makefile

    r71426 r78571  
    4747
    4848vbxbios.rom : vbxbios.bin
     49!if $(CPU) > 286
    4950        biossums $< $@
     51!else
     52        cp $< $@
     53!endif
    5054
    5155vbxbios.bin : $(OBJS) $(__MAKEFILES__)
  • trunk/src/VBox/Devices/PC/DevACPI.cpp

    r76553 r78571  
    21142114{
    21152115    ACPIState *pThis = (ACPIState *)pvUser;
    2116     DEVACPI_LOCK_R3(pThis);
    21172116
    21182117    LogFunc(("Port=%#x u32=%#x cb=%u\n", Port, u32, cb));
     
    21222121        return PDMDevHlpDBGFStop(pDevIns, RT_SRC_POS, "cb=%d Port=%u u32=%#x\n", cb, Port, u32);
    21232122
     2123    DEVACPI_LOCK_R3(pThis);
    21242124    switch (off)
    21252125    {
     
    22032203    RT_NOREF1(pDevIns);
    22042204    ACPIState *pThis = (ACPIState *)pvUser;
    2205     DEVACPI_LOCK_R3(pThis);
    22062205
    22072206    int rc = VINF_SUCCESS;
     
    22122211        return VERR_IOM_IOPORT_UNUSED;
    22132212
     2213    DEVACPI_LOCK_R3(pThis);
    22142214    switch (off)
    22152215    {
  • trunk/src/VBox/Devices/PC/DevDMA.cpp

    r76553 r78571  
    9999#define DMA_SAVESTATE_OLD       1   /* The original saved state. */
    100100#define DMA_SAVESTATE_CURRENT   2   /* The new and improved saved state. */
     101#define DMA_FIXES
    101102
    102103/* State information for a single DMA channel. */
     
    266267            else
    267268                ch->u16BaseAddr  = RT_MAKE_U16(ch->u16BaseAddr, u32);
    268 
    269             ch->u16CurCount = 0;
    270             ch->u16CurAddr  = ch->u16BaseAddr;
    271269        }
    272270        else
     
    278276                ch->u16BaseAddr  = RT_MAKE_U16(u32, RT_HIBYTE(ch->u16BaseAddr));
    279277        }
     278        /*
     279         * Update the current count/address.
     280         *
     281         * NB: The current count actually counts from zero up, while the base count
     282         * uses the the 8257 semantics and counts down. The guest never sees the
     283         * current count directly.
     284         */
     285        if (is_count)
     286            ch->u16CurCount = 0;
     287        else
     288            ch->u16CurAddr  = ch->u16BaseAddr;
     289
    280290        Log2(("dmaWriteAddr: port %#06x, chidx %d, data %#02x\n",
    281291              port, chidx, u32));
     
    312322            val = ch->u16BaseCount - ch->u16CurCount;
    313323        else
     324#ifdef DMA_FIXES
     325            val = ch->u16CurAddr;
     326#else
    314327            val = ch->u16CurAddr + ch->u16CurCount * dir;
     328#endif
    315329
    316330        bptr = dmaReadBytePtr(dc);
     
    601615    DMAChannel  *ch = &dc->ChState[chidx];
    602616    uint32_t    start_cnt, end_cnt;
     617    int         uDelta;
    603618    int         opmode;
    604619
     
    616631    end_cnt = ch->pfnXferHandler(pThis->pDevIns, ch->pvUser, (ctlidx * 4) + chidx,
    617632                                 start_cnt, (ch->u16BaseCount + 1) << dc->is16bit);
     633    uDelta = (end_cnt - start_cnt) >> dc->is16bit;
    618634    ch->u16CurCount = end_cnt >> dc->is16bit;
     635#ifdef DMA_FIXES    // Necessary, but currently upsets SB16.
     636    int dir = IS_MODE_DEC(ch->u8Mode) ? -1 : 1;
     637    ch->u16CurAddr += uDelta * dir;
     638#endif
    619639    /* Set the TC (Terminal Count) bit if transfer was completed. */
    620640    if (ch->u16CurCount == ch->u16BaseCount + 1)
     
    624644        case DMODE_SINGLE:
    625645        case DMODE_BLOCK:
    626             dc->u8Status |= RT_BIT(chidx);
    627             Log3(("TC set for DMA channel %d\n", (ctlidx * 4) + chidx));
     646            dc->u8Status |= RT_BIT(chidx);  /* Set the TC status bit. */
     647            Log3(("TC set for DMA channel %d, auto-init %s\n", (ctlidx * 4) + chidx, IS_MODE_AI(ch->u8Mode) ? "on" : "off"));
     648            if (IS_MODE_AI(ch->u8Mode))
     649            {
     650                /* Auto-init DMA, resets the current address/count. */
     651#ifdef DMA_FIXES    // Necessary, but currently upsets SB16.
     652                ch->u16CurAddr  = ch->u16BaseAddr;
     653                ch->u16CurCount = 0;
     654#endif
     655            }
     656            else
     657                dc->u8Mask |= RT_BIT(chidx);    /* No auto-init, mask channel. */
    628658            break;
    629659        default:
     
    655685        {
    656686            mask = 1 << chidx;
     687            /* Run channel if not masked and its DREQ is active. */
    657688            if (!(dc->u8Mask & mask) && (dc->u8Status & (mask << 4)))
    658689                dmaRunChannel(pThis, ctlidx, chidx);
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