Changeset 4765 in vbox
- Timestamp:
- Sep 13, 2007 10:09:04 AM (18 years ago)
- svn:sync-xref-src-repo-rev:
- 24450
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/sup.h
r4755 r4765 369 369 370 370 /** 371 * Allocate zero-filled locked pages. 372 * 373 * Use this to allocate a number of pages rather than using RTMem*() and mess with 374 * alignment. The returned address is of course page aligned. Call SUPPageFreeLocked() 375 * to free the pages once done with them. 376 * 377 * @returns VBox status. 378 * @param cPages Number of pages to allocate. 379 * @param ppvPages Where to store the base pointer to the allocated pages. 380 */ 381 SUPR3DECL(int) SUPPageAllocLocked(size_t cPages, void **ppvPages); 382 383 /** 384 * Frees locked pages allocated with SUPPageAllocLocked(). 385 * 386 * @returns VBox status. 387 * @param pvPages Pointer returned by SUPPageAlloc(). 388 * @param cPages Number of pages that was allocated. 389 */ 390 SUPR3DECL(int) SUPPageFreeLocked(void *pvPages, size_t cPages); 391 392 /** 371 393 * Locks down the physical memory backing a virtual memory 372 394 * range in the current process. -
trunk/src/VBox/HostDrivers/Support/SUPLib.cpp
r4755 r4765 784 784 return suplibOsPageFree(pvPages, cPages); 785 785 #endif 786 } 787 788 SUPR3DECL(int) SUPPageAllocLocked(size_t cPages, void **ppvPages) 789 { 790 /* 791 * Validate. 792 */ 793 if (cPages == 0) 794 { 795 AssertMsgFailed(("Invalid param cPages=0, must be > 0\n")); 796 return VERR_INVALID_PARAMETER; 797 } 798 AssertPtr(ppvPages); 799 if (!ppvPages) 800 return VERR_INVALID_PARAMETER; 801 *ppvPages = NULL; 802 803 SUPALLOCPAGE_IN In; 804 SUPALLOCPAGE_OUT Out; 805 806 In.u32Cookie = g_u32Cookie; 807 In.u32SessionCookie = g_u32SessionCookie; 808 In.cPages = cPages; 809 Out.u32Cookie = g_u32Cookie; 810 int rc = suplibOsIOCtl(SUP_IOCTL_PAGE_ALLOC, &In, sizeof(In), &Out, sizeof(Out)); 811 if (VBOX_SUCCESS(rc)) 812 *ppvPages = Out.pvR3; 813 814 return rc; 815 } 816 817 SUPR3DECL(int) SUPPageFreeLocked(void *pvPages, size_t cPages) 818 { 819 /* 820 * Validate. 821 */ 822 AssertPtr(pvPages); 823 if (!pvPages) 824 return VINF_SUCCESS; 825 826 SUPFREEPAGE_IN In; 827 828 In.u32Cookie = g_u32Cookie; 829 In.u32SessionCookie = g_u32SessionCookie; 830 In.pvR3 = pvPages; 831 return suplibOsIOCtl(SUP_IOCTL_PAGE_FREE, &In, sizeof(In), NULL, 0); 786 832 } 787 833
Note:
See TracChangeset
for help on using the changeset viewer.