VirtualBox

Changeset 9574

Show
Ignore:
Timestamp:
06/10/08 17:19:00 (6 months ago)
Author:
vboxsync
Message:

Mask away invalid parts of the cpu context in CPUMSetGuestCtxCore.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/src/VBox/VMM/VMMAll/CPUMAllRegs.cpp

    r9543 r9574  
    393393    /** @todo #1410 requires selectors to be checked. */ 
    394394 
    395     PCPUMCTXCORE pCtxCoreDst CPUMCTX2CORE(&pVM->cpum.s.Guest); 
     395    PCPUMCTXCORE pCtxCoreDst = CPUMCTX2CORE(&pVM->cpum.s.Guest); 
    396396    *pCtxCoreDst = *pCtxCore; 
     397 
     398    /* Mask away invalid parts of the cpu context. */ 
     399    if (CPUMGetGuestMode(pVM) != CPUMMODE_LONG) 
     400    { 
     401        uint64_t u64Mask = UINT64_C(0xffffffff); 
     402 
     403        pCtxCoreDst->rip        &= u64Mask; 
     404        pCtxCoreDst->rax        &= u64Mask; 
     405        pCtxCoreDst->rbx        &= u64Mask; 
     406        pCtxCoreDst->rcx        &= u64Mask; 
     407        pCtxCoreDst->rdx        &= u64Mask; 
     408        pCtxCoreDst->rsi        &= u64Mask; 
     409        pCtxCoreDst->rdi        &= u64Mask; 
     410        pCtxCoreDst->rbp        &= u64Mask; 
     411        pCtxCoreDst->rsp        &= u64Mask; 
     412        pCtxCoreDst->rflags.u   &= u64Mask; 
     413 
     414        pCtxCoreDst->r8         = 0; 
     415        pCtxCoreDst->r9         = 0; 
     416        pCtxCoreDst->r10        = 0; 
     417        pCtxCoreDst->r11        = 0; 
     418        pCtxCoreDst->r12        = 0; 
     419        pCtxCoreDst->r13        = 0; 
     420        pCtxCoreDst->r14        = 0; 
     421        pCtxCoreDst->r15        = 0; 
     422    } 
    397423} 
    398424 

© 2008 Sun Microsystems, Inc.
ContactPrivacy policy