Changeset 171 for soft/giet_vm/memo/src


Ignore:
Timestamp:
Jul 18, 2012, 9:17:22 AM (12 years ago)
Author:
karaoui
Message:

Testing the placement of the kernel segments without the identity mapping.
debugging memo.
debugging the vm_handler to disable the interrupts while passing in physical addressing.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • soft/giet_vm/memo/src/libelfpp/elfpp_access.cc

    r163 r171  
    644644        segment *s = new segment(obj);
    645645
    646         if(!(sec->get_flags() & elfpp::SHF_ALLOC))
    647     {
    648             s->set_type(PT_NULL);
    649         continue;
    650     }
    651    
    652     s->set_type(PT_LOAD);
    653         s->set_file_offset(0);//done while writing section in file
    654         s->set_vaddr(sec->get_vaddr());
    655         s->set_paddr(sec->get_vaddr());
    656 
    657         s->set_mem_size(sec->get_size());
    658         s->set_file_size(sec->get_size());
    659 
    660         flag = PF_R ;//ALLOC ==> read ?
    661         flag = flag | (p_flags_e)(sec->get_flags() & SHF_WRITE)? PF_W : PF_R ;
    662         flag = flag | (p_flags_e)(sec->get_flags() & SHF_EXECINSTR)? PF_X : PF_R ;
    663         s->set_flags(flag);
    664         s->set_align(0);//FIXME!
    665 
    666         obj.add_segment(*s);
     646        if(!(sec->get_flags() & elfpp::SHF_ALLOC))
     647        {
     648            s->set_type(PT_NULL);
     649            continue;
     650        }
     651       
     652        s->set_type(PT_LOAD);
     653        s->set_file_offset(0);//done while writing section in file
     654#ifdef MEMO_DEBUG
     655        std::cout << "seg building (" << std::hex << sec->get_vaddr() << ") for: " << *sec << std::endl;
     656#endif
     657        s->set_vaddr(sec->get_vaddr());
     658        s->set_paddr(sec->get_vaddr());
     659
     660        s->set_mem_size(sec->get_size());
     661        s->set_file_size(sec->get_size());
     662
     663            flag = PF_R ;//ALLOC ==> read ?
     664            flag = flag | (p_flags_e)(sec->get_flags() & SHF_WRITE)? PF_W : PF_R ;
     665            flag = flag | (p_flags_e)(sec->get_flags() & SHF_EXECINSTR)? PF_X : PF_R ;
     666        s->set_flags(flag);
     667        s->set_align(0);//FIXME!
     668
     669#ifdef MEMO_DEBUG
     670        std::cout <<"New segment " << s->get_file_size() << std::endl;
     671#endif
     672        obj.add_segment(*s);
    667673      }
    668674  }
     
    675681    if (obj.generate_symtab_)
    676682      save_symtab(obj);
     683
     684    // create all segments
    677685
    678686    create_segments(obj);
     
    797805    std::memset(phdr, 0, sizeof(phdr));
    798806
    799     unsigned int i = 0;
     807    unsigned int i = 1;//to keep the same order as sections
    800808    FOREACH(s, obj.get_segment_table())
    801809      {
     
    812820       
    813821        swap(&phdr[i].p_align, s->get_align());
    814         //offset done while writing sections
     822        //note: offset done while writing sections
    815823        i++;
    816824      }
     
    829837    FOREACH(s, obj.get_section_table())
    830838      {
    831         if (s->get_type() == SHT_NOBITS)
    832           continue;
    833 
     839        if (s->get_type() == SHT_NOBITS)
     840          continue;
     841
     842#ifdef MEMO_DEBUG
     843        std::cout << "offset: " << ftell(file) << " for " << *s << std::endl;
     844        std::cout << std::hex << "paddr: " << phdr[s->index_].p_paddr << ", sect vaddr: " << s->get_vaddr() << "/" <<shdr[s->index_].sh_addr << std::endl;
     845#endif
    834846        swap(&shdr[s->index_].sh_offset, ftell(file));
    835847        swap(&phdr[s->index_].p_offset, ftell(file));
Note: See TracChangeset for help on using the changeset viewer.