本文整理匯總了C++中ClearPageReserved函數的典型用法代碼示例。如果您正苦於以下問題:C++ ClearPageReserved函數的具體用法?C++ ClearPageReserved怎麽用?C++ ClearPageReserved使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了ClearPageReserved函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: vperfctr_free
static void vperfctr_free(struct vperfctr *perfctr)
{
debug_free(perfctr);
ClearPageReserved(virt_to_page(perfctr));
free_page((unsigned long)perfctr);
dec_nrctrs();
}
示例2: rtR0MemObjLinuxFreePages
/**
* Frees the physical pages allocated by the rtR0MemObjLinuxAllocPages() call.
*
* This method does NOT free the object.
*
* @param pMemLnx The object which physical pages should be freed.
*/
static void rtR0MemObjLinuxFreePages(PRTR0MEMOBJLNX pMemLnx)
{
size_t iPage = pMemLnx->cPages;
if (iPage > 0)
{
/*
* Restore the page flags.
*/
while (iPage-- > 0)
{
ClearPageReserved(pMemLnx->apPages[iPage]);
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 4, 22)
#else
MY_SET_PAGES_NOEXEC(pMemLnx->apPages[iPage], 1);
#endif
}
/*
* Free the pages.
*/
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 4, 22)
if (!pMemLnx->fContiguous)
{
iPage = pMemLnx->cPages;
while (iPage-- > 0)
__free_page(pMemLnx->apPages[iPage]);
}
else
#endif
__free_pages(pMemLnx->apPages[0], rtR0MemObjLinuxOrder(pMemLnx->cPages));
pMemLnx->cPages = 0;
}
}
示例3: uninorth_free_gatt_table
static int uninorth_free_gatt_table(void)
{
int page_order;
char *table, *table_end;
void *temp;
struct page *page;
temp = agp_bridge->current_size;
page_order = A_SIZE_32(temp)->page_order;
/* Do not worry about freeing memory, because if this is
* called, then all agp memory is deallocated and removed
* from the table.
*/
table = (char *) agp_bridge->gatt_table_real;
table_end = table + ((PAGE_SIZE * (1 << page_order)) - 1);
for (page = virt_to_page(table); page <= virt_to_page(table_end); page++)
ClearPageReserved(page);
free_pages((unsigned long) agp_bridge->gatt_table_real, page_order);
return 0;
}
示例4: set_highmem_pages_init
void __init set_highmem_pages_init(void)
{
struct zone *zone;
int nid;
for_each_zone(zone) {
unsigned long zone_start_pfn, zone_end_pfn;
if (!is_highmem(zone))
continue;
zone_start_pfn = zone->zone_start_pfn;
zone_end_pfn = zone_start_pfn + zone->spanned_pages;
nid = zone_to_nid(zone);
printk(KERN_INFO "Initializing %s for node %d (%08lx:%08lx)\n",
zone->name, nid, zone_start_pfn, zone_end_pfn);
add_highpages_with_active_regions(nid, zone_start_pfn,
zone_end_pfn);
/* XEN: init high-mem pages outside initial allocation. */
if (zone_start_pfn < xen_start_info->nr_pages)
zone_start_pfn = xen_start_info->nr_pages;
for (; zone_start_pfn < zone_end_pfn; zone_start_pfn++) {
ClearPageReserved(pfn_to_page(zone_start_pfn));
init_page_count(pfn_to_page(zone_start_pfn));
}
}
totalram_pages += totalhigh_pages;
}
示例5: prom_free_prom_memory
void __init prom_free_prom_memory (void)
{
unsigned long addr, end;
/*
* Free everything below the kernel itself but leave
* the first page reserved for the exception handlers.
*/
#if defined(CONFIG_DECLANCE) || defined(CONFIG_DECLANCE_MODULE)
/*
* Leave 128 KB reserved for Lance memory for
* IOASIC DECstations.
*
* XXX: save this address for use in dec_lance.c?
*/
if (IOASIC)
end = __pa(&_text) - 0x00020000;
else
#endif
end = __pa(&_text);
addr = PAGE_SIZE;
while (addr < end) {
ClearPageReserved(virt_to_page(__va(addr)));
set_page_count(virt_to_page(__va(addr)), 1);
free_page((unsigned long)__va(addr));
addr += PAGE_SIZE;
}
printk("Freeing unused PROM memory: %ldk freed\n",
(end - PAGE_SIZE) >> 10);
}
示例6: exemple_init
static int __init exemple_init (void)
{
int err;
struct page * pg = NULL;
exemple_buffer = kmalloc(PAGE_SIZE, GFP_KERNEL);
if (exemple_buffer == NULL)
return -ENOMEM;
exemple_buffer[0] = '\0';
pg = virt_to_page(exemple_buffer);
SetPageReserved(pg);
err = misc_register(& exemple_misc_driver);
if (err != 0) {
ClearPageReserved(pg);
kfree(exemple_buffer);
exemple_buffer = NULL;
return err;
}
#if LINUX_VERSION_CODE < KERNEL_VERSION(4,15,0)
init_timer (& exemple_timer);
exemple_timer.function = exemple_timer_function;
#else
timer_setup (& exemple_timer, exemple_timer_function, 0);
#endif
exemple_timer.expires = jiffies + HZ;
add_timer(& exemple_timer);
return 0;
}
示例7: device_release
static int device_release(struct inode *inode, struct file *filp){
struct mmap_info *info=NULL;
struct page *page=NULL;
unsigned i=0;
unsigned num_pages=0;
pr_info("device_release: %d.%d\n", MAJOR (inode->i_rdev), MINOR (inode->i_rdev));
IS_DONE_FLAG = 1;
// Free RX buffer pointer queues
info = filp->private_data;
if (info->data ) {
printk("[GNoM_km] on release: (%d) <%p>\n", info->reference_cnt, info->data);
num_pages = (1<<K_PAGE_ORDER);
for(i=0; i<num_pages; ++i){ // Unpin all of the the allocated pages
page = virt_to_page((size_t)info->data + (i*CPU_PAGE_SIZE));
if(PageReserved(page)){
ClearPageReserved(page);
}
}
free_pages((unsigned long)info->data, K_PAGE_ORDER); // Free 2^K_PAGE_ORDER pages
kfree(info);
filp->private_data = NULL;
}
printk("[GNoM_km]: %u mmaped Pages succesfully released\n", i);
return 0;
}
示例8: spu_free_lscsa
void spu_free_lscsa(struct spu_state *csa)
{
unsigned char *p;
int i;
if (!csa->use_big_pages) {
spu_free_lscsa_std(csa);
return;
}
csa->use_big_pages = 0;
if (csa->lscsa == NULL)
goto free_pages;
for (p = csa->lscsa->ls; p < csa->lscsa->ls + LS_SIZE; p += PAGE_SIZE)
ClearPageReserved(vmalloc_to_page(p));
vunmap(csa->lscsa);
csa->lscsa = NULL;
free_pages:
for (i = 0; i < SPU_LSCSA_NUM_BIG_PAGES; i++)
if (csa->lscsa_pages[i])
__free_pages(csa->lscsa_pages[i], SPU_64K_PAGE_ORDER);
}
示例9: ati_free_page_map
static void ati_free_page_map(ati_page_map *page_map)
{
unmap_page_from_agp(virt_to_page(page_map->real));
iounmap(page_map->remapped);
ClearPageReserved(virt_to_page(page_map->real));
free_page((unsigned long) page_map->real);
}
示例10: omap24xxcam_vbq_free_mmap_buffer
/*
* Free the memory-mapped buffer memory allocated for a
* videobuf_buffer and the associated scatterlist.
*/
static void omap24xxcam_vbq_free_mmap_buffer(struct videobuf_buffer *vb)
{
struct videobuf_dmabuf *dma = videobuf_to_dma(vb);
size_t alloc_size;
struct page *page;
int i;
if (dma->sglist == NULL)
return;
i = dma->sglen;
while (i) {
i--;
alloc_size = sg_dma_len(&dma->sglist[i]);
page = sg_page(&dma->sglist[i]);
do {
ClearPageReserved(page++);
} while (alloc_size -= PAGE_SIZE);
__free_pages(sg_page(&dma->sglist[i]),
get_order(sg_dma_len(&dma->sglist[i])));
}
kfree(dma->sglist);
dma->sglist = NULL;
}
示例11: dev_nvram_exit
static void
dev_nvram_exit(void)
{
int order = 0;
struct page *page, *end;
if (nvram_class) {
class_device_destroy(nvram_class, MKDEV(nvram_major, 0));
class_destroy(nvram_class);
}
if (nvram_major >= 0)
unregister_chrdev(nvram_major, "nvram");
if (nvram_mtd)
put_mtd_device(nvram_mtd);
while ((PAGE_SIZE << order) < nvram_space)
order++;
end = virt_to_page(nvram_buf + (PAGE_SIZE << order) - 1);
for (page = virt_to_page(nvram_buf); page <= end; page++)
ClearPageReserved(page);
_nvram_exit();
}
示例12: RTR0DECL
/**
* Frees memory allocated using RTMemContAlloc().
*
* @param pv Pointer to return from RTMemContAlloc().
* @param cb The cb parameter passed to RTMemContAlloc().
*/
RTR0DECL(void) RTMemContFree(void *pv, size_t cb)
{
if (pv)
{
int cOrder;
unsigned cPages;
unsigned iPage;
struct page *paPages;
/* validate */
AssertMsg(!((uintptr_t)pv & PAGE_OFFSET_MASK), ("pv=%p\n", pv));
Assert(cb > 0);
/* calc order and get pages */
cb = RT_ALIGN_Z(cb, PAGE_SIZE);
cPages = cb >> PAGE_SHIFT;
cOrder = CalcPowerOf2Order(cPages);
paPages = virt_to_page(pv);
/*
* Restore page attributes freeing the pages.
*/
for (iPage = 0; iPage < cPages; iPage++)
{
ClearPageReserved(&paPages[iPage]);
#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 4, 20) /** @todo find the exact kernel where change_page_attr was introduced. */
MY_SET_PAGES_NOEXEC(&paPages[iPage], 1);
#endif
}
__free_pages(paPages, cOrder);
}
}
示例13: amd_create_page_map
static int amd_create_page_map(struct amd_page_map *page_map)
{
int i;
page_map->real = (unsigned long *) __get_free_page(GFP_KERNEL);
if (page_map->real == NULL)
return -ENOMEM;
#ifndef CONFIG_X86
SetPageReserved(virt_to_page(page_map->real));
global_cache_flush();
page_map->remapped = ioremap_nocache(virt_to_gart(page_map->real),
PAGE_SIZE);
if (page_map->remapped == NULL) {
ClearPageReserved(virt_to_page(page_map->real));
free_page((unsigned long) page_map->real);
page_map->real = NULL;
return -ENOMEM;
}
global_cache_flush();
#else
set_memory_uc((unsigned long)page_map->real, 1);
page_map->remapped = page_map->real;
#endif
for (i = 0; i < PAGE_SIZE / sizeof(unsigned long); i++) {
writel(agp_bridge->scratch_page, page_map->remapped+i);
readl(page_map->remapped+i); /* PCI Posting. */
}
return 0;
}
示例14: Device1Exit
static void Device1Exit(void)
{
int i;
UWORD *pTemp = (UWORD*)pUsbSpeed;
dUsbExit();
pUsbSpeed = &UsbSpeedDefault;
for (i = 0; i < NPAGES * PAGE_SIZE; i+= PAGE_SIZE)
{
ClearPageReserved(virt_to_page(((unsigned long)pTemp) + i));
//#define DEBUG
#undef DEBUG
#ifdef DEBUG
printk(" %s memory page %d unmapped\n",DEVICE1_NAME,i);
#endif
}
kfree(kmalloc_ptr);
misc_deregister(&Device1);
//#define DEBUG
#undef DEBUG
#ifdef DEBUG
printk(" %s device unregistered\n",DEVICE1_NAME);
#endif
}
示例15: dev_nvram_exit
static void
dev_nvram_exit(void)
{
int order = 0;
struct page *page, *end;
if (nvram_class) {
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 36)
class_device_destroy(nvram_class, MKDEV(nvram_major, 0));
#else /* 2.6.36 and up */
device_destroy(nvram_class, MKDEV(nvram_major, 0));
#endif
class_destroy(nvram_class);
}
if (nvram_major >= 0)
unregister_chrdev(nvram_major, "nvram");
if (nvram_mtd)
put_mtd_device(nvram_mtd);
while ((PAGE_SIZE << order) < MAX_NVRAM_SPACE)
order++;
end = virt_to_page(nvram_buf + (PAGE_SIZE << order) - 1);
for (page = virt_to_page(nvram_buf); page <= end; page++)
ClearPageReserved(page);
_nvram_exit();
}