summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorqiuyiuestc <[email protected]>2011-01-05 00:40:46 +0000
committerqiuyiuestc <[email protected]>2011-01-05 00:40:46 +0000
commitba507951956707c8a46b75df06070980551888a8 (patch)
treecb15b565a6307bf9bba997f732716e0458d4815c
parentaa1a78082fe0f50eb8eca7462808ba722b2f62d6 (diff)
update module
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@1233 bbd45198-f89e-11dd-88c7-29a3b14d5316
-rw-r--r--src/module.c24
1 files changed, 7 insertions, 17 deletions
diff --git a/src/module.c b/src/module.c
index 8856bca367..b85b0f2b4b 100644
--- a/src/module.c
+++ b/src/module.c
@@ -381,7 +381,7 @@ rt_module_t rt_module_load(const rt_uint8_t* name, void* module_ptr)
if (rt_strcmp(shstrab + shdr[index].sh_name, ELF_DYNSYM) == 0) break;
}
- /* found .dynsyn section */
+ /* found .dynsym section */
if(index != elf_module->e_shnum)
{
int i, count = 0;
@@ -413,19 +413,6 @@ rt_module_t rt_module_load(const rt_uint8_t* name, void* module_ptr)
}
}
}
-
-#if 0
- /* construct module symbol table */
- for (index = 0; index < elf_module->e_shnum; index ++)
- {
- rt_uint8_t* shstrab = (rt_uint8_t*) module_ptr + shdr[elf_module->e_shstrndx].sh_offset;
- if (rt_strcmp(shstrab + shdr[index].sh_name, ELF_RTMSYMTAB) == 0)
- {
- module->symtab = (struct rt_module_symtab *)(module->module_space + shdr[index].sh_addr);
- module->nsym = shdr[index].sh_size / sizeof(struct rt_module_symtab);
- }
- }
-#endif
/* init module object container */
rt_module_init_object_container(module);
@@ -442,7 +429,7 @@ rt_module_t rt_module_load(const rt_uint8_t* name, void* module_ptr)
module->mem_list = RT_NULL;
/* create mpool for page node */
- module->mpool = rt_mp_create(name, 1024, sizeof(struct rt_module_page));
+ module->mpool = rt_mp_create(name, 256, sizeof(struct rt_module_page));
/* create module thread */
module->stack_size = 2048;
@@ -482,7 +469,10 @@ rt_module_t rt_module_open(const char* filename)
struct rt_module* module;
struct stat s;
char *buffer, *offset_ptr;;
-
+
+ /* check parameters */
+ RT_ASSERT(filename != RT_NULL);
+
if (stat(filename, &s) !=0)
{
rt_kprintf("access file failed\n");
@@ -744,7 +734,7 @@ rt_err_t rt_module_unload(rt_module_t module)
/* release module symbol table */
for(i=0; i<module->nsym; i++) rt_free(module->symtab[i].name);
if(module->symtab != RT_NULL) rt_free(module->symtab);
-
+
/* delete module object */
rt_object_delete((rt_object_t)module);