Changeset 624 for trunk/hal/tsar_mips32/core/hal_gpt.c
- Timestamp:
- Mar 12, 2019, 1:37:38 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/hal/tsar_mips32/core/hal_gpt.c
r623 r624 174 174 } // end hal_gpt_create() 175 175 176 177 176 /////////////////////////////////// 178 177 void hal_gpt_destroy( gpt_t * gpt ) … … 334 333 335 334 336 /////////////////////////////////////////////////////////////////////////////////////337 // FOr the TSAR architecture, this function allocates a first level PT1 (8 Kbytes),338 // and maps one single big page for the kerne code segment in slot[0].339 /////////////////////////////////////////////////////////////////////////////////////340 void hal_gpt_build_kpt( cxy_t cxy,341 gpt_t * gpt )342 {343 error_t error;344 345 // allocate memory for one gpt346 error = hal_gpt_create( gpt );347 348 if( error )349 {350 printk("\n[PANIC] in %s : cannot allocate kernel GPT in cluster %x\n",351 __FUNCTION__ , cxy );352 hal_core_sleep();353 }354 355 // compute attr and ppn for one PTE1356 uint32_t attr = 0xCA800000; // bits : V,T,C,X,G357 uint32_t ppn = (cxy << 20) >> 9;358 359 // set PTE1360 error = hal_gpt_set_pte( XPTR( cxy , gpt ) , 0 , attr , ppn );361 362 if( error )363 {364 printk("\n[PANIC] in %s : cannot initialize kernel GPT in cluster %x\n",365 __FUNCTION__ , cxy );366 hal_core_sleep();367 }368 }369 370 335 ////////////////////////////////////////// 371 336 error_t hal_gpt_set_pte( xptr_t gpt_xp, … … 617 582 } // end hal_gpt_reset_pte() 618 583 584 585 /* unused until now (march 2019) [AG] 586 587 ////////////////////////////////////// 588 void hal_gpt_reset_range( gpt * gpt, 589 vpn_t vpn_min, 590 vpn_t vpn_max ) 591 { 592 vpn_t vpn; // current vpn 593 594 uint32_t * pt1; // PT1 base address 595 uint32_t pte1; // PT1 entry value 596 597 ppn_t pt2_ppn; // PPN of PT2 598 uint32_t * pt2; // PT2 base address 599 600 uint32_t ix1; // index in PT1 601 uint32_t ix2; // index in PT2 602 603 // get PT1 604 pt1 = gpt->ptr; 605 606 // initialize current index 607 vpn = vpn_min; 608 609 // loop on pages 610 while( vpn <= vpn_max ) 611 { 612 // get ix1 index from vpn 613 ix1 = TSAR_MMU_IX1_FROM_VPN( vpn ); 614 615 // get PTE1 616 pte1 = pt1[ix1] 617 618 if( (pte1 & TSAR_MMU_MAPPED) == 0 ) // PT1[ix1] unmapped 619 { 620 // update vpn (next big page) 621 (vpn = ix1 + 1) << 9; 622 } 623 if( (pte1 & TSAR_MMU_SMALL) == 0 ) // it's a PTE1 (big page) 624 { 625 // unmap the big page 626 pt1[ix1] = 0; 627 hal_fence(); 628 629 // update vpn (next big page) 630 (vpn = ix1 + 1) << 9; 631 } 632 else // it's a PTD1 (small page) 633 { 634 // compute PT2 base address 635 pt2_ppn = TSAR_MMU_PTBA_FROM_PTE1( pte1 ); 636 pt2 = GET_PTR( ppm_ppn2base( pt2_ppn ) ); 637 638 // get ix2 index from vpn 639 ix2 = TSAR_MMU_IX2_FROM_VPN( vpn ); 640 641 // unmap the small page 642 pt2[2*ix2] = 0; 643 hal_fence(); 644 645 // update vpn (next small page) 646 vpn++; 647 } 648 } 649 } // hal_gpt_reset_range() 650 */ 651 619 652 ////////////////////////////////////// 620 653 error_t hal_gpt_lock_pte( gpt_t * gpt,
Note: See TracChangeset
for help on using the changeset viewer.