VirtualBox

Changeset 14771 in vbox for trunk/src/VBox/VMM


Ignore:
Timestamp:
Nov 28, 2008 11:07:18 AM (16 years ago)
Author:
vboxsync
Message:

Fixed 64 bits switcher loading

Location:
trunk/src/VBox/VMM
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMSwitcher.cpp

    r14768 r14771  
    5555    &vmmR3Switcher32BitTo32Bit_Def,
    5656    &vmmR3Switcher32BitToPAE_Def,
    57     NULL, //&vmmR3Switcher32BitToAMD64_Def - disabled because it causes assertions.
     57    &vmmR3Switcher32BitToAMD64_Def,
    5858    &vmmR3SwitcherPAETo32Bit_Def,
    5959    &vmmR3SwitcherPAEToPAE_Def,
    60     NULL, //&vmmR3SwitcherPAEToAMD64_Def - disabled because it causes assertions.
     60    &vmmR3SwitcherPAEToAMD64_Def,
    6161    NULL,   //&vmmR3SwitcherPAETo32Bit_Def,
    6262# ifdef VBOX_WITH_HYBIRD_32BIT_KERNEL
     
    348348            case FIX_GC_2_ID_NEAR_REL:
    349349            {
    350                 Assert(offSrc - pSwitcher->offGCCode < pSwitcher->cbGCCode);
     350                AssertMsg(offSrc - pSwitcher->offGCCode < pSwitcher->cbGCCode, ("%x - %x < %x\n", offSrc, pSwitcher->offGCCode, pSwitcher->cbGCCode));
    351351                uint32_t offTrg = *u.pu32++;
    352352                Assert(offTrg - pSwitcher->offIDCode0 < pSwitcher->cbIDCode0 || offTrg - pSwitcher->offIDCode1 < pSwitcher->cbIDCode1);
     
    610610#if defined(RT_ARCH_AMD64) || defined(VBOX_WITH_HYBIRD_32BIT_KERNEL)
    611611            /*
    612              * 64-bit HC pointer fixup to (HC) target within the code (32-bit offset).
    613              */
    614             case FIX_HC_64BIT:
    615             {
    616                 uint32_t offTrg = *u.pu32++;
    617                 Assert(offSrc < pSwitcher->cbCode);
    618                 Assert(offTrg - pSwitcher->offHCCode0 < pSwitcher->cbHCCode0 || offTrg - pSwitcher->offHCCode1 < pSwitcher->cbHCCode1);
    619                 *uSrc.pu64 = R0PtrCode + offTrg;
    620                 break;
    621             }
    622 
    623             /*
    624612             * 64-bit HC Code Selector (no argument).
    625613             */
     
    636624#endif
    637625            /*
     626             * 64-bit HC pointer fixup to (HC) target within the code (32-bit offset).
     627             */
     628            case FIX_HC_64BIT:
     629            {
     630                uint32_t offTrg = *u.pu32++;
     631                Assert(offSrc < pSwitcher->cbCode);
     632                Assert(offTrg - pSwitcher->offHCCode0 < pSwitcher->cbHCCode0 || offTrg - pSwitcher->offHCCode1 < pSwitcher->cbHCCode1);
     633                *uSrc.pu64 = R0PtrCode + offTrg;
     634                break;
     635            }
     636
     637            /*
    638638             * 64-bit HC pointer to the CPUM instance data (no argument).
    639639             */
     
    661661             */
    662662            case FIX_ID_64BIT:
     663            case FIX_HC_64BIT_NOCHECK:
    663664            {
    664665                uint32_t offTrg = *u.pu32++;
    665666                Assert(offSrc < pSwitcher->cbCode);
    666                 Assert(offTrg - pSwitcher->offIDCode0 < pSwitcher->cbIDCode0 || offTrg - pSwitcher->offIDCode1 < pSwitcher->cbIDCode1);
     667                Assert(u8 == FIX_HC_64BIT_NOCHECK || offTrg - pSwitcher->offIDCode0 < pSwitcher->cbIDCode0 || offTrg - pSwitcher->offIDCode1 < pSwitcher->cbIDCode1);
    667668                *uSrc.pu64 = u32IDCode + offTrg;
    668669                break;
     
    883884}
    884885
     886/**
     887 * Relocator for the PAE to AMD64 world switcher.
     888 */
     889DECLCALLBACK(void) vmmR3SwitcherPAEToAMD64_Relocate(PVM pVM, PVMMSWITCHERDEF pSwitcher, RTR0PTR R0PtrCode, uint8_t *pu8CodeR3, RTGCPTR GCPtrCode, uint32_t u32IDCode)
     890{
     891    vmmR3SwitcherGenericRelocate(pVM, pSwitcher, R0PtrCode, pu8CodeR3, GCPtrCode, u32IDCode,
     892                                 SELMGetHyperCS(pVM), SELMGetHyperDS(pVM), SELMGetHyperTSS(pVM), SELMGetHyperGDT(pVM), SELMGetHyperCS64(pVM));
     893}
     894
    885895
    886896/**
  • trunk/src/VBox/VMM/VMMSwitcher/LegacyandAMD64.mac

    r14767 r14771  
    171171    ;; Jump to identity mapped location
    172172    ;;
    173     FIXUP FIX_GC_2_ID_NEAR_REL, 1, NAME(IDEnterTarget) - NAME(Start)
     173    FIXUP FIX_HC_2_ID_NEAR_REL, 1, NAME(IDEnterTarget) - NAME(Start)
    174174    jmp near NAME(IDEnterTarget)
    175175
     
    225225; 64-bit jump target
    226226NAME(pICEnterTarget):
    227 FIXUP FIX_HC_64BIT, 0, NAME(ICEnterTarget) - NAME(Start)
     227FIXUP FIX_HC_64BIT_NOCHECK, 0, NAME(ICEnterTarget) - NAME(Start)
    228228dq 0ffffffffffffffffh
    229229
     
    327327    mov     cr3, rax
    328328    ;; We're now in the intermediate memory context!
     329
     330    ;;
     331    ;; Switch to compatibility mode, placing ourselves in identity mapped code.
     332    ;;
     333    jmp far [NAME(fpIDEnterTarget) wrt rip]
     334
     335; 16:32 Pointer to IDEnterTarget.
     336NAME(fpIDEnterTarget):
     337    FIXUP FIX_ID_32BIT, 0, NAME(IDExitTarget) - NAME(Start)
     338dd  0
     339    FIXUP FIX_HYPER_CS, 0
     340dd  0
    329341       
    330     ;;
    331     ;; Jump to identity mapped location
    332     ;;
    333     FIXUP FIX_GC_2_ID_NEAR_REL, 1, NAME(IDExitTarget) - NAME(Start)
    334     jmp near NAME(IDExitTarget)
    335 
    336342    ; We're now on identity mapped pages!
    337343ALIGNCODE(16)
     
    378384    ;; 5. Jump to guest code mapping of the code and load the Hypervisor CS.
    379385    ;;
    380     FIXUP FIX_ID_2_GC_NEAR_REL, 1, NAME(ICExitTarget) - NAME(Start)
     386    FIXUP FIX_ID_2_HC_NEAR_REL, 1, NAME(ICExitTarget) - NAME(Start)
    381387    jmp near NAME(ICExitTarget)
    382388   
     
    589595        at VMMSWITCHERDEF.cbIDCode0,                    dd NAME(ICEnterTarget)              - NAME(IDEnterTarget)
    590596        at VMMSWITCHERDEF.offIDCode1,                   dd NAME(IDExitTarget)               - NAME(Start)
    591         at VMMSWITCHERDEF.cbIDCode1,                    dd NAME(ICExitTarget)               - NAME(IDExitTarget)
    592         at VMMSWITCHERDEF.offGCCode,                    dd NAME(ICEnterTarget)              - NAME(Start)
    593         at VMMSWITCHERDEF.cbGCCode,                     dd NAME(IDExitTarget)               - NAME(ICEnterTarget)
     597        at VMMSWITCHERDEF.cbIDCode1,                    dd NAME(ICExitTarget)               - NAME(Start)
     598        at VMMSWITCHERDEF.offGCCode,                    dd 0
     599        at VMMSWITCHERDEF.cbGCCode,                     dd 0
    594600
    595601    iend
  • trunk/src/VBox/VMM/VMMSwitcher/VMMSwitcher.h

    r14167 r14771  
    6363#define FIX_ID_FAR32_TO_64BIT_MODE 33
    6464#define FIX_GC_APIC_BASE_32BIT  34
     65#define FIX_HC_64BIT_NOCHECK    35
    6566#define FIX_THE_END             255
    6667/** @} */
  • trunk/src/VBox/VMM/VMMSwitcher/VMMSwitcher.mac

    r14167 r14771  
    107107%define FIX_ID_FAR32_TO_64BIT_MODE 33
    108108%define FIX_GC_APIC_BASE_32BIT  34
     109%define FIX_HC_64BIT_NOCHECK    35
    109110%define FIX_THE_END             255
    110111;/** @} */
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