VirtualBox

Changeset 80167 in vbox


Ignore:
Timestamp:
Aug 7, 2019 12:34:52 AM (5 years ago)
Author:
vboxsync
Message:

VMM: Kicking out raw-mode - PGMAll.cpp, PGMAllBth.h, more virt handler leftovers. bugref:9517

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

Legend:

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

    r80163 r80167  
    5252DECLINLINE(int) pgmShwGetLongModePDPtr(PVMCPU pVCpu, RTGCPTR64 GCPtr, PX86PML4E *ppPml4e, PX86PDPT *ppPdpt, PX86PDPAE *ppPD);
    5353DECLINLINE(int) pgmShwGetPaePoolPagePD(PVMCPU pVCpu, RTGCPTR GCPtr, PPGMPOOLPAGE *ppShwPde);
    54 #ifndef IN_RC
    5554static int pgmShwSyncLongModePDPtr(PVMCPU pVCpu, RTGCPTR64 GCPtr, X86PGPAEUINT uGstPml4e, X86PGPAEUINT uGstPdpe, PX86PDPAE *ppPD);
    5655static int pgmShwGetEPTPDPtr(PVMCPU pVCpu, RTGCPTR64 GCPtr, PEPTPDPT *ppPdpt, PEPTPD *ppPD);
    57 #endif
    5856
    5957
     
    190188
    191189
    192 #ifndef IN_RC /* AMD64 implies VT-x/AMD-V */
    193190/*
    194191 * Shadow - AMD64 mode
    195192 */
    196 # define PGM_SHW_TYPE               PGM_TYPE_AMD64
    197 # define PGM_SHW_NAME(name)         PGM_SHW_NAME_AMD64(name)
    198 # include "PGMAllShw.h"
     193#define PGM_SHW_TYPE               PGM_TYPE_AMD64
     194#define PGM_SHW_NAME(name)         PGM_SHW_NAME_AMD64(name)
     195#include "PGMAllShw.h"
    199196
    200197/* Guest - protected mode (only used for AMD-V nested paging in 64 bits mode) */
    201198/** @todo retire this hack. */
    202 # define PGM_GST_TYPE               PGM_TYPE_PROT
    203 # define PGM_GST_NAME(name)         PGM_GST_NAME_PROT(name)
    204 # define PGM_BTH_NAME(name)         PGM_BTH_NAME_AMD64_PROT(name)
    205 # define BTH_PGMPOOLKIND_PT_FOR_PT  PGMPOOLKIND_PAE_PT_FOR_PHYS
    206 # define BTH_PGMPOOLKIND_ROOT       PGMPOOLKIND_PAE_PD_PHYS
     199#define PGM_GST_TYPE               PGM_TYPE_PROT
     200#define PGM_GST_NAME(name)         PGM_GST_NAME_PROT(name)
     201#define PGM_BTH_NAME(name)         PGM_BTH_NAME_AMD64_PROT(name)
     202#define BTH_PGMPOOLKIND_PT_FOR_PT  PGMPOOLKIND_PAE_PT_FOR_PHYS
     203#define BTH_PGMPOOLKIND_ROOT       PGMPOOLKIND_PAE_PD_PHYS
     204#include "PGMGstDefs.h"
     205#include "PGMAllBth.h"
     206#undef BTH_PGMPOOLKIND_PT_FOR_PT
     207#undef BTH_PGMPOOLKIND_ROOT
     208#undef PGM_BTH_NAME
     209#undef PGM_GST_TYPE
     210#undef PGM_GST_NAME
     211
     212#ifdef VBOX_WITH_64_BITS_GUESTS
     213/* Guest - AMD64 mode */
     214# define PGM_GST_TYPE              PGM_TYPE_AMD64
     215# define PGM_GST_NAME(name)        PGM_GST_NAME_AMD64(name)
     216# define PGM_BTH_NAME(name)        PGM_BTH_NAME_AMD64_AMD64(name)
     217# define BTH_PGMPOOLKIND_PT_FOR_PT PGMPOOLKIND_PAE_PT_FOR_PAE_PT
     218# define BTH_PGMPOOLKIND_PT_FOR_BIG PGMPOOLKIND_PAE_PT_FOR_PAE_2MB
     219# define BTH_PGMPOOLKIND_ROOT      PGMPOOLKIND_64BIT_PML4
    207220# include "PGMGstDefs.h"
     221# include "PGMAllGst.h"
    208222# include "PGMAllBth.h"
     223# undef BTH_PGMPOOLKIND_PT_FOR_BIG
    209224# undef BTH_PGMPOOLKIND_PT_FOR_PT
    210225# undef BTH_PGMPOOLKIND_ROOT
     
    212227# undef PGM_GST_TYPE
    213228# undef PGM_GST_NAME
    214 
    215 # ifdef VBOX_WITH_64_BITS_GUESTS
    216 /* Guest - AMD64 mode */
    217 #  define PGM_GST_TYPE              PGM_TYPE_AMD64
    218 #  define PGM_GST_NAME(name)        PGM_GST_NAME_AMD64(name)
    219 #  define PGM_BTH_NAME(name)        PGM_BTH_NAME_AMD64_AMD64(name)
    220 #  define BTH_PGMPOOLKIND_PT_FOR_PT PGMPOOLKIND_PAE_PT_FOR_PAE_PT
    221 #  define BTH_PGMPOOLKIND_PT_FOR_BIG PGMPOOLKIND_PAE_PT_FOR_PAE_2MB
    222 #  define BTH_PGMPOOLKIND_ROOT      PGMPOOLKIND_64BIT_PML4
    223 #  include "PGMGstDefs.h"
    224 #  include "PGMAllGst.h"
    225 #  include "PGMAllBth.h"
    226 #  undef BTH_PGMPOOLKIND_PT_FOR_BIG
    227 #  undef BTH_PGMPOOLKIND_PT_FOR_PT
    228 #  undef BTH_PGMPOOLKIND_ROOT
    229 #  undef PGM_BTH_NAME
    230 #  undef PGM_GST_TYPE
    231 #  undef PGM_GST_NAME
    232 # endif /* VBOX_WITH_64_BITS_GUESTS */
    233 
    234 # undef PGM_SHW_TYPE
    235 # undef PGM_SHW_NAME
     229#endif /* VBOX_WITH_64_BITS_GUESTS */
     230
     231#undef PGM_SHW_TYPE
     232#undef PGM_SHW_NAME
    236233
    237234
     
    239236 * Shadow - 32-bit nested paging mode.
    240237 */
    241 # define PGM_SHW_TYPE               PGM_TYPE_NESTED_32BIT
    242 # define PGM_SHW_NAME(name)         PGM_SHW_NAME_NESTED_32BIT(name)
    243 # include "PGMAllShw.h"
     238#define PGM_SHW_TYPE                PGM_TYPE_NESTED_32BIT
     239#define PGM_SHW_NAME(name)          PGM_SHW_NAME_NESTED_32BIT(name)
     240#include "PGMAllShw.h"
    244241
    245242/* Guest - real mode */
    246 # define PGM_GST_TYPE               PGM_TYPE_REAL
    247 # define PGM_GST_NAME(name)         PGM_GST_NAME_REAL(name)
    248 # define PGM_BTH_NAME(name)         PGM_BTH_NAME_NESTED_32BIT_REAL(name)
     243#define PGM_GST_TYPE                PGM_TYPE_REAL
     244#define PGM_GST_NAME(name)          PGM_GST_NAME_REAL(name)
     245#define PGM_BTH_NAME(name)          PGM_BTH_NAME_NESTED_32BIT_REAL(name)
     246#include "PGMGstDefs.h"
     247#include "PGMAllBth.h"
     248#undef PGM_BTH_NAME
     249#undef PGM_GST_TYPE
     250#undef PGM_GST_NAME
     251
     252/* Guest - protected mode */
     253#define PGM_GST_TYPE                PGM_TYPE_PROT
     254#define PGM_GST_NAME(name)          PGM_GST_NAME_PROT(name)
     255#define PGM_BTH_NAME(name)          PGM_BTH_NAME_NESTED_32BIT_PROT(name)
     256#include "PGMGstDefs.h"
     257#include "PGMAllBth.h"
     258#undef PGM_BTH_NAME
     259#undef PGM_GST_TYPE
     260#undef PGM_GST_NAME
     261
     262/* Guest - 32-bit mode */
     263#define PGM_GST_TYPE                PGM_TYPE_32BIT
     264#define PGM_GST_NAME(name)          PGM_GST_NAME_32BIT(name)
     265#define PGM_BTH_NAME(name)          PGM_BTH_NAME_NESTED_32BIT_32BIT(name)
     266#include "PGMGstDefs.h"
     267#include "PGMAllBth.h"
     268#undef PGM_BTH_NAME
     269#undef PGM_GST_TYPE
     270#undef PGM_GST_NAME
     271
     272/* Guest - PAE mode */
     273#define PGM_GST_TYPE                PGM_TYPE_PAE
     274#define PGM_GST_NAME(name)          PGM_GST_NAME_PAE(name)
     275#define PGM_BTH_NAME(name)          PGM_BTH_NAME_NESTED_32BIT_PAE(name)
     276#include "PGMGstDefs.h"
     277#include "PGMAllBth.h"
     278#undef PGM_BTH_NAME
     279#undef PGM_GST_TYPE
     280#undef PGM_GST_NAME
     281
     282#ifdef VBOX_WITH_64_BITS_GUESTS
     283/* Guest - AMD64 mode */
     284# define PGM_GST_TYPE               PGM_TYPE_AMD64
     285# define PGM_GST_NAME(name)         PGM_GST_NAME_AMD64(name)
     286# define PGM_BTH_NAME(name)         PGM_BTH_NAME_NESTED_32BIT_AMD64(name)
    249287# include "PGMGstDefs.h"
    250288# include "PGMAllBth.h"
     
    252290# undef PGM_GST_TYPE
    253291# undef PGM_GST_NAME
     292#endif /* VBOX_WITH_64_BITS_GUESTS */
     293
     294#undef PGM_SHW_TYPE
     295#undef PGM_SHW_NAME
     296
     297
     298/*
     299 * Shadow - PAE nested paging mode.
     300 */
     301#define PGM_SHW_TYPE                PGM_TYPE_NESTED_PAE
     302#define PGM_SHW_NAME(name)          PGM_SHW_NAME_NESTED_PAE(name)
     303#include "PGMAllShw.h"
     304
     305/* Guest - real mode */
     306#define PGM_GST_TYPE                PGM_TYPE_REAL
     307#define PGM_GST_NAME(name)          PGM_GST_NAME_REAL(name)
     308#define PGM_BTH_NAME(name)          PGM_BTH_NAME_NESTED_PAE_REAL(name)
     309#include "PGMGstDefs.h"
     310#include "PGMAllBth.h"
     311#undef PGM_BTH_NAME
     312#undef PGM_GST_TYPE
     313#undef PGM_GST_NAME
    254314
    255315/* Guest - protected mode */
    256 # define PGM_GST_TYPE               PGM_TYPE_PROT
    257 # define PGM_GST_NAME(name)         PGM_GST_NAME_PROT(name)
    258 # define PGM_BTH_NAME(name)         PGM_BTH_NAME_NESTED_32BIT_PROT(name)
     316#define PGM_GST_TYPE                PGM_TYPE_PROT
     317#define PGM_GST_NAME(name)          PGM_GST_NAME_PROT(name)
     318#define PGM_BTH_NAME(name)          PGM_BTH_NAME_NESTED_PAE_PROT(name)
     319#include "PGMGstDefs.h"
     320#include "PGMAllBth.h"
     321#undef PGM_BTH_NAME
     322#undef PGM_GST_TYPE
     323#undef PGM_GST_NAME
     324
     325/* Guest - 32-bit mode */
     326#define PGM_GST_TYPE                PGM_TYPE_32BIT
     327#define PGM_GST_NAME(name)          PGM_GST_NAME_32BIT(name)
     328#define PGM_BTH_NAME(name)          PGM_BTH_NAME_NESTED_PAE_32BIT(name)
     329#include "PGMGstDefs.h"
     330#include "PGMAllBth.h"
     331#undef PGM_BTH_NAME
     332#undef PGM_GST_TYPE
     333#undef PGM_GST_NAME
     334
     335/* Guest - PAE mode */
     336#define PGM_GST_TYPE                PGM_TYPE_PAE
     337#define PGM_GST_NAME(name)          PGM_GST_NAME_PAE(name)
     338#define PGM_BTH_NAME(name)          PGM_BTH_NAME_NESTED_PAE_PAE(name)
     339#include "PGMGstDefs.h"
     340#include "PGMAllBth.h"
     341#undef PGM_BTH_NAME
     342#undef PGM_GST_TYPE
     343#undef PGM_GST_NAME
     344
     345#ifdef VBOX_WITH_64_BITS_GUESTS
     346/* Guest - AMD64 mode */
     347# define PGM_GST_TYPE               PGM_TYPE_AMD64
     348# define PGM_GST_NAME(name)         PGM_GST_NAME_AMD64(name)
     349# define PGM_BTH_NAME(name)         PGM_BTH_NAME_NESTED_PAE_AMD64(name)
    259350# include "PGMGstDefs.h"
    260351# include "PGMAllBth.h"
     
    262353# undef PGM_GST_TYPE
    263354# undef PGM_GST_NAME
     355#endif /* VBOX_WITH_64_BITS_GUESTS */
     356
     357#undef PGM_SHW_TYPE
     358#undef PGM_SHW_NAME
     359
     360
     361/*
     362 * Shadow - AMD64 nested paging mode.
     363 */
     364#define PGM_SHW_TYPE                PGM_TYPE_NESTED_AMD64
     365#define PGM_SHW_NAME(name)          PGM_SHW_NAME_NESTED_AMD64(name)
     366#include "PGMAllShw.h"
     367
     368/* Guest - real mode */
     369#define PGM_GST_TYPE                PGM_TYPE_REAL
     370#define PGM_GST_NAME(name)          PGM_GST_NAME_REAL(name)
     371#define PGM_BTH_NAME(name)          PGM_BTH_NAME_NESTED_AMD64_REAL(name)
     372#include "PGMGstDefs.h"
     373#include "PGMAllBth.h"
     374#undef PGM_BTH_NAME
     375#undef PGM_GST_TYPE
     376#undef PGM_GST_NAME
     377
     378/* Guest - protected mode */
     379#define PGM_GST_TYPE                PGM_TYPE_PROT
     380#define PGM_GST_NAME(name)          PGM_GST_NAME_PROT(name)
     381#define PGM_BTH_NAME(name)          PGM_BTH_NAME_NESTED_AMD64_PROT(name)
     382#include "PGMGstDefs.h"
     383#include "PGMAllBth.h"
     384#undef PGM_BTH_NAME
     385#undef PGM_GST_TYPE
     386#undef PGM_GST_NAME
    264387
    265388/* Guest - 32-bit mode */
    266 # define PGM_GST_TYPE               PGM_TYPE_32BIT
    267 # define PGM_GST_NAME(name)         PGM_GST_NAME_32BIT(name)
    268 # define PGM_BTH_NAME(name)         PGM_BTH_NAME_NESTED_32BIT_32BIT(name)
     389#define PGM_GST_TYPE                PGM_TYPE_32BIT
     390#define PGM_GST_NAME(name)          PGM_GST_NAME_32BIT(name)
     391#define PGM_BTH_NAME(name)          PGM_BTH_NAME_NESTED_AMD64_32BIT(name)
     392#include "PGMGstDefs.h"
     393#include "PGMAllBth.h"
     394#undef PGM_BTH_NAME
     395#undef PGM_GST_TYPE
     396#undef PGM_GST_NAME
     397
     398/* Guest - PAE mode */
     399#define PGM_GST_TYPE                PGM_TYPE_PAE
     400#define PGM_GST_NAME(name)          PGM_GST_NAME_PAE(name)
     401#define PGM_BTH_NAME(name)          PGM_BTH_NAME_NESTED_AMD64_PAE(name)
     402#include "PGMGstDefs.h"
     403#include "PGMAllBth.h"
     404#undef PGM_BTH_NAME
     405#undef PGM_GST_TYPE
     406#undef PGM_GST_NAME
     407
     408#ifdef VBOX_WITH_64_BITS_GUESTS
     409/* Guest - AMD64 mode */
     410# define PGM_GST_TYPE               PGM_TYPE_AMD64
     411# define PGM_GST_NAME(name)         PGM_GST_NAME_AMD64(name)
     412# define PGM_BTH_NAME(name)         PGM_BTH_NAME_NESTED_AMD64_AMD64(name)
    269413# include "PGMGstDefs.h"
    270414# include "PGMAllBth.h"
     
    272416# undef PGM_GST_TYPE
    273417# undef PGM_GST_NAME
    274 
    275 /* Guest - PAE mode */
    276 # define PGM_GST_TYPE               PGM_TYPE_PAE
    277 # define PGM_GST_NAME(name)         PGM_GST_NAME_PAE(name)
    278 # define PGM_BTH_NAME(name)         PGM_BTH_NAME_NESTED_32BIT_PAE(name)
    279 # include "PGMGstDefs.h"
    280 # include "PGMAllBth.h"
    281 # undef PGM_BTH_NAME
    282 # undef PGM_GST_TYPE
    283 # undef PGM_GST_NAME
    284 
    285 # ifdef VBOX_WITH_64_BITS_GUESTS
    286 /* Guest - AMD64 mode */
    287 #  define PGM_GST_TYPE              PGM_TYPE_AMD64
    288 #  define PGM_GST_NAME(name)        PGM_GST_NAME_AMD64(name)
    289 #  define PGM_BTH_NAME(name)        PGM_BTH_NAME_NESTED_32BIT_AMD64(name)
    290 #  include "PGMGstDefs.h"
    291 #  include "PGMAllBth.h"
    292 #  undef PGM_BTH_NAME
    293 #  undef PGM_GST_TYPE
    294 #  undef PGM_GST_NAME
    295 # endif /* VBOX_WITH_64_BITS_GUESTS */
    296 
    297 # undef PGM_SHW_TYPE
    298 # undef PGM_SHW_NAME
    299 
    300 
    301 /*
    302  * Shadow - PAE nested paging mode.
    303  */
    304 # define PGM_SHW_TYPE               PGM_TYPE_NESTED_PAE
    305 # define PGM_SHW_NAME(name)         PGM_SHW_NAME_NESTED_PAE(name)
    306 # include "PGMAllShw.h"
    307 
    308 /* Guest - real mode */
    309 # define PGM_GST_TYPE               PGM_TYPE_REAL
    310 # define PGM_GST_NAME(name)         PGM_GST_NAME_REAL(name)
    311 # define PGM_BTH_NAME(name)         PGM_BTH_NAME_NESTED_PAE_REAL(name)
    312 # include "PGMGstDefs.h"
    313 # include "PGMAllBth.h"
    314 # undef PGM_BTH_NAME
    315 # undef PGM_GST_TYPE
    316 # undef PGM_GST_NAME
    317 
    318 /* Guest - protected mode */
    319 # define PGM_GST_TYPE               PGM_TYPE_PROT
    320 # define PGM_GST_NAME(name)         PGM_GST_NAME_PROT(name)
    321 # define PGM_BTH_NAME(name)         PGM_BTH_NAME_NESTED_PAE_PROT(name)
    322 # include "PGMGstDefs.h"
    323 # include "PGMAllBth.h"
    324 # undef PGM_BTH_NAME
    325 # undef PGM_GST_TYPE
    326 # undef PGM_GST_NAME
    327 
    328 /* Guest - 32-bit mode */
    329 # define PGM_GST_TYPE               PGM_TYPE_32BIT
    330 # define PGM_GST_NAME(name)         PGM_GST_NAME_32BIT(name)
    331 # define PGM_BTH_NAME(name)         PGM_BTH_NAME_NESTED_PAE_32BIT(name)
    332 # include "PGMGstDefs.h"
    333 # include "PGMAllBth.h"
    334 # undef PGM_BTH_NAME
    335 # undef PGM_GST_TYPE
    336 # undef PGM_GST_NAME
    337 
    338 /* Guest - PAE mode */
    339 # define PGM_GST_TYPE               PGM_TYPE_PAE
    340 # define PGM_GST_NAME(name)         PGM_GST_NAME_PAE(name)
    341 # define PGM_BTH_NAME(name)         PGM_BTH_NAME_NESTED_PAE_PAE(name)
    342 # include "PGMGstDefs.h"
    343 # include "PGMAllBth.h"
    344 # undef PGM_BTH_NAME
    345 # undef PGM_GST_TYPE
    346 # undef PGM_GST_NAME
    347 
    348 # ifdef VBOX_WITH_64_BITS_GUESTS
    349 /* Guest - AMD64 mode */
    350 #  define PGM_GST_TYPE              PGM_TYPE_AMD64
    351 #  define PGM_GST_NAME(name)        PGM_GST_NAME_AMD64(name)
    352 #  define PGM_BTH_NAME(name)        PGM_BTH_NAME_NESTED_PAE_AMD64(name)
    353 #  include "PGMGstDefs.h"
    354 #  include "PGMAllBth.h"
    355 #  undef PGM_BTH_NAME
    356 #  undef PGM_GST_TYPE
    357 #  undef PGM_GST_NAME
    358 # endif /* VBOX_WITH_64_BITS_GUESTS */
    359 
    360 # undef PGM_SHW_TYPE
    361 # undef PGM_SHW_NAME
    362 
    363 
    364 /*
    365  * Shadow - AMD64 nested paging mode.
    366  */
    367 # define PGM_SHW_TYPE               PGM_TYPE_NESTED_AMD64
    368 # define PGM_SHW_NAME(name)         PGM_SHW_NAME_NESTED_AMD64(name)
    369 # include "PGMAllShw.h"
    370 
    371 /* Guest - real mode */
    372 # define PGM_GST_TYPE               PGM_TYPE_REAL
    373 # define PGM_GST_NAME(name)         PGM_GST_NAME_REAL(name)
    374 # define PGM_BTH_NAME(name)         PGM_BTH_NAME_NESTED_AMD64_REAL(name)
    375 # include "PGMGstDefs.h"
    376 # include "PGMAllBth.h"
    377 # undef PGM_BTH_NAME
    378 # undef PGM_GST_TYPE
    379 # undef PGM_GST_NAME
    380 
    381 /* Guest - protected mode */
    382 # define PGM_GST_TYPE               PGM_TYPE_PROT
    383 # define PGM_GST_NAME(name)         PGM_GST_NAME_PROT(name)
    384 # define PGM_BTH_NAME(name)         PGM_BTH_NAME_NESTED_AMD64_PROT(name)
    385 # include "PGMGstDefs.h"
    386 # include "PGMAllBth.h"
    387 # undef PGM_BTH_NAME
    388 # undef PGM_GST_TYPE
    389 # undef PGM_GST_NAME
    390 
    391 /* Guest - 32-bit mode */
    392 # define PGM_GST_TYPE               PGM_TYPE_32BIT
    393 # define PGM_GST_NAME(name)         PGM_GST_NAME_32BIT(name)
    394 # define PGM_BTH_NAME(name)         PGM_BTH_NAME_NESTED_AMD64_32BIT(name)
    395 # include "PGMGstDefs.h"
    396 # include "PGMAllBth.h"
    397 # undef PGM_BTH_NAME
    398 # undef PGM_GST_TYPE
    399 # undef PGM_GST_NAME
    400 
    401 /* Guest - PAE mode */
    402 # define PGM_GST_TYPE               PGM_TYPE_PAE
    403 # define PGM_GST_NAME(name)         PGM_GST_NAME_PAE(name)
    404 # define PGM_BTH_NAME(name)         PGM_BTH_NAME_NESTED_AMD64_PAE(name)
    405 # include "PGMGstDefs.h"
    406 # include "PGMAllBth.h"
    407 # undef PGM_BTH_NAME
    408 # undef PGM_GST_TYPE
    409 # undef PGM_GST_NAME
    410 
    411 # ifdef VBOX_WITH_64_BITS_GUESTS
    412 /* Guest - AMD64 mode */
    413 #  define PGM_GST_TYPE              PGM_TYPE_AMD64
    414 #  define PGM_GST_NAME(name)        PGM_GST_NAME_AMD64(name)
    415 #  define PGM_BTH_NAME(name)        PGM_BTH_NAME_NESTED_AMD64_AMD64(name)
    416 #  include "PGMGstDefs.h"
    417 #  include "PGMAllBth.h"
    418 #  undef PGM_BTH_NAME
    419 #  undef PGM_GST_TYPE
    420 #  undef PGM_GST_NAME
    421 # endif /* VBOX_WITH_64_BITS_GUESTS */
    422 
    423 # undef PGM_SHW_TYPE
    424 # undef PGM_SHW_NAME
     418#endif /* VBOX_WITH_64_BITS_GUESTS */
     419
     420#undef PGM_SHW_TYPE
     421#undef PGM_SHW_NAME
    425422
    426423
     
    428425 * Shadow - EPT.
    429426 */
    430 # define PGM_SHW_TYPE               PGM_TYPE_EPT
    431 # define PGM_SHW_NAME(name)         PGM_SHW_NAME_EPT(name)
    432 # include "PGMAllShw.h"
     427#define PGM_SHW_TYPE                PGM_TYPE_EPT
     428#define PGM_SHW_NAME(name)          PGM_SHW_NAME_EPT(name)
     429#include "PGMAllShw.h"
    433430
    434431/* Guest - real mode */
    435 # define PGM_GST_TYPE               PGM_TYPE_REAL
    436 # define PGM_GST_NAME(name)         PGM_GST_NAME_REAL(name)
    437 # define PGM_BTH_NAME(name)         PGM_BTH_NAME_EPT_REAL(name)
     432#define PGM_GST_TYPE                PGM_TYPE_REAL
     433#define PGM_GST_NAME(name)          PGM_GST_NAME_REAL(name)
     434#define PGM_BTH_NAME(name)          PGM_BTH_NAME_EPT_REAL(name)
     435#define BTH_PGMPOOLKIND_PT_FOR_PT   PGMPOOLKIND_EPT_PT_FOR_PHYS
     436#include "PGMGstDefs.h"
     437#include "PGMAllBth.h"
     438#undef BTH_PGMPOOLKIND_PT_FOR_PT
     439#undef PGM_BTH_NAME
     440#undef PGM_GST_TYPE
     441#undef PGM_GST_NAME
     442
     443/* Guest - protected mode */
     444#define PGM_GST_TYPE                PGM_TYPE_PROT
     445#define PGM_GST_NAME(name)          PGM_GST_NAME_PROT(name)
     446#define PGM_BTH_NAME(name)          PGM_BTH_NAME_EPT_PROT(name)
     447#define BTH_PGMPOOLKIND_PT_FOR_PT   PGMPOOLKIND_EPT_PT_FOR_PHYS
     448#include "PGMGstDefs.h"
     449#include "PGMAllBth.h"
     450#undef BTH_PGMPOOLKIND_PT_FOR_PT
     451#undef PGM_BTH_NAME
     452#undef PGM_GST_TYPE
     453#undef PGM_GST_NAME
     454
     455/* Guest - 32-bit mode */
     456#define PGM_GST_TYPE                PGM_TYPE_32BIT
     457#define PGM_GST_NAME(name)          PGM_GST_NAME_32BIT(name)
     458#define PGM_BTH_NAME(name)          PGM_BTH_NAME_EPT_32BIT(name)
     459#define BTH_PGMPOOLKIND_PT_FOR_PT   PGMPOOLKIND_EPT_PT_FOR_PHYS
     460#include "PGMGstDefs.h"
     461#include "PGMAllBth.h"
     462#undef BTH_PGMPOOLKIND_PT_FOR_PT
     463#undef PGM_BTH_NAME
     464#undef PGM_GST_TYPE
     465#undef PGM_GST_NAME
     466
     467/* Guest - PAE mode */
     468#define PGM_GST_TYPE                PGM_TYPE_PAE
     469#define PGM_GST_NAME(name)          PGM_GST_NAME_PAE(name)
     470#define PGM_BTH_NAME(name)          PGM_BTH_NAME_EPT_PAE(name)
     471#define BTH_PGMPOOLKIND_PT_FOR_PT   PGMPOOLKIND_EPT_PT_FOR_PHYS
     472#include "PGMGstDefs.h"
     473#include "PGMAllBth.h"
     474#undef BTH_PGMPOOLKIND_PT_FOR_PT
     475#undef PGM_BTH_NAME
     476#undef PGM_GST_TYPE
     477#undef PGM_GST_NAME
     478
     479#ifdef VBOX_WITH_64_BITS_GUESTS
     480/* Guest - AMD64 mode */
     481# define PGM_GST_TYPE               PGM_TYPE_AMD64
     482# define PGM_GST_NAME(name)         PGM_GST_NAME_AMD64(name)
     483# define PGM_BTH_NAME(name)         PGM_BTH_NAME_EPT_AMD64(name)
    438484# define BTH_PGMPOOLKIND_PT_FOR_PT  PGMPOOLKIND_EPT_PT_FOR_PHYS
    439485# include "PGMGstDefs.h"
     
    443489# undef PGM_GST_TYPE
    444490# undef PGM_GST_NAME
    445 
    446 /* Guest - protected mode */
    447 # define PGM_GST_TYPE               PGM_TYPE_PROT
    448 # define PGM_GST_NAME(name)         PGM_GST_NAME_PROT(name)
    449 # define PGM_BTH_NAME(name)         PGM_BTH_NAME_EPT_PROT(name)
    450 # define BTH_PGMPOOLKIND_PT_FOR_PT  PGMPOOLKIND_EPT_PT_FOR_PHYS
    451 # include "PGMGstDefs.h"
    452 # include "PGMAllBth.h"
    453 # undef BTH_PGMPOOLKIND_PT_FOR_PT
    454 # undef PGM_BTH_NAME
    455 # undef PGM_GST_TYPE
    456 # undef PGM_GST_NAME
    457 
    458 /* Guest - 32-bit mode */
    459 # define PGM_GST_TYPE               PGM_TYPE_32BIT
    460 # define PGM_GST_NAME(name)         PGM_GST_NAME_32BIT(name)
    461 # define PGM_BTH_NAME(name)         PGM_BTH_NAME_EPT_32BIT(name)
    462 # define BTH_PGMPOOLKIND_PT_FOR_PT  PGMPOOLKIND_EPT_PT_FOR_PHYS
    463 # include "PGMGstDefs.h"
    464 # include "PGMAllBth.h"
    465 # undef BTH_PGMPOOLKIND_PT_FOR_PT
    466 # undef PGM_BTH_NAME
    467 # undef PGM_GST_TYPE
    468 # undef PGM_GST_NAME
    469 
    470 /* Guest - PAE mode */
    471 # define PGM_GST_TYPE               PGM_TYPE_PAE
    472 # define PGM_GST_NAME(name)         PGM_GST_NAME_PAE(name)
    473 # define PGM_BTH_NAME(name)         PGM_BTH_NAME_EPT_PAE(name)
    474 # define BTH_PGMPOOLKIND_PT_FOR_PT  PGMPOOLKIND_EPT_PT_FOR_PHYS
    475 # include "PGMGstDefs.h"
    476 # include "PGMAllBth.h"
    477 # undef BTH_PGMPOOLKIND_PT_FOR_PT
    478 # undef PGM_BTH_NAME
    479 # undef PGM_GST_TYPE
    480 # undef PGM_GST_NAME
    481 
    482 # ifdef VBOX_WITH_64_BITS_GUESTS
    483 /* Guest - AMD64 mode */
    484 #  define PGM_GST_TYPE              PGM_TYPE_AMD64
    485 #  define PGM_GST_NAME(name)        PGM_GST_NAME_AMD64(name)
    486 #  define PGM_BTH_NAME(name)        PGM_BTH_NAME_EPT_AMD64(name)
    487 #  define BTH_PGMPOOLKIND_PT_FOR_PT PGMPOOLKIND_EPT_PT_FOR_PHYS
    488 #  include "PGMGstDefs.h"
    489 #  include "PGMAllBth.h"
    490 #  undef BTH_PGMPOOLKIND_PT_FOR_PT
    491 #  undef PGM_BTH_NAME
    492 #  undef PGM_GST_TYPE
    493 #  undef PGM_GST_NAME
    494 # endif /* VBOX_WITH_64_BITS_GUESTS */
    495 
    496 # undef PGM_SHW_TYPE
    497 # undef PGM_SHW_NAME
     491#endif /* VBOX_WITH_64_BITS_GUESTS */
     492
     493#undef PGM_SHW_TYPE
     494#undef PGM_SHW_NAME
    498495
    499496
     
    501498 * Shadow - NEM / None.
    502499 */
    503 # define PGM_SHW_TYPE               PGM_TYPE_NONE
    504 # define PGM_SHW_NAME(name)         PGM_SHW_NAME_NONE(name)
    505 # include "PGMAllShw.h"
     500#define PGM_SHW_TYPE                PGM_TYPE_NONE
     501#define PGM_SHW_NAME(name)          PGM_SHW_NAME_NONE(name)
     502#include "PGMAllShw.h"
    506503
    507504/* Guest - real mode */
    508 # define PGM_GST_TYPE               PGM_TYPE_REAL
    509 # define PGM_GST_NAME(name)         PGM_GST_NAME_REAL(name)
    510 # define PGM_BTH_NAME(name)         PGM_BTH_NAME_NONE_REAL(name)
     505#define PGM_GST_TYPE                PGM_TYPE_REAL
     506#define PGM_GST_NAME(name)          PGM_GST_NAME_REAL(name)
     507#define PGM_BTH_NAME(name)          PGM_BTH_NAME_NONE_REAL(name)
     508#include "PGMGstDefs.h"
     509#include "PGMAllBth.h"
     510#undef PGM_BTH_NAME
     511#undef PGM_GST_TYPE
     512#undef PGM_GST_NAME
     513
     514/* Guest - protected mode */
     515#define PGM_GST_TYPE                PGM_TYPE_PROT
     516#define PGM_GST_NAME(name)          PGM_GST_NAME_PROT(name)
     517#define PGM_BTH_NAME(name)          PGM_BTH_NAME_NONE_PROT(name)
     518#include "PGMGstDefs.h"
     519#include "PGMAllBth.h"
     520#undef PGM_BTH_NAME
     521#undef PGM_GST_TYPE
     522#undef PGM_GST_NAME
     523
     524/* Guest - 32-bit mode */
     525#define PGM_GST_TYPE                PGM_TYPE_32BIT
     526#define PGM_GST_NAME(name)          PGM_GST_NAME_32BIT(name)
     527#define PGM_BTH_NAME(name)          PGM_BTH_NAME_NONE_32BIT(name)
     528#include "PGMGstDefs.h"
     529#include "PGMAllBth.h"
     530#undef PGM_BTH_NAME
     531#undef PGM_GST_TYPE
     532#undef PGM_GST_NAME
     533
     534/* Guest - PAE mode */
     535#define PGM_GST_TYPE               PGM_TYPE_PAE
     536#define PGM_GST_NAME(name)         PGM_GST_NAME_PAE(name)
     537#define PGM_BTH_NAME(name)         PGM_BTH_NAME_NONE_PAE(name)
     538#include "PGMGstDefs.h"
     539#include "PGMAllBth.h"
     540#undef PGM_BTH_NAME
     541#undef PGM_GST_TYPE
     542#undef PGM_GST_NAME
     543
     544#ifdef VBOX_WITH_64_BITS_GUESTS
     545/* Guest - AMD64 mode */
     546# define PGM_GST_TYPE               PGM_TYPE_AMD64
     547# define PGM_GST_NAME(name)         PGM_GST_NAME_AMD64(name)
     548# define PGM_BTH_NAME(name)         PGM_BTH_NAME_NONE_AMD64(name)
    511549# include "PGMGstDefs.h"
    512550# include "PGMAllBth.h"
     
    514552# undef PGM_GST_TYPE
    515553# undef PGM_GST_NAME
    516 
    517 /* Guest - protected mode */
    518 # define PGM_GST_TYPE               PGM_TYPE_PROT
    519 # define PGM_GST_NAME(name)         PGM_GST_NAME_PROT(name)
    520 # define PGM_BTH_NAME(name)         PGM_BTH_NAME_NONE_PROT(name)
    521 # include "PGMGstDefs.h"
    522 # include "PGMAllBth.h"
    523 # undef PGM_BTH_NAME
    524 # undef PGM_GST_TYPE
    525 # undef PGM_GST_NAME
    526 
    527 /* Guest - 32-bit mode */
    528 # define PGM_GST_TYPE               PGM_TYPE_32BIT
    529 # define PGM_GST_NAME(name)         PGM_GST_NAME_32BIT(name)
    530 # define PGM_BTH_NAME(name)         PGM_BTH_NAME_NONE_32BIT(name)
    531 # include "PGMGstDefs.h"
    532 # include "PGMAllBth.h"
    533 # undef PGM_BTH_NAME
    534 # undef PGM_GST_TYPE
    535 # undef PGM_GST_NAME
    536 
    537 /* Guest - PAE mode */
    538 # define PGM_GST_TYPE               PGM_TYPE_PAE
    539 # define PGM_GST_NAME(name)         PGM_GST_NAME_PAE(name)
    540 # define PGM_BTH_NAME(name)         PGM_BTH_NAME_NONE_PAE(name)
    541 # include "PGMGstDefs.h"
    542 # include "PGMAllBth.h"
    543 # undef PGM_BTH_NAME
    544 # undef PGM_GST_TYPE
    545 # undef PGM_GST_NAME
    546 
    547 # ifdef VBOX_WITH_64_BITS_GUESTS
    548 /* Guest - AMD64 mode */
    549 #  define PGM_GST_TYPE              PGM_TYPE_AMD64
    550 #  define PGM_GST_NAME(name)        PGM_GST_NAME_AMD64(name)
    551 #  define PGM_BTH_NAME(name)        PGM_BTH_NAME_NONE_AMD64(name)
    552 #  include "PGMGstDefs.h"
    553 #  include "PGMAllBth.h"
    554 #  undef PGM_BTH_NAME
    555 #  undef PGM_GST_TYPE
    556 #  undef PGM_GST_NAME
    557 # endif /* VBOX_WITH_64_BITS_GUESTS */
    558 
    559 # undef PGM_SHW_TYPE
    560 # undef PGM_SHW_NAME
    561 
    562 #endif /* !IN_RC */
     554#endif /* VBOX_WITH_64_BITS_GUESTS */
     555
     556#undef PGM_SHW_TYPE
     557#undef PGM_SHW_NAME
     558
    563559
    564560
     
    613609#endif
    614610    },
    615 #if defined(VBOX_WITH_64_BITS_GUESTS) && !defined(IN_RC)
     611#ifdef VBOX_WITH_64_BITS_GUESTS
    616612    {
    617613        PGM_TYPE_AMD64,
     
    657653#endif
    658654    },
    659 #ifndef IN_RC
    660655    {
    661656        PGM_TYPE_AMD64,
     
    664659        PGM_SHW_NAME_AMD64(Enter),
    665660        PGM_SHW_NAME_AMD64(Exit),
    666 # ifdef IN_RING3
     661#ifdef IN_RING3
    667662        PGM_SHW_NAME_AMD64(Relocate),
    668 # endif
     663#endif
    669664    },
    670665    {
     
    674669        PGM_SHW_NAME_NESTED_32BIT(Enter),
    675670        PGM_SHW_NAME_NESTED_32BIT(Exit),
    676 # ifdef IN_RING3
     671#ifdef IN_RING3
    677672        PGM_SHW_NAME_NESTED_32BIT(Relocate),
    678 # endif
     673#endif
    679674    },
    680675    {
     
    684679        PGM_SHW_NAME_NESTED_PAE(Enter),
    685680        PGM_SHW_NAME_NESTED_PAE(Exit),
    686 # ifdef IN_RING3
     681#ifdef IN_RING3
    687682        PGM_SHW_NAME_NESTED_PAE(Relocate),
    688 # endif
     683#endif
    689684    },
    690685    {
     
    694689        PGM_SHW_NAME_NESTED_AMD64(Enter),
    695690        PGM_SHW_NAME_NESTED_AMD64(Exit),
    696 # ifdef IN_RING3
     691#ifdef IN_RING3
    697692        PGM_SHW_NAME_NESTED_AMD64(Relocate),
    698 # endif
     693#endif
    699694    },
    700695    {
     
    704699        PGM_SHW_NAME_EPT(Enter),
    705700        PGM_SHW_NAME_EPT(Exit),
    706 # ifdef IN_RING3
     701#ifdef IN_RING3
    707702        PGM_SHW_NAME_EPT(Relocate),
    708 # endif
     703#endif
    709704    },
    710705    {
     
    714709        PGM_SHW_NAME_NONE(Enter),
    715710        PGM_SHW_NAME_NONE(Exit),
    716 # ifdef IN_RING3
     711#ifdef IN_RING3
    717712        PGM_SHW_NAME_NONE(Relocate),
    718 # endif
     713#endif
    719714    },
    720 #endif /* IN_RC */
    721715};
    722716
     
    777771    PGMMODEDATABTH_NULL_ENTRY(), /* PGM_TYPE_PAE, PGM_TYPE_NONE         - illegal */
    778772
    779 #ifndef IN_RC
    780773    /* AMD64 shadow paging mode: */
    781774    PGMMODEDATABTH_NULL_ENTRY(), /* 0 */
     
    784777    PGMMODEDATABTH_NULL_ENTRY(), //PGMMODEDATABTH_ENTRY(PGM_TYPE_AMD64, PGM_TYPE_32BIT, PGM_BTH_NAME_AMD64_32BIT),
    785778    PGMMODEDATABTH_NULL_ENTRY(), //PGMMODEDATABTH_ENTRY(PGM_TYPE_AMD64, PGM_TYPE_PAE,   PGM_BTH_NAME_AMD64_PAE),
    786 # ifdef VBOX_WITH_64_BITS_GUESTS
     779#ifdef VBOX_WITH_64_BITS_GUESTS
    787780    PGMMODEDATABTH_ENTRY(PGM_TYPE_AMD64, PGM_TYPE_AMD64, PGM_BTH_NAME_AMD64_AMD64),
    788 # else
     781#else
    789782    PGMMODEDATABTH_NULL_ENTRY(), /* PGM_TYPE_AMD64, PGM_TYPE_AMD64        - illegal */
    790 # endif
     783#endif
    791784    PGMMODEDATABTH_NULL_ENTRY(), /* PGM_TYPE_AMD64, PGM_TYPE_NESTED_32BIT - illegal */
    792785    PGMMODEDATABTH_NULL_ENTRY(), /* PGM_TYPE_AMD64, PGM_TYPE_NESTED_PAE   - illegal */
     
    801794    PGMMODEDATABTH_ENTRY(PGM_TYPE_NESTED_32BIT, PGM_TYPE_32BIT, PGM_BTH_NAME_NESTED_32BIT_32BIT),
    802795    PGMMODEDATABTH_ENTRY(PGM_TYPE_NESTED_32BIT, PGM_TYPE_PAE,   PGM_BTH_NAME_NESTED_32BIT_PAE),
    803 # ifdef VBOX_WITH_64_BITS_GUESTS
     796#ifdef VBOX_WITH_64_BITS_GUESTS
    804797    PGMMODEDATABTH_ENTRY(PGM_TYPE_NESTED_32BIT, PGM_TYPE_AMD64, PGM_BTH_NAME_NESTED_32BIT_AMD64),
    805 # else
     798#else
    806799    PGMMODEDATABTH_NULL_ENTRY(), /* PGM_TYPE_NESTED_32BIT, PGM_TYPE_AMD64        - illegal */
    807 # endif
     800#endif
    808801    PGMMODEDATABTH_NULL_ENTRY(), /* PGM_TYPE_NESTED_32BIT, PGM_TYPE_NESTED_32BIT - illegal */
    809802    PGMMODEDATABTH_NULL_ENTRY(), /* PGM_TYPE_NESTED_32BIT, PGM_TYPE_NESTED_PAE   - illegal */
     
    818811    PGMMODEDATABTH_ENTRY(PGM_TYPE_NESTED_PAE, PGM_TYPE_32BIT, PGM_BTH_NAME_NESTED_PAE_32BIT),
    819812    PGMMODEDATABTH_ENTRY(PGM_TYPE_NESTED_PAE, PGM_TYPE_PAE,   PGM_BTH_NAME_NESTED_PAE_PAE),
    820 # ifdef VBOX_WITH_64_BITS_GUESTS
     813#ifdef VBOX_WITH_64_BITS_GUESTS
    821814    PGMMODEDATABTH_ENTRY(PGM_TYPE_NESTED_PAE, PGM_TYPE_AMD64, PGM_BTH_NAME_NESTED_PAE_AMD64),
    822 # else
     815#else
    823816    PGMMODEDATABTH_NULL_ENTRY(), /* PGM_TYPE_NESTED_PAE, PGM_TYPE_AMD64        - illegal */
    824 # endif
     817#endif
    825818    PGMMODEDATABTH_NULL_ENTRY(), /* PGM_TYPE_NESTED_PAE, PGM_TYPE_NESTED_32BIT - illegal */
    826819    PGMMODEDATABTH_NULL_ENTRY(), /* PGM_TYPE_NESTED_PAE, PGM_TYPE_NESTED_PAE   - illegal */
     
    835828    PGMMODEDATABTH_ENTRY(PGM_TYPE_NESTED_AMD64, PGM_TYPE_32BIT, PGM_BTH_NAME_NESTED_AMD64_32BIT),
    836829    PGMMODEDATABTH_ENTRY(PGM_TYPE_NESTED_AMD64, PGM_TYPE_PAE,   PGM_BTH_NAME_NESTED_AMD64_PAE),
    837 # ifdef VBOX_WITH_64_BITS_GUESTS
     830#ifdef VBOX_WITH_64_BITS_GUESTS
    838831    PGMMODEDATABTH_ENTRY(PGM_TYPE_NESTED_AMD64, PGM_TYPE_AMD64, PGM_BTH_NAME_NESTED_AMD64_AMD64),
    839 # else
     832#else
    840833    PGMMODEDATABTH_NULL_ENTRY(), /* PGM_TYPE_NESTED_AMD64, PGM_TYPE_AMD64        - illegal */
    841 # endif
     834#endif
    842835    PGMMODEDATABTH_NULL_ENTRY(), /* PGM_TYPE_NESTED_AMD64, PGM_TYPE_NESTED_32BIT - illegal */
    843836    PGMMODEDATABTH_NULL_ENTRY(), /* PGM_TYPE_NESTED_AMD64, PGM_TYPE_NESTED_PAE   - illegal */
     
    852845    PGMMODEDATABTH_ENTRY(PGM_TYPE_EPT, PGM_TYPE_32BIT, PGM_BTH_NAME_EPT_32BIT),
    853846    PGMMODEDATABTH_ENTRY(PGM_TYPE_EPT, PGM_TYPE_PAE,   PGM_BTH_NAME_EPT_PAE),
    854 # ifdef VBOX_WITH_64_BITS_GUESTS
     847#ifdef VBOX_WITH_64_BITS_GUESTS
    855848    PGMMODEDATABTH_ENTRY(PGM_TYPE_EPT, PGM_TYPE_AMD64, PGM_BTH_NAME_EPT_AMD64),
    856 # else
     849#else
    857850    PGMMODEDATABTH_NULL_ENTRY(), /* PGM_TYPE_EPT, PGM_TYPE_AMD64        - illegal */
    858 # endif
     851#endif
    859852    PGMMODEDATABTH_NULL_ENTRY(), /* PGM_TYPE_EPT, PGM_TYPE_NESTED_32BIT - illegal */
    860853    PGMMODEDATABTH_NULL_ENTRY(), /* PGM_TYPE_EPT, PGM_TYPE_NESTED_PAE   - illegal */
     
    869862    PGMMODEDATABTH_ENTRY(PGM_TYPE_NONE, PGM_TYPE_32BIT, PGM_BTH_NAME_EPT_32BIT),
    870863    PGMMODEDATABTH_ENTRY(PGM_TYPE_NONE, PGM_TYPE_PAE,   PGM_BTH_NAME_EPT_PAE),
    871 # ifdef VBOX_WITH_64_BITS_GUESTS
     864#ifdef VBOX_WITH_64_BITS_GUESTS
    872865    PGMMODEDATABTH_ENTRY(PGM_TYPE_NONE, PGM_TYPE_AMD64, PGM_BTH_NAME_EPT_AMD64),
    873 # else
     866#else
    874867    PGMMODEDATABTH_NULL_ENTRY(), /* PGM_TYPE_NONE, PGM_TYPE_AMD64        - illegal */
    875 # endif
     868#endif
    876869    PGMMODEDATABTH_NULL_ENTRY(), /* PGM_TYPE_NONE, PGM_TYPE_NESTED_32BIT - illegal */
    877870    PGMMODEDATABTH_NULL_ENTRY(), /* PGM_TYPE_NONE, PGM_TYPE_NESTED_PAE   - illegal */
     
    880873    PGMMODEDATABTH_NULL_ENTRY(), /* PGM_TYPE_NONE, PGM_TYPE_NONE         - illegal */
    881874
    882 #endif /* IN_RC */
    883875
    884876#undef PGMMODEDATABTH_ENTRY
     
    887879
    888880
    889 #ifndef IN_RING3
     881#ifdef IN_RING0
    890882/**
    891883 * #PF Handler.
     
    906898
    907899
    908 #ifdef VBOX_WITH_STATISTICS
     900# ifdef VBOX_WITH_STATISTICS
    909901    /*
    910902     * Error code stats.
     
    944936            STAM_COUNTER_INC(&pVCpu->pgm.s.CTX_SUFF(pStats)->StatRZTrap0eSVReserved);
    945937    }
    946 #endif /* VBOX_WITH_STATISTICS */
     938# endif /* VBOX_WITH_STATISTICS */
    947939
    948940    /*
     
    969961            rc = VINF_SUCCESS;
    970962
    971 # ifdef IN_RING0
    972963        /* Note: hack alert for difficult to reproduce problem. */
    973964        if (    rc == VERR_PAGE_NOT_PRESENT                 /* SMP only ; disassembly might fail. */
     
    980971            rc = VINF_SUCCESS;
    981972        }
    982 # endif
    983973    }
    984974
     
    989979    return rc;
    990980}
    991 #endif /* !IN_RING3 */
     981#endif /* IN_RING0 */
    992982
    993983
     
    12361226     */
    12371227    REMNotifyInvalidatePage(pVM, GCPtrPage);
    1238 #endif /* !IN_RING3 */
     1228#endif
    12391229    IEMTlbInvalidatePage(pVCpu, GCPtrPage);
    1240 
    1241 
    1242 #ifdef IN_RC
    1243     /*
    1244      * Check for conflicts and pending CR3 monitoring updates.
    1245      */
    1246     if (pgmMapAreMappingsFloating(pVM))
    1247     {
    1248         if (    pgmGetMapping(pVM, GCPtrPage)
    1249             &&  PGMGstGetPage(pVCpu, GCPtrPage, NULL, NULL) != VERR_PAGE_TABLE_NOT_PRESENT)
    1250         {
    1251             LogFlow(("PGMGCInvalidatePage: Conflict!\n"));
    1252             VMCPU_FF_SET(pVCpu, VMCPU_FF_PGM_SYNC_CR3);
    1253             STAM_COUNTER_INC(&pVM->pgm.s.CTX_SUFF(pStats)->StatRCInvlPgConflict);
    1254             return VINF_PGM_SYNC_CR3;
    1255         }
    1256 
    1257         if (pVCpu->pgm.s.fSyncFlags & PGM_SYNC_MONITOR_CR3)
    1258         {
    1259             LogFlow(("PGMGCInvalidatePage: PGM_SYNC_MONITOR_CR3 -> reinterpret instruction in R3\n"));
    1260             STAM_COUNTER_INC(&pVM->pgm.s.CTX_SUFF(pStats)->StatRCInvlPgSyncMonCR3);
    1261             return VINF_EM_RAW_EMULATE_INSTR;
    1262         }
    1263     }
    1264 #endif /* IN_RC */
    12651230
    12661231    /*
     
    12881253        Assert(!pVM->pgm.s.fMappingsFixed); Assert(pgmMapAreMappingsEnabled(pVM));
    12891254    }
    1290 
    1291 # ifdef VBOX_WITH_RAW_MODE
    1292     /*
    1293      * Inform CSAM about the flush
    1294      *
    1295      * Note: This is to check if monitored pages have been changed; when we implement
    1296      *       callbacks for virtual handlers, this is no longer required.
    1297      */
    1298     CSAMR3FlushPage(pVM, GCPtrPage);
    1299 # endif
    13001255#endif /* IN_RING3 */
    13011256
     
    15631518        /* The PD was cached or created; hook it up now. */
    15641519        pPdpe->u |= pShwPage->Core.Key | (uGstPdpe & (X86_PDPE_P | X86_PDPE_A));
    1565 
    1566 # if defined(IN_RC)
    1567         /*
    1568          * In 32 bits PAE mode we *must* invalidate the TLB when changing a
    1569          * PDPT entry; the CPU fetches them only during cr3 load, so any
    1570          * non-present PDPT will continue to cause page faults.
    1571          */
    1572         ASMReloadCR3();
    1573 # endif
    15741520        PGM_DYNMAP_UNUSED_HINT(pVCpu, pPdpe);
    15751521    }
     
    16191565}
    16201566
    1621 #ifndef IN_RC
    16221567
    16231568/**
     
    18591804}
    18601805
    1861 #endif /* IN_RC */
    18621806
    18631807#ifdef IN_RING0
     
    19751919            return PGM_GST_NAME_PAE(Walk)(pVCpu, GCPtr, &pWalk->u.Pae);
    19761920
    1977 #if !defined(IN_RC)
    19781921        case PGMMODE_AMD64:
    19791922        case PGMMODE_AMD64_NX:
    19801923            pWalk->enmType = PGMPTWALKGSTTYPE_AMD64;
    19811924            return PGM_GST_NAME_AMD64(Walk)(pVCpu, GCPtr, &pWalk->u.Amd64);
    1982 #endif
    19831925
    19841926        case PGMMODE_REAL:
     
    19871929            return VERR_PGM_NOT_USED_IN_MODE;
    19881930
    1989 #if defined(IN_RC)
    1990         case PGMMODE_AMD64:
    1991         case PGMMODE_AMD64_NX:
    1992 #endif
    19931931        case PGMMODE_NESTED_32BIT:
    19941932        case PGMMODE_NESTED_PAE:
     
    23162254        RTRCPTR     RCPtr       = NIL_RTRCPTR;
    23172255        RTHCPTR     HCPtr       = NIL_RTHCPTR;
    2318 #if !defined(IN_RC) && !defined(VBOX_WITH_2X_4GB_ADDR_SPACE_IN_R0)
     2256# ifndef VBOX_WITH_2X_4GB_ADDR_SPACE_IN_R0
    23192257        rc = pgmPhysGCPhys2CCPtrInternalDepr(pVM, pPage, GCPhys, &HCPtr);
    23202258        AssertRC(rc);
    2321 #endif
     2259# endif
    23222260        if (RT_SUCCESS(rc))
    23232261        {
     
    23502288}
    23512289
    2352 #endif /* !VBOX_WITH_2X_4GB_ADDR_SPACE_IN_R0 */
    2353 #if !defined(IN_RC) && !defined(VBOX_WITH_2X_4GB_ADDR_SPACE_IN_R0)
     2290
    23542291/**
    23552292 * Performs the lazy mapping of the 32-bit guest PD.
     
    23762313        {
    23772314            pVCpu->pgm.s.pGstAmd64Pml4R3 = (R3PTRTYPE(PX86PML4))HCPtrGuestCR3;
    2378 #  ifndef VBOX_WITH_2X_4GB_ADDR_SPACE
     2315# ifndef VBOX_WITH_2X_4GB_ADDR_SPACE
    23792316            pVCpu->pgm.s.pGstAmd64Pml4R0 = (R0PTRTYPE(PX86PML4))HCPtrGuestCR3;
    2380 #  endif
     2317# endif
    23812318            *ppPml4 = (PX86PML4)HCPtrGuestCR3;
    23822319
     
    23902327    return rc;
    23912328}
    2392 #endif
     2329
     2330#endif /* !VBOX_WITH_2X_4GB_ADDR_SPACE_IN_R0 */
    23932331
    23942332
     
    24362374            /* Force lazy remapping if it changed in any way. */
    24372375            pVCpu->pgm.s.apGstPaePDsR3[i]     = 0;
    2438 #  ifndef VBOX_WITH_2X_4GB_ADDR_SPACE
     2376#ifndef VBOX_WITH_2X_4GB_ADDR_SPACE
    24392377            pVCpu->pgm.s.apGstPaePDsR0[i]     = 0;
    2440 #  endif
     2378#endif
    24412379            pVCpu->pgm.s.apGstPaePDsRC[i]     = 0;
    24422380            pVCpu->pgm.s.aGCPhysGstPaePDs[i]  = NIL_RTGCPHYS;
     
    25412479    else
    25422480    {
    2543 # ifdef PGMPOOL_WITH_OPTIMIZED_DIRTY_PT
     2481#ifdef PGMPOOL_WITH_OPTIMIZED_DIRTY_PT
    25442482        PPGMPOOL pPool = pVM->pgm.s.CTX_SUFF(pPool);
    25452483        if (pPool->cDirtyPages)
     
    25492487            pgmUnlock(pVM);
    25502488        }
    2551 # endif
     2489#endif
    25522490        /*
    25532491         * Check if we have a pending update of the CR3 monitoring.
     
    28502788    /* Flush the TLB */
    28512789    PGM_INVL_VCPU_TLBS(pVCpu);
    2852 
    2853 #ifndef IN_RC
    28542790    return PGMHCChangeMode(pVCpu->CTX_SUFF(pVM), pVCpu, enmGuestMode);
    2855 #else
    2856     LogFlow(("PGMChangeMode: returns VINF_PGM_CHANGE_MODE.\n"));
    2857     return VINF_PGM_CHANGE_MODE;
    2858 #endif
    2859 }
    2860 
    2861 #ifndef IN_RC
     2791}
     2792
    28622793
    28632794/**
     
    30672998                            break;
    30682999
    3069 #if HC_ARCH_BITS == 64 || defined(RT_OS_DARWIN)
    30703000                        case SUPPAGINGMODE_AMD64:
    30713001                        case SUPPAGINGMODE_AMD64_GLOBAL:
     
    30743004                            enmShadowMode = PGMMODE_NESTED_AMD64;
    30753005                            break;
    3076 #endif
     3006
    30773007                        default:
    30783008                            AssertLogRelMsgFailedReturn(("enmHostMode=%d\n", pVM->pgm.s.enmHostMode), PGMMODE_INVALID);
     
    32513181}
    32523182
    3253 #endif /* !IN_RC */
    32543183
    32553184/**
     
    35023431    int rc = PDMCritSectEnter(&pVM->pgm.s.CritSectX, VERR_SEM_BUSY);
    35033432#endif
    3504 #if defined(IN_RC) || defined(IN_RING0)
     3433#ifdef IN_RING0
    35053434    if (rc == VERR_SEM_BUSY)
    35063435        rc = VMMRZCallRing3NoCpu(pVM, VMMCALLRING3_PGM_LOCK, 0);
     
    35263455}
    35273456
    3528 #if defined(IN_RC) || defined(VBOX_WITH_2X_4GB_ADDR_SPACE_IN_R0)
     3457#ifdef VBOX_WITH_2X_4GB_ADDR_SPACE_IN_R0
    35293458
    35303459/**
     
    35713500}
    35723501
    3573 #endif /* IN_RC || VBOX_WITH_2X_4GB_ADDR_SPACE_IN_R0 */
     3502#endif /* VBOX_WITH_2X_4GB_ADDR_SPACE_IN_R0 */
    35743503#if !defined(IN_R0) || defined(LOG_ENABLED)
    35753504
     
    35933522        szTmp[cch++] = s_achPageStates[PGM_PAGE_GET_STATE_NA(pPage)];
    35943523
    3595 #define IS_PART_INCLUDED(lvl) ( !(fFlags & RTSTR_F_PRECISION) || cchPrecision == (lvl) || cchPrecision >= (lvl)+10 )
     3524# define IS_PART_INCLUDED(lvl) ( !(fFlags & RTSTR_F_PRECISION) || cchPrecision == (lvl) || cchPrecision >= (lvl)+10 )
    35963525        if (IS_PART_INCLUDED(5))
    35973526        {
     
    36303559            cch += RTStrFormatNumber(&szTmp[cch], PGM_PAGE_GET_TD_IDX_NA(pPage), 16, 4, 0, RTSTR_F_ZEROPAD | RTSTR_F_16BIT);
    36313560        }
    3632 #undef IS_PART_INCLUDED
     3561# undef IS_PART_INCLUDED
    36333562
    36343563        cch = pfnOutput(pvArgOutput, szTmp, cch);
     
    37643693    return cErrors;
    37653694}
    3766 # endif
     3695# endif /* !PGM_WITHOUT_MAPPINGS */
    37673696
    37683697
  • trunk/src/VBox/VMM/VMMAll/PGMAllBth.h

    r80163 r80167  
    4242static int PGM_BTH_NAME(CheckDirtyPageFault)(PVMCPU pVCpu, uint32_t uErr, PSHWPDE pPdeDst, GSTPDE const *pPdeSrc, RTGCPTR GCPtrPage);
    4343static int PGM_BTH_NAME(SyncPT)(PVMCPU pVCpu, unsigned iPD, PGSTPD pPDSrc, RTGCPTR GCPtrPage);
    44 # if PGM_WITH_PAGING(PGM_GST_TYPE, PGM_SHW_TYPE)
     44#if PGM_WITH_PAGING(PGM_GST_TYPE, PGM_SHW_TYPE)
    4545static void PGM_BTH_NAME(SyncPageWorker)(PVMCPU pVCpu, PSHWPTE pPteDst, GSTPDE PdeSrc, GSTPTE PteSrc, PPGMPOOLPAGE pShwPage, unsigned iPTDst);
    46 # else
     46#else
    4747static void PGM_BTH_NAME(SyncPageWorker)(PVMCPU pVCpu, PSHWPTE pPteDst, RTGCPHYS GCPhysPage, PPGMPOOLPAGE pShwPage, unsigned iPTDst);
    4848#endif
     
    686686
    687687                /*
    688                  * Check if the fault address is in a virtual page access handler range.
    689                  */
    690                 PPGMVIRTHANDLER pCur = (PPGMVIRTHANDLER)RTAvlroGCPtrRangeGet(&pVM->pgm.s.CTX_SUFF(pTrees)->HyperVirtHandlers,
    691                                                                              pvFault);
    692                 if (    pCur
    693                     &&  pvFault - pCur->Core.Key < pCur->cb
    694                     &&  uErr & X86_TRAP_PF_RW)
    695                 {
    696                     VBOXSTRICTRC rcStrict;
    697 #   ifdef IN_RC
    698                     STAM_PROFILE_START(&pCur->Stat, h);
    699                     PPGMVIRTHANDLERTYPEINT pCurType = PGMVIRTANDLER_GET_TYPE(pVM, pCur);
    700                     void *pvUser = pCur->CTX_SUFF(pvUser);
    701                     pgmUnlock(pVM);
    702                     rcStrict = pCurType->CTX_SUFF(pfnPfHandler)(pVM, pVCpu, uErr, pRegFrame, pvFault, pCur->Core.Key,
    703                                                                 pvFault - pCur->Core.Key, pvUser);
    704                     pgmLock(pVM);
    705                     STAM_PROFILE_STOP(&pCur->Stat, h);
    706 #   else
    707                     AssertFailed();
    708                     rcStrict = VINF_EM_RAW_EMULATE_INSTR; /* can't happen with VMX */
    709 #   endif
    710                     STAM_COUNTER_INC(&pVCpu->pgm.s.CTX_SUFF(pStats)->StatRZTrap0eHandlersMapping);
    711                     STAM_STATS({ pVCpu->pgm.s.CTX_SUFF(pStatTrap0eAttribution) = &pVCpu->pgm.s.CTX_SUFF(pStats)->StatRZTrap0eTime2Mapping; });
    712                     return VBOXSTRICTRC_TODO(rcStrict);
    713                 }
    714 
    715                 /*
    716688                 * Pretend we're not here and let the guest handle the trap.
    717689                 */
     
    765737# endif
    766738
    767 #  if PGM_WITH_PAGING(PGM_GST_TYPE, PGM_SHW_TYPE) && !defined(IN_RING0)
    768     if (uErr & X86_TRAP_PF_P)
    769     {
    770         /*
    771          * The page isn't marked, but it might still be monitored by a virtual page access handler.
    772          * (ASSUMES no temporary disabling of virtual handlers.)
    773          */
    774         /** @todo r=bird: Since the purpose is to catch out of sync pages with virtual handler(s) here,
    775          * we should correct both the shadow page table and physical memory flags, and not only check for
    776          * accesses within the handler region but for access to pages with virtual handlers. */
    777         PPGMVIRTHANDLER pCur = (PPGMVIRTHANDLER)RTAvlroGCPtrRangeGet(&pVM->pgm.s.CTX_SUFF(pTrees)->VirtHandlers, pvFault);
    778         if (pCur)
    779         {
    780             PPGMVIRTHANDLERTYPEINT pCurType = PGMVIRTANDLER_GET_TYPE(pVM, pCur);
    781             AssertMsg(   !(pvFault - pCur->Core.Key < pCur->cb)
    782                       || (    pCurType->enmKind != PGMVIRTHANDLERKIND_WRITE
    783                            || !(uErr & X86_TRAP_PF_P)
    784                            || (pCurType->enmKind == PGMVIRTHANDLERKIND_WRITE && (uErr & X86_TRAP_PF_RW))),
    785                       ("Unexpected trap for virtual handler: %08X (phys=%08x) %R[pgmpage] uErr=%X, enumKind=%d\n",
    786                        pvFault, GCPhys, pPage, uErr, pCurType->enmKind));
    787 
    788             if (    pvFault - pCur->Core.Key < pCur->cb
    789                 &&  (    uErr & X86_TRAP_PF_RW
    790                      ||  pCurType->enmKind != PGMVIRTHANDLERKIND_WRITE ) )
    791             {
    792                 VBOXSTRICTRC rcStrict;
    793 #   ifdef IN_RC
    794                 STAM_PROFILE_START(&pCur->Stat, h);
    795                 void *pvUser = pCur->CTX_SUFF(pvUser);
    796                 pgmUnlock(pVM);
    797                 rcStrict = pCurType->CTX_SUFF(pfnPfHandler)(pVM, pVCpu, uErr, pRegFrame, pvFault, pCur->Core.Key,
    798                                                             pvFault - pCur->Core.Key, pvUser);
    799                 pgmLock(pVM);
    800                 STAM_PROFILE_STOP(&pCur->Stat, h);
    801 #   else
    802                 rcStrict = VINF_EM_RAW_EMULATE_INSTR; /** @todo for VMX */
    803 #   endif
    804                 STAM_STATS({ pVCpu->pgm.s.CTX_SUFF(pStatTrap0eAttribution) = &pVCpu->pgm.s.CTX_SUFF(pStats)->StatRZTrap0eTime2HndVirt; });
    805                 return VBOXSTRICTRC_TODO(rcStrict);
    806             }
    807         }
    808     }
    809 #  endif /* PGM_WITH_PAGING(PGM_GST_TYPE, PGM_SHW_TYPE) */
    810 
    811739    /*
    812740     * We are here only if page is present in Guest page tables and
     
    837765        }
    838766
    839 #   if defined(LOG_ENABLED) && !defined(IN_RING0)
     767#   if defined(LOG_ENABLED) && 0
    840768        RTGCPHYS   GCPhys2;
    841769        uint64_t   fPageGst2;
     
    850778#   endif /* LOG_ENABLED */
    851779
    852 #   if PGM_WITH_PAGING(PGM_GST_TYPE, PGM_SHW_TYPE) && !defined(IN_RING0)
    853         if (   !GstWalk.Core.fEffectiveUS
    854             && CSAMIsEnabled(pVM)
    855             && CPUMGetGuestCPL(pVCpu) == 0)
    856         {
    857             /* Note: Can't check for X86_TRAP_ID bit, because that requires execute disable support on the CPU. */
    858             if (    pvFault == (RTGCPTR)pRegFrame->eip
    859                 ||  pvFault - pRegFrame->eip < 8    /* instruction crossing a page boundary */
    860 #    ifdef CSAM_DETECT_NEW_CODE_PAGES
    861                 ||  (   !PATMIsPatchGCAddr(pVM, pRegFrame->eip)
    862                      && CSAMDoesPageNeedScanning(pVM, pRegFrame->eip))   /* any new code we encounter here */
    863 #    endif /* CSAM_DETECT_NEW_CODE_PAGES */
    864                )
    865             {
    866                 LogFlow(("CSAMExecFault %RX32\n", pRegFrame->eip));
    867                 rc = CSAMExecFault(pVM, (RTRCPTR)pRegFrame->eip);
    868                 if (rc != VINF_SUCCESS)
    869                 {
    870                     /*
    871                      * CSAM needs to perform a job in ring 3.
    872                      *
    873                      * Sync the page before going to the host context; otherwise we'll end up in a loop if
    874                      * CSAM fails (e.g. instruction crosses a page boundary and the next page is not present)
    875                      */
    876                     LogFlow(("CSAM ring 3 job\n"));
    877                     int rc2 = PGM_BTH_NAME(SyncPage)(pVCpu, GstWalk.Pde, pvFault, 1, uErr);
    878                     AssertRC(rc2);
    879 
    880                     STAM_STATS({ pVCpu->pgm.s.CTX_SUFF(pStatTrap0eAttribution) = &pVCpu->pgm.s.CTX_SUFF(pStats)->StatRZTrap0eTime2CSAM; });
    881                     return rc;
    882                 }
    883             }
    884 #    ifdef CSAM_DETECT_NEW_CODE_PAGES
    885             else if (    uErr == X86_TRAP_PF_RW
    886                      &&  pRegFrame->ecx >= 0x100         /* early check for movswd count */
    887                      &&  pRegFrame->ecx < 0x10000)
    888             {
    889                 /* In case of a write to a non-present supervisor shadow page, we'll take special precautions
    890                  * to detect loading of new code pages.
    891                  */
    892 
    893                 /*
    894                  * Decode the instruction.
    895                  */
    896                 PDISCPUSTATE pDis = &pVCpu->pgm.s.DisState;
    897                 uint32_t     cbOp;
    898                 rc = EMInterpretDisasCurrent(pVM, pVCpu, pDis, &cbOp);
    899 
    900                 /* For now we'll restrict this to rep movsw/d instructions */
    901                 if (    rc == VINF_SUCCESS
    902                     &&  pDis->pCurInstr->opcode == OP_MOVSWD
    903                     &&  (pDis->prefix & DISPREFIX_REP))
    904                 {
    905                     CSAMMarkPossibleCodePage(pVM, pvFault);
    906                 }
    907             }
    908 #    endif  /* CSAM_DETECT_NEW_CODE_PAGES */
    909 
    910             /*
    911              * Mark this page as safe.
    912              */
    913             /** @todo not correct for pages that contain both code and data!! */
    914             Log2(("CSAMMarkPage %RGv; scanned=%d\n", pvFault, true));
    915             CSAMMarkPage(pVM, pvFault, true);
    916         }
    917 #   endif /* PGM_WITH_PAGING(PGM_GST_TYPE, PGM_SHW_TYPE) && !defined(IN_RING0) */
    918780#   if PGM_WITH_PAGING(PGM_GST_TYPE, PGM_SHW_TYPE)
    919781        rc = PGM_BTH_NAME(SyncPage)(pVCpu, GstWalk.Pde, pvFault, PGM_SYNC_NR_PAGES, uErr);
     
    11591021# endif
    11601022}
     1023
    11611024#endif /* !IN_RING3 */
    11621025
     
    11841047PGM_BTH_DECL(int, InvalidatePage)(PVMCPU pVCpu, RTGCPTR GCPtrPage)
    11851048{
    1186 #if    PGM_WITH_PAGING(PGM_GST_TYPE, PGM_SHW_TYPE)   \
     1049#if    PGM_WITH_PAGING(PGM_GST_TYPE, PGM_SHW_TYPE) \
    11871050    && !PGM_TYPE_IS_NESTED_OR_EPT(PGM_SHW_TYPE) \
    11881051    && PGM_SHW_TYPE != PGM_TYPE_NONE
     
    20721935                                RTGCPTR GCPtrCurPage = (GCPtrPage & ~(RTGCPTR)(GST_PT_MASK << GST_PT_SHIFT)) | ((offPTSrc + iPTDst) << PAGE_SHIFT);
    20731936                                NOREF(GCPtrCurPage);
    2074 #   ifdef VBOX_WITH_RAW_MODE_NOT_R0
    2075                                 /*
    2076                                  * Assuming kernel code will be marked as supervisor - and not as user level
    2077                                  * and executed using a conforming code selector - And marked as readonly.
    2078                                  * Also assume that if we're monitoring a page, it's of no interest to CSAM.
    2079                                  */
    2080                                 PPGMPAGE pPage;
    2081                                 if (    ((PdeSrc.u & pPteSrc->u) & (X86_PTE_RW | X86_PTE_US))
    2082                                     ||  iPTDst == ((GCPtrPage >> SHW_PT_SHIFT) & SHW_PT_MASK)   /* always sync GCPtrPage */
    2083                                     ||  !CSAMDoesPageNeedScanning(pVM, GCPtrCurPage)
    2084                                     ||  (   (pPage = pgmPhysGetPage(pVM, pPteSrc->u & GST_PTE_PG_MASK))
    2085                                          && PGM_PAGE_HAS_ACTIVE_HANDLERS(pPage))
    2086                                    )
    2087 #   endif /* else: CSAM not active */
    2088                                    PGM_BTH_NAME(SyncPageWorker)(pVCpu, &pPTDst->a[iPTDst], PdeSrc, *pPteSrc, pShwPage, iPTDst);
     1937                                PGM_BTH_NAME(SyncPageWorker)(pVCpu, &pPTDst->a[iPTDst], PdeSrc, *pPteSrc, pShwPage, iPTDst);
    20891938                                Log2(("SyncPage: 4K+ %RGv PteSrc:{P=%d RW=%d U=%d raw=%08llx} PteDst=%08llx%s\n",
    20901939                                      GCPtrCurPage, pPteSrc->n.u1Present,
     
    22492098# elif (PGM_GST_TYPE == PGM_TYPE_REAL || PGM_GST_TYPE == PGM_TYPE_PROT) \
    22502099    && !PGM_TYPE_IS_NESTED(PGM_SHW_TYPE) \
    2251     && (PGM_SHW_TYPE != PGM_TYPE_EPT || PGM_GST_TYPE == PGM_TYPE_PROT) \
    2252     && !defined(IN_RC)
     2100    && (PGM_SHW_TYPE != PGM_TYPE_EPT || PGM_GST_TYPE == PGM_TYPE_PROT)
    22532101    NOREF(PdeSrc);
    22542102
     
    25282376        const GSTPTE   PteSrc  = *pPteSrc;
    25292377
    2530 #ifdef VBOX_WITH_RAW_MODE_NOT_R0
    2531         /* Bail out here as pgmPoolGetPage will return NULL and we'll crash below.
    2532          * Our individual shadow handlers will provide more information and force a fatal exit.
    2533          */
    2534         if (   VM_IS_RAW_MODE_ENABLED(pVM)
    2535             && MMHyperIsInsideArea(pVM, (RTGCPTR)GCPtrPage))
    2536         {
    2537             LogRel(("CheckPageFault: write to hypervisor region %RGv\n", GCPtrPage));
    2538             return VINF_PGM_NO_DIRTY_BIT_TRACKING;
    2539         }
    2540 #endif
    25412378        /*
    25422379         * Map shadow page table.
     
    30392876                        else if (PGM_PAGE_IS_BALLOONED(pPage))
    30402877                            SHW_PTE_SET(PteDst, 0); /* Handle ballooned pages at #PF time. */
    3041 # ifdef VBOX_WITH_RAW_MODE_NOT_R0
    3042                         /*
    3043                          * Assuming kernel code will be marked as supervisor and not as user level and executed
    3044                          * using a conforming code selector. Don't check for readonly, as that implies the whole
    3045                          * 4MB can be code or readonly data. Linux enables write access for its large pages.
    3046                          */
    3047                         else if (    !PdeSrc.n.u1User
    3048                                  &&  CSAMDoesPageNeedScanning(pVM, GCPtr | (iPTDst << SHW_PT_SHIFT)))
    3049                             SHW_PTE_SET(PteDst, 0);
    3050 # endif
    30512878                        else
    30522879                            SHW_PTE_SET(PteDst, PGM_PAGE_GET_HCPHYS(pPage) | SHW_PTE_GET_U(PteDstBase));
     
    31172944    && !PGM_TYPE_IS_NESTED(PGM_SHW_TYPE) \
    31182945    && (PGM_SHW_TYPE != PGM_TYPE_EPT || PGM_GST_TYPE == PGM_TYPE_PROT) \
    3119     && PGM_SHW_TYPE != PGM_TYPE_NONE \
    3120     && !defined(IN_RC)
     2946    && PGM_SHW_TYPE != PGM_TYPE_NONE
    31212947    NOREF(iPDSrc); NOREF(pPDSrc);
    31222948
     
    32633089        }
    32643090    }
    3265 # endif /* HC_ARCH_BITS == 64 */
     3091# endif /* defined(PGM_WITH_LARGE_PAGES) && PGM_SHW_TYPE != PGM_TYPE_32BIT && PGM_SHW_TYPE != PGM_TYPE_PAE */
    32663092
    32673093    /*
     
    37523578
    37533579#ifdef VBOX_STRICT
    3754 # ifdef IN_RC
    3755 #  undef AssertMsgFailed
    3756 #  define AssertMsgFailed Log
    3757 # endif
    37583580
    37593581/**
     
    45474369    AssertReturn(pPageCR3, VERR_PGM_INVALID_CR3_ADDR);
    45484370    /** @todo this needs some reworking wrt. locking?  */
    4549 # if defined(IN_RC) || defined(VBOX_WITH_2X_4GB_ADDR_SPACE_IN_R0)
     4371# ifdef VBOX_WITH_2X_4GB_ADDR_SPACE_IN_R0
    45504372    HCPtrGuestCR3 = NIL_RTHCPTR;
    45514373    int rc = VINF_SUCCESS;
     
    45824404                PPGMPAGE    pPage  = pgmPhysGetPage(pVM, GCPhys);
    45834405                AssertReturn(pPage, VERR_PGM_INVALID_PDPE_ADDR);
    4584 #  if defined(IN_RC) || defined(VBOX_WITH_2X_4GB_ADDR_SPACE_IN_R0)
     4406#  ifdef VBOX_WITH_2X_4GB_ADDR_SPACE_IN_R0
    45854407                HCPtr = NIL_RTHCPTR;
    45864408                int rc2 = VINF_SUCCESS;
     
    46074429            pVCpu->pgm.s.apGstPaePDsRC[i]     = 0;
    46084430            pVCpu->pgm.s.aGCPhysGstPaePDs[i]  = NIL_RTGCPHYS;
    4609 #  ifdef IN_RC
    4610             PGM_INVL_PG(pVCpu, GCPtr); /** @todo this shouldn't be necessary? */
    4611 #  endif
    46124431        }
    46134432
     
    46594478    rc = VINF_SUCCESS;
    46604479
    4661 #  ifdef IN_RC
    4662     /*
    4663      * WARNING! We can't deal with jumps to ring 3 in the code below as the
    4664      *          state will be inconsistent! Flush important things now while
    4665      *          we still can and then make sure there are no ring-3 calls.
    4666      */
    4667 #   ifdef VBOX_WITH_REM
    4668     REMNotifyHandlerPhysicalFlushIfAlmostFull(pVM, pVCpu);
    4669 #   endif
    4670     VMMRZCallRing3Disable(pVCpu);
    4671 #  endif
    4672 
    46734480    pVCpu->pgm.s.CTX_SUFF(pShwPageCR3) = pNewShwPageCR3;
    46744481#  ifdef IN_RING0
    46754482    pVCpu->pgm.s.pShwPageCR3R3 = MMHyperCCToR3(pVM, pVCpu->pgm.s.CTX_SUFF(pShwPageCR3));
    46764483    pVCpu->pgm.s.pShwPageCR3RC = MMHyperCCToRC(pVM, pVCpu->pgm.s.CTX_SUFF(pShwPageCR3));
    4677 #  elif defined(IN_RC)
    4678     pVCpu->pgm.s.pShwPageCR3R3 = MMHyperCCToR3(pVM, pVCpu->pgm.s.CTX_SUFF(pShwPageCR3));
    4679     pVCpu->pgm.s.pShwPageCR3R0 = MMHyperCCToR0(pVM, pVCpu->pgm.s.CTX_SUFF(pShwPageCR3));
    46804484#  else
    46814485    pVCpu->pgm.s.pShwPageCR3R0 = MMHyperCCToR0(pVM, pVCpu->pgm.s.CTX_SUFF(pShwPageCR3));
     
    46984502    /* Set the current hypervisor CR3. */
    46994503    CPUMSetHyperCR3(pVCpu, PGMGetHyperCR3(pVCpu));
    4700 
    4701 #  ifdef IN_RC
    4702     /* NOTE: The state is consistent again. */
    4703     VMMRZCallRing3Enable(pVCpu);
    4704 #  endif
    47054504
    47064505    /* Clean up the old CR3 root. */
     
    47754574#endif
    47764575
    4777 #if !defined(IN_RC) /* In RC we rely on MapCR3 to do the shadow part for us at a safe time */
    47784576    /*
    47794577     * Update shadow paging info.
    47804578     */
    4781 # if  (   (   PGM_SHW_TYPE == PGM_TYPE_32BIT  \
    4782            || PGM_SHW_TYPE == PGM_TYPE_PAE    \
    4783            || PGM_SHW_TYPE == PGM_TYPE_AMD64))
    4784 
    4785 #  if PGM_GST_TYPE != PGM_TYPE_REAL
     4579#if  (   (   PGM_SHW_TYPE == PGM_TYPE_32BIT \
     4580          || PGM_SHW_TYPE == PGM_TYPE_PAE \
     4581          || PGM_SHW_TYPE == PGM_TYPE_AMD64))
     4582# if PGM_GST_TYPE != PGM_TYPE_REAL
    47864583    Assert(!pVM->pgm.s.fNestedPaging);
    4787 #  endif
    4788 
     4584# endif
    47894585    pgmLock(pVM);
    47904586
     
    48124608        pVCpu->pgm.s.pShwPageCR3RC = 0;
    48134609    }
     4610
    48144611    pgmUnlock(pVM);
    4815 # endif
    4816 #endif /* !IN_RC*/
     4612#endif
    48174613
    48184614    return rc;
  • trunk/src/VBox/VMM/include/PGMInternal.h

    r80163 r80167  
    26042604    /** Physical access handlers (AVL range+offsetptr tree). */
    26052605    AVLROGCPHYSTREE                 PhysHandlers;
    2606 #ifdef VBOX_WITH_RAW_MODE
    2607     /** Virtual access handlers (AVL range + GC ptr tree). */
    2608     AVLROGCPTRTREE                  VirtHandlers;
    2609     /** Virtual access handlers (Phys range AVL range + offsetptr tree).
    2610      * @remarks Handler of the hypervisor kind are of course not present.  */
    2611     AVLROGCPHYSTREE                 PhysToVirtHandlers;
    2612     /** Virtual access handlers for the hypervisor (AVL range + GC ptr tree). */
    2613     AVLROGCPTRTREE                  HyperVirtHandlers;
    2614     /** List of virtual access handler types (offset pointers) of type
    2615      * PGMVIRTHANDLERTYPEINT.  This is needed for relocations. */
    2616     RTLISTOFF32ANCHOR               HeadVirtHandlerTypes;
    2617 #endif
    26182606} PGMTREES;
    26192607/** Pointer to PGM trees. */
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