use rt_malloc_page api in module.c

git-svn-id: https://rt-thread.googlecode.com/svn/trunk@1189 bbd45198-f89e-11dd-88c7-29a3b14d5316
This commit is contained in:
qiuyiuestc 2010-12-10 00:20:30 +00:00
parent 43448c696d
commit 0ee9b3d922
2 changed files with 6 additions and 7 deletions

View File

@ -186,10 +186,6 @@ void rt_malloc_sethook(void (*hook)(void *ptr, rt_uint32_t size));
void rt_free_sethook(void (*hook)(void *ptr));
#endif
#ifdef RT_USING_SLAB
void *rt_page_alloc(rt_size_t npages);
void rt_page_free(void *addr, rt_size_t npages);
#endif
#endif
/*@}*/

View File

@ -52,6 +52,9 @@ struct rt_mem_head
struct rt_mem_head *next; /* next valid memory block */
};
extern void *rt_malloc_page(rt_size_t npages);
extern void rt_free_page(void *page_ptr, rt_size_t npages);
static rt_module_t rt_current_module = RT_NULL;
rt_list_t rt_module_symbol_list;
struct rt_module_symtab *_rt_module_symtab_begin = RT_NULL, *_rt_module_symtab_end = RT_NULL;
@ -676,7 +679,7 @@ rt_err_t rt_module_unload(rt_module_t module)
/* free page */
page = rt_list_entry(list->next, struct rt_module_page, list);
rt_page_free(page->ptr, page->npage);
rt_free_page(page->ptr, page->npage);
rt_list_remove(list->next);
}
@ -743,7 +746,7 @@ static struct rt_mem_head *morepage(rt_size_t nu)
/* allocate pages from system heap */
npage = (nu * sizeof(struct rt_mem_head) + RT_MM_PAGE_SIZE - 1)/RT_MM_PAGE_SIZE;
cp = rt_page_alloc(npage);
cp = rt_malloc_page(npage);
if(!cp) return RT_NULL;
/* allocate page list node from mpool */
@ -785,7 +788,7 @@ void *rt_module_malloc(rt_size_t size)
rt_uint32_t npage = size / RT_MM_PAGE_SIZE;
/* allocate pages from system heap */
cp = rt_page_alloc(npage);
cp = rt_malloc_page(npage);
if(!cp) return RT_NULL;
/* allocate page list node from mpool */