- Timestamp:
- Jun 21, 2012, 2:47:19 PM (12 years ago)
- Location:
- soft/giet_vm
- Files:
-
- 62 added
- 1 deleted
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
soft/giet_vm/Makefile
r162 r163 64 64 ## merge all *.elf to soft.elf 65 65 soft.elf: boot.elf sys.elf map.bin apps 66 $(MAKE) -C m over67 m over/mover.x map.bin66 $(MAKE) -C memo 67 memo/memo.x map.bin 68 68 $(DU) -D $@ > $(BUILD_PATH)$@.txt 69 69 … … 127 127 rm -f *.o *.elf *.bin *.txt core *~ 2>$(TRASH) 128 128 $(MAKE) clean -C xml/ 2>$(TRASH) 129 $(MAKE) clean -C m over/ 2>$(TRASH)129 $(MAKE) clean -C memo/ 2>$(TRASH) 130 130 rm -r $(BUILD_PATH) 2>$(TRASH) 131 131 set -e; for d in $(APP_DIRS); do $(MAKE) clean -C $$d ; done -
soft/giet_vm/boot/boot_handler.c
r162 r163 61 61 #endif 62 62 63 #if !defined(GIET_NB_PT2_MAX)64 # error The GIET_NB_PT2_MAX value must be defined in the 'giet_config.h' file !65 #endif66 67 68 63 //////////////////////////////////////////////////////////////////////////// 69 64 // Global variables … … 434 429 // As the set of PT2s is implemented as a fixed size array (no dynamic 435 430 // allocation), this function checks a possible overflow of the PT2 array. 431 // 432 // The parametre global is a boolean taht indicate wether a global vseg is 433 // being mapped. 436 434 ////////////////////////////////////////////////////////////////////////////// 437 435 void boot_add_pte( unsigned int vspace_id, 438 unsigned int vpn, 439 unsigned int flags, 440 unsigned int ppn ) 436 unsigned int vpn, 437 unsigned int flags, 438 unsigned int ppn, 439 unsigned char global ) 441 440 { 442 441 unsigned int ix1; … … 488 487 if ( ( *pt_flags & PTE_V) != 0 ) // page already mapped 489 488 { 490 boot_tty_puts("\n[BOOT ERROR] in boot_add_pte() function\n"); 491 boot_tty_puts("page already mapped\n"); 492 boot_exit(); 493 } 494 else // set PTE2 495 { 496 *pt_flags = flags; 497 *pt_ppn = ppn; 498 } 489 if(global) 490 { 491 boot_tty_puts("\n[BOOT ERROR] in boot_add_pte() function\n"); 492 boot_tty_puts("page already mapped\n"); 493 boot_exit(); 494 }else 495 { 496 /** 497 * The case where a global vseg is already mapped as private vseg of a 498 * vspace_id. Typically used when a vseg is being replicated. 499 */ 500 boot_tty_puts("\n[BOOT] global PTE for vspace "); 501 boot_tty_putw(vspace_id); 502 boot_tty_puts(" already mapped, vpn = "); 503 boot_tty_putw(vpn); 504 boot_tty_puts("\n"); 505 return; 506 } 507 } 508 509 // set PTE2 510 *pt_flags = flags; 511 *pt_ppn = ppn; 512 499 513 } // end boot_add_pte() 500 514 … … 517 531 mapping_vspace_t* vspace = boot_get_vspace_base( header ); 518 532 mapping_vseg_t* vseg = boot_get_vseg_base( header ); 533 534 // private segments 535 for ( vseg_id = vspace[vspace_id].vseg_offset ; 536 vseg_id < (vspace[vspace_id].vseg_offset + vspace[vspace_id].vsegs) ; 537 vseg_id++ ) 538 { 539 vpn = vseg[vseg_id].vbase >> 12; 540 ppn = vseg[vseg_id].pbase >> 12; 541 npages = vseg[vseg_id].length >> 12; 542 if ( (vseg[vseg_id].length & 0xFFF) != 0 ) npages++; 543 544 flags = PTE_V; 545 if ( vseg[vseg_id].mode & C_MODE_MASK ) flags = flags | PTE_C; 546 if ( vseg[vseg_id].mode & X_MODE_MASK ) flags = flags | PTE_X; 547 if ( vseg[vseg_id].mode & W_MODE_MASK ) flags = flags | PTE_W; 548 if ( vseg[vseg_id].mode & U_MODE_MASK ) flags = flags | PTE_U; 549 550 #if BOOT_DEBUG_PT 551 boot_tty_puts("- vseg "); 552 boot_tty_puts( vseg[vseg_id].name ); 553 boot_tty_puts(" / flags = "); 554 boot_tty_putw( flags ); 555 boot_tty_puts("\n"); 556 #endif 557 // loop on 4K pages 558 for ( page_id = 0 ; page_id < npages ; page_id++ ) 559 { 560 boot_add_pte( vspace_id, 561 vpn, 562 flags, 563 ppn, 564 0 ); 565 vpn++; 566 ppn++; 567 } 568 } 519 569 520 570 // global segments … … 547 597 vpn, 548 598 flags, 549 ppn ); 550 vpn++; 551 ppn++; 552 } 553 } 554 555 // private segments 556 for ( vseg_id = vspace[vspace_id].vseg_offset ; 557 vseg_id < (vspace[vspace_id].vseg_offset + vspace[vspace_id].vsegs) ; 558 vseg_id++ ) 559 { 560 vpn = vseg[vseg_id].vbase >> 12; 561 ppn = vseg[vseg_id].pbase >> 12; 562 npages = vseg[vseg_id].length >> 12; 563 if ( (vseg[vseg_id].length & 0xFFF) != 0 ) npages++; 564 565 flags = PTE_V; 566 if ( vseg[vseg_id].mode & C_MODE_MASK ) flags = flags | PTE_C; 567 if ( vseg[vseg_id].mode & X_MODE_MASK ) flags = flags | PTE_X; 568 if ( vseg[vseg_id].mode & W_MODE_MASK ) flags = flags | PTE_W; 569 if ( vseg[vseg_id].mode & U_MODE_MASK ) flags = flags | PTE_U; 570 571 #if BOOT_DEBUG_PT 572 boot_tty_puts("- vseg "); 573 boot_tty_puts( vseg[vseg_id].name ); 574 boot_tty_puts(" / flags = "); 575 boot_tty_putw( flags ); 576 boot_tty_puts("\n"); 577 #endif 578 // loop on 4K pages 579 for ( page_id = 0 ; page_id < npages ; page_id++ ) 580 { 581 boot_add_pte( vspace_id, 582 vpn, 583 flags, 584 ppn ); 599 ppn, 600 1 ); 585 601 vpn++; 586 602 ppn++; … … 628 644 _max_pte2[region_id] = (vobj->length - PT1_SIZE) / PT2_SIZE; 629 645 646 #if BOOT_DEBUG_VIEW 630 647 boot_tty_puts("ptabs for vspace "); 631 648 boot_tty_putw(region_id); 632 boot_tty_puts(" address:");649 boot_tty_puts(" address: "); 633 650 boot_tty_putw((unsigned)_ptabs[region_id]); 634 651 boot_tty_puts("\n"); 652 #endif 635 653 } 636 654 } … … 780 798 } 781 799 782 // GIET_NB_PT2_MAX must be even783 if ( (GIET_NB_PT2_MAX & 0x1) != 0 )784 {785 boot_tty_puts("\n[BOOT ERROR] : GIET_NB_PT2_MAX must be an even numver\n");786 boot_tty_puts("\n");787 boot_exit();788 }789 790 800 // number of virtual spaces no larger than GIET_NB_VSPACE_MAX 791 801 if ( header->vspaces > GIET_NB_VSPACE_MAX ) -
soft/giet_vm/sys/init.c
r160 r163 33 33 in_kinit void _init() 34 34 { 35 _puts("\n KERNEL INIT! \n "); 35 _puts("\n[INIT] Starting kernel initialisations "); 36 _putw( _proctime() ); 37 _puts("\n"); 36 38 37 39 // building tasks contexts -
soft/giet_vm/sys/sys_handler.c
r161 r163 131 131 132 132 ///////////////////////////////////////////////////////////////////////////// 133 // _vobj_get_ base()133 // _vobj_get_vbase() 134 134 // returns 0: success, else: failed. 135 // give access to thebase address of a vobj identified by the (vspace_name / channel_name ) couple.135 // return the virtual base address of a vobj identified by the (vspace_name / channel_name ) couple. 136 136 // The "type" argument is here for checking purpose. 137 137 ///////////////////////////////////////////////////////////////////////////// … … 166 166 } 167 167 } 168 } 169 // not found !!! 170 return -2; 168 } 169 return -2;//not found 171 170 } 172 171
Note: See TracChangeset
for help on using the changeset viewer.