Changeset 4693 in vbox
- Timestamp:
- Sep 11, 2007 10:14:38 AM (17 years ago)
- svn:sync-xref-src-repo-rev:
- 24354
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/pgm.h
r4692 r4693 808 808 * scarse resources (R0 and GC) in the mapping cache. When you're done 809 809 * with the page, call PGMPhysReleasePageMappingLock() ASAP to release it. 810 * 811 * This API will assume your intention is to write to the page, and will 812 * therefore replace shared and zero pages. If you do not intend to modify 813 * the page, use the PGMPhysGCPhys2CCPtrReadOnly() API. 810 814 * 811 815 * @returns VBox status code. … … 821 825 * @remark Avoid calling this API from within critical sections (other than 822 826 * the PGM one) because of the deadlock risk. 827 * @thread Any thread. 823 828 */ 824 829 PGMDECL(int) PGMPhysGCPhys2CCPtr(PVM pVM, RTGCPHYS GCPhys, void **ppv, PPGMPAGEMAPLOCK pLock); 830 831 /** 832 * Requests the mapping of a guest page into the current context. 833 * 834 * This API should only be used for very short term, as it will consume 835 * scarse resources (R0 and GC) in the mapping cache. When you're done 836 * with the page, call PGMPhysReleasePageMappingLock() ASAP to release it. 837 * 838 * @returns VBox status code. 839 * @retval VINF_SUCCESS on success. 840 * @retval VERR_PGM_PHYS_PAGE_RESERVED it it's a valid page but has no physical backing. 841 * @retval VERR_PGM_INVALID_GC_PHYSICAL_ADDRESS if it's not a valid physical address. 842 * 843 * @param pVM The VM handle. 844 * @param GCPhys The guest physical address of the page that should be mapped. 845 * @param ppv Where to store the address corresponding to GCPhys. 846 * @param pLock Where to store the lock information that PGMPhysReleasePageMappingLock needs. 847 * 848 * @remark Avoid calling this API from within critical sections (other than 849 * the PGM one) because of the deadlock risk. 850 * @thread Any thread. 851 */ 852 PGMDECL(int) PGMPhysGCPhys2CCPtrReadOnly(PVM pVM, RTGCPHYS GCPhys, void * const *ppv, PPGMPAGEMAPLOCK pLock); 853 854 /** 855 * Requests the mapping of a guest page given by virtual address into the current context. 856 * 857 * This API should only be used for very short term, as it will consume 858 * scarse resources (R0 and GC) in the mapping cache. When you're done 859 * with the page, call PGMPhysReleasePageMappingLock() ASAP to release it. 860 * 861 * This API will assume your intention is to write to the page, and will 862 * therefore replace shared and zero pages. If you do not intend to modify 863 * the page, use the PGMPhysGCPtr2CCPtrReadOnly() API. 864 * 865 * @returns VBox status code. 866 * @retval VINF_SUCCESS on success. 867 * @retval VERR_PAGE_TABLE_NOT_PRESENT if the page directory for the virtual address isn't present. 868 * @retval VERR_PAGE_NOT_PRESENT if the page at the virtual address isn't present. 869 * @retval VERR_PGM_PHYS_PAGE_RESERVED it it's a valid page but has no physical backing. 870 * @retval VERR_PGM_INVALID_GC_PHYSICAL_ADDRESS if it's not a valid physical address. 871 * 872 * @param pVM The VM handle. 873 * @param GCPhys The guest physical address of the page that should be mapped. 874 * @param ppv Where to store the address corresponding to GCPhys. 875 * @param pLock Where to store the lock information that PGMPhysReleasePageMappingLock needs. 876 * 877 * @remark Avoid calling this API from within critical sections (other than 878 * the PGM one) because of the deadlock risk. 879 * @thread EMT 880 */ 881 PGMDECL(int) PGMPhysGCPtr2CCPtr(PVM pVM, RTGCPTR GCPtr, void **ppv, PPGMPAGEMAPLOCK pLock); 882 883 /** 884 * Requests the mapping of a guest page given by virtual address into the current context. 885 * 886 * This API should only be used for very short term, as it will consume 887 * scarse resources (R0 and GC) in the mapping cache. When you're done 888 * with the page, call PGMPhysReleasePageMappingLock() ASAP to release it. 889 * 890 * @returns VBox status code. 891 * @retval VINF_SUCCESS on success. 892 * @retval VERR_PAGE_TABLE_NOT_PRESENT if the page directory for the virtual address isn't present. 893 * @retval VERR_PAGE_NOT_PRESENT if the page at the virtual address isn't present. 894 * @retval VERR_PGM_PHYS_PAGE_RESERVED it it's a valid page but has no physical backing. 895 * @retval VERR_PGM_INVALID_GC_PHYSICAL_ADDRESS if it's not a valid physical address. 896 * 897 * @param pVM The VM handle. 898 * @param GCPhys The guest physical address of the page that should be mapped. 899 * @param ppv Where to store the address corresponding to GCPhys. 900 * @param pLock Where to store the lock information that PGMPhysReleasePageMappingLock needs. 901 * 902 * @remark Avoid calling this API from within critical sections (other than 903 * the PGM one) because of the deadlock risk. 904 * @thread EMT 905 */ 906 PGMDECL(int) PGMPhysGCPtr2CCPtrReadOnly(PVM pVM, RTGCPTR GCPtr, void * const *ppv, PPGMPAGEMAPLOCK pLock); 825 907 826 908 /** 827 909 * Release the mapping of a guest page. 828 910 * 829 * This is the counter part of PGMPhysGCPhys2CCPtr. 911 * This is the counter part of PGMPhysGCPhys2CCPtr, PGMPhysGCPhys2CCPtrReadOnly 912 * PGMPhysGCPtr2CCPtr and PGMPhysGCPtr2CCPtrReadOnly. 830 913 * 831 914 * @param pVM The VM handle. -
trunk/src/VBox/VMM/VMMAll/PGMAllPhys.cpp
r4692 r4693 379 379 * scarse resources (R0 and GC) in the mapping cache. When you're done 380 380 * with the page, call PGMPhysReleasePageMappingLock() ASAP to release it. 381 * 382 * This API will assume your intention is to write to the page, and will 383 * therefore replace shared and zero pages. If you do not intend to modify 384 * the page, use the PGMPhysGCPhys2CCPtrReadOnly() API. 381 385 * 382 386 * @returns VBox status code. … … 392 396 * @remark Avoid calling this API from within critical sections (other than 393 397 * the PGM one) because of the deadlock risk. 398 * @thread Any thread. 394 399 */ 395 400 PGMDECL(int) PGMPhysGCPhys2CCPtr(PVM pVM, RTGCPHYS GCPhys, void **ppv, PPGMPAGEMAPLOCK pLock) 396 401 { 397 # ifdef NEW_PHYS_CODE 398 int rc = pgmLock(pVM); 399 AssertRCReturn(rc); 400 402 #ifdef NEW_PHYS_CODE 401 403 #ifdef IN_GC 402 404 /* Until a physical TLB is implemented for GC, let PGMGCDynMapGCPageEx handle it. */ 403 405 return PGMGCDynMapGCPageEx(pVM, GCPhys, ppv); 404 405 406 #else 407 int rc = pgmLock(pVM); 408 AssertRCReturn(rc); 409 406 410 /* 407 411 * Query the Physical TLB entry for the page (may fail). … … 455 459 456 460 /** 461 * Requests the mapping of a guest page into the current context. 462 * 463 * This API should only be used for very short term, as it will consume 464 * scarse resources (R0 and GC) in the mapping cache. When you're done 465 * with the page, call PGMPhysReleasePageMappingLock() ASAP to release it. 466 * 467 * @returns VBox status code. 468 * @retval VINF_SUCCESS on success. 469 * @retval VERR_PGM_PHYS_PAGE_RESERVED it it's a valid page but has no physical backing. 470 * @retval VERR_PGM_INVALID_GC_PHYSICAL_ADDRESS if it's not a valid physical address. 471 * 472 * @param pVM The VM handle. 473 * @param GCPhys The guest physical address of the page that should be mapped. 474 * @param ppv Where to store the address corresponding to GCPhys. 475 * @param pLock Where to store the lock information that PGMPhysReleasePageMappingLock needs. 476 * 477 * @remark Avoid calling this API from within critical sections (other than 478 * the PGM one) because of the deadlock risk. 479 * @thread Any thread. 480 */ 481 PGMDECL(int) PGMPhysGCPhys2CCPtrReadOnly(PVM pVM, RTGCPHYS GCPhys, void * const *ppv, PPGMPAGEMAPLOCK pLock) 482 { 483 /** @todo implement this */ 484 return PGMPhysGCPhys2CCPtr(pVM, GCPhys, (void **)ppv, pLock); 485 } 486 487 488 /** 489 * Requests the mapping of a guest page given by virtual address into the current context. 490 * 491 * This API should only be used for very short term, as it will consume 492 * scarse resources (R0 and GC) in the mapping cache. When you're done 493 * with the page, call PGMPhysReleasePageMappingLock() ASAP to release it. 494 * 495 * This API will assume your intention is to write to the page, and will 496 * therefore replace shared and zero pages. If you do not intend to modify 497 * the page, use the PGMPhysGCPtr2CCPtrReadOnly() API. 498 * 499 * @returns VBox status code. 500 * @retval VINF_SUCCESS on success. 501 * @retval VERR_PAGE_TABLE_NOT_PRESENT if the page directory for the virtual address isn't present. 502 * @retval VERR_PAGE_NOT_PRESENT if the page at the virtual address isn't present. 503 * @retval VERR_PGM_PHYS_PAGE_RESERVED it it's a valid page but has no physical backing. 504 * @retval VERR_PGM_INVALID_GC_PHYSICAL_ADDRESS if it's not a valid physical address. 505 * 506 * @param pVM The VM handle. 507 * @param GCPhys The guest physical address of the page that should be mapped. 508 * @param ppv Where to store the address corresponding to GCPhys. 509 * @param pLock Where to store the lock information that PGMPhysReleasePageMappingLock needs. 510 * 511 * @remark Avoid calling this API from within critical sections (other than 512 * the PGM one) because of the deadlock risk. 513 * @thread EMT 514 */ 515 PGMDECL(int) PGMPhysGCPtr2CCPtr(PVM pVM, RTGCPTR GCPtr, void **ppv, PPGMPAGEMAPLOCK pLock) 516 { 517 RTGCPHYS GCPhys; 518 int rc = PGMPhysGCPtr2GCPhys(pVM, GCPtr, &GCPhys); 519 if (VBOX_SUCCESS(rc)) 520 rc = PGMPhysGCPhys2CCPtr(pVM, GCPhys, ppv, pLock); 521 return rc; 522 } 523 524 525 /** 526 * Requests the mapping of a guest page given by virtual address into the current context. 527 * 528 * This API should only be used for very short term, as it will consume 529 * scarse resources (R0 and GC) in the mapping cache. When you're done 530 * with the page, call PGMPhysReleasePageMappingLock() ASAP to release it. 531 * 532 * @returns VBox status code. 533 * @retval VINF_SUCCESS on success. 534 * @retval VERR_PAGE_TABLE_NOT_PRESENT if the page directory for the virtual address isn't present. 535 * @retval VERR_PAGE_NOT_PRESENT if the page at the virtual address isn't present. 536 * @retval VERR_PGM_PHYS_PAGE_RESERVED it it's a valid page but has no physical backing. 537 * @retval VERR_PGM_INVALID_GC_PHYSICAL_ADDRESS if it's not a valid physical address. 538 * 539 * @param pVM The VM handle. 540 * @param GCPhys The guest physical address of the page that should be mapped. 541 * @param ppv Where to store the address corresponding to GCPhys. 542 * @param pLock Where to store the lock information that PGMPhysReleasePageMappingLock needs. 543 * 544 * @remark Avoid calling this API from within critical sections (other than 545 * the PGM one) because of the deadlock risk. 546 * @thread EMT 547 */ 548 PGMDECL(int) PGMPhysGCPtr2CCPtrReadOnly(PVM pVM, RTGCPTR GCPtr, void * const *ppv, PPGMPAGEMAPLOCK pLock) 549 { 550 RTGCPHYS GCPhys; 551 int rc = PGMPhysGCPtr2GCPhys(pVM, GCPtr, &GCPhys); 552 if (VBOX_SUCCESS(rc)) 553 rc = PGMPhysGCPhys2CCPtrReadOnly(pVM, GCPhys, ppv, pLock); 554 return rc; 555 } 556 557 558 /** 457 559 * Release the mapping of a guest page. 458 560 * 459 * This is the counter part of PGMPhysGCPhys2CCPtr. 561 * This is the counter part of PGMPhysGCPhys2CCPtr, PGMPhysGCPhys2CCPtrReadOnly 562 * PGMPhysGCPtr2CCPtr and PGMPhysGCPtr2CCPtrReadOnly. 460 563 * 461 564 * @param pVM The VM handle. -
trunk/src/VBox/VMM/VMMAll/TRPMAll.cpp
r4692 r4693 591 591 if ((pTrapStackGC >> PAGE_SHIFT) != ((pTrapStackGC - 10*sizeof(uint32_t)) >> PAGE_SHIFT)) /* fail if we cross a page boundary */ 592 592 goto failure; 593 594 /** @todo add PGMPhysGCPtr2CCPtr */595 593 PGMPAGEMAPLOCK PageMappingLock; 596 RTGCPHYS GCPhysStack; 597 rc = PGMPhysGCPtr2GCPhys(pVM, pTrapStackGC, &GCPhysStack); 598 if (VBOX_SUCCESS(rc)) 599 rc = PGMPhysGCPhys2CCPtr(pVM, GCPhysStack, (void **)&pTrapStack, &PageMappingLock); 594 rc = PGMPhysGCPtr2CCPtr(pVM, pTrapStackGC, (void **)&pTrapStack, &PageMappingLock); 600 595 if (VBOX_FAILURE(rc)) 601 596 {
Note:
See TracChangeset
for help on using the changeset viewer.