VirtualBox

Changeset 42900 in vbox for trunk/src/VBox/VMM/VMMR0


Ignore:
Timestamp:
Aug 21, 2012 10:30:08 AM (12 years ago)
Author:
vboxsync
Message:

VMMR0/HWSVMR0: lookup table for IOIO intercepts' operand size.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMR0/HWSVMR0.cpp

    r42894 r42900  
    6262*   Global Variables                                                           *
    6363*******************************************************************************/
     64/* IO operation lookup arrays. */
     65static uint32_t const g_aIOSize[8]  = {0, 1, 2, 0, 4, 0, 0, 0};
     66static uint32_t const g_aIOOpAnd[8] = {0, 0xff, 0xffff, 0, 0xffffffff, 0, 0, 0};
     67
    6468
    6569/**
     
    23942398    {
    23952399        SVM_IOIO_EXIT   IoExitInfo;
    2396         uint32_t        uIOSize, uAndVal;
    23972400
    23982401        IoExitInfo.au32[0] = pVMCB->ctrl.u64ExitInfo1;
    2399 
    2400         /** @todo could use a lookup table here */
    2401         if (IoExitInfo.n.u1OP8)
    2402         {
    2403             uIOSize = 1;
    2404             uAndVal = 0xff;
    2405         }
    2406         else if (IoExitInfo.n.u1OP16)
    2407         {
    2408             uIOSize = 2;
    2409             uAndVal = 0xffff;
    2410         }
    2411         else if (IoExitInfo.n.u1OP32)
    2412         {
    2413             uIOSize = 4;
    2414             uAndVal = 0xffffffff;
    2415         }
    2416         else
     2402        unsigned uIdx      = (IoExitInfo.au32[0] >> 4) & 0x7;
     2403        uint32_t uIOSize   = g_aIOSize[uIdx];
     2404        uint32_t uAndVal   = g_aIOOpAnd[uIdx];
     2405        if (RT_UNLIKELY(!uIOSize))
    24172406        {
    24182407            AssertFailed(); /* should be fatal. */
    2419             rc = VINF_EM_RAW_EMULATE_INSTR;
     2408            rc = VINF_EM_RAW_EMULATE_INSTR;  /** @todo r=ramshankar: would this really fall back to the recompiler and work? */
    24202409            break;
    24212410        }
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