Changeset 6869 in vbox
- Timestamp:
- Feb 8, 2008 3:47:35 PM (17 years ago)
- Location:
- trunk/src/VBox/VMM
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/MMPagePool.cpp
r6529 r6869 494 494 AssertRelease(pVM->mm.s.pvDummyPage); 495 495 pVM->mm.s.HCPhysDummyPage = mmPagePoolPtr2Phys(pVM->mm.s.pPagePool, pVM->mm.s.pvDummyPage); 496 AssertRelease(!(pVM->mm.s.HCPhysDummyPage & ~X86_PTE_PAE_PG_MASK)); 496 497 } 497 498 return pVM->mm.s.pvDummyPage; -
trunk/src/VBox/VMM/PGMInternal.h
r6862 r6869 508 508 * of information into as few bits as possible. The format is also subject 509 509 * to change (there is one comming up soon). Which means that for we'll be 510 * using PGM_PAGE_GET_* and PGM_PAGE_SET_* macros for all accessess to the511 * structure.510 * using PGM_PAGE_GET_*, PGM_PAGE_IS_ and PGM_PAGE_SET_* macros for *all* 511 * accessess to the structure. 512 512 */ 513 513 typedef struct PGMPAGE … … 516 516 RTHCPHYS HCPhys; 517 517 /** The page state. */ 518 uint32_t u2State : 2;518 uint32_t u2StateX : 2; 519 519 /** Flag indicating that a write monitored page was written to when set. */ 520 uint32_t fWrittenTo : 1;520 uint32_t fWrittenToX : 1; 521 521 /** For later. */ 522 522 uint32_t fSomethingElse : 1; … … 524 524 * @todo Merge with HCPhys once we've liberated HCPhys of its stuff. 525 525 * The HCPhys will be 100% static. */ 526 uint32_t idPage : 28;526 uint32_t idPageX : 28; 527 527 /** The page type (PGMPAGETYPE). */ 528 528 uint32_t u3Type : 3; … … 537 537 typedef PPGMPAGE *PPPGMPAGE; 538 538 539 /** @name The Page state, PGMPAGE::u2State. 539 540 /** 541 * Clears the page structure. 542 * @param pPage Pointer to the physical guest page tracking structure. 543 */ 544 #define PGM_PAGE_CLEAR(pPage) \ 545 do { \ 546 (pPage)->HCPhys = 0; \ 547 (pPage)->u2StateX = 0; \ 548 (pPage)->fWrittenToX = 0; \ 549 (pPage)->fSomethingElse = 0; \ 550 (pPage)->idPageX = 0; \ 551 (pPage)->u3Type = 0; \ 552 (pPage)->u29B = 0; \ 553 } while (0) 554 555 /** 556 * Clears the page structure. 557 * @param pPage Pointer to the physical guest page tracking structure. 558 */ 559 #define PGM_PAGE_INIT(pPage, _HCPhys, _idPage, _uType, _uState) \ 560 do { \ 561 (pPage)->HCPhys = (_HCPhys); \ 562 (pPage)->u2StateX = (_uState); \ 563 (pPage)->fWrittenToX = 0; \ 564 (pPage)->fSomethingElse = 0; \ 565 (pPage)->idPageX = (_idPage); \ 566 (pPage)->u3Type = (_uType); \ 567 (pPage)->u29B = 0; \ 568 } while (0) 569 570 /** 571 * Clears the page structure. 572 * @param pPage Pointer to the physical guest page tracking structure. 573 */ 574 #ifdef VBOX_WITH_NEW_PHYS_CODE 575 # define PGM_PAGE_INIT_ZERO(pPage, pVM, _uType) \ 576 PGM_PAGE_INIT(pPage, (pVM)->pgm.s.HCPhysZeroPg, NIL_GMM_PAGEID, PGM_PAGE_STATE_ZERO, (_uType)) 577 #else 578 # define PGM_PAGE_INIT_ZERO(pPage, pVM, _uType) \ 579 PGM_PAGE_INIT(pPage, 0, NIL_GMM_PAGEID, PGM_PAGE_STATE_ZERO, (_uType)) 580 #endif 581 /** Temporary hack. Replaced by PGM_PAGE_INIT_ZERO once the old code is kicked out. */ 582 # define PGM_PAGE_INIT_ZERO_REAL(pPage, pVM, _uType) \ 583 PGM_PAGE_INIT(pPage, (pVM)->pgm.s.HCPhysZeroPg, NIL_GMM_PAGEID, PGM_PAGE_STATE_ZERO, (_uType)) 584 585 586 /** @name The Page state, PGMPAGE::u2StateX. 540 587 * @{ */ 541 588 /** The zero page. … … 562 609 * @param pPage Pointer to the physical guest page tracking structure. 563 610 */ 564 #define PGM_PAGE_GET_STATE(pPage) ( (pPage)->u2State )611 #define PGM_PAGE_GET_STATE(pPage) ( (pPage)->u2StateX ) 565 612 566 613 /** … … 570 617 */ 571 618 #define PGM_PAGE_SET_STATE(pPage, _uState) \ 572 do { (pPage)->u2State = (_uState); } while (0)619 do { (pPage)->u2StateX = (_uState); } while (0) 573 620 574 621 … … 594 641 * @param pPage Pointer to the physical guest page tracking structure. 595 642 */ 596 #define PGM_PAGE_GET_PAGEID(pPage) ( (pPage)->idPage )643 #define PGM_PAGE_GET_PAGEID(pPage) ( (pPage)->idPageX ) 597 644 /* later: 598 645 #define PGM_PAGE_GET_PAGEID(pPage) ( ((uint32_t)(pPage)->HCPhys >> (48 - 12)) … … 603 650 * @param pPage Pointer to the physical guest page tracking structure. 604 651 */ 605 #define PGM_PAGE_SET_PAGEID(pPage, _idPage) do { (pPage)->idPage = (_idPage); } while (0)652 #define PGM_PAGE_SET_PAGEID(pPage, _idPage) do { (pPage)->idPageX = (_idPage); } while (0) 606 653 /* later: 607 654 #define PGM_PAGE_SET_PAGEID(pPage, _idPage) do { (pPage)->HCPhys = (((pPage)->HCPhys) & UINT64_C(0x0000fffffffff000)) \ … … 615 662 * @param pPage Pointer to the physical guest page tracking structure. 616 663 */ 617 #define PGM_PAGE_GET_CHUNKID(pPage) ( (pPage)->idPage >> GMM_CHUNKID_SHIFT )664 #define PGM_PAGE_GET_CHUNKID(pPage) ( (pPage)->idPageX >> GMM_CHUNKID_SHIFT ) 618 665 /* later: 619 666 #if GMM_CHUNKID_SHIFT == 12 … … 634 681 * @param pPage Pointer to the physical guest page tracking structure. 635 682 */ 636 #define PGM_PAGE_GET_PAGE_IN_CHUNK(pPage) ( (pPage)->idPage & GMM_PAGEID_IDX_MASK )683 #define PGM_PAGE_GET_PAGE_IN_CHUNK(pPage) ( (pPage)->idPageX & GMM_PAGEID_IDX_MASK ) 637 684 /* later: 638 685 #if GMM_CHUNKID_SHIFT <= 12 … … 680 727 * @param pPage Pointer to the physical guest page tracking structure. 681 728 */ 682 #define PGM_PAGE_IS_ZERO(pPage) ( (pPage)->u2State == PGM_PAGE_STATE_ZERO )729 #define PGM_PAGE_IS_ZERO(pPage) ( (pPage)->u2StateX == PGM_PAGE_STATE_ZERO ) 683 730 684 731 /** … … 687 734 * @param pPage Pointer to the physical guest page tracking structure. 688 735 */ 689 #define PGM_PAGE_IS_SHARED(pPage) ( (pPage)->u2State == PGM_PAGE_STATE_SHARED ) 690 736 #define PGM_PAGE_IS_SHARED(pPage) ( (pPage)->u2StateX == PGM_PAGE_STATE_SHARED ) 737 738 739 /** 740 * Marks the paget as written to (for GMM change monitoring). 741 * @param pPage Pointer to the physical guest page tracking structure. 742 */ 743 #define PGM_PAGE_SET_WRITTEN_TO(pPage) do { (pPage)->fWrittenToX = 1; } while (0) 744 745 /** 746 * Clears the written-to indicator. 747 * @param pPage Pointer to the physical guest page tracking structure. 748 */ 749 #define PGM_PAGE_CLEAR_WRITTEN_TO(pPage) do { (pPage)->fWrittenToX = 0; } while (0) 750 751 /** 752 * Checks if the page was marked as written-to. 753 * @returns true/false. 754 * @param pPage Pointer to the physical guest page tracking structure. 755 */ 756 #define PGM_PAGE_IS_WRITTEN_TO(pPage) ( (pPage)->fWrittenToX ) 691 757 692 758 /** -
trunk/src/VBox/VMM/PGMPhys.cpp
r6861 r6869 227 227 RTGCPHYS iPage = cPages; 228 228 while (iPage-- > 0) 229 { 230 #ifdef VBOX_WITH_NEW_PHYS_CODE 231 pNew->aPages[iPage].HCPhys = pVM->pgm.s.HCPhysZeroPg; 232 #else 233 pNew->aPages[iPage].HCPhys = 0; 234 #endif 235 pNew->aPages[iPage].fWrittenTo = 0; 236 pNew->aPages[iPage].fSomethingElse = 0; 237 pNew->aPages[iPage].u29B = 0; 238 PGM_PAGE_SET_TYPE(&pNew->aPages[iPage], PGMPAGETYPE_RAM); 239 PGM_PAGE_SET_STATE(&pNew->aPages[iPage], PGM_PAGE_STATE_ZERO); 240 PGM_PAGE_SET_PAGEID(&pNew->aPages[iPage], NIL_GMM_PAGEID); 241 } 229 PGM_PAGE_INIT_ZERO(&pNew->aPages[iPage], pVM, PGMPAGETYPE_RAM); 242 230 243 231 /* … … 512 500 for (uint32_t iPage = 0; iPage < cPages; iPage++, pPage++, pRomPage++) 513 501 { 514 pPage->fWrittenTo = 0; 515 pPage->fSomethingElse = 0; 516 pPage->u29B = 0; 517 PGM_PAGE_SET_TYPE(pPage, PGMPAGETYPE_ROM); 518 PGM_PAGE_SET_HCPHYS(pPage, pReq->aPages[iPage].HCPhysGCPhys); 519 PGM_PAGE_SET_STATE(pPage, PGM_PAGE_STATE_ALLOCATED); 520 PGM_PAGE_SET_PAGEID(pPage, pReq->aPages[iPage].idPage); 502 PGM_PAGE_INIT(pPage, 503 pReq->aPages[iPage].HCPhysGCPhys, 504 pReq->aPages[iPage].idPage, 505 PGMPAGETYPE_ROM, 506 PGM_PAGE_STATE_ALLOCATED); 521 507 522 508 pRomPage->Virgin = *pPage; … … 591 577 { 592 578 PPGMROMPAGE pPage = &pRomNew->aPages[iPage]; 593 594 pPage->Shadow.HCPhys = 0; 595 pPage->Shadow.fWrittenTo = 0; 596 pPage->Shadow.fSomethingElse = 0; 597 pPage->Shadow.u29B = 0; 598 PGM_PAGE_SET_TYPE( &pPage->Shadow, PGMPAGETYPE_ROM_SHADOW); 599 PGM_PAGE_SET_STATE( &pPage->Shadow, PGM_PAGE_STATE_ZERO); 600 PGM_PAGE_SET_PAGEID(&pPage->Shadow, pReq->aPages[iPage].idPage); 601 602 pRomNew->aPages[iPage].enmProt = PGMROMPROT_READ_ROM_WRITE_IGNORE; 579 pPage->enmProt = PGMROMPROT_READ_ROM_WRITE_IGNORE; 580 PGM_PAGE_INIT_ZERO_REAL(&pPage->Shadow, pVM, PGMPAGETYPE_ROM_SHADOW); 603 581 } 604 582 … … 787 765 for (iPage = 0; iPage < cPages; iPage++) 788 766 if (PGM_PAGE_GET_STATE(&pRom->aPages[iPage].Shadow) != PGM_PAGE_STATE_ZERO) 789 { 790 PGM_PAGE_SET_STATE( &pRom->aPages[iPage].Shadow, PGM_PAGE_STATE_ZERO); 791 PGM_PAGE_SET_HCPHYS(&pRom->aPages[iPage].Shadow, pVM->pgm.s.HCPhysZeroPg); 792 PGM_PAGE_SET_PAGEID(&pRom->aPages[iPage].Shadow, NIL_GMM_PAGEID); 793 pRom->aPages[iPage].Shadow.fWrittenTo = false; 794 iReqPage++; 795 } 767 PGM_PAGE_INIT_ZERO_REAL(&pRom->aPages[iPage].Shadow, pVM, PGMPAGETYPE_ROM_SHADOW); 796 768 } 797 769 } … … 909 881 *pOld = *pRamPage; 910 882 *pRamPage = *pNew; 911 /** @todo sync the volatile flags (handlers) when these have been moved out of HCPhys.*/883 /** @todo preserve the volatile flags (handlers) when these have been moved out of HCPhys! */ 912 884 } 913 885 } … … 1050 1022 while (iPage-- > 0) 1051 1023 { 1052 pNew->aPages[iPage].HCPhys = (paPages[iPage].Phys & X86_PTE_PAE_PG_MASK) | fFlags; /** @todo PAGE FLAGS */ 1053 pNew->aPages[iPage].fWrittenTo = 0; 1054 pNew->aPages[iPage].fSomethingElse = 0; 1055 pNew->aPages[iPage].u29B = 0; 1056 PGM_PAGE_SET_PAGEID(&pNew->aPages[iPage], NIL_GMM_PAGEID); 1057 PGM_PAGE_SET_TYPE(&pNew->aPages[iPage], fFlags & MM_RAM_FLAGS_MMIO2 ? PGMPAGETYPE_MMIO2 : PGMPAGETYPE_RAM); 1058 PGM_PAGE_SET_STATE(&pNew->aPages[iPage], PGM_PAGE_STATE_ALLOCATED); 1024 PGM_PAGE_INIT(&pNew->aPages[iPage], paPages[iPage].Phys & X86_PTE_PAE_PG_MASK, NIL_GMM_PAGEID, 1025 fFlags & MM_RAM_FLAGS_MMIO2 ? PGMPAGETYPE_MMIO2 : PGMPAGETYPE_RAM, 1026 PGM_PAGE_STATE_ALLOCATED); 1027 pNew->aPages[iPage].HCPhys |= fFlags; /** @todo PAGE FLAGS*/ 1059 1028 } 1060 1029 } … … 1071 1040 while (iPage-- > 0) 1072 1041 { 1042 PGM_PAGE_INIT(&pNew->aPages[iPage], 0, NIL_GMM_PAGEID, PGMPAGETYPE_RAM, PGM_PAGE_STATE_ZERO); 1073 1043 pNew->aPages[iPage].HCPhys = fFlags; /** @todo PAGE FLAGS */ 1074 pNew->aPages[iPage].fWrittenTo = 0;1075 pNew->aPages[iPage].fSomethingElse = 0;1076 pNew->aPages[iPage].u29B = 0;1077 PGM_PAGE_SET_PAGEID(&pNew->aPages[iPage], NIL_GMM_PAGEID);1078 PGM_PAGE_SET_TYPE(&pNew->aPages[iPage], PGMPAGETYPE_RAM);1079 PGM_PAGE_SET_STATE(&pNew->aPages[iPage], PGM_PAGE_STATE_ZERO);1080 1044 } 1081 1045 } … … 1083 1047 { 1084 1048 Assert(fFlags == (MM_RAM_FLAGS_RESERVED | MM_RAM_FLAGS_MMIO)); 1085 RTHCPHYS HCPhysDummyPage = (MMR3PageDummyHCPhys(pVM) & X86_PTE_PAE_PG_MASK) | fFlags; /** @todo PAGE FLAGS */1049 RTHCPHYS HCPhysDummyPage = MMR3PageDummyHCPhys(pVM); 1086 1050 while (iPage-- > 0) 1087 1051 { 1088 pNew->aPages[iPage].HCPhys = HCPhysDummyPage; /** @todo PAGE FLAGS */ 1089 pNew->aPages[iPage].fWrittenTo = 0; 1090 pNew->aPages[iPage].fSomethingElse = 0; 1091 pNew->aPages[iPage].u29B = 0; 1092 PGM_PAGE_SET_PAGEID(&pNew->aPages[iPage], NIL_GMM_PAGEID); 1093 PGM_PAGE_SET_TYPE(&pNew->aPages[iPage], PGMPAGETYPE_MMIO); 1094 PGM_PAGE_SET_STATE(&pNew->aPages[iPage], PGM_PAGE_STATE_ZERO); 1052 PGM_PAGE_INIT(&pNew->aPages[iPage], HCPhysDummyPage, NIL_GMM_PAGEID, PGMPAGETYPE_MMIO, PGM_PAGE_STATE_ZERO); 1053 pNew->aPages[iPage].HCPhys |= fFlags; /** @todo PAGE FLAGS*/ 1095 1054 } 1096 1055 } -
trunk/src/VBox/VMM/VMMAll/PGMAllPhys.cpp
r6856 r6869 425 425 int pgmPhysPageMakeWritable(PVM pVM, PPGMPAGE pPage, RTGCPHYS GCPhys) 426 426 { 427 switch ( pPage->u2State)427 switch (PGM_PAGE_GET_STATE(pPage)) 428 428 { 429 429 case PGM_PAGE_STATE_WRITE_MONITORED: 430 pPage->fWrittenTo = true;431 pPage->u2State = PGM_PAGE_STATE_ALLOCATED;430 PGM_PAGE_SET_WRITTEN_TO(pPage); 431 PGM_PAGE_SET_STATE(pPage, PGM_PAGE_STATE_ALLOCATED); 432 432 /* fall thru */ 433 433 default: /* to shut up GCC */ … … 641 641 */ 642 642 PPGMPAGE pPage = pTlbe->pPage; 643 if (RT_UNLIKELY( pPage->u2State!= PGM_PAGE_STATE_ALLOCATED))643 if (RT_UNLIKELY(PGM_PAGE_GET_STATE(pPage) != PGM_PAGE_STATE_ALLOCATED)) 644 644 { 645 645 rc = pgmPhysPageMakeWritable(pVM, pPage, GCPhys);
Note:
See TracChangeset
for help on using the changeset viewer.