Use AoS for modules instead of SoA
This commit is contained in:
@@ -4,11 +4,12 @@
|
||||
#include "memory.h"
|
||||
#include "moduler/elf.h"
|
||||
#include "types.h"
|
||||
#include <libelf.h>
|
||||
|
||||
HiloadResult moduler_reload(ModuleInfos *modinfos,
|
||||
const struct sc_array_memreg *const memregs,
|
||||
int modindex) {
|
||||
const char *modname = sc_array_at(&modinfos->names, modindex);
|
||||
HiloadResult moduler_reload(HiModuleData *module,
|
||||
const struct sc_array_memreg *const memregs) {
|
||||
|
||||
const char *modname = module->name;
|
||||
MemoryRegionSpan memspan = memory_get_module_span(memregs, modname);
|
||||
log_debugv("Module: %s - [%p, %p]\n", modname, memspan.region_start,
|
||||
memspan.region_end);
|
||||
@@ -18,9 +19,10 @@ HiloadResult moduler_reload(ModuleInfos *modinfos,
|
||||
int err = elf_errno();
|
||||
if (err) {
|
||||
log_error("%s\n", elf_errmsg(err));
|
||||
return HILOAD_FAIL;
|
||||
}
|
||||
|
||||
void *module_address = (void *)sc_array_at(&modinfos->addresses, modindex);
|
||||
void *module_address = (void *)module->address;
|
||||
|
||||
size_t phdrnum = 0;
|
||||
err = elf_getphdrnum(elf, &phdrnum);
|
||||
@@ -76,7 +78,7 @@ HiloadResult moduler_reload(ModuleInfos *modinfos,
|
||||
}
|
||||
++dyn;
|
||||
}
|
||||
printf("strtab: %p\n"
|
||||
log_debugv("\nstrtab: %p\n"
|
||||
"symtab: %p\n"
|
||||
"strsz: %zu\n"
|
||||
"syment: %zu\n"
|
||||
@@ -94,6 +96,6 @@ HiloadResult moduler_reload(ModuleInfos *modinfos,
|
||||
|
||||
}
|
||||
|
||||
modinfos->state[modindex] = HI_MODULE_STATE_CLEAN;
|
||||
module->state = HI_MODULE_STATE_CLEAN;
|
||||
return HILOAD_OK;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user