Changeset 138 for trunk/IPs/systemC/Environment/Data/src/loadexec.c
- Timestamp:
- May 12, 2010, 7:34:01 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/IPs/systemC/Environment/Data/src/loadexec.c
r134 r138 73 73 return; 74 74 75 if ((sect->flags & SEC_LOAD) && !(sect->flags & SEC_IN_MEMORY)) { 76 bfd_get_section_contents(exec, sect, 77 rinfo->mem + (sect->lma - rinfo->ladr), 78 0, bfd_section_size(exec, sect)); 79 sect->contents = rinfo->mem; 75 if ((sect->flags & SEC_LOAD) && !(sect->flags & SEC_IN_MEMORY)) 76 { 77 /* #if 1 */ 78 /* printf(" * bindsection : \n"); */ 79 /* printf(" * exec : %x\n",(int)exec); */ 80 /* printf(" * sect : %x\n",(int)sect); */ 81 /* printf(" * size : %d\n",(int)(rinfo->mem + (sect->lma - rinfo->ladr))); */ 82 /* printf(" * mem : %d\n",(int)rinfo->mem); */ 83 /* printf(" * lma : %d\n",(int)sect->lma); */ 84 /* printf(" * ladr : %d\n",(int)rinfo->ladr); */ 85 /* fflush(stdout); */ 86 /* #endif */ 87 88 bfd_get_section_contents(exec, 89 sect, 90 rinfo->mem + (sect->lma - rinfo->ladr), 91 0, 92 bfd_section_size(exec, sect)); 93 sect->contents = rinfo->mem; 80 94 } 81 95 } … … 92 106 return; 93 107 108 /* #if 1 */ 109 /* printf(" * sectionsize : \n"); */ 110 /* printf(" * name : %s\n",rinfo->sections[i]); */ 111 /* printf(" * size (before): %d (%x)\n",rinfo->size,rinfo->size); */ 112 /* printf(" * ladr (before): %d (%x)\n",rinfo->ladr,rinfo->ladr); */ 113 /* printf(" * hadr (before): %d (%x)\n",rinfo->hadr,rinfo->hadr); */ 114 /* #endif */ 115 94 116 rinfo->size += bfd_section_size(exec, sect); 95 117 rinfo->ladr = sect->lma < rinfo->ladr ? sect->lma : rinfo->ladr; 96 118 rinfo->hadr = sect->lma + rinfo->size > rinfo->hadr ? 97 119 sect->lma + rinfo->size : rinfo->hadr; 120 121 /* #if 1 */ 122 /* printf(" * size (after ): %d (%x)\n",rinfo->size,rinfo->size); */ 123 /* printf(" * ladr (after ): %d (%x)\n",rinfo->ladr,rinfo->ladr); */ 124 /* printf(" * hadr (after ): %d (%x)\n",rinfo->hadr,rinfo->hadr); */ 125 /* #endif */ 126 98 127 } 99 128 100 129 void loadexec(void **emem, int *esize, int *eoffset, const char *file, const char **sections) 101 130 { 102 bfd *exec;103 131 static int x; 104 132 raminfo ringo; … … 107 135 bfd_init(); 108 136 109 exec = bfd_openr(file, NULL);137 bfd * exec = bfd_openr(file, NULL); 110 138 111 139 if (!exec) { … … 120 148 } 121 149 122 #if 0 123 cout("Loading sections "); 124 for (i = 0; sections[i]; i++) 125 __cout("%s%s", sections[i], ((sections[i+1]!=NULL)?", ":" ")); 126 __cout("from \"%s\"\n",bfd_get_filename(exec)); 127 //cout("of executable '%s' for '%s' architecture in format '%s'\n", 128 // bfd_get_filename(exec), bfd_printable_name(exec), exec->xvec->name); 129 #endif 150 /* #if 1 */ 151 /* printf(" * Loading sections from \"%s\" :\n",bfd_get_filename(exec)); */ 152 /* { */ 153 /* int i; */ 154 /* for (i = 0; sections[i]; i++) */ 155 /* printf(" * %s\n", sections[i]); */ 156 /* } */ 157 158 /* //cout("of executable '%s' for '%s' architecture in format '%s'\n", */ 159 /* // bfd_get_filename(exec), bfd_printable_name(exec), exec->xvec->name); */ 160 /* #endif */ 130 161 131 162 /* Set input parameters to bindsection */ … … 135 166 ringo.ladr = ~0; 136 167 ringo.hadr = 0; 168 ringo.mem = NULL; 169 137 170 bfd_map_over_sections(exec, sectionssize, &ringo); 171 172 /* #if 1 */ 173 /* printf(" * Meminfo : \n"); */ 174 /* printf(" * size : %d (%x)\n",ringo.size,ringo.size); */ 175 /* printf(" * esize : %d (%x)\n",*esize,*esize); */ 176 /* printf(" * ladr : %d (%x)\n",ringo.ladr,ringo.ladr); */ 177 /* printf(" * hadr : %d (%x)\n",ringo.hadr,ringo.hadr); */ 178 /* #endif */ 179 138 180 /* Get output parameters from sectionssize */ 139 181 if (ringo.size < ringo.hadr - ringo.ladr) … … 146 188 147 189 /* Start over again from the start of the memory */ 148 bfd_map_over_sections(exec, bindsection, &ringo); 190 bfd_map_over_sections(exec, 191 bindsection, 192 &ringo); 149 193 /* Get output parameters from bindsection */ 150 194
Note: See TracChangeset
for help on using the changeset viewer.