summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorqiuyiuestc <[email protected]>2010-12-10 00:20:30 +0000
committerqiuyiuestc <[email protected]>2010-12-10 00:20:30 +0000
commit0ee9b3d9224fff35a7735f0d9ea3eb20e33f3c2b (patch)
tree36df871ae3f13cf3185d3b5149cc8b5f0e7eb53f
parent43448c696d16545407e726946e4a0405d01bf3bd (diff)
use rt_malloc_page api in module.c
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@1189 bbd45198-f89e-11dd-88c7-29a3b14d5316
-rw-r--r--include/rtthread.h4
-rw-r--r--src/module.c9
2 files changed, 6 insertions, 7 deletions
diff --git a/include/rtthread.h b/include/rtthread.h
index 933df95453..76e85b2006 100644
--- a/include/rtthread.h
+++ b/include/rtthread.h
@@ -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
/*@}*/
diff --git a/src/module.c b/src/module.c
index 592647a306..16a3a21d76 100644
--- a/src/module.c
+++ b/src/module.c
@@ -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 */