Changeset 19381 in vbox for trunk/src/VBox/VMM/VMMR0/GMMR0.cpp
- Timestamp:
- May 5, 2009 2:44:43 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMR0/GMMR0.cpp
r19360 r19381 1037 1037 * 1038 1038 * @param pVM Pointer to the shared VM structure. 1039 * @param idCpu VCPU id 1039 1040 * @param cBasePages The number of pages that may be allocated for the base RAM and ROMs. 1040 1041 * This does not include MMIO2 and similar. … … 1047 1048 * @thread The creator thread / EMT. 1048 1049 */ 1049 GMMR0DECL(int) GMMR0InitialReservation(PVM pVM, u int64_t cBasePages, uint32_t cShadowPages, uint32_t cFixedPages,1050 GMMR0DECL(int) GMMR0InitialReservation(PVM pVM, unsigned idCpu, uint64_t cBasePages, uint32_t cShadowPages, uint32_t cFixedPages, 1050 1051 GMMOCPOLICY enmPolicy, GMMPRIORITY enmPriority) 1051 1052 { … … 1059 1060 GMM_GET_VALID_INSTANCE(pGMM, VERR_INTERNAL_ERROR); 1060 1061 PGVM pGVM = GVMMR0ByVM(pVM); 1061 if ( !pGVM)1062 if (RT_UNLIKELY(!pGVM)) 1062 1063 return VERR_INVALID_PARAMETER; 1063 if ( pGVM->hEMT != RTThreadNativeSelf())1064 if (RT_UNLIKELY(pGVM->aCpus[idCpu].hEMT != RTThreadNativeSelf())) 1064 1065 return VERR_NOT_OWNER; 1065 1066 … … 1111 1112 * @returns see GMMR0InitialReservation. 1112 1113 * @param pVM Pointer to the shared VM structure. 1114 * @param idCpu VCPU id 1113 1115 * @param pReq The request packet. 1114 1116 */ 1115 GMMR0DECL(int) GMMR0InitialReservationReq(PVM pVM, PGMMINITIALRESERVATIONREQ pReq)1117 GMMR0DECL(int) GMMR0InitialReservationReq(PVM pVM, unsigned idCpu, PGMMINITIALRESERVATIONREQ pReq) 1116 1118 { 1117 1119 /* … … 1122 1124 AssertMsgReturn(pReq->Hdr.cbReq == sizeof(*pReq), ("%#x != %#x\n", pReq->Hdr.cbReq, sizeof(*pReq)), VERR_INVALID_PARAMETER); 1123 1125 1124 return GMMR0InitialReservation(pVM, pReq->cBasePages, pReq->cShadowPages, pReq->cFixedPages, pReq->enmPolicy, pReq->enmPriority);1126 return GMMR0InitialReservation(pVM, idCpu, pReq->cBasePages, pReq->cShadowPages, pReq->cFixedPages, pReq->enmPolicy, pReq->enmPriority); 1125 1127 } 1126 1128 … … 1133 1135 * 1134 1136 * @param pVM Pointer to the shared VM structure. 1137 * @param idCpu VCPU id 1135 1138 * @param cBasePages The number of pages that may be allocated for the base RAM and ROMs. 1136 1139 * This does not include MMIO2 and similar. … … 1141 1144 * @thread EMT. 1142 1145 */ 1143 GMMR0DECL(int) GMMR0UpdateReservation(PVM pVM, u int64_t cBasePages, uint32_t cShadowPages, uint32_t cFixedPages)1146 GMMR0DECL(int) GMMR0UpdateReservation(PVM pVM, unsigned idCpu, uint64_t cBasePages, uint32_t cShadowPages, uint32_t cFixedPages) 1144 1147 { 1145 1148 LogFlow(("GMMR0UpdateReservation: pVM=%p cBasePages=%#llx cShadowPages=%#x cFixedPages=%#x\n", … … 1152 1155 GMM_GET_VALID_INSTANCE(pGMM, VERR_INTERNAL_ERROR); 1153 1156 PGVM pGVM = GVMMR0ByVM(pVM); 1154 if ( !pGVM)1157 if (RT_UNLIKELY(!pGVM)) 1155 1158 return VERR_INVALID_PARAMETER; 1156 if ( pGVM->hEMT != RTThreadNativeSelf())1159 if (RT_UNLIKELY(pGVM->aCpus[idCpu].hEMT != RTThreadNativeSelf())) 1157 1160 return VERR_NOT_OWNER; 1158 1161 … … 1201 1204 * @returns see GMMR0UpdateReservation. 1202 1205 * @param pVM Pointer to the shared VM structure. 1206 * @param idCpu VCPU id 1203 1207 * @param pReq The request packet. 1204 1208 */ 1205 GMMR0DECL(int) GMMR0UpdateReservationReq(PVM pVM, PGMMUPDATERESERVATIONREQ pReq)1209 GMMR0DECL(int) GMMR0UpdateReservationReq(PVM pVM, unsigned idCpu, PGMMUPDATERESERVATIONREQ pReq) 1206 1210 { 1207 1211 /* … … 1212 1216 AssertMsgReturn(pReq->Hdr.cbReq == sizeof(*pReq), ("%#x != %#x\n", pReq->Hdr.cbReq, sizeof(*pReq)), VERR_INVALID_PARAMETER); 1213 1217 1214 return GMMR0UpdateReservation(pVM, pReq->cBasePages, pReq->cShadowPages, pReq->cFixedPages);1218 return GMMR0UpdateReservation(pVM, idCpu, pReq->cBasePages, pReq->cShadowPages, pReq->cFixedPages); 1215 1219 } 1216 1220 … … 1840 1844 * 1841 1845 * @param pVM Pointer to the shared VM structure. 1846 * @param idCpu VCPU id 1842 1847 * @param cPagesToUpdate The number of pages to update (starting from the head). 1843 1848 * @param cPagesToAlloc The number of pages to allocate (starting from the head). … … 1846 1851 * @thread EMT. 1847 1852 */ 1848 GMMR0DECL(int) GMMR0AllocateHandyPages(PVM pVM, u int32_t cPagesToUpdate, uint32_t cPagesToAlloc, PGMMPAGEDESC paPages)1853 GMMR0DECL(int) GMMR0AllocateHandyPages(PVM pVM, unsigned idCpu, uint32_t cPagesToUpdate, uint32_t cPagesToAlloc, PGMMPAGEDESC paPages) 1849 1854 { 1850 1855 LogFlow(("GMMR0AllocateHandyPages: pVM=%p cPagesToUpdate=%#x cPagesToAlloc=%#x paPages=%p\n", … … 1860 1865 if (RT_UNLIKELY(!pGVM)) 1861 1866 return VERR_INVALID_PARAMETER; 1862 if (RT_UNLIKELY(pGVM-> hEMT != RTThreadNativeSelf()))1867 if (RT_UNLIKELY(pGVM->aCpus[idCpu].hEMT != RTThreadNativeSelf())) 1863 1868 return VERR_NOT_OWNER; 1864 1869 … … 2021 2026 * 2022 2027 * @param pVM Pointer to the shared VM structure. 2028 * @param idCpu VCPU id 2023 2029 * @param cPages The number of pages to allocate. 2024 2030 * @param paPages Pointer to the page descriptors. … … 2028 2034 * @thread EMT. 2029 2035 */ 2030 GMMR0DECL(int) GMMR0AllocatePages(PVM pVM, u int32_t cPages, PGMMPAGEDESC paPages, GMMACCOUNT enmAccount)2036 GMMR0DECL(int) GMMR0AllocatePages(PVM pVM, unsigned idCpu, uint32_t cPages, PGMMPAGEDESC paPages, GMMACCOUNT enmAccount) 2031 2037 { 2032 2038 LogFlow(("GMMR0AllocatePages: pVM=%p cPages=%#x paPages=%p enmAccount=%d\n", pVM, cPages, paPages, enmAccount)); … … 2038 2044 GMM_GET_VALID_INSTANCE(pGMM, VERR_INTERNAL_ERROR); 2039 2045 PGVM pGVM = GVMMR0ByVM(pVM); 2040 if ( !pGVM)2046 if (RT_UNLIKELY(!pGVM)) 2041 2047 return VERR_INVALID_PARAMETER; 2042 if ( pGVM->hEMT != RTThreadNativeSelf())2048 if (RT_UNLIKELY(pGVM->aCpus[idCpu].hEMT != RTThreadNativeSelf())) 2043 2049 return VERR_NOT_OWNER; 2044 2050 … … 2095 2101 * @returns see GMMR0AllocatePages. 2096 2102 * @param pVM Pointer to the shared VM structure. 2103 * @param idCpu VCPU id 2097 2104 * @param pReq The request packet. 2098 2105 */ 2099 GMMR0DECL(int) GMMR0AllocatePagesReq(PVM pVM, PGMMALLOCATEPAGESREQ pReq)2106 GMMR0DECL(int) GMMR0AllocatePagesReq(PVM pVM, unsigned idCpu, PGMMALLOCATEPAGESREQ pReq) 2100 2107 { 2101 2108 /* … … 2111 2118 VERR_INVALID_PARAMETER); 2112 2119 2113 return GMMR0AllocatePages(pVM, pReq->cPages, &pReq->aPages[0], pReq->enmAccount);2120 return GMMR0AllocatePages(pVM, idCpu, pReq->cPages, &pReq->aPages[0], pReq->enmAccount); 2114 2121 } 2115 2122 … … 2359 2366 { 2360 2367 Log(("gmmR0AllocatePages: #%#x/%#x: not owner! hGVM=%#x hSelf=%#x\n", iPage, idPage, 2361 pPage->Private.hGVM, pGVM->h EMT));2368 pPage->Private.hGVM, pGVM->hSelf)); 2362 2369 rc = VERR_GMM_NOT_PAGE_OWNER; 2363 2370 break; … … 2417 2424 * 2418 2425 * @param pVM Pointer to the shared VM structure. 2426 * @param idCpu VCPU id 2419 2427 * @param cPages The number of pages to allocate. 2420 2428 * @param paPages Pointer to the page descriptors containing the Page IDs for each page. … … 2422 2430 * @thread EMT. 2423 2431 */ 2424 GMMR0DECL(int) GMMR0FreePages(PVM pVM, u int32_t cPages, PGMMFREEPAGEDESC paPages, GMMACCOUNT enmAccount)2432 GMMR0DECL(int) GMMR0FreePages(PVM pVM, unsigned idCpu, uint32_t cPages, PGMMFREEPAGEDESC paPages, GMMACCOUNT enmAccount) 2425 2433 { 2426 2434 LogFlow(("GMMR0FreePages: pVM=%p cPages=%#x paPages=%p enmAccount=%d\n", pVM, cPages, paPages, enmAccount)); … … 2432 2440 GMM_GET_VALID_INSTANCE(pGMM, VERR_INTERNAL_ERROR); 2433 2441 PGVM pGVM = GVMMR0ByVM(pVM); 2434 if ( !pGVM)2442 if (RT_UNLIKELY(!pGVM)) 2435 2443 return VERR_INVALID_PARAMETER; 2436 if ( pGVM->hEMT != RTThreadNativeSelf())2444 if (RT_UNLIKELY(pGVM->aCpus[idCpu].hEMT != RTThreadNativeSelf())) 2437 2445 return VERR_NOT_OWNER; 2438 2446 … … 2465 2473 * @returns see GMMR0FreePages. 2466 2474 * @param pVM Pointer to the shared VM structure. 2475 * @param idCpu VCPU id 2467 2476 * @param pReq The request packet. 2468 2477 */ 2469 GMMR0DECL(int) GMMR0FreePagesReq(PVM pVM, PGMMFREEPAGESREQ pReq)2478 GMMR0DECL(int) GMMR0FreePagesReq(PVM pVM, unsigned idCpu, PGMMFREEPAGESREQ pReq) 2470 2479 { 2471 2480 /* … … 2481 2490 VERR_INVALID_PARAMETER); 2482 2491 2483 return GMMR0FreePages(pVM, pReq->cPages, &pReq->aPages[0], pReq->enmAccount);2492 return GMMR0FreePages(pVM, idCpu, pReq->cPages, &pReq->aPages[0], pReq->enmAccount); 2484 2493 } 2485 2494 … … 2500 2509 * 2501 2510 * @param pVM Pointer to the shared VM structure. 2511 * @param idCpu VCPU id 2502 2512 * @param cBalloonedPages The number of pages that was ballooned. 2503 2513 * @param cPagesToFree The number of pages to be freed. … … 2508 2518 * @thread EMT. 2509 2519 */ 2510 GMMR0DECL(int) GMMR0BalloonedPages(PVM pVM, u int32_t cBalloonedPages, uint32_t cPagesToFree, PGMMFREEPAGEDESC paPages, bool fCompleted)2520 GMMR0DECL(int) GMMR0BalloonedPages(PVM pVM, unsigned idCpu, uint32_t cBalloonedPages, uint32_t cPagesToFree, PGMMFREEPAGEDESC paPages, bool fCompleted) 2511 2521 { 2512 2522 LogFlow(("GMMR0BalloonedPages: pVM=%p cBalloonedPages=%#x cPagestoFree=%#x paPages=%p enmAccount=%d fCompleted=%RTbool\n", … … 2519 2529 GMM_GET_VALID_INSTANCE(pGMM, VERR_INTERNAL_ERROR); 2520 2530 PGVM pGVM = GVMMR0ByVM(pVM); 2521 if ( !pGVM)2531 if (RT_UNLIKELY(!pGVM)) 2522 2532 return VERR_INVALID_PARAMETER; 2523 if ( pGVM->hEMT != RTThreadNativeSelf())2533 if (RT_UNLIKELY(pGVM->aCpus[idCpu].hEMT != RTThreadNativeSelf())) 2524 2534 return VERR_NOT_OWNER; 2525 2535 … … 2591 2601 * @returns see GMMR0BalloonedPages. 2592 2602 * @param pVM Pointer to the shared VM structure. 2603 * @param idCpu VCPU id 2593 2604 * @param pReq The request packet. 2594 2605 */ 2595 GMMR0DECL(int) GMMR0BalloonedPagesReq(PVM pVM, PGMMBALLOONEDPAGESREQ pReq)2606 GMMR0DECL(int) GMMR0BalloonedPagesReq(PVM pVM, unsigned idCpu, PGMMBALLOONEDPAGESREQ pReq) 2596 2607 { 2597 2608 /* … … 2607 2618 VERR_INVALID_PARAMETER); 2608 2619 2609 return GMMR0BalloonedPages(pVM, pReq->cBalloonedPages, pReq->cPagesToFree, &pReq->aPages[0], pReq->fCompleted);2620 return GMMR0BalloonedPages(pVM, idCpu, pReq->cBalloonedPages, pReq->cPagesToFree, &pReq->aPages[0], pReq->fCompleted); 2610 2621 } 2611 2622 … … 2618 2629 * 2619 2630 * @param pVM Pointer to the shared VM structure. 2631 * @param idCpu VCPU id 2620 2632 * @param cPages The number of pages that was let out of the balloon. 2621 2633 * @thread EMT. 2622 2634 */ 2623 GMMR0DECL(int) GMMR0DeflatedBalloon(PVM pVM, u int32_t cPages)2635 GMMR0DECL(int) GMMR0DeflatedBalloon(PVM pVM, unsigned idCpu, uint32_t cPages) 2624 2636 { 2625 2637 LogFlow(("GMMR0DeflatedBalloon: pVM=%p cPages=%#x\n", pVM, cPages)); … … 2631 2643 GMM_GET_VALID_INSTANCE(pGMM, VERR_INTERNAL_ERROR); 2632 2644 PGVM pGVM = GVMMR0ByVM(pVM); 2633 if ( !pGVM)2645 if (RT_UNLIKELY(!pGVM)) 2634 2646 return VERR_INVALID_PARAMETER; 2635 if ( pGVM->hEMT != RTThreadNativeSelf())2647 if (RT_UNLIKELY(pGVM->aCpus[idCpu].hEMT != RTThreadNativeSelf())) 2636 2648 return VERR_NOT_OWNER; 2637 2649 … … 2806 2818 * @returns VBox status code. 2807 2819 * @param pVM The VM. 2820 * @param idCpu VCPU id 2808 2821 * @param idChunkMap The chunk to map. NIL_GMM_CHUNKID if nothing to map. 2809 2822 * @param idChunkUnmap The chunk to unmap. NIL_GMM_CHUNKID if nothing to unmap. … … 2811 2824 * @thread EMT 2812 2825 */ 2813 GMMR0DECL(int) GMMR0MapUnmapChunk(PVM pVM, u int32_t idChunkMap, uint32_t idChunkUnmap, PRTR3PTR ppvR3)2826 GMMR0DECL(int) GMMR0MapUnmapChunk(PVM pVM, unsigned idCpu, uint32_t idChunkMap, uint32_t idChunkUnmap, PRTR3PTR ppvR3) 2814 2827 { 2815 2828 LogFlow(("GMMR0MapUnmapChunk: pVM=%p idChunkMap=%#x idChunkUnmap=%#x ppvR3=%p\n", … … 2822 2835 GMM_GET_VALID_INSTANCE(pGMM, VERR_INTERNAL_ERROR); 2823 2836 PGVM pGVM = GVMMR0ByVM(pVM); 2824 if ( !pGVM)2837 if (RT_UNLIKELY(!pGVM)) 2825 2838 return VERR_INVALID_PARAMETER; 2826 if ( pGVM->hEMT != RTThreadNativeSelf())2839 if (RT_UNLIKELY(pGVM->aCpus[idCpu].hEMT != RTThreadNativeSelf())) 2827 2840 return VERR_NOT_OWNER; 2828 2841 … … 2893 2906 * @returns see GMMR0MapUnmapChunk. 2894 2907 * @param pVM Pointer to the shared VM structure. 2908 * @param idCpu VCPU id 2895 2909 * @param pReq The request packet. 2896 2910 */ 2897 GMMR0DECL(int) GMMR0MapUnmapChunkReq(PVM pVM, PGMMMAPUNMAPCHUNKREQ pReq)2911 GMMR0DECL(int) GMMR0MapUnmapChunkReq(PVM pVM, unsigned idCpu, PGMMMAPUNMAPCHUNKREQ pReq) 2898 2912 { 2899 2913 /* … … 2904 2918 AssertMsgReturn(pReq->Hdr.cbReq == sizeof(*pReq), ("%#x != %#x\n", pReq->Hdr.cbReq, sizeof(*pReq)), VERR_INVALID_PARAMETER); 2905 2919 2906 return GMMR0MapUnmapChunk(pVM, pReq->idChunkMap, pReq->idChunkUnmap, &pReq->pvR3);2920 return GMMR0MapUnmapChunk(pVM, idCpu, pReq->idChunkMap, pReq->idChunkUnmap, &pReq->pvR3); 2907 2921 } 2908 2922 … … 2916 2930 * @returns VBox status code. 2917 2931 * @param pVM The VM. 2932 * @param idCpu VCPU id 2918 2933 * @param pvR3 Pointer to the chunk size memory block to lock down. 2919 2934 */ 2920 GMMR0DECL(int) GMMR0SeedChunk(PVM pVM, RTR3PTR pvR3)2935 GMMR0DECL(int) GMMR0SeedChunk(PVM pVM, unsigned idCpu, RTR3PTR pvR3) 2921 2936 { 2922 2937 /* … … 2926 2941 GMM_GET_VALID_INSTANCE(pGMM, VERR_INTERNAL_ERROR); 2927 2942 PGVM pGVM = GVMMR0ByVM(pVM); 2928 if ( !pGVM)2943 if (RT_UNLIKELY(!pGVM)) 2929 2944 return VERR_INVALID_PARAMETER; 2930 if ( pGVM->hEMT != RTThreadNativeSelf())2945 if (RT_UNLIKELY(pGVM->aCpus[idCpu].hEMT != RTThreadNativeSelf())) 2931 2946 return VERR_NOT_OWNER; 2932 2947
Note:
See TracChangeset
for help on using the changeset viewer.