VirtualBox

Changeset 16859 in vbox for trunk/src


Ignore:
Timestamp:
Feb 17, 2009 4:19:51 PM (16 years ago)
Author:
vboxsync
Message:

Load hypervisor CR3 from CPUM (instead of hardcoded fixups in the switchers). Dangerous change. Watch for regressions.

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

Legend:

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

    r16801 r16859  
    15061506        /* The flags will be corrected when entering and leaving long mode. */
    15071507    }
    1508 
    1509     CPUMSetHyperCR3(pVM, (uint32_t)pVM->pgm.s.HCPhysShw32BitPD);
    15101508#endif
    15111509
  • trunk/src/VBox/VMM/PGMShw.h

    r16376 r16859  
    195195    pVM->pgm.s.HCPhysShwCR3 = pVM->pgm.s.HCPhysShwNestedRoot;
    196196#endif
     197
     198#ifndef VBOX_WITH_PGMPOOL_PAGING_ONLY
     199    CPUMSetHyperCR3(pVM, PGMGetHyperCR3(pVM));
     200#endif
     201
    197202    return VINF_SUCCESS;
    198203}
  • trunk/src/VBox/VMM/VMM.cpp

    r16107 r16859  
    10711071    for (;;)
    10721072    {
     1073        Assert(CPUMGetHyperCR3(pVM) == PGMGetHyperCR3(pVM));
    10731074        int rc;
    10741075        do
     
    12071208    {
    12081209        int rc;
     1210        Assert(CPUMGetHyperCR3(pVM) == PGMGetHyperCR3(pVM));
    12091211        do
    12101212        {
     
    12631265    {
    12641266        int rc;
     1267        Assert(CPUMGetHyperCR3(pVM) == PGMGetHyperCR3(pVM));
    12651268        do
    12661269        {
  • trunk/src/VBox/VMM/VMMAll/CPUMAllRegs.cpp

    r15416 r16859  
    126126{
    127127    pVM->cpum.s.Hyper.cr3 = cr3;
     128
     129#ifdef IN_RC
     130    /* Update the current CR3. */
     131    ASMSetCR3(cr3);
     132#endif
     133}
     134
     135VMMDECL(uint32_t) CPUMGetHyperCR3(PVM pVM)
     136{
     137    return pVM->cpum.s.Hyper.cr3;
    128138}
    129139
  • trunk/src/VBox/VMM/VMMAll/PGMAllBth.h

    r16842 r16859  
    46724672#  endif
    46734673
    4674 #  ifdef IN_RC
    4675     /* Update the current CR3. */
    4676     ASMSetCR3(pVM->pgm.s.HCPhysShwCR3);
    4677 #  endif
     4674    /* Set the current hypervisor CR3. */
     4675    CPUMSetHyperCR3(pVM, PGMGetHyperCR3(pVM));
    46784676
    46794677    /* Clean up the old CR3 root. */
  • trunk/src/VBox/VMM/VMMSwitcher.cpp

    r16847 r16859  
    462462
    463463                *uSrc.pu32 = PGMGetInterAmd64CR3(pVM);
    464                 break;
    465             }
    466 
    467 #ifdef VBOX_WITH_PGMPOOL_PAGING_ONLY
    468             /* @todo No need for three GetHyper calls; one and the same base is used */
    469 #endif
    470             /*
    471              * Store the 32-Bit CR3 (32-bit) for the hypervisor (shadow) memory context.
    472              */
    473             case FIX_HYPER_32BIT_CR3:
    474             {
    475                 *uSrc.pu32 = PGMGetHyper32BitCR3(pVM);
    476                 break;
    477             }
    478 
    479             /*
    480              * Store the PAE CR3 (32-bit) for the hypervisor (shadow) memory context.
    481              */
    482             case FIX_HYPER_PAE_CR3:
    483             {
    484                 *uSrc.pu32 = PGMGetHyperPaeCR3(pVM);
    485464                break;
    486465            }
  • trunk/src/VBox/VMM/VMMSwitcher/32BitTo32Bit.asm

    r8155 r16859  
    2828%define SWITCHER_FIX_INTER_CR3_HC   FIX_INTER_32BIT_CR3
    2929%define SWITCHER_FIX_INTER_CR3_GC   FIX_INTER_32BIT_CR3
    30 %define SWITCHER_FIX_HYPER_CR3      FIX_HYPER_32BIT_CR3
    3130
    3231;*******************************************************************************
  • trunk/src/VBox/VMM/VMMSwitcher/32BitToPAE.asm

    r8155 r16859  
    2828%define SWITCHER_FIX_INTER_CR3_HC   FIX_INTER_32BIT_CR3
    2929%define SWITCHER_FIX_INTER_CR3_GC   FIX_INTER_PAE_CR3
    30 %define SWITCHER_FIX_HYPER_CR3      FIX_HYPER_PAE_CR3
    3130%define NEED_PAE_ON_32BIT_HOST  1
    3231
  • trunk/src/VBox/VMM/VMMSwitcher/AMD64To32Bit.asm

    r14169 r16859  
    3030;%define SWITCHER_FIX_INTER_CR3_HC   FIX_INTER_AMD64_CR3
    3131%define SWITCHER_FIX_INTER_CR3_GC   FIX_INTER_32BIT_CR3
    32 %define SWITCHER_FIX_HYPER_CR3      FIX_HYPER_32BIT_CR3
    3332
    3433
  • trunk/src/VBox/VMM/VMMSwitcher/AMD64ToPAE.asm

    r14167 r16859  
    3030;%define SWITCHER_FIX_INTER_CR3_HC   FIX_INTER_AMD64_CR3
    3131%define SWITCHER_FIX_INTER_CR3_GC   FIX_INTER_PAE_CR3
    32 %define SWITCHER_FIX_HYPER_CR3      FIX_HYPER_PAE_CR3
    3332
    3433
  • trunk/src/VBox/VMM/VMMSwitcher/AMD64andLegacy.mac

    r15414 r16859  
    329329    DEBUG_CHAR('1')                     ; trashes esi
    330330
     331    ; Store the hypervisor cr3 for later loading
     332    mov     ebp, [rdx + CPUM.Hyper.cr3]
     333
    331334    ;;
    332335    ;; Load Intermediate memory context.
     
    438441;jnz .delay_loop
    439442    ; load final cr3 and do far jump to load cs.
    440     FIXUP SWITCHER_FIX_HYPER_CR3, 1
    441     mov     eax, 0ffffffffh
    442     mov     cr3, eax
     443    mov     cr3, ebp                ; ebp set above
    443444    DEBUG_CHAR('0')
    444445
  • trunk/src/VBox/VMM/VMMSwitcher/PAETo32Bit.asm

    r8155 r16859  
    2828%define SWITCHER_FIX_INTER_CR3_HC   FIX_INTER_PAE_CR3
    2929%define SWITCHER_FIX_INTER_CR3_GC   FIX_INTER_32BIT_CR3
    30 %define SWITCHER_FIX_HYPER_CR3      FIX_HYPER_32BIT_CR3
    3130%define NEED_32BIT_ON_PAE_HOST  1
    3231
  • trunk/src/VBox/VMM/VMMSwitcher/PAEToPAE.asm

    r8155 r16859  
    2828%define SWITCHER_FIX_INTER_CR3_HC   FIX_INTER_PAE_CR3
    2929%define SWITCHER_FIX_INTER_CR3_GC   FIX_INTER_PAE_CR3
    30 %define SWITCHER_FIX_HYPER_CR3      FIX_HYPER_PAE_CR3
    3130
    3231;*******************************************************************************
  • trunk/src/VBox/VMM/VMMSwitcher/PAEand32Bit.mac

    r14192 r16859  
    215215    DEBUG_CHAR('1')                     ; trashes esi
    216216
     217    ; Store the hypervisor cr3 for later loading
     218    mov     ebp, [edx + CPUM.Hyper.cr3]
     219   
    217220    ;;
    218221    ;; Load Intermediate memory context.
     
    269272    DEBUG_CHAR('-')
    270273    ; load final cr3 and do far jump to load cs.
    271     FIXUP SWITCHER_FIX_HYPER_CR3, 1
    272     mov     eax, 0ffffffffh
    273     mov     cr3, eax
     274    mov     cr3, ebp            ; ebp set above
    274275    DEBUG_CHAR('0')
    275276
  • trunk/src/VBox/VMM/VMMSwitcher/VMMSwitcher.h

    r16847 r16859  
    4343#define FIX_INTER_PAE_CR3       13
    4444#define FIX_INTER_AMD64_CR3     14
    45 #define FIX_HYPER_32BIT_CR3     15
    46 #define FIX_HYPER_PAE_CR3       16
    4745#define FIX_HYPER_CS            18
    4846#define FIX_HYPER_DS            19
  • trunk/src/VBox/VMM/VMMSwitcher/VMMSwitcher.mac

    r16847 r16859  
    8787%define FIX_INTER_PAE_CR3       13
    8888%define FIX_INTER_AMD64_CR3     14
    89 %define FIX_HYPER_32BIT_CR3     15
    90 %define FIX_HYPER_PAE_CR3       16
    9189%define FIX_HYPER_CS            18
    9290%define FIX_HYPER_DS            19
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