Skip to content

Commit ba5c1be

Browse files
committed
[dlmodule] Add cache ops in dlmodule.
1 parent f0ab006 commit ba5c1be

File tree

3 files changed

+16
-7
lines changed

3 files changed

+16
-7
lines changed

components/finsh/msh.c

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -376,25 +376,27 @@ int msh_exec(char *cmd, rt_size_t length)
376376
{
377377
return cmd_ret;
378378
}
379-
#if defined(RT_USING_MODULE) && defined(RT_USING_DFS)
380-
if (msh_exec_module(cmd, length) == 0)
379+
#ifdef RT_USING_DFS
380+
#ifdef DFS_USING_WORKDIR
381+
if (msh_exec_script(cmd, length) == 0)
381382
{
382383
return 0;
383384
}
384385
#endif
385386

386-
#if defined(RT_USING_DFS) && defined(DFS_USING_WORKDIR)
387-
if (msh_exec_script(cmd, length) == 0)
387+
#ifdef RT_USING_MODULE
388+
if (msh_exec_module(cmd, length) == 0)
388389
{
389390
return 0;
390391
}
391392
#endif
392393

393-
#if defined(RT_USING_LWP) && defined(RT_USING_DFS)
394+
#ifdef RT_USING_LWP
394395
if (_msh_exec_lwp(cmd, length) == 0)
395396
{
396397
return 0;
397398
}
399+
#endif
398400
#endif
399401

400402
/* truncate the cmd at the first space. */
@@ -449,8 +451,8 @@ void msh_auto_complete_path(char *path)
449451
ptr = path;
450452
for (;;)
451453
{
452-
if (*ptr == '/') index = ptr + 1;
453-
if (!*ptr) break;
454+
if (*ptr == '/') index = ptr + 1;
455+
if (!*ptr) break;
454456

455457
ptr ++;
456458
}

components/libc/libdl/dlelf.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,7 @@ rt_err_t dlmodule_load_relocated_object(struct rt_dlmodule* module, void *module
277277
rt_kprintf("Module: allocate space failed.\n");
278278
return -RT_ERROR;
279279
}
280+
module->mem_size = module_size;
280281

281282
/* zero all space */
282283
ptr = module->mem_space;

components/libc/libdl/dlmodule.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -491,6 +491,12 @@ struct rt_dlmodule* dlmodule_load(const char* filename)
491491
/* increase module reference count */
492492
module->nref ++;
493493

494+
/* deal with cache */
495+
#ifdef RT_USING_CACHE
496+
rt_hw_cpu_dcache_ops(RT_HW_CACHE_FLUSH, module->mem_space, module->mem_size);
497+
rt_hw_cpu_icache_ops(RT_HW_CACHE_INVALIDATE, module->mem_space, module->mem_size);
498+
#endif
499+
494500
/* set module initialization and cleanup function */
495501
module->init_func = dlsym(module, "module_init");
496502
module->cleanup_func = dlsym(module, "module_cleanup");

0 commit comments

Comments
 (0)