Changeset 171 for soft/giet_vm
- Timestamp:
- Jul 18, 2012, 9:17:22 AM (12 years ago)
- Location:
- soft/giet_vm
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
soft/giet_vm/map.xml
r170 r171 89 89 vbase = "0x80000000" 90 90 mode = "CX__" 91 psegname = "PSEG_RA K"92 ident = " 1" >91 psegname = "PSEG_RAU" 92 ident = "0" > 93 93 <vobj name = "seg_kernel_code" 94 94 type = "ELF" … … 101 101 vbase = "0x80010000" 102 102 mode = "C_W_" 103 psegname = "PSEG_RA K"104 ident = " 1" >103 psegname = "PSEG_RAU" 104 ident = "O" > 105 105 <vobj name = "seg_kernel_data" 106 106 type = "ELF" … … 112 112 vbase = "0x80080000" 113 113 mode = "__W_" 114 psegname = "PSEG_RA K"115 ident = " 1" >114 psegname = "PSEG_RAU" 115 ident = "0" > 116 116 <vobj name = "seg_kernel_uncdata" 117 117 type = "ELF" … … 123 123 vbase = "0x80090000" 124 124 mode = "CX__" 125 psegname = "PSEG_RA K"126 ident = " 1" >125 psegname = "PSEG_RAU" 126 ident = "0" > 127 127 <vobj name = "seg_kernel_init" 128 128 type = "ELF" -
soft/giet_vm/memo/src/libelfpp/elfpp_access.cc
r163 r171 644 644 segment *s = new segment(obj); 645 645 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); 667 673 } 668 674 } … … 675 681 if (obj.generate_symtab_) 676 682 save_symtab(obj); 683 684 // create all segments 677 685 678 686 create_segments(obj); … … 797 805 std::memset(phdr, 0, sizeof(phdr)); 798 806 799 unsigned int i = 0;807 unsigned int i = 1;//to keep the same order as sections 800 808 FOREACH(s, obj.get_segment_table()) 801 809 { … … 812 820 813 821 swap(&phdr[i].p_align, s->get_align()); 814 // offset done while writing sections822 //note: offset done while writing sections 815 823 i++; 816 824 } … … 829 837 FOREACH(s, obj.get_section_table()) 830 838 { 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 834 846 swap(&shdr[s->index_].sh_offset, ftell(file)); 835 847 swap(&phdr[s->index_].p_offset, ftell(file)); -
soft/giet_vm/sys/vm_handler.c
r170 r171 118 118 119 119 // gets ppn_value and flags_value, after temporary DTLB desactivation 120 asm volatile ( "move $27, %2 \n" /* $27 <= pte2 */ 121 "li $26, 0xB \n" /* DTLB unactivated */ 122 "mtc2 $26, $1 \n" 123 "lw %0, 0($27) \n" /* read flags */ 124 "lw %1, 4($27) \n" /* read ppn */ 125 "li $26, 0xF \n" 126 "mtc2 $26, $1 \n" /* DTLB activated */ 120 asm volatile ( 121 "li $27, 0xFFFFFFFE \n" /* Mask for IE bits */ 122 "mfc0 $8, $12 \n" /* $8 <= SR */ 123 "and $26, $26, $27 \n" /* disable Interrupts */ 124 "move $27, %2 \n" /* $27 <= pte2 */ 125 "li $26, 0xB \n" /* DTLB unactivated */ 126 "mtc2 $26, $1 \n" 127 "lw %0, 0($27) \n" /* read flags */ 128 "lw %1, 4($27) \n" /* read ppn */ 129 "li $26, 0xF \n" 130 "mtc2 $26, $1 \n" /* DTLB activated */ 131 "or $26, $8, $0 \n" /* SR previous state */ 127 132 :"=r"(flags_value), "=r"(ppn_value) 128 133 :"r"(pte2) 129 :"$26" );134 :"$26","$27","$8" ); 130 135 131 136 // check PTE2 mapping
Note: See TracChangeset
for help on using the changeset viewer.