--- zzzz-none-000/linux-2.6.32.60/mm/vmalloc.c 2012-10-07 21:41:24.000000000 +0000 +++ ur8-7270-606/linux-2.6.32.60/mm/vmalloc.c 2013-02-12 10:41:53.000000000 +0000 @@ -1182,6 +1182,7 @@ vunmap_page_range(addr, end); flush_tlb_kernel_range(addr, end); } +EXPORT_SYMBOL_GPL(unmap_kernel_range); int map_vm_area(struct vm_struct *area, pgprot_t prot, struct page ***pages) { @@ -1320,6 +1321,7 @@ return __get_vm_area_node(size, 1, flags, VMALLOC_START, VMALLOC_END, -1, GFP_KERNEL, __builtin_return_address(0)); } +EXPORT_SYMBOL_GPL(get_vm_area); struct vm_struct *get_vm_area_caller(unsigned long size, unsigned long flags, void *caller) @@ -2032,6 +2034,34 @@ } EXPORT_SYMBOL(remap_vmalloc_range); +/*------------------------------------------------------------------------------------------*\ +\*------------------------------------------------------------------------------------------*/ +int get_vmalloc_pages(char *addr, unsigned int* segm_table) { + struct vm_struct *vm = NULL; + int i; + unsigned int ad = 0; + + read_lock(&vmlist_lock); + vm = find_vm_area(addr); + if (!vm) { + /*--- printk(KERN_ERR "{%s} no vm found\n", __func__); ---*/ + read_unlock(&vmlist_lock); + return -EINVAL; + } + + /*--- printk("[%s] addr=%#x is mapped on %d pages \n", __FUNCTION__, (unsigned int)addr, vm->nr_pages); ---*/ + for ( i = 0; i < vm->nr_pages; i++ ){ + struct page *p = vm->pages[i]; + ad = (unsigned int)page_address(p); + *segm_table++ = ad; + } + read_unlock(&vmlist_lock); + + return 0; +} + +EXPORT_SYMBOL(get_vmalloc_pages); + /* * Implement a stub for vmalloc_sync_all() if the architecture chose not to * have one.