1 #ifndef __RAM_SEGMENTS_C__1POIF5E8U4__
2 #define __RAM_SEGMENTS_C__1POIF5E8U4__
5 #include <loader/codeprop-otf.h>
23 unsigned int type,
int size)
25 struct ram_output *
const ram = (
struct ram_output *)output;
26 void *block = malloc(size);
27 if (!block)
return NULL;
29 case ELFLOADER_SEG_TEXT:
30 if (ram->text) free(ram->text);
33 case ELFLOADER_SEG_RODATA:
34 if (ram->rodata) free(ram->rodata);
37 case ELFLOADER_SEG_DATA:
38 if (ram->data) free(ram->data);
41 case ELFLOADER_SEG_BSS:
42 if (ram->bss) free(ram->bss);
54 unsigned int type,
void *addr,
int size)
56 ((
struct ram_output*)output)->base = addr;
57 ((
struct ram_output*)output)->offset = 0;
71 struct ram_output *
const ram = (
struct ram_output *)output;
72 memcpy(ram->base + ram->offset, buf, len);
80 return ((
struct ram_output*)output)->offset;
83 static const struct elfloader_output_ops elf_output_ops =
93 static struct ram_output seg_output = {
103 PROCESS(ram_segments_cleanup_process,
"RAM segments cleanup process");
110 || ev == PROCESS_EVENT_EXIT);
111 if (ev == PROCESS_EVENT_EXIT)
break;
115 if (seg_output.text) {
116 free(seg_output.text);
117 seg_output.text =
NULL;
119 if (seg_output.rodata) {
120 free(seg_output.rodata);
121 seg_output.rodata =
NULL;
123 if (seg_output.data) {
124 free(seg_output.data);
125 seg_output.data =
NULL;
128 if (seg_output.bss) {
129 free(seg_output.bss);
130 seg_output.bss =
NULL;