Changeset 246 for soft/giet_vm/boot/boot_init.c
- Timestamp:
- Jul 9, 2013, 3:54:53 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
soft/giet_vm/boot/boot_init.c
r245 r246 156 156 { 157 157 unsigned int value; 158 unsigned int lsb = (unsigned int) paddr;159 unsigned int msb = (unsigned int) (paddr >> 32);158 unsigned int lsb = (unsigned int) paddr; 159 unsigned int msb = (unsigned int) (paddr >> 32); 160 160 161 161 asm volatile( … … 489 489 } 490 490 491 491 492 // get page table physical base address 492 493 pt1_pbase = boot_ptabs_paddr[vspace_id]; 493 494 494 495 // get ptd in PT1 495 ptd = boot_physical_read( pt1_pbase + 4*ix1);496 ptd = boot_physical_read(pt1_pbase + 4 * ix1); 496 497 497 498 if ((ptd & PTE_V) == 0) // invalid PTD: compute PT2 base address, … … 508 509 { 509 510 pt2_pbase = pt1_pbase + PT1_SIZE + PT2_SIZE * pt2_id; 510 ptd = PTE_V | PTE_T | (unsigned int) (pt2_pbase >> 12);511 boot_physical_write( pt1_pbase + 4 *ix1, ptd);511 ptd = PTE_V | PTE_T | (unsigned int) (pt2_pbase >> 12); 512 boot_physical_write( pt1_pbase + 4 * ix1, ptd); 512 513 boot_next_free_pt2[vspace_id] = pt2_id + 1; 513 514 } … … 519 520 520 521 // set PTE in PT2 : flags & PPN in two 32 bits words 521 pte_paddr = pt2_pbase + 8 *ix2;522 boot_physical_write( pte_paddr, flags);523 boot_physical_write( pte_paddr + 4, ppn);524 525 if ( verbose)526 {527 boot_puts(" / pt1_pbase = ");528 boot_putl( pt1_pbase );529 boot_puts(" / ptd = ");530 boot_putl( ptd );531 boot_puts(" / pt2_pbase = ");532 boot_putl( pt2_pbase );533 boot_puts(" / pte_paddr = ");534 boot_putl( pte_paddr );535 boot_puts(" / ppn = ");536 boot_putx( ppn );537 boot_puts("/\n");538 }522 pte_paddr = pt2_pbase + 8 * ix2; 523 boot_physical_write(pte_paddr , flags); 524 boot_physical_write(pte_paddr + 4, ppn); 525 526 if (verbose) 527 { 528 boot_puts(" / pt1_pbase = "); 529 boot_putl( pt1_pbase ); 530 boot_puts(" / ptd = "); 531 boot_putl( ptd ); 532 boot_puts(" / pt2_pbase = "); 533 boot_putl( pt2_pbase ); 534 boot_puts(" / pte_paddr = "); 535 boot_putl( pte_paddr ); 536 boot_puts(" / ppn = "); 537 boot_putx( ppn ); 538 boot_puts("/\n"); 539 } 539 540 540 541 } // end boot_add_pte() … … 567 568 { 568 569 vpn = vseg[vseg_id].vbase >> 12; 569 ppn = (unsigned int)(vseg[vseg_id].pbase >> 12); 570 ppn = (unsigned int) (vseg[vseg_id].pbase >> 12); 571 570 572 npages = vseg[vseg_id].length >> 12; 571 573 if ((vseg[vseg_id].length & 0xFFF) != 0) npages++; 572 574 573 575 flags = PTE_V; 574 if (vseg[vseg_id].mode & C_MODE_MASK) 575 if (vseg[vseg_id].mode & X_MODE_MASK) 576 if (vseg[vseg_id].mode & W_MODE_MASK) 577 if (vseg[vseg_id].mode & U_MODE_MASK) 576 if (vseg[vseg_id].mode & C_MODE_MASK) flags = flags | PTE_C; 577 if (vseg[vseg_id].mode & X_MODE_MASK) flags = flags | PTE_X; 578 if (vseg[vseg_id].mode & W_MODE_MASK) flags = flags | PTE_W; 579 if (vseg[vseg_id].mode & U_MODE_MASK) flags = flags | PTE_U; 578 580 579 581 #if BOOT_DEBUG_PT … … 705 707 vobj[vobj_id].paddr = cur_paddr; 706 708 707 // initiali se boot_ptabs_vaddr[] & boot_ptabs-paddr[] if PTAB709 // initialize boot_ptabs_vaddr[] & boot_ptabs-paddr[] if PTAB 708 710 if (vobj[vobj_id].type == VOBJ_TYPE_PTAB) 709 711 { … … 725 727 boot_ptabs_vaddr[vspace_id] = vobj[vobj_id].vaddr; 726 728 boot_ptabs_paddr[vspace_id] = vobj[vobj_id].paddr; 727 729 728 730 // reset all valid bits in PT1 729 731 for ( offset = 0 ; offset < 8192 ; offset = offset + 4) 730 732 { 731 boot_physical_write( 733 boot_physical_write(cur_paddr + offset, 0); 732 734 } 733 735 … … 998 1000 999 1001 for (vseg_id = vspace[vspace_id].vseg_offset; 1000 1001 1002 vseg_id < (vspace[vspace_id].vseg_offset + vspace[vspace_id].vsegs); 1003 vseg_id++) 1002 1004 { 1003 1005 boot_vseg_map(&vseg[vseg_id], vspace_id); … … 1132 1134 boot_puts(vobj[vobj_id].name); 1133 1135 boot_puts(" / paddr = "); 1134 boot_put x(vobj[vobj_id].paddr);1136 boot_putl(vobj[vobj_id].paddr); 1135 1137 boot_puts(" / length = "); 1136 1138 boot_putx(vobj[vobj_id].length); … … 1179 1181 boot_puts(vobj[vobj_id].name); 1180 1182 boot_puts(" / Paddr :"); 1181 boot_put x(vobj[vobj_id].paddr);1183 boot_putl(vobj[vobj_id].paddr); 1182 1184 boot_puts(" / init = "); 1183 1185 boot_putx(*addr); … … 1884 1886 1885 1887 // mmu activation ( with page table [Ã] ) 1886 boot_set_mmu_ptpr( (unsigned int)(boot_ptabs_paddr[0] >> 13));1888 boot_set_mmu_ptpr((unsigned int) (boot_ptabs_paddr[0] >> 13)); 1887 1889 boot_set_mmu_mode(0xF); 1888 1890 … … 1890 1892 boot_putd(boot_proctime()); 1891 1893 boot_puts("\n"); 1894 1892 1895 1893 1896 // vobjs initialisation
Note: See TracChangeset
for help on using the changeset viewer.