VirtualBox

Changeset 9395

Show
Ignore:
Timestamp:
06/04/08 18:22:54 (6 months ago)
Author:
vboxsync
Message:

fixed more places with incorrect descriptor base address calculation

Files:

Legend:

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

    r9394 r9395  
    10831083         */ 
    10841084        PVBOXDESC   pDesc = &pVM->selm.s.paGdtHC[SelLdt >> X86_SEL_SHIFT]; 
    1085         RTGCPTR     GCPtrLdt = pDesc->Gen.u16BaseLow | (pDesc->Gen.u8BaseHigh1 << 16) | (pDesc->Gen.u8BaseHigh2 << 24); 
     1085        RTGCPTR     GCPtrLdt = pDesc->Gen.u16BaseLow | (pDesc->Gen.u8BaseHigh1 << 16) | ((RTGCPTR)pDesc->Gen.u8BaseHigh2 << 24); 
    10861086        unsigned    cbLdt = pDesc->Gen.u16LimitLow | (pDesc->Gen.u4LimitHigh << 16); 
    10871087        if (pDesc->Gen.u1Granularity) 
     
    14201420         */ 
    14211421        PVBOXDESC   pDesc = &pVM->selm.s.paGdtHC[SelTss >> X86_SEL_SHIFT]; 
    1422         RTGCPTR     GCPtrTss = pDesc->Gen.u16BaseLow | (pDesc->Gen.u8BaseHigh1 << 16) | ((pDesc->Gen.u8BaseHigh2 << 24) & 0xff000000); 
     1422        RTGCPTR     GCPtrTss = pDesc->Gen.u16BaseLow | (pDesc->Gen.u8BaseHigh1 << 16) | ((RTGCPTR)pDesc->Gen.u8BaseHigh2 << 24); 
    14231423        unsigned    cbTss = pDesc->Gen.u16LimitLow | (pDesc->Gen.u4LimitHigh << 16); 
    14241424        if (pDesc->Gen.u1Granularity) 
     
    16251625        return rc; 
    16261626    } 
    1627     RTGCPTR     GCPtrLDTEGuest = LDTDesc.Gen.u16BaseLow | (LDTDesc.Gen.u8BaseHigh1 << 16) | (LDTDesc.Gen.u8BaseHigh2 << 24); 
     1627    RTGCPTR     GCPtrLDTEGuest = LDTDesc.Gen.u16BaseLow | (LDTDesc.Gen.u8BaseHigh1 << 16) | ((RTGCPTR)LDTDesc.Gen.u8BaseHigh2 << 24); 
    16281628    unsigned    cbLdt = LDTDesc.Gen.u16LimitLow | (LDTDesc.Gen.u4LimitHigh << 16); 
    16291629    if (LDTDesc.Gen.u1Granularity) 
     
    17041704         */ 
    17051705        PVBOXDESC   pDesc = &pVM->selm.s.paGdtHC[SelTss >> X86_SEL_SHIFT]; 
    1706         RTGCPTR     GCPtrTss = pDesc->Gen.u16BaseLow | (pDesc->Gen.u8BaseHigh1 << 16) | (pDesc->Gen.u8BaseHigh2 << 24); 
     1706        RTGCPTR     GCPtrTss = pDesc->Gen.u16BaseLow | (pDesc->Gen.u8BaseHigh1 << 16) | ((RTGCPTR)pDesc->Gen.u8BaseHigh2 << 24); 
    17071707        unsigned    cbTss = pDesc->Gen.u16LimitLow | (pDesc->Gen.u4LimitHigh << 16); 
    17081708        if (pDesc->Gen.u1Granularity) 
     
    18161816    if (ppvLdt) 
    18171817    { 
    1818         *ppvLdt = (RTGCPTR)(   (Desc.Gen.u8BaseHigh2 << 24) 
     1818        *ppvLdt = (RTGCPTR)(    ((RTGCPTR)Desc.Gen.u8BaseHigh2 << 24) 
    18191819                              |  (Desc.Gen.u8BaseHigh1 << 16) 
    18201820                              |   Desc.Gen.u16BaseLow); 
     
    19081908 
    19091909            /* calc the descriptor location. */ 
    1910             GCPtrDesc =    (Desc.Gen.u8BaseHigh2 << 24) 
     1910            GCPtrDesc =    ((RTGCPTR)Desc.Gen.u8BaseHigh2 << 24) 
    19111911                        |  (Desc.Gen.u8BaseHigh1 << 16) 
    19121912                        |   Desc.Gen.u16BaseLow; 
     
    19411941    if (Desc.Gen.u1Granularity) 
    19421942        pSelInfo->cbLimit = (pSelInfo->cbLimit << PAGE_SHIFT) | PAGE_OFFSET_MASK; 
    1943     pSelInfo->GCPtrBase =   (Desc.Gen.u8BaseHigh2 << 24) 
     1943    pSelInfo->GCPtrBase =   ((RTGCPTR)Desc.Gen.u8BaseHigh2 << 24) 
    19441944                          | (Desc.Gen.u8BaseHigh1 << 16) 
    19451945                          |  Desc.Gen.u16BaseLow; 
     
    20082008    if (Desc.Gen.u1Granularity) 
    20092009        pSelInfo->cbLimit = (pSelInfo->cbLimit << PAGE_SHIFT) | PAGE_OFFSET_MASK; 
    2010     pSelInfo->GCPtrBase =   (Desc.Gen.u8BaseHigh2 << 24) 
     2010    pSelInfo->GCPtrBase =   ((RTGCPTR)Desc.Gen.u8BaseHigh2 << 24) 
    20112011                          | (Desc.Gen.u8BaseHigh1 << 16) 
    20122012                          |  Desc.Gen.u16BaseLow; 
  • trunk/src/VBox/VMM/VMMAll/SELMAll.cpp

    r9212 r9395  
    7070 
    7171    return (RTGCPTR)( (RTGCUINTPTR)Addr 
    72                        + (   (Desc.Gen.u8BaseHigh2 << 24) 
     72                       + (   ((RTGCPTR)Desc.Gen.u8BaseHigh2 << 24) 
    7373                          |  (Desc.Gen.u8BaseHigh1 << 16) 
    7474                          |   Desc.Gen.u16BaseLow)); 
     
    203203        /* calc address assuming straight stuff. */ 
    204204        pvFlat = (RTGCPTR)(  (RTGCUINTPTR)Addr 
    205                            + (   (Desc.Gen.u8BaseHigh2 << 24) 
     205                           + (   ((RTGCPTR)Desc.Gen.u8BaseHigh2 << 24) 
    206206                              |  (Desc.Gen.u8BaseHigh1 << 16) 
    207207                              |   Desc.Gen.u16BaseLow ) 
     
    408408                { 
    409409                    *ppvFlat = (RTGCPTR)(  (RTGCUINTPTR)Addr 
    410                                            + (   (Desc.Gen.u8BaseHigh2 << 24) 
     410                                           + (   ((RTGCPTR)Desc.Gen.u8BaseHigh2 << 24) 
    411411                                              |  (Desc.Gen.u8BaseHigh1 << 16) 
    412412                                              |   Desc.Gen.u16BaseLow) 

© 2008 Sun Microsystems, Inc.
ContactPrivacy policy