Changeset 20862 in vbox for trunk/src/VBox/HostDrivers
- Timestamp:
- Jun 23, 2009 6:25:31 PM (16 years ago)
- svn:sync-xref-src-repo-rev:
- 49006
- Location:
- trunk/src/VBox/HostDrivers/Support
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostDrivers/Support/SUPLib.cpp
r20861 r20862 865 865 866 866 867 SUPR3DECL(int) SUPPageLock(void *pvStart, size_t cPages, PSUPPAGE paPages) 867 /** 868 * Locks down the physical memory backing a virtual memory 869 * range in the current process. 870 * 871 * @returns VBox status code. 872 * @param pvStart Start of virtual memory range. 873 * Must be page aligned. 874 * @param cPages Number of pages. 875 * @param paPages Where to store the physical page addresses returned. 876 * On entry this will point to an array of with cbMemory >> PAGE_SHIFT entries. 877 */ 878 int supR3PageLock(void *pvStart, size_t cPages, PSUPPAGE paPages) 868 879 { 869 880 /* … … 920 931 921 932 922 SUPR3DECL(int) SUPPageUnlock(void *pvStart) 933 /** 934 * Releases locked down pages. 935 * 936 * @returns VBox status code. 937 * @param pvStart Start of virtual memory range previously locked 938 * down by SUPPageLock(). 939 */ 940 int supR3PageUnlock(void *pvStart) 923 941 { 924 942 /* … … 974 992 { 975 993 /* fallback */ 976 rc = SUPPageUnlock(pvPages);994 rc = supR3PageUnlock(pvPages); 977 995 if (RT_SUCCESS(rc)) 978 996 rc = suplibOsPageFree(&g_supLibData, pvPages, cPages); … … 992 1010 if (!paPages) 993 1011 paPages = (PSUPPAGE)alloca(sizeof(paPages[0]) * cPages); 994 rc = SUPPageLock(*ppvPages, cPages, paPages);1012 rc = supR3PageLock(*ppvPages, cPages, paPages); 995 1013 if (RT_FAILURE(rc)) 996 1014 suplibOsPageFree(&g_supLibData, *ppvPages, cPages); … … 1207 1225 && !g_fSupportsPageAllocNoKernel) 1208 1226 { 1209 int rc2 = SUPPageUnlock(pvPages);1227 int rc2 = supR3PageUnlock(pvPages); 1210 1228 if (RT_SUCCESS(rc2)) 1211 1229 rc = suplibOsPageFree(&g_supLibData, pvPages, cPages); -
trunk/src/VBox/HostDrivers/Support/SUPLibInternal.h
r20374 r20862 315 315 316 316 317 int supR3PageLock(void *pvStart, size_t cPages, PSUPPAGE paPages); 318 int supR3PageUnlock(void *pvStart); 319 317 320 RT_C_DECLS_END 318 321 -
trunk/src/VBox/HostDrivers/Support/testcase/tstPin.cpp
r14831 r20862 42 42 #include <iprt/string.h> 43 43 44 #include "../SUPLibInternal.h" 45 44 46 45 47 int main(int argc, char **argv) … … 63 65 RTPrintf("pv=%p\n", pv); 64 66 SUPPAGE aPages[1]; 65 rc = SUPPageLock(pv, 1, &aPages[0]);67 rc = supR3PageLock(pv, 1, &aPages[0]); 66 68 RTPrintf("rc=%d aPages[0]=%RHp\n", rc, pv, aPages[0]); 67 69 RTThreadSleep(1500); … … 88 90 SUPPageAlloc(0x10000 >> PAGE_SHIFT, &aPinnings[i].pv); 89 91 aPinnings[i].pvAligned = RT_ALIGN_P(aPinnings[i].pv, PAGE_SIZE); 90 rc = SUPPageLock(aPinnings[i].pvAligned, 0xf000 >> PAGE_SHIFT, &aPinnings[i].aPages[0]);92 rc = supR3PageLock(aPinnings[i].pvAligned, 0xf000 >> PAGE_SHIFT, &aPinnings[i].aPages[0]); 91 93 if (!rc) 92 94 { … … 116 118 if (aPinnings[i].pvAligned) 117 119 { 118 rc = SUPPageUnlock(aPinnings[i].pvAligned);120 rc = supR3PageUnlock(aPinnings[i].pvAligned); 119 121 if (rc) 120 122 { … … 177 179 static SUPPAGE aPages[BIG_SIZE >> PAGE_SHIFT]; 178 180 void *pvAligned = RT_ALIGN_P(pv, PAGE_SIZE); 179 rc = SUPPageLock(pvAligned, BIG_SIZE >> PAGE_SHIFT, &aPages[0]);181 rc = supR3PageLock(pvAligned, BIG_SIZE >> PAGE_SHIFT, &aPages[0]); 180 182 if (!rc) 181 183 { … … 189 191 190 192 /* unlock */ 191 rc = SUPPageUnlock(pvAligned);193 rc = supR3PageUnlock(pvAligned); 192 194 if (rc) 193 195 {
Note:
See TracChangeset
for help on using the changeset viewer.