VirtualBox

Changeset 1510 in vbox for trunk/src/recompiler


Ignore:
Timestamp:
Mar 15, 2007 12:33:47 PM (18 years ago)
Author:
vboxsync
Message:

Using a null selector is illegal.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/recompiler/target-i386/op.c

    r1506 r1510  
    496496        sync_seg(env, idx, env->segs[idx].newselector);
    497497    }
     498    /* Loading a null selector into a segment register is valid, but using it is most definitely not! */
     499    if (    (env->cr[0] & (CR0_PE_MASK|CR0_PG_MASK)) == (CR0_PE_MASK|CR0_PG_MASK)
     500        &&  !(env->eflags & VM_MASK)
     501        &&  env->segs[idx].selector == 0
     502       )
     503    {
     504        raise_exception(EXCP0D_GPF);
     505    }
     506
    498507    A0 = (uint32_t)env->segs[idx].base;
    499508#else
     
    511520        sync_seg(env, idx, env->segs[idx].newselector);
    512521    }
     522    /* Loading a null selector into a segment register is valid, but using it is most definitely not! */
     523    if (    (env->cr[0] & (CR0_PE_MASK|CR0_PG_MASK)) == (CR0_PE_MASK|CR0_PG_MASK)
     524        &&  !(env->eflags & VM_MASK)
     525        &&  env->segs[idx].selector == 0
     526       )
     527    {
     528        raise_exception(EXCP0D_GPF);
     529    }
     530
    513531    A0 = (uint32_t)(A0 + env->segs[idx].base);
    514532#else
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