Changeset 161
- Timestamp:
- Jun 20, 2012, 9:50:34 AM (13 years ago)
- Location:
- soft/giet_vm
- Files:
-
- 5 deleted
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
soft/giet_vm/Makefile
r160 r161 36 36 .PHONY: apps prepare 37 37 38 all: prepare soft. bin38 all: prepare soft.elf 39 39 40 40 41 ## merge all *. bin to soft.bin42 soft. bin: boot.bin sys.binmap.bin apps41 ## merge all *.elf to soft.elf 42 soft.elf: boot.elf sys.elf map.bin apps 43 43 make -C mover 44 44 mover/mover.x -sm map.bin … … 55 55 56 56 ## system compilation 57 sys. bin: $(SYS_OBJS) $(SYS_PATH)/sys.ld58 (cd $(BUILD_DIR_NAME); $(LD) -o ../$@ -T ../$(SYS_PATH)/sys.ld $(SYS_OBJS) )59 (cd $(BUILD_DIR_NAME); $(DU) -D ../$@ > $@.txt)57 sys.elf: $(SYS_OBJS) $(SYS_PATH)/sys.ld 58 (cd $(BUILD_DIR_NAME); $(LD) -o $@ -T ../$(SYS_PATH)/sys.ld $(SYS_OBJS) ) 59 (cd $(BUILD_DIR_NAME); $(DU) -D $@ > $@.txt) 60 60 61 61 switch.o: $(SYS_PATH)/switch.s giet_config.h … … 92 92 93 93 ## boot compilation 94 boot. bin: $(BOOT_OBJS) $(BOOT_PATH)/boot.ld95 (cd $(BUILD_DIR_NAME); $(LD) -o ../$@ -T ../$(BOOT_PATH)/boot.ld $(BOOT_OBJS) )96 (cd $(BUILD_DIR_NAME); $(DU) -D ../$@ > $@.txt)94 boot.elf: $(BOOT_OBJS) $(BOOT_PATH)/boot.ld 95 (cd $(BUILD_DIR_NAME); $(LD) -o $@ -T ../$(BOOT_PATH)/boot.ld $(BOOT_OBJS) ) 96 (cd $(BUILD_DIR_NAME); $(DU) -D $@ > $@.txt) 97 97 98 98 reset.o: $(BOOT_PATH)/reset.S giet_config.h … … 110 110 ### special rules 111 111 clean: 112 rm -f *.o *. bin *.txt core *~ 2>$(TRASH)112 rm -f *.o *.elf *.bin *.txt core *~ 2>$(TRASH) 113 113 make clean -C xml/ 2>$(TRASH) 114 114 make clean -C mover/ 2>$(TRASH) -
soft/giet_vm/apps/Makefile
r160 r161 14 14 SYS_PATH = $(SOFT_PATH)sys 15 15 DUMP_PATH = $(SOFT_PATH) #where goes the generated *.bin 16 BIN_PATH = $(SOFT_PATH)17 16 MAP_PATH = $(SOFT_PATH)xml 18 17 BUILD_PATH = $(SOFT_PATH)/build/ 18 BIN_PATH = $(SOFT_PATH)/build/ 19 19 20 20 INCLUDE = -I$(LIB_PATH) -I$(SOFT_PATH) -I$(SYS_PATH) -I$(MAP_PATH) -
soft/giet_vm/apps/fifo/Makefile
r160 r161 8 8 OBJS= main.o 9 9 10 all: $(APP_NAME). bin10 all: $(APP_NAME).elf 11 11 12 BIN_NAME_PATH=$(BIN_PATH)$(APP_NAME). bin12 BIN_NAME_PATH=$(BIN_PATH)$(APP_NAME).elf 13 13 14 $(APP_NAME). bin: $(OBJS) $(APP_NAME).ld14 $(APP_NAME).elf: $(OBJS) $(APP_NAME).ld 15 15 $(LD) -o $(BIN_NAME_PATH) -T $(APP_NAME).ld $(OBJS) $(USES) 16 16 $(DU) -D $(BIN_NAME_PATH) > $@.txt … … 22 22 23 23 clean: 24 rm -f *.o *. bin*.txt core *~ 2>$(TRASH)24 rm -f *.o *.elf *.txt core *~ 2>$(TRASH) 25 25 rm $(BIN_NAME_PATH) 2>$(TRASH) -
soft/giet_vm/apps/hello/Makefile
r160 r161 7 7 OBJS= main.o 8 8 9 all: $(APP_NAME). bin9 all: $(APP_NAME).elf 10 10 11 BIN_NAME_PATH=$(BIN_PATH)$(APP_NAME). bin11 BIN_NAME_PATH=$(BIN_PATH)$(APP_NAME).elf 12 12 13 $(APP_NAME). bin: $(OBJS) $(APP_NAME).ld13 $(APP_NAME).elf: $(OBJS) $(APP_NAME).ld 14 14 $(LD) -o $(BIN_NAME_PATH) -T $(APP_NAME).ld $(OBJS) $(USES) 15 15 $(DU) -D $(BIN_NAME_PATH) > $@.txt … … 21 21 22 22 clean: 23 rm -f *.o *. bin*.txt core *~ 2>$(TRASH)23 rm -f *.o *.elf *.txt core *~ 2>$(TRASH) 24 24 rm $(BIN_NAME_PATH) 2>$(TRASH) -
soft/giet_vm/apps/numsplit/Makefile
r160 r161 11 11 SRCS=$(patsubst %.o,%.c,$(OBJS)) 12 12 13 all: $(APP_NAME). bin13 all: $(APP_NAME).elf 14 14 15 15 .PHONY: compile 16 16 17 BIN_NAME_PATH=$(BIN_PATH)$(APP_NAME). bin17 BIN_NAME_PATH=$(BIN_PATH)$(APP_NAME).elf 18 18 19 $(APP_NAME). bin: compile $(APP_NAME).ld19 $(APP_NAME).elf: compile $(APP_NAME).ld 20 20 $(LD) -o $(BIN_NAME_PATH) -T $(APP_NAME).ld $(OBJS) $(USES) 21 21 $(DU) -D $(BIN_NAME_PATH) > $@.txt … … 26 26 27 27 clean: 28 rm -f *.o *. bin*.txt core *~ 2>$(TRASH)28 rm -f *.o *.elf *.txt core *~ 2>$(TRASH) 29 29 rm $(BIN_NAME_PATH) 2>$(TRASH) -
soft/giet_vm/apps/pgcd/Makefile
r160 r161 7 7 OBJS= main.o 8 8 9 all: $(APP_NAME). bin9 all: $(APP_NAME).elf 10 10 11 BIN_NAME_PATH=$(BIN_PATH)$(APP_NAME). bin11 BIN_NAME_PATH=$(BIN_PATH)$(APP_NAME).elf 12 12 13 $(APP_NAME). bin: $(OBJS) $(APP_NAME).ld13 $(APP_NAME).elf: $(OBJS) $(APP_NAME).ld 14 14 $(LD) -o $(BIN_NAME_PATH) -T $(APP_NAME).ld $(OBJS) $(USES) 15 15 $(DU) -D $(BIN_NAME_PATH) > $@.txt … … 21 21 22 22 clean: 23 rm -f *.o *. bin*.txt core *~ 2>$(TRASH)23 rm -f *.o *.elf *.txt core *~ 2>$(TRASH) 24 24 rm $(BIN_NAME_PATH) 2>$(TRASH) -
soft/giet_vm/apps/router/Makefile
r160 r161 8 8 OBJS= main.o 9 9 10 all: $(APP_NAME). bin10 all: $(APP_NAME).elf 11 11 12 BIN_NAME_PATH=$(BIN_PATH)$(APP_NAME). bin12 BIN_NAME_PATH=$(BIN_PATH)$(APP_NAME).elf 13 13 14 $(APP_NAME). bin: $(OBJS) $(APP_NAME).ld14 $(APP_NAME).elf: $(OBJS) $(APP_NAME).ld 15 15 $(LD) -o $(BIN_NAME_PATH) -T $(APP_NAME).ld $(OBJS) $(USES) 16 16 $(DU) -D $(BIN_NAME_PATH) > $@.txt … … 21 21 22 22 clean: 23 rm -f *.o *. bin*.txt core *~ 2>$(TRASH)23 rm -f *.o *.elf *.txt core *~ 2>$(TRASH) 24 24 rm $(BIN_NAME_PATH) 2>$(TRASH) -
soft/giet_vm/map.xml
r160 r161 59 59 psegname = "PSEG_ROM" 60 60 ident = "1" > 61 <vobj name = " boot_code_data"61 <vobj name = "seg_boot" 62 62 type = "ELF" 63 63 length = "0x00008000" 64 binpath = "b oot.bin"64 binpath = "build/boot.elf" 65 65 /> 66 66 </vseg> … … 81 81 psegname = "PSEG_ROM" 82 82 ident = "1" > 83 <vobj name = " boot_mapping"83 <vobj name = "seg_mapping" 84 84 type = "ELF" 85 85 length = "0x00004000" … … 93 93 psegname = "PSEG_RAK" 94 94 ident = "1" > 95 <vobj name = " kernel_code"95 <vobj name = "seg_kernel_code" 96 96 type = "ELF" 97 97 length = "0x00010000" 98 binpath = " sys.bin"98 binpath = "build/sys.elf" 99 99 /> 100 100 </vseg> … … 105 105 psegname = "PSEG_RAK" 106 106 ident = "1" > 107 <vobj name = " kernel_data"107 <vobj name = "seg_kernel_data" 108 108 type = "ELF" 109 109 length = "0x00010000" 110 binpath = " sys.bin"110 binpath = "build/sys.elf" 111 111 /> 112 112 </vseg> … … 117 117 psegname = "PSEG_RAK" 118 118 ident = "1" > 119 <vobj name = " kernel_uncdata"119 <vobj name = "seg_kernel_uncdata" 120 120 type = "ELF" 121 121 length = "0x00010000" 122 binpath = " sys.bin"122 binpath = "build/sys.elf" 123 123 /> 124 124 </vseg> … … 129 129 psegname = "PSEG_RAK" 130 130 ident = "1" > 131 <vobj name = " kernel_init"131 <vobj name = "seg_kernel_init" 132 132 type = "ELF" 133 133 length = "0x00010000" 134 binpath = " sys.bin"134 binpath = "build/sys.elf" 135 135 /> 136 136 </vseg> … … 200 200 <vspaceset> 201 201 <vspace name = "router" 202 funcs = " data"202 funcs = "seg_data_router" 203 203 ttys = "4" > 204 204 … … 208 208 psegname = "PSEG_RAU" 209 209 ident = "0" > 210 <vobj name = " data"210 <vobj name = "seg_data_router" 211 211 type = "ELF" 212 212 length = "0x00010000" 213 binpath = " router.bin"213 binpath = "build/router.elf" 214 214 /> 215 215 </vseg> … … 220 220 psegname = "PSEG_RAU" 221 221 ident = "0" > 222 <vobj name = " code"222 <vobj name = "seg_code_router" 223 223 type = "ELF" 224 224 length = "0x00010000" 225 binpath = " router.bin"225 binpath = "build/router.elf" 226 226 /> 227 227 </vseg> … … 278 278 vbase = "0x00050000" 279 279 mode = "__WU" 280 psegname = "PSEG_RAU" 281 mwmr = "1" > 280 psegname = "PSEG_RAU" > 282 281 <vobj name = "mwmr_in" 283 282 type = "MWMR" … … 288 287 vbase = "0x00060000" 289 288 mode = "__WU" 290 psegname = "PSEG_RAU" 291 mwmr = "1" > 289 psegname = "PSEG_RAU"> 292 290 <vobj name = "mwmr_out" 293 291 type = "MWMR" … … 322 320 323 321 <vspace name = "hello" 324 funcs = " data"322 funcs = "seg_data_hello" 325 323 ttys = "1" > 326 324 … … 330 328 psegname = "PSEG_RAU" 331 329 ident = "0" > 332 <vobj name = " data"330 <vobj name = "seg_data_hello" 333 331 type = "ELF" 334 332 length = "0x00010000" 335 binpath = " hello.bin"/>333 binpath = "build/hello.elf"/> 336 334 </vseg> 337 335 … … 341 339 psegname = "PSEG_RAU" 342 340 ident = "0" > 343 <vobj name = " code"341 <vobj name = "seg_code_hello" 344 342 type = "ELF" 345 343 length = "0x00010000" 346 binpath = " hello.bin"/>344 binpath = "build/hello.elf"/> 347 345 </vseg> 348 346 … … 378 376 379 377 <vspace name = "pgcd" 380 funcs = " data"378 funcs = "seg_data_pgcd" 381 379 ttys = "1" > 382 380 … … 386 384 psegname = "PSEG_RAU" 387 385 ident = "0" > 388 <vobj name = " data"386 <vobj name = "seg_data_pgcd" 389 387 type = "ELF" 390 388 length = "0x00010000" 391 binpath = " pgcd.bin" />389 binpath = "build/pgcd.elf" /> 392 390 </vseg> 393 391 … … 409 407 psegname = "PSEG_RAU" 410 408 ident = "0" > 411 <vobj name = " code"409 <vobj name = "seg_code_pgcd" 412 410 type = "ELF" 413 411 length = "0x00010000" 414 binpath = " pgcd.bin" />412 binpath = "build/pgcd.elf" /> 415 413 </vseg> 416 414 … … 434 432 435 433 <vspace name = "numsplit" 436 funcs = " data"434 funcs = "seg_data_numsplit" 437 435 ttys = "2" > 438 436 … … 442 440 psegname = "PSEG_RAU" 443 441 ident = "0" > 444 <vobj name = " data"442 <vobj name = "seg_data_numsplit" 445 443 type = "ELF" 446 444 length = "0x00010000" 447 binpath = " numsplit.bin"445 binpath = "build/numsplit.elf" 448 446 /> 449 447 </vseg> … … 454 452 psegname = "PSEG_RAU" 455 453 ident = "0" > 456 <vobj name = " code"454 <vobj name = "seg_code_numsplit" 457 455 type = "ELF" 458 456 length = "0x00010000" 459 binpath = " numsplit.bin"457 binpath = "build/numsplit.elf" 460 458 /> 461 459 </vseg> … … 494 492 vbase = "0x00050000" 495 493 mode = "__WU" 496 psegname = "PSEG_RAU" 497 mwmr = "1" > 494 psegname = "PSEG_RAU"> 498 495 <vobj name = "mwmr" 499 496 type = "MWMR" -
soft/giet_vm/mover/include/mover.h
r160 r161 66 66 mutable std::map<std::string, elfpp::object*> m_loaders; 67 67 PSegHandler m_psegh; 68 PathHandler m_path h;68 PathHandler m_pathHandler; 69 69 70 70 bool m_ginit; … … 73 73 void* load_bin(std::string name); 74 74 elfpp::section* get_sect_by_addr(elfpp::object *loader, unsigned int addr); 75 elfpp::section* get_sect_by_name(elfpp::object *loader, std::string name); 75 76 76 77 public: -
soft/giet_vm/mover/include/path_handler.h
r160 r161 23 23 std::vector<std::string> split(const std::string &s, char delim); 24 24 25 //extract the path without the filename 25 26 std::string getFilePath(const std::string& filepath); 26 27 … … 30 31 PathHandler(const std::string& filepath); 31 32 32 std::string getFullName(const std::string& filepath) const; 33 //return the fullPath relative to where execution is done. 34 std::string getFullPath(const std::string& filepath) const; 33 35 34 36 std::string getFileName(const std::string& filepath); -
soft/giet_vm/mover/main.cpp
r160 r161 7 7 { 8 8 std::string map_path(""); 9 std::string soft_path("soft. bin");9 std::string soft_path("soft.elf"); 10 10 bool show = false; 11 11 bool show_map = false; -
soft/giet_vm/mover/src/mover.cpp
r160 r161 5 5 * This file is part of SoCLib, GNU LGPLv2.1. 6 6 * 7 * SoCLib is free software; you can redistribute v s and/or modify vs7 * SoCLib is free software; you can redistribute vSO and/or modify vSO 8 8 * under the terms of the GNU Lesser General Public License as published 9 9 * by the Free Software Foundation; version 2.1 of the License. 10 10 * 11 * SoCLib is distributed in the hope that v swill be useful, but11 * SoCLib is distributed in the hope that vSO will be useful, but 12 12 * WITHOUT ANY WARRANTY; without even the implied warranty of 13 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU … … 40 40 41 41 42 //#define MOVER_DEBUG42 #define MOVER_DEBUG 43 43 44 44 Mover::Mover( const std::string &filename, 45 45 const size_t pageSize) 46 46 :m_path(filename), 47 m_path h(filename),47 m_pathHandler(filename), 48 48 m_ginit(false), 49 49 m_generator(new elfpp::object()) 50 50 { 51 //m_generator = new elfpp::object(); 52 53 //m_pathh = 54 51 55 52 PSeg::setPageSize(pageSize); 56 53 57 54 load_bin(m_path); 55 58 56 #ifdef MOVER_DEBUG 59 57 std::cout << "Binary file path: " << m_path << std::endl; … … 94 92 } 95 93 94 //TODO:delete 96 95 elfpp::section* Mover::get_sect_by_addr(elfpp::object *loader, unsigned int addr) 97 96 { … … 103 102 continue; 104 103 if(sect->get_load_address() == addr) //load_addr ? 104 { 105 return (&*sect); 106 } 107 } 108 return NULL; 109 } 110 elfpp::section* Mover::get_sect_by_name(elfpp::object *loader, std::string name) 111 { 112 #ifdef MOVER_DEBUG 113 std::cout << "get_sect_by_name " << name << std::endl; 114 #endif 115 FOREACH( sect, loader->get_section_table() ) 116 { 117 assert(&*sect != NULL); 118 elfpp::sh_flags_e eflags = sect->get_flags(); 119 if ( !(eflags & elfpp::SHF_ALLOC) ) 120 continue; 121 122 #ifdef MOVER_DEBUG 123 std::cout << "Trying " << sect->get_name() << std::endl; 124 #endif 125 if(!(sect->get_name()).compare(name)) 105 126 { 106 127 return (&*sect); … … 208 229 mapping_vspace_t* vspace = get_vspace_base ( header );; 209 230 mapping_vseg_t* vseg = get_vseg_base ( header ); 231 mapping_vobj_t* vobj = get_vobj_base ( header ); 210 232 211 233 // header … … 240 262 << " + ident = " << (bool)vseg[vseg_id].ident << std::endl 241 263 << " + psegname" << pseg[vseg[vseg_id].psegid].name << std::endl; 242 //TODO print vobjs 243 /* 244 for ( vobj_id = vseg[vseg_id].vobj_offset ; vobj_id < vseg[vseg_id].vobj_offset + vseg[vseg_id].vobjs ; vobj_id++ ) 245 { 246 _tty_printf("\t vobjs = \"%s\"\n", vobj[vobj_id].name); 247 _tty_printf("\t name = \"%s\"\n", vobj[vobj_id].name); 248 _tty_printf("\t type = \"%s\" \n", vobj[vobj_id].type); 249 _tty_printf("\t length = \"0x%x\" \n", vobj[vobj_id].length); 250 _tty_printf("\t align = \"%d\" \n", vobj[vobj_id].align); 251 _tty_printf("\t binpath = \"%s\" \n", vobj[vobj_id].binpath); 252 _tty_printf("\t \n"); 253 }*/ 264 for(size_t vobj_id = vseg[vseg_id].vobj_offset ; vobj_id < vseg[vseg_id].vobj_offset + vseg[vseg_id].vobjs ; vobj_id++ ) 265 { 266 std::cout << "\t vobjs = "<< vobj[vobj_id].name << std::endl; 267 std::cout<<"\t name =" << vobj[vobj_id].name <<std::endl; 268 std::cout<<"\t type =" << vobj[vobj_id].type <<std::endl; 269 std::cout<<"\t length =" << vobj[vobj_id].length <<std::endl; 270 std::cout<<"\t align =" << vobj[vobj_id].align <<std::endl; 271 std::cout<<"\t binpath =" << vobj[vobj_id].binpath <<std::endl; 272 std::cout<<"\t \n"; 273 } 254 274 } 255 275 … … 274 294 << " + ident = " << (bool)vseg[vseg_id].ident << std::endl 275 295 << " + psegname = " << pseg[vseg[vseg_id].psegid].name << std::endl << std::endl; 276 //TODO print vobjs 277 /* 278 for ( vobj_id = vseg[vseg_id].vobj_offset ; vobj_id < vseg[vseg_id].vobj_offset + vseg[vseg_id].vobjs ; vobj_id++ ) 296 for(size_t vobj_id = vseg[vseg_id].vobj_offset ; vobj_id < vseg[vseg_id].vobj_offset + vseg[vseg_id].vobjs ; vobj_id++ ) 279 297 { 280 _tty_printf("\t\t vobjs = \"%s\"\n", vobj[vobj_id].name);281 _tty_printf("\t\t name = \"%s\"\n", vobj[vobj_id].name);282 _tty_printf("\t\t type = \"%s\" \n", vobj[vobj_id].type);283 _tty_printf("\t\t length = \"0x%x\" \n", vobj[vobj_id].length);284 _tty_printf("\t\t align = \"%d\" \n", vobj[vobj_id].align);285 _tty_printf("\t\t binpath = \"%s\" \n\n", vobj[vobj_id].binpath);298 std::cout<<"\t\t vobjs =" << vobj[vobj_id].name <<std::endl; 299 std::cout<<"\t\t name =" << vobj[vobj_id].name <<std::endl; 300 std::cout<<"\t\t type =" << vobj[vobj_id].type <<std::endl; 301 std::cout<<"\t\t length =" << vobj[vobj_id].length <<std::endl; 302 std::cout<<"\t\t align =" << vobj[vobj_id].align <<std::endl; 303 std::cout<<"\t\t binpath =" << vobj[vobj_id].binpath <<std::endl; 286 304 } 287 */288 305 } 289 306 … … 311 328 bool aligned = false; 312 329 313 VSeg * vs= new VSeg;314 std::string s(vseg->name); 315 v s->m_name = s;316 317 v s->m_vma = vseg->vbase;330 VSeg *vSO = new VSeg; 331 332 vSO->m_name = std::string(vseg->name); 333 vSO->m_vma = vseg->vbase; 334 vSO->m_lma = ps->nextLma(); 318 335 319 336 cur_vaddr = vseg->vbase; 320 337 cur_paddr = ps->nextLma(); 321 322 vs->m_length = 0; 338 323 339 mapping_vobj_t* cur_vobj; 324 325 340 size_t simple_size = 0; //for debug 326 341 327 342 #ifdef MOVER_DEBUG 328 std::cout << "--------------------vseg_map ---------------------" << std::endl;343 std::cout << "--------------------vseg_map "<< vseg->name <<"---------------------" << std::endl; 329 344 #endif 330 345 … … 334 349 335 350 #ifdef MOVER_DEBUG 336 std::cout << "cur vobj("<< vobj_id <<"): " << cur_vobj->name << " (" <<cur_vobj->vaddr << ")"337 << " size "<< cur_vobj->length << " type" << cur_vobj->type << std::endl;351 std::cout << "current vobj("<< vobj_id <<"): " << cur_vobj->name << " (" <<cur_vobj->vaddr << ")" 352 << " size: "<< cur_vobj->length << " type: " << cur_vobj->type << std::endl; 338 353 #endif 339 354 340 355 if(cur_vobj->type == ELF) 341 356 { 342 343 357 if(!first) 344 358 throw soclib::exception::RunTimeError(std::string("elf vobj type, must be placed first in a vseg")); 345 359 346 std::string f(m_pathh.getFullName(std::string(cur_vobj->binpath)));347 360 size_t elf_size; 348 #ifdef MOVER_DEBUG 349 std::cout << "Handling: " << f << " ..." << std::endl; 350 #endif 351 if(!f.compare(m_path)) //local blob: map_info 361 std::string filePath(m_pathHandler.getFullPath(std::string(cur_vobj->binpath))); 362 #ifdef MOVER_DEBUG 363 std::cout << "Handling: " << filePath << " ..." << std::endl; 364 #endif 365 if(!filePath.compare(m_path)) //local blob: map_info 352 366 { 353 /**creating a new session */ 367 #ifdef MOVER_DEBUG 368 std::cout << "Found the vseg of the mapping info" << std::endl; 369 #endif 370 /**creating a new section */ 354 371 sect = new elfpp::section(*m_generator, elfpp::SHT_PROGBITS); 355 372 356 sect->set_name(std::string( "seg_mapping_info"));373 sect->set_name(std::string(cur_vobj->name)); 357 374 sect->set_flags(elfpp::SHF_ALLOC | elfpp::SHF_WRITE); 358 375 sect->set_size(this->m_size); 359 360 sect->set_content(m_data); 376 sect->set_content(this->m_data); 361 377 362 378 elf_size = this->m_size; 363 assert((elf_size >0) and "MAP INFO fileempty !?");379 assert((elf_size >0) and "MAPPING INFO file is empty !?"); 364 380 } 365 381 else 366 382 { 367 383 #ifdef MOVER_DEBUG 368 std::cout << "ELF vseg found " << std::endl; 369 #endif 370 if(m_loaders.count(f) == 0 ) 371 m_loaders[f] = new elfpp::object(f); 372 elfpp::object* loader = m_loaders[f]; 373 //elfpp::object* loader = (new elfpp::object(f));//TODO:free! 374 384 std::cout << "Found an ELF vseg" << std::endl; 385 #endif 386 if(m_loaders.count(filePath) == 0 ) 387 m_loaders[filePath] = new elfpp::object(filePath); 388 elfpp::object* loader = m_loaders[filePath];//TODO:free!? 389 390 //sect = get_sect_by_name(loader, std::string(cur_vobj->name)); 391 //assert(( sect->get_vaddr() == cur_vaddr) and "Vaddr doesn't match!"); 375 392 sect = get_sect_by_addr(loader, cur_vaddr); 376 393 assert(sect and "No section found"); 377 394 395 sect->set_name(std::string(cur_vobj->name)); 396 378 397 elf_size = sect->get_size(); 379 380 398 assert((elf_size >0) and "ELF section empty ?"); 399 381 400 if(!m_ginit) 382 401 { 383 //we suppose the header is the same for the all the bins 402 /** Initailising the header of the generator from the first binary 403 * we suppose the header is the same for all the binarys 404 * */ 384 405 m_generator->copy_info(*loader); 385 406 m_ginit=true; 386 407 } 387 408 } 388 cur_vobj->length = elf_size;//set the actual size 409 389 410 if(elf_size > cur_vobj->length) 390 std::cout << "Warning, specified elf type vobj ("<< cur_vobj->name <<") size is "<< cur_vobj->length 391 << ", the actual size is " << elf_size << std::endl; 392 393 vs->m_file = f; 394 vs->m_loadable = true; 411 std::cout << "Warning, specified elf type vobj ("<< 412 cur_vobj->name <<") size is "<< cur_vobj->length << ", the actual size is " 413 << elf_size << std::endl; 414 415 cur_vobj->length = elf_size;//set the true size of this ELF vobj 416 417 vSO->m_file = filePath; 418 vSO->m_loadable = true; 395 419 } 396 420 first = false; 397 421 422 //aligning the vobj->paddr if necessary 398 423 if(cur_vobj->align) 399 424 { … … 401 426 aligned = true; 402 427 } 403 404 428 405 429 cur_vaddr += cur_vobj->length; … … 411 435 assert((cur_paddr >= ps->nextLma() )); 412 436 413 v s->m_length = (cur_paddr - ps->nextLma()); //pageAlign is done by the psegs437 vSO->m_length = (cur_paddr - ps->nextLma()); //pageAlign is done by the psegs 414 438 415 439 #ifdef MOVER_DEBUG 416 440 if(aligned) 417 441 { 418 std::cout << "vseg base "<< std::hex << ps->nextLma() <<(ps->nextLma()+simple_size) <<" size " << std::dec << simple_size << std::endl; 419 std::cout << "vseg aligned to: base: " << std::hex << ps->nextLma() 420 <<" to "<< std::hex << ps->nextLma()+vs->m_length<< " size " << std::dec << vs->m_length << std::endl; 442 std::cout << "vseg base "<< std::hex << ps->nextLma() 443 <<(ps->nextLma()+simple_size) <<" size " << std::dec << simple_size << 444 std::endl; 445 446 std::cout << "vseg aligned to: base: " << std::hex << ps->nextLma() 447 <<" to "<< std::hex << ps->nextLma()+vSO->m_length<< " size " << std::dec << 448 vSO->m_length << std::endl; 421 449 } 422 450 #endif 423 451 424 v s->m_ident = vseg->ident;452 vSO->m_ident = vseg->ident; 425 453 426 454 //set the lma 427 455 if ( vseg->ident != 0 ) // identity mapping required 428 ps->addIdent( *v s);456 ps->addIdent( *vSO ); 429 457 else 430 ps->add( *v s);458 ps->add( *vSO ); 431 459 432 460 if(!sect) 433 461 return; 434 462 435 //std::cout << "section: "<< *sect <<"\n seted to: " << (*v s) << std::endl;436 sect->set_vaddr((*v s).lma());463 //std::cout << "section: "<< *sect <<"\n seted to: " << (*vSO) << std::endl; 464 sect->set_vaddr((*vSO).lma()); 437 465 m_generator->add_section(*(new elfpp::section(*sect))); 438 466 -
soft/giet_vm/mover/src/path_handler.cpp
r160 r161 30 30 } 31 31 32 std::string PathHandler::getFull Name(const std::string& filepath) const32 std::string PathHandler::getFullPath(const std::string& filepath) const 33 33 { 34 34 return dirPath+filepath; -
soft/giet_vm/sys/sys_handler.c
r160 r161 12 12 13 13 #include <sys_handler.h> 14 //#include <boot_handler.h>15 14 #include <drivers.h> 16 15 #include <ctx_handler.h> … … 130 129 } 131 130 } 131 132 132 ///////////////////////////////////////////////////////////////////////////// 133 133 // _vobj_get_base()
Note: See TracChangeset
for help on using the changeset viewer.