VirtualBox

Changeset 13188 in vbox for trunk/src/VBox/VMM/VMMAll


Ignore:
Timestamp:
Oct 11, 2008 1:58:30 AM (16 years ago)
Author:
vboxsync
Message:

PGM: polish.

Location:
trunk/src/VBox/VMM/VMMAll
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMAll/PGMAll.cpp

    r13122 r13188  
    185185 * Shadow - AMD64 mode
    186186 */
    187 #define PGM_SHW_TYPE                PGM_TYPE_AMD64
    188 #define PGM_SHW_NAME(name)          PGM_SHW_NAME_AMD64(name)
    189 #include "PGMAllShw.h"
     187# define PGM_SHW_TYPE               PGM_TYPE_AMD64
     188# define PGM_SHW_NAME(name)         PGM_SHW_NAME_AMD64(name)
     189# include "PGMAllShw.h"
    190190
    191191/* Guest - protected mode */
    192 #define PGM_GST_TYPE                PGM_TYPE_PROT
    193 #define PGM_GST_NAME(name)          PGM_GST_NAME_PROT(name)
    194 #define PGM_BTH_NAME(name)          PGM_BTH_NAME_AMD64_PROT(name)
    195 #define BTH_PGMPOOLKIND_PT_FOR_PT   PGMPOOLKIND_PAE_PT_FOR_PHYS
    196 #include "PGMAllBth.h"
    197 #undef BTH_PGMPOOLKIND_PT_FOR_PT
    198 #undef PGM_BTH_NAME
    199 #undef PGM_GST_TYPE
    200 #undef PGM_GST_NAME
    201 
    202 #ifdef VBOX_WITH_64_BITS_GUESTS
     192# define PGM_GST_TYPE               PGM_TYPE_PROT
     193# define PGM_GST_NAME(name)         PGM_GST_NAME_PROT(name)
     194# define PGM_BTH_NAME(name)         PGM_BTH_NAME_AMD64_PROT(name)
     195# define BTH_PGMPOOLKIND_PT_FOR_PT  PGMPOOLKIND_PAE_PT_FOR_PHYS
     196# include "PGMAllBth.h"
     197# undef BTH_PGMPOOLKIND_PT_FOR_PT
     198# undef PGM_BTH_NAME
     199# undef PGM_GST_TYPE
     200# undef PGM_GST_NAME
     201
     202# ifdef VBOX_WITH_64_BITS_GUESTS
    203203/* Guest - AMD64 mode */
    204 #define PGM_GST_TYPE                PGM_TYPE_AMD64
    205 #define PGM_GST_NAME(name)          PGM_GST_NAME_AMD64(name)
    206 #define PGM_BTH_NAME(name)          PGM_BTH_NAME_AMD64_AMD64(name)
    207 #define BTH_PGMPOOLKIND_PT_FOR_PT   PGMPOOLKIND_PAE_PT_FOR_PAE_PT
    208 #define BTH_PGMPOOLKIND_PT_FOR_BIG  PGMPOOLKIND_PAE_PT_FOR_PAE_2MB
    209 #include "PGMAllGst.h"
    210 #include "PGMAllBth.h"
    211 #undef BTH_PGMPOOLKIND_PT_FOR_BIG
    212 #undef BTH_PGMPOOLKIND_PT_FOR_PT
    213 #undef PGM_BTH_NAME
    214 #undef PGM_GST_TYPE
    215 #undef PGM_GST_NAME
    216 #endif
    217 
    218 #undef PGM_SHW_TYPE
    219 #undef PGM_SHW_NAME
     204#  define PGM_GST_TYPE              PGM_TYPE_AMD64
     205#  define PGM_GST_NAME(name)        PGM_GST_NAME_AMD64(name)
     206#  define PGM_BTH_NAME(name)        PGM_BTH_NAME_AMD64_AMD64(name)
     207#  define BTH_PGMPOOLKIND_PT_FOR_PT PGMPOOLKIND_PAE_PT_FOR_PAE_PT
     208#  define BTH_PGMPOOLKIND_PT_FOR_BIG PGMPOOLKIND_PAE_PT_FOR_PAE_2MB
     209#  include "PGMAllGst.h"
     210#  include "PGMAllBth.h"
     211#  undef BTH_PGMPOOLKIND_PT_FOR_BIG
     212#  undef BTH_PGMPOOLKIND_PT_FOR_PT
     213#  undef PGM_BTH_NAME
     214#  undef PGM_GST_TYPE
     215#  undef PGM_GST_NAME
     216# endif /* VBOX_WITH_64_BITS_GUESTS */
     217
     218# undef PGM_SHW_TYPE
     219# undef PGM_SHW_NAME
     220
    220221
    221222/*
    222223 * Shadow - Nested paging mode
    223224 */
    224 #define PGM_SHW_TYPE                PGM_TYPE_NESTED
    225 #define PGM_SHW_NAME(name)          PGM_SHW_NAME_NESTED(name)
    226 #include "PGMAllShw.h"
     225# define PGM_SHW_TYPE               PGM_TYPE_NESTED
     226# define PGM_SHW_NAME(name)         PGM_SHW_NAME_NESTED(name)
     227# include "PGMAllShw.h"
    227228
    228229/* Guest - real mode */
    229 #define PGM_GST_TYPE                PGM_TYPE_REAL
    230 #define PGM_GST_NAME(name)          PGM_GST_NAME_REAL(name)
    231 #define PGM_BTH_NAME(name)          PGM_BTH_NAME_NESTED_REAL(name)
    232 #include "PGMAllBth.h"
    233 #undef PGM_BTH_NAME
    234 #undef PGM_GST_TYPE
    235 #undef PGM_GST_NAME
     230# define PGM_GST_TYPE               PGM_TYPE_REAL
     231# define PGM_GST_NAME(name)         PGM_GST_NAME_REAL(name)
     232# define PGM_BTH_NAME(name)         PGM_BTH_NAME_NESTED_REAL(name)
     233# include "PGMAllBth.h"
     234# undef PGM_BTH_NAME
     235# undef PGM_GST_TYPE
     236# undef PGM_GST_NAME
    236237
    237238/* Guest - protected mode */
    238 #define PGM_GST_TYPE                PGM_TYPE_PROT
    239 #define PGM_GST_NAME(name)          PGM_GST_NAME_PROT(name)
    240 #define PGM_BTH_NAME(name)          PGM_BTH_NAME_NESTED_PROT(name)
    241 #include "PGMAllBth.h"
    242 #undef PGM_BTH_NAME
    243 #undef PGM_GST_TYPE
    244 #undef PGM_GST_NAME
     239# define PGM_GST_TYPE               PGM_TYPE_PROT
     240# define PGM_GST_NAME(name)         PGM_GST_NAME_PROT(name)
     241# define PGM_BTH_NAME(name)         PGM_BTH_NAME_NESTED_PROT(name)
     242# include "PGMAllBth.h"
     243# undef PGM_BTH_NAME
     244# undef PGM_GST_TYPE
     245# undef PGM_GST_NAME
    245246
    246247/* Guest - 32-bit mode */
    247 #define PGM_GST_TYPE                PGM_TYPE_32BIT
    248 #define PGM_GST_NAME(name)          PGM_GST_NAME_32BIT(name)
    249 #define PGM_BTH_NAME(name)          PGM_BTH_NAME_NESTED_32BIT(name)
    250 #include "PGMAllBth.h"
    251 #undef PGM_BTH_NAME
    252 #undef PGM_GST_TYPE
    253 #undef PGM_GST_NAME
     248# define PGM_GST_TYPE               PGM_TYPE_32BIT
     249# define PGM_GST_NAME(name)         PGM_GST_NAME_32BIT(name)
     250# define PGM_BTH_NAME(name)         PGM_BTH_NAME_NESTED_32BIT(name)
     251# include "PGMAllBth.h"
     252# undef PGM_BTH_NAME
     253# undef PGM_GST_TYPE
     254# undef PGM_GST_NAME
    254255
    255256/* Guest - PAE mode */
    256 #define PGM_GST_TYPE                PGM_TYPE_PAE
    257 #define PGM_GST_NAME(name)          PGM_GST_NAME_PAE(name)
    258 #define PGM_BTH_NAME(name)          PGM_BTH_NAME_NESTED_PAE(name)
    259 #include "PGMAllBth.h"
    260 #undef PGM_BTH_NAME
    261 #undef PGM_GST_TYPE
    262 #undef PGM_GST_NAME
    263 
    264 #ifdef VBOX_WITH_64_BITS_GUESTS
     257# define PGM_GST_TYPE               PGM_TYPE_PAE
     258# define PGM_GST_NAME(name)         PGM_GST_NAME_PAE(name)
     259# define PGM_BTH_NAME(name)         PGM_BTH_NAME_NESTED_PAE(name)
     260# include "PGMAllBth.h"
     261# undef PGM_BTH_NAME
     262# undef PGM_GST_TYPE
     263# undef PGM_GST_NAME
     264
     265# ifdef VBOX_WITH_64_BITS_GUESTS
    265266/* Guest - AMD64 mode */
    266 #define PGM_GST_TYPE                PGM_TYPE_AMD64
    267 #define PGM_GST_NAME(name)          PGM_GST_NAME_AMD64(name)
    268 #define PGM_BTH_NAME(name)          PGM_BTH_NAME_NESTED_AMD64(name)
    269 #include "PGMAllBth.h"
    270 #undef PGM_BTH_NAME
    271 #undef PGM_GST_TYPE
    272 #undef PGM_GST_NAME
    273 #endif
    274 
    275 #undef PGM_SHW_TYPE
    276 #undef PGM_SHW_NAME
     267#  define PGM_GST_TYPE              PGM_TYPE_AMD64
     268#  define PGM_GST_NAME(name)        PGM_GST_NAME_AMD64(name)
     269#  define PGM_BTH_NAME(name)        PGM_BTH_NAME_NESTED_AMD64(name)
     270#  include "PGMAllBth.h"
     271#  undef PGM_BTH_NAME
     272#  undef PGM_GST_TYPE
     273#  undef PGM_GST_NAME
     274# endif /* VBOX_WITH_64_BITS_GUESTS */
     275
     276# undef PGM_SHW_TYPE
     277# undef PGM_SHW_NAME
     278
    277279
    278280/*
    279281 * Shadow - EPT
    280282 */
    281 #define PGM_SHW_TYPE                PGM_TYPE_EPT
    282 #define PGM_SHW_NAME(name)          PGM_SHW_NAME_EPT(name)
    283 #include "PGMAllShw.h"
     283# define PGM_SHW_TYPE               PGM_TYPE_EPT
     284# define PGM_SHW_NAME(name)         PGM_SHW_NAME_EPT(name)
     285# include "PGMAllShw.h"
    284286
    285287/* Guest - real mode */
    286 #define PGM_GST_TYPE                PGM_TYPE_REAL
    287 #define PGM_GST_NAME(name)          PGM_GST_NAME_REAL(name)
    288 #define PGM_BTH_NAME(name)          PGM_BTH_NAME_EPT_REAL(name)
    289 #define BTH_PGMPOOLKIND_PT_FOR_PT   PGMPOOLKIND_EPT_PT_FOR_PHYS
    290 #include "PGMAllBth.h"
    291 #undef BTH_PGMPOOLKIND_PT_FOR_PT
    292 #undef PGM_BTH_NAME
    293 #undef PGM_GST_TYPE
    294 #undef PGM_GST_NAME
     288# define PGM_GST_TYPE               PGM_TYPE_REAL
     289# define PGM_GST_NAME(name)         PGM_GST_NAME_REAL(name)
     290# define PGM_BTH_NAME(name)         PGM_BTH_NAME_EPT_REAL(name)
     291# define BTH_PGMPOOLKIND_PT_FOR_PT  PGMPOOLKIND_EPT_PT_FOR_PHYS
     292# include "PGMAllBth.h"
     293# undef BTH_PGMPOOLKIND_PT_FOR_PT
     294# undef PGM_BTH_NAME
     295# undef PGM_GST_TYPE
     296# undef PGM_GST_NAME
    295297
    296298/* Guest - protected mode */
    297 #define PGM_GST_TYPE                PGM_TYPE_PROT
    298 #define PGM_GST_NAME(name)          PGM_GST_NAME_PROT(name)
    299 #define PGM_BTH_NAME(name)          PGM_BTH_NAME_EPT_PROT(name)
    300 #define BTH_PGMPOOLKIND_PT_FOR_PT   PGMPOOLKIND_EPT_PT_FOR_PHYS
    301 #include "PGMAllBth.h"
    302 #undef BTH_PGMPOOLKIND_PT_FOR_PT
    303 #undef PGM_BTH_NAME
    304 #undef PGM_GST_TYPE
    305 #undef PGM_GST_NAME
     299# define PGM_GST_TYPE               PGM_TYPE_PROT
     300# define PGM_GST_NAME(name)         PGM_GST_NAME_PROT(name)
     301# define PGM_BTH_NAME(name)         PGM_BTH_NAME_EPT_PROT(name)
     302# define BTH_PGMPOOLKIND_PT_FOR_PT  PGMPOOLKIND_EPT_PT_FOR_PHYS
     303# include "PGMAllBth.h"
     304# undef BTH_PGMPOOLKIND_PT_FOR_PT
     305# undef PGM_BTH_NAME
     306# undef PGM_GST_TYPE
     307# undef PGM_GST_NAME
    306308
    307309/* Guest - 32-bit mode */
    308 #define PGM_GST_TYPE                PGM_TYPE_32BIT
    309 #define PGM_GST_NAME(name)          PGM_GST_NAME_32BIT(name)
    310 #define PGM_BTH_NAME(name)          PGM_BTH_NAME_EPT_32BIT(name)
    311 #define BTH_PGMPOOLKIND_PT_FOR_PT   PGMPOOLKIND_EPT_PT_FOR_PHYS
    312 #include "PGMAllBth.h"
    313 #undef BTH_PGMPOOLKIND_PT_FOR_PT
    314 #undef PGM_BTH_NAME
    315 #undef PGM_GST_TYPE
    316 #undef PGM_GST_NAME
     310# define PGM_GST_TYPE               PGM_TYPE_32BIT
     311# define PGM_GST_NAME(name)         PGM_GST_NAME_32BIT(name)
     312# define PGM_BTH_NAME(name)         PGM_BTH_NAME_EPT_32BIT(name)
     313# define BTH_PGMPOOLKIND_PT_FOR_PT  PGMPOOLKIND_EPT_PT_FOR_PHYS
     314# include "PGMAllBth.h"
     315# undef BTH_PGMPOOLKIND_PT_FOR_PT
     316# undef PGM_BTH_NAME
     317# undef PGM_GST_TYPE
     318# undef PGM_GST_NAME
    317319
    318320/* Guest - PAE mode */
    319 #define PGM_GST_TYPE                PGM_TYPE_PAE
    320 #define PGM_GST_NAME(name)          PGM_GST_NAME_PAE(name)
    321 #define PGM_BTH_NAME(name)          PGM_BTH_NAME_EPT_PAE(name)
    322 #define BTH_PGMPOOLKIND_PT_FOR_PT   PGMPOOLKIND_EPT_PT_FOR_PHYS
    323 #include "PGMAllBth.h"
    324 #undef BTH_PGMPOOLKIND_PT_FOR_PT
    325 #undef PGM_BTH_NAME
    326 #undef PGM_GST_TYPE
    327 #undef PGM_GST_NAME
    328 
    329 #ifdef VBOX_WITH_64_BITS_GUESTS
     321# define PGM_GST_TYPE               PGM_TYPE_PAE
     322# define PGM_GST_NAME(name)         PGM_GST_NAME_PAE(name)
     323# define PGM_BTH_NAME(name)         PGM_BTH_NAME_EPT_PAE(name)
     324# define BTH_PGMPOOLKIND_PT_FOR_PT  PGMPOOLKIND_EPT_PT_FOR_PHYS
     325# include "PGMAllBth.h"
     326# undef BTH_PGMPOOLKIND_PT_FOR_PT
     327# undef PGM_BTH_NAME
     328# undef PGM_GST_TYPE
     329# undef PGM_GST_NAME
     330
     331# ifdef VBOX_WITH_64_BITS_GUESTS
    330332/* Guest - AMD64 mode */
    331 #define PGM_GST_TYPE                PGM_TYPE_AMD64
    332 #define PGM_GST_NAME(name)          PGM_GST_NAME_AMD64(name)
    333 #define PGM_BTH_NAME(name)          PGM_BTH_NAME_EPT_AMD64(name)
    334 #define BTH_PGMPOOLKIND_PT_FOR_PT  PGMPOOLKIND_EPT_PT_FOR_PHYS
    335 #include "PGMAllBth.h"
    336 #undef BTH_PGMPOOLKIND_PT_FOR_PT
    337 #undef PGM_BTH_NAME
    338 #undef PGM_GST_TYPE
    339 #undef PGM_GST_NAME
    340 #endif
    341 
    342 #undef PGM_SHW_TYPE
    343 #undef PGM_SHW_NAME
     333#  define PGM_GST_TYPE              PGM_TYPE_AMD64
     334#  define PGM_GST_NAME(name)        PGM_GST_NAME_AMD64(name)
     335#  define PGM_BTH_NAME(name)        PGM_BTH_NAME_EPT_AMD64(name)
     336#  define BTH_PGMPOOLKIND_PT_FOR_PT PGMPOOLKIND_EPT_PT_FOR_PHYS
     337#  include "PGMAllBth.h"
     338#  undef BTH_PGMPOOLKIND_PT_FOR_PT
     339#  undef PGM_BTH_NAME
     340#  undef PGM_GST_TYPE
     341#  undef PGM_GST_NAME
     342# endif /* VBOX_WITH_64_BITS_GUESTS */
     343
     344# undef PGM_SHW_TYPE
     345# undef PGM_SHW_NAME
    344346
    345347#endif /* !IN_GC */
     
    644646    /** @todo merge PGMGCInvalidatePage with this one */
    645647
    646 #ifndef IN_RING3
     648# ifndef IN_RING3
    647649    /*
    648650     * Notify the recompiler so it can record this instruction.
     
    652654    if (VBOX_FAILURE(rc))
    653655        return rc;
    654 #endif
     656# endif
    655657
    656658    STAM_PROFILE_START(&pVM->pgm.s.CTX_MID_Z(Stat,InvalidatePage), a);
     
    658660    STAM_PROFILE_STOP(&pVM->pgm.s.CTX_MID_Z(Stat,InvalidatePage), a);
    659661
    660 #ifndef IN_RING0
     662# ifndef IN_RING0
    661663    /*
    662664     * Check if we have a pending update of the CR3 monitoring.
     
    670672        rc = PGM_GST_PFN(MonitorCR3, pVM)(pVM, pVM->pgm.s.GCPhysCR3);
    671673    }
    672 #endif
    673 
    674 #ifdef IN_RING3
     674# endif
     675
     676# ifdef IN_RING3
    675677    /*
    676678     * Inform CSAM about the flush
     
    678680    /** @note this is to check if monitored pages have been changed; when we implement callbacks for virtual handlers, this is no longer required. */
    679681    CSAMR3FlushPage(pVM, GCPtrPage);
    680 #endif
     682# endif
    681683    return rc;
    682684}
    683 #endif
     685#endif /* !IN_GC */
    684686
    685687
     
    780782}
    781783
    782 /**
    783  * Syncs the SHADOW page directory pointer for the specified address. Allocates
    784  * backing pages in case the PDPT entry is missing.
     784
     785/**
     786 * Syncs the SHADOW page directory pointer for the specified address.
     787 *
     788 * Allocates backing pages in case the PDPT entry is missing.
    785789 *
    786790 * @returns VBox status.
     
    833837}
    834838
     839
    835840/**
    836841 * Gets the SHADOW page directory pointer for the specified address.
     
    864869    return VINF_SUCCESS;
    865870}
     871
    866872
    867873#ifndef IN_GC
  • trunk/src/VBox/VMM/VMMAll/PGMAllBth.h

    r13134 r13188  
    112112
    113113#    elif PGM_GST_TYPE == PGM_TYPE_AMD64
    114     unsigned     iPDSrc;
    115     PX86PML4E    pPml4eSrc;
    116     X86PDPE      PdpeSrc;
    117     PGSTPD       pPDSrc;
     114    unsigned        iPDSrc;
     115    PX86PML4E       pPml4eSrc;
     116    X86PDPE         PdpeSrc;
     117    PGSTPD          pPDSrc;
    118118
    119119    pPDSrc = pgmGstGetLongModePDPtr(&pVM->pgm.s, pvFault, &pPml4eSrc, &PdpeSrc, &iPDSrc);
     
    133133    }
    134134#   endif
    135 #  else
     135
     136#  else  /* !PGM_WITH_PAGING */
    136137    PGSTPD          pPDSrc = NULL;
    137138    const unsigned  iPDSrc = 0;
    138 #  endif
     139#  endif /* !PGM_WITH_PAGING */
     140
    139141
    140142#  if PGM_SHW_TYPE == PGM_TYPE_32BIT
    141143    const unsigned  iPDDst = (RTGCUINTPTR)pvFault >> SHW_PD_SHIFT;
    142144    PX86PD          pPDDst = pVM->pgm.s.CTXMID(p,32BitPD);
     145
    143146#  elif PGM_SHW_TYPE == PGM_TYPE_PAE
    144147    const unsigned  iPDDst = (RTGCUINTPTR)pvFault >> SHW_PD_SHIFT;
     
    158161#   if PGM_GST_TYPE == PGM_TYPE_PROT
    159162    /* AMD-V nested paging */
    160     X86PML4E     Pml4eSrc;
    161     X86PDPE      PdpeSrc;
    162     PX86PML4E    pPml4eSrc = &Pml4eSrc;
     163    X86PML4E        Pml4eSrc;
     164    X86PDPE         PdpeSrc;
     165    PX86PML4E       pPml4eSrc = &Pml4eSrc;
    163166
    164167    /* Fake PML4 & PDPT entry; access control handled on the page table level, so allow everything. */
     
    174177    }
    175178    Assert(pPDDst);
     179
    176180#  elif PGM_SHW_TYPE == PGM_TYPE_EPT
    177181    const unsigned  iPDDst = (((RTGCUINTPTR)pvFault >> SHW_PD_SHIFT) & SHW_PD_MASK);
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