Changeset 53 for trunk/hal/tsar_mips32
- Timestamp:
- Jun 26, 2017, 4:22:00 PM (7 years ago)
- Location:
- trunk/hal/tsar_mips32
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/hal/tsar_mips32/hal_gpt.c
r50 r53 121 121 122 122 // initialize generic page table descriptor 123 gpt->ptr = ppm_page2 base( page );123 gpt->ptr = ppm_page2vaddr( page ); 124 124 gpt->ppn = ppm_page2ppn( page ); 125 125 gpt->page = page; … … 193 193 // get pointer on PT2 194 194 pt2_ppn = TSAR_MMU_PTBA_FROM_PTE1( pte1 ); 195 pt2 = ppm_ppn2 base( pt2_ppn );195 pt2 = ppm_ppn2vaddr( pt2_ppn ); 196 196 197 197 // scan the PT2 to release all entries VALID and USER if reference cluster … … 212 212 // release the PT2 213 213 req.type = KMEM_PAGE; 214 req.ptr = ppm_ base2page( pt2 );214 req.ptr = ppm_vaddr2page( pt2 ); 215 215 kmem_free( &req ); 216 216 } … … 220 220 // release the PT1 221 221 req.type = KMEM_PAGE; 222 req.ptr = ppm_ base2page( pt1 );222 req.ptr = ppm_vaddr2page( pt1 ); 223 223 kmem_free( &req ); 224 224 … … 255 255 { 256 256 pt2_ppn = TSAR_MMU_PTBA_FROM_PTE1( pte1 ); 257 pt2 = ppm_ppn2 base( pt2_ppn );257 pt2 = ppm_ppn2vaddr( pt2_ppn ); 258 258 259 259 // scan the PT2 … … 339 339 } 340 340 pt2_ppn = ppm_page2ppn( page ); 341 pt2 = ppm_page2 base( page );341 pt2 = ppm_page2vaddr( page ); 342 342 343 343 // try to atomicaly set a PTD1 in the PT1 entry … … 361 361 362 362 // compute pointer on PT2 base 363 pt2 = (uint32_t*)ppm_ppn2 base( pt2_ppn );363 pt2 = (uint32_t*)ppm_ppn2vaddr( pt2_ppn ); 364 364 } 365 365 } … … 378 378 379 379 // compute pointer on PT2 base 380 pt2 = (uint32_t*)ppm_ppn2 base( pt2_ppn );380 pt2 = (uint32_t*)ppm_ppn2vaddr( pt2_ppn ); 381 381 } 382 382 … … 424 424 // compute PT2 base address 425 425 pt2_ppn = TSAR_MMU_PTBA_FROM_PTE1( pte1 ); 426 pt2 = (uint32_t*)ppm_ppn2 base( pt2_ppn );426 pt2 = (uint32_t*)ppm_ppn2vaddr( pt2_ppn ); 427 427 428 428 *ppn = pt2[2*ix2+1] & ((1<<TSAR_MMU_PPN_WIDTH)-1); … … 478 478 // compute PT2 base address 479 479 pt2_ppn = TSAR_MMU_PTBA_FROM_PTE1( pte1 ); 480 pt2 = (uint32_t*)ppm_ppn2 base( pt2_ppn );480 pt2 = (uint32_t*)ppm_ppn2vaddr( pt2_ppn ); 481 481 482 482 // get PPN … … 548 548 549 549 pt2_ppn = ppm_page2ppn( page ); 550 pt2 = ppm_page2 base( page );550 pt2 = ppm_page2vaddr( page ); 551 551 552 552 // try to set the PT1 entry … … 568 568 // get the PT2 base address 569 569 pt2_ppn = TSAR_MMU_PPN_FROM_PTE1( pte1 ); 570 pt2 = (uint32_t*)ppm_ppn2 base( pt2_ppn );570 pt2 = (uint32_t*)ppm_ppn2vaddr( pt2_ppn ); 571 571 } 572 572 } … … 585 585 586 586 // compute pointer on PT2 base 587 pt2 = (uint32_t*)ppm_ppn2 base( pt2_ppn );587 pt2 = (uint32_t*)ppm_ppn2vaddr( pt2_ppn ); 588 588 } 589 589 … … 645 645 // get pointer on PT2 base 646 646 pt2_ppn = TSAR_MMU_PPN_FROM_PTE1( pte1 ); 647 pt2 = ppm_ppn2 base( pt2_ppn );647 pt2 = ppm_ppn2vaddr( pt2_ppn ); 648 648 649 649 // get pointer on PTE2 … … 722 722 723 723 // get pointer on new PT2 in DST_GPT 724 dst_pt2 = (uint32_t *)ppm_page2 base( page );724 dst_pt2 = (uint32_t *)ppm_page2vaddr( page ); 725 725 726 726 // set a new PTD1 in DST_GPT … … 730 730 // get pointer on PT2 in SRC_GPT 731 731 src_pt2_ppn = (ppn_t)TSAR_MMU_PTBA_FROM_PTE1( pte1 ); 732 src_pt2 = (uint32_t *)ppm_ppn2 base( src_pt2_ppn );732 src_pt2 = (uint32_t *)ppm_ppn2vaddr( src_pt2_ppn ); 733 733 734 734 // scan the SRC_PT2 -
trunk/hal/tsar_mips32/hal_ppm.c
r50 r53 23 23 */ 24 24 25 #include <kernel_config.h> 26 #include <hal_types.h> 27 #include <hal_ppm.h> 28 #include <hal_special.h> 29 #include <printk.h> 30 #include <spinlock.h> 31 #include <process.h> 32 #include <ppm.h> 33 #include <thread.h> 34 #include <cluster.h> 35 #include <page.h> 25 36 26 37 ////////////////////////////////////////////////////////////////////////////////////////// … … 33 44 34 45 35 /////////////////////////////////////////// ///////36 struct page_s *hal_ppm_init( boot_info_t * info )46 /////////////////////////////////////////// 47 error_t hal_ppm_init( boot_info_t * info ) 37 48 { 49 uint32_t i; 50 38 51 // get relevant info from boot_info structure 39 52 uint32_t pages_nr = info->pages_nr; … … 54 67 55 68 // initialize all free_pages[] lists as empty 56 ppm->total_free_pages = 0;57 69 for( i = 0 ; i < CONFIG_PPM_MAX_ORDER ; i++ ) 58 70 { … … 70 82 ppm->pages_nr = pages_nr; 71 83 ppm->vaddr_base = NULL; 72 ppm->pages_tbl = (page_t*)( vaddr_base + (pages_offset << CONFIG_PPM_PAGE_SHIFT) ); 84 ppm->pages_tbl = (page_t*)( ppm->vaddr_base + 85 (pages_tbl_offset << CONFIG_PPM_PAGE_SHIFT) ); 73 86 74 87 // compute size of pages_tbl[] array rounded to an integer number of pages … … 79 92 80 93 // compute total number of reserved pages (kernel code & pages_tbl[]) 81 uint32_t reserved_pages = pages_ offset + tbl_nb_pages;94 uint32_t reserved_pages = pages_tbl_offset + pages_tbl_nr; 82 95 83 96 // initialises all page descriptors in pages_tbl[] … … 106 119 107 120 // check consistency 108 ppm_assert_order( ppm );121 return ppm_assert_order( ppm ); 109 122 110 // success 111 return ppm->pages_tbl; 123 } // end hal_ppm_init() 112 124 113 }114
Note: See TracChangeset
for help on using the changeset viewer.