| 169 | } |
| 170 | |
| 171 | int rmodule_load(void *base, struct rmodule *module) |
| 172 | { |
| 173 | /* |
| 174 | * In order to load the module at a given address, the following steps |
| 175 | * take place: |
| 176 | * 1. Copy payload to base address. |
| 177 | * 2. Adjust relocations within the module to new base address. |
| 178 | * 3. Clear the bss segment last since the relocations live where |
| 179 | * the bss is. If an rmodule is being loaded from its load |
| 180 | * address the relocations need to be processed before the bss. |
| 181 | */ |
| 182 | module->location = base; |
| 183 | rmodule_copy_payload(module); |
| 184 | if (rmodule_relocate(module)) |
| 185 | return -1; |
| 186 | rmodule_clear_bss(module); |
| 187 | |
| 188 | prog_segment_loaded((uintptr_t)module->location, |
| 189 | rmodule_memory_size(module), SEG_FINAL); |
| 190 | |
| 191 | return 0; |
| 192 | } |
| 193 | |
| 194 | static void *rmodule_cbfs_allocator(void *rsl_arg, size_t unused, |
| 195 | const union cbfs_mdata *mdata) |
no test coverage detected