- Timestamp:
- Nov 10, 2021 4:55:00 PM (3 years ago)
- svn:sync-xref-src-repo-rev:
- 148181
- Location:
- trunk/src/VBox/VMM
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMAll/PGMAllGst.h
r92319 r92331 149 149 # endif 150 150 151 uint64_t fEffective = X86_PTE_RW | X86_PTE_US | X86_PTE_PWT | X86_PTE_PCD | X86_PTE_A | 1; /** @todo can this default assignment be removed? */151 uint64_t fEffective; 152 152 { 153 153 # if PGM_GST_TYPE == PGM_TYPE_AMD64 … … 170 170 else return PGM_GST_NAME(WalkReturnRsvdError)(pVCpu, pWalk, 4); 171 171 172 pWalk->Core.fEffective = fEffective = Pml4e.u & ( X86_PML4E_ RW| X86_PML4E_US | X86_PML4E_PWT172 pWalk->Core.fEffective = fEffective = Pml4e.u & ( X86_PML4E_P | X86_PML4E_RW | X86_PML4E_US | X86_PML4E_PWT 173 173 | X86_PML4E_PCD | X86_PML4E_A | X86_PML4E_NX); 174 174 … … 204 204 205 205 # if PGM_GST_TYPE == PGM_TYPE_AMD64 206 pWalk->Core.fEffective = fEffective &= (Pdpe.u & (X86_PDPE_RW | X86_PDPE_US | X86_PDPE_PWT | X86_PDPE_PCD | X86_PDPE_A)) 206 pWalk->Core.fEffective = fEffective &= (Pdpe.u & ( X86_PDPE_P | X86_PDPE_RW | X86_PDPE_US 207 | X86_PDPE_PWT | X86_PDPE_PCD | X86_PDPE_A)) 207 208 | (Pdpe.u & X86_PDPE_LM_NX); 208 209 # else 209 210 /* NX in the legacy-mode PAE PDPE is reserved. The valid check above ensures the NX bit is not set. */ 210 pWalk->Core.fEffective = fEffective = X86_PDPE_ RW | X86_PDPE_US | X86_PDPE_A211 pWalk->Core.fEffective = fEffective = X86_PDPE_P | X86_PDPE_RW | X86_PDPE_US | X86_PDPE_A 211 212 | (Pdpe.u & (X86_PDPE_PWT | X86_PDPE_PCD)); 212 213 # endif … … 245 246 */ 246 247 # if PGM_GST_TYPE == PGM_TYPE_32BIT 247 fEffective &= Pde.u & (X86_PDE4M_RW | X86_PDE4M_US | X86_PDE4M_PWT | X86_PDE4M_PCD | X86_PDE4M_A);248 fEffective = Pde.u & (X86_PDE4M_P | X86_PDE4M_RW | X86_PDE4M_US | X86_PDE4M_PWT | X86_PDE4M_PCD | X86_PDE4M_A); 248 249 # else 249 fEffective &= (Pde.u & (X86_PDE4M_ RW | X86_PDE4M_US | X86_PDE4M_PWT | X86_PDE4M_PCD | X86_PDE4M_A))250 fEffective &= (Pde.u & (X86_PDE4M_P | X86_PDE4M_RW | X86_PDE4M_US | X86_PDE4M_PWT | X86_PDE4M_PCD | X86_PDE4M_A)) 250 251 | (Pde.u & X86_PDE2M_PAE_NX); 251 252 # endif … … 254 255 pWalk->Core.fEffective = fEffective; 255 256 Assert(GST_IS_NX_ACTIVE(pVCpu) || !(fEffective & PGM_PTATTRS_NX_MASK)); 257 Assert(fEffective & PGM_PTATTRS_R_MASK); 256 258 257 259 pWalk->Core.fEffectiveRW = !!(fEffective & X86_PTE_RW); … … 273 275 return PGM_GST_NAME(WalkReturnRsvdError)(pVCpu, pWalk, 2); 274 276 # if PGM_GST_TYPE == PGM_TYPE_32BIT 275 pWalk->Core.fEffective = fEffective &= Pde.u & (X86_PDE_RW | X86_PDE_US | X86_PDE_PWT | X86_PDE_PCD | X86_PDE_A); 277 pWalk->Core.fEffective = fEffective = Pde.u & ( X86_PDE_P | X86_PDE_RW | X86_PDE_US 278 | X86_PDE_PWT | X86_PDE_PCD | X86_PDE_A); 276 279 # else 277 pWalk->Core.fEffective = fEffective &= (Pde.u & (X86_PDE_RW | X86_PDE_US | X86_PDE_PWT | X86_PDE_PCD | X86_PDE_A)) 280 pWalk->Core.fEffective = fEffective &= (Pde.u & ( X86_PDE_P | X86_PDE_RW | X86_PDE_US 281 | X86_PDE_PWT | X86_PDE_PCD | X86_PDE_A)) 278 282 | (Pde.u & X86_PDE_PAE_NX); 279 283 # endif … … 306 310 */ 307 311 # if PGM_GST_TYPE == PGM_TYPE_32BIT 308 fEffective &= Pte.u & (X86_PTE_RW | X86_PTE_US | X86_PTE_PWT | X86_PTE_PCD | X86_PTE_A);312 fEffective &= Pte.u & (X86_PTE_P | X86_PTE_RW | X86_PTE_US | X86_PTE_PWT | X86_PTE_PCD | X86_PTE_A); 309 313 # else 310 fEffective &= (Pte.u & (X86_PTE_ RW | X86_PTE_US | X86_PTE_PWT | X86_PTE_PCD | X86_PTE_A))314 fEffective &= (Pte.u & (X86_PTE_P | X86_PTE_RW | X86_PTE_US | X86_PTE_PWT | X86_PTE_PCD | X86_PTE_A)) 311 315 | (Pte.u & X86_PTE_PAE_NX); 312 316 # endif … … 314 318 pWalk->Core.fEffective = fEffective; 315 319 Assert(GST_IS_NX_ACTIVE(pVCpu) || !(fEffective & PGM_PTATTRS_NX_MASK)); 320 Assert(fEffective & PGM_PTATTRS_R_MASK); 316 321 317 322 pWalk->Core.fEffectiveRW = !!(fEffective & X86_PTE_RW); … … 376 381 if (!Walk.Core.fBigPage) 377 382 *pfFlags = (Walk.Pte.u & ~(GST_PTE_PG_MASK | X86_PTE_RW | X86_PTE_US)) /* NX not needed */ 378 | (Walk.Core.fEffective & ( PGM_PTATTRS_ RW_MASK383 | (Walk.Core.fEffective & ( PGM_PTATTRS_W_MASK 379 384 | PGM_PTATTRS_US_MASK)) 380 385 # if PGM_WITH_NX(PGM_GST_TYPE, PGM_GST_TYPE) … … 385 390 { 386 391 *pfFlags = (Walk.Pde.u & ~(GST_PTE_PG_MASK | X86_PDE4M_RW | X86_PDE4M_US | X86_PDE4M_PS)) /* NX not needed */ 387 | (Walk.Core.fEffective & ( PGM_PTATTRS_ RW_MASK392 | (Walk.Core.fEffective & ( PGM_PTATTRS_W_MASK 388 393 | PGM_PTATTRS_US_MASK 389 394 | PGM_PTATTRS_PAT_MASK)) -
trunk/src/VBox/VMM/include/PGMInternal.h
r92313 r92331 2341 2341 * The following bits map 1:1 (shifted by PGM_PTATTRS_EPT_SHIFT) to the Intel EPT 2342 2342 * attributes as these are unique to EPT and fit within 64-bits despite the shift: 2343 * - R(Read access).2344 * - W(Write access).2345 * - X_SUPER(Execute or execute access for supervisor-mode linear addresses).2343 * - EPT_R (Read access). 2344 * - EPT_W (Write access). 2345 * - EPT_X_SUPER (Execute or execute access for supervisor-mode linear addresses). 2346 2346 * - EPT_MEMTYPE (EPT memory type). 2347 2347 * - IGNORE_PAT (Ignore PAT memory type). 2348 2348 * - X_USER (Execute access for user-mode linear addresses). 2349 * 2350 * For regular page tables, the R bit is always 1 (same as P bit). 2351 * For Intel EPT, the EPT_R and EPT_W bits are copied to R and W bits respectively. 2349 2352 * 2350 2353 * The following EPT attributes are mapped to the following positions because they … … 2366 2369 typedef PGMPTATTRS *PPGMPTATTRS; 2367 2370 2368 /** Re served bit. */2369 #define PGM_PTATTRS_R SVD_0_SHIFT02370 #define PGM_PTATTRS_R SVD_0_MASK RT_BIT_64(PGM_PTATTRS_RSVD_0_SHIFT)2371 /** Read and write access bit. */2372 #define PGM_PTATTRS_ RW_SHIFT12373 #define PGM_PTATTRS_ RW_MASK RT_BIT_64(PGM_PTATTRS_RW_SHIFT)2371 /** Read bit (always 1 for regular PT, copy of EPT_R for EPT). */ 2372 #define PGM_PTATTRS_R_SHIFT 0 2373 #define PGM_PTATTRS_R_MASK RT_BIT_64(PGM_PTATTRS_R_SHIFT) 2374 /** Write access bit (aka read/write bit for regular PT). */ 2375 #define PGM_PTATTRS_W_SHIFT 1 2376 #define PGM_PTATTRS_W_MASK RT_BIT_64(PGM_PTATTRS_W_SHIFT) 2374 2377 /** User-mode access bit. */ 2375 2378 #define PGM_PTATTRS_US_SHIFT 2 … … 2434 2437 2435 2438 RT_BF_ASSERT_COMPILE_CHECKS(PGM_PTATTRS_, UINT64_C(0), UINT64_MAX, 2436 (RSVD_0, RW, US, PWT, PCD, A, D, PAT, G, RSVD_12_9, EPT_R, EPT_W, EPT_X_SUPER, EPT_MEMTYPE, 2437 EPT_IGNORE_PAT, RSVD_22_20, EPT_X_USER, RSVD_23, EPT_SUPER_SHW_STACK, EPT_SUPPRESS_VE_XCPT, 2438 RSVD_62_27, NX)); 2439 (R, W, US, PWT, PCD, A, D, PAT, G, RSVD_12_9, EPT_R, EPT_W, EPT_X_SUPER, EPT_MEMTYPE, EPT_IGNORE_PAT, 2440 RSVD_22_20, EPT_X_USER, RSVD_23, EPT_SUPER_SHW_STACK, EPT_SUPPRESS_VE_XCPT, RSVD_62_27, NX)); 2439 2441 2440 2442 /** The bit position where the EPT specific attributes begin. */ … … 2445 2447 2446 2448 /** The mask of all PGM page attribute bits for regular page-tables. */ 2447 #define PGM_PTATTRS_PT_VALID_MASK ( PGM_PTATTRS_RW_MASK \ 2449 #define PGM_PTATTRS_PT_VALID_MASK ( PGM_PTATTRS_R_MASK \ 2450 | PGM_PTATTRS_W_MASK \ 2448 2451 | PGM_PTATTRS_US_MASK \ 2449 2452 | PGM_PTATTRS_PWT_MASK \ … … 2456 2459 2457 2460 /** The mask of all PGM page attribute bits for EPT. */ 2458 #define PGM_PTATTRS_EPT_VALID_MASK ( PGM_PTATTRS_A_MASK \ 2461 #define PGM_PTATTRS_EPT_VALID_MASK ( PGM_PTATTRS_R_MASK \ 2462 | PGM_PTATTRS_W_MASK \ 2463 | PGM_PTATTRS_A_MASK \ 2459 2464 | PGM_PTATTRS_D_MASK \ 2460 | PGM_PTATTRS_ R_MASK \2461 | PGM_PTATTRS_ W_MASK \2465 | PGM_PTATTRS_EPT_R_MASK \ 2466 | PGM_PTATTRS_EPT_W_MASK \ 2462 2467 | PGM_PTATTRS_EPT_X_SUPER \ 2463 2468 | PGM_PTATTRS_EPT_MEMTYPE \ … … 2471 2476 2472 2477 /* Verify bits match the regular PT bits. */ 2473 AssertCompile(PGM_PTATTRS_ RW_SHIFT== X86_PTE_BIT_RW);2478 AssertCompile(PGM_PTATTRS_W_SHIFT == X86_PTE_BIT_RW); 2474 2479 AssertCompile(PGM_PTATTRS_US_SHIFT == X86_PTE_BIT_US); 2475 2480 AssertCompile(PGM_PTATTRS_PWT_SHIFT == X86_PTE_BIT_PWT); … … 2479 2484 AssertCompile(PGM_PTATTRS_PAT_SHIFT == X86_PTE_BIT_PAT); 2480 2485 AssertCompile(PGM_PTATTRS_G_SHIFT == X86_PTE_BIT_G); 2481 AssertCompile(PGM_PTATTRS_ RW_MASK== X86_PTE_RW);2486 AssertCompile(PGM_PTATTRS_W_MASK == X86_PTE_RW); 2482 2487 AssertCompile(PGM_PTATTRS_US_MASK == X86_PTE_US); 2483 2488 AssertCompile(PGM_PTATTRS_PWT_MASK == X86_PTE_PWT);
Note:
See TracChangeset
for help on using the changeset viewer.