Changeset 53 for trunk/kernel/mm
- Timestamp:
- Jun 26, 2017, 4:22:00 PM (7 years ago)
- Location:
- trunk/kernel/mm
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kernel/mm/kcm.c
r50 r53 158 158 159 159 // get page base address 160 kcm_page = (kcm_page_t *)ppm_page2 base( page );160 kcm_page = (kcm_page_t *)ppm_page2vaddr( page ); 161 161 162 162 // initialize KCM-page descriptor -
trunk/kernel/mm/khm.c
r20 r53 51 51 // get kernel heap base from PPM 52 52 page_t * page = ppm_alloc_pages( CONFIG_PPM_HEAP_ORDER ); 53 void * heap_base = ppm_page2 base( page );53 void * heap_base = ppm_page2vaddr( page ); 54 54 55 55 // initialize first block (complete heap) -
trunk/kernel/mm/mapper.c
r23 r53 332 332 333 333 // compute pointer in mapper 334 map_ptr = (uint8_t *)ppm_page2 base( page ) + page_offset;334 map_ptr = (uint8_t *)ppm_page2vaddr( page ) + page_offset; 335 335 336 336 // compute pointer in buffer -
trunk/kernel/mm/page.c
r23 r53 245 245 void * dst_base; 246 246 247 if( dst->order != src->order ) 248 { 249 printk("\n[PANIC] in %s : src size != dst size\n", __FUNCTION__ ); 250 hal_core_sleep(); 251 } 247 assert( (dst->order == src->order) , __FUNCTION__ , "src size != dst size\n" ); 252 248 253 249 size = (1 << dst->order) * CONFIG_PPM_PAGE_SIZE; 254 src_base = ppm_page2 base( src );255 dst_base = ppm_page2 base( dst );250 src_base = ppm_page2vaddr( src ); 251 dst_base = ppm_page2vaddr( dst ); 256 252 257 253 memcpy( dst_base , src_base , size ); … … 265 261 266 262 size = (1 << page->order) * CONFIG_PPM_PAGE_SIZE; 267 base = ppm_page2base( page ); 268 269 // kmem_print_kcm_table(); 270 271 // printk("\n@@@ in page_zero : size = %x / base = %x / kcm_tbl = %x\n", 272 // size , (uint32_t)base , (uint32_t)(&LOCAL_CLUSTER->kcm_tbl[0] ) ); 263 base = ppm_page2vaddr( page ); 273 264 274 265 memset( base , 0 , size ); 275 276 // kmem_print_kcm_table();277 278 266 } 279 267 … … 283 271 printk("*** Page %d : base = %x / flags = %x / order = %d / count = %d\n", 284 272 page->index, 285 ppm_page2 base( page ),273 ppm_page2vaddr( page ), 286 274 page->flags, 287 275 page->order, -
trunk/kernel/mm/ppm.c
r50 r53 264 264 } // end ppm_print() 265 265 266 ////////////////////////// u/////////267 voidppm_assert_order( ppm_t * ppm )266 /////////////////////////////////////// 267 error_t ppm_assert_order( ppm_t * ppm ) 268 268 { 269 269 uint32_t order; … … 279 279 page = LIST_ELEMENT( iter , page_t , list ); 280 280 281 assert( (page->order == order) , __FUNCTION__ , "PPM inconsistency" );281 if( page->order != order ) return -1; 282 282 } 283 283 } 284 284 285 return 0; 286 285 287 } // end ppm_assert_order() 286 288 -
trunk/kernel/mm/ppm.h
r50 r53 69 69 70 70 /***************************************************************************************** 71 * This function initializes a PPM (Physical Pages Manager) in a cluster.72 * The physical memory base address in all clusters is zero.73 * The physical memory size is NOT constrained to be smaller than 4 Gbytes.74 *****************************************************************************************75 * @ ppm : pointer on physical pages manager.76 * @ pages_nr : total physical memory size (number of 4 Kbytes pages).77 * @ pages_offset : number of pages already allocated in this physical memory.78 ****************************************************************************************/79 void ppm_init( ppm_t * ppm,80 uint32_t pages_nr,81 uint32_t pages_offset );82 83 /*****************************************************************************************84 71 * This is the low-level physical pages allocation function. 85 72 * It allocates N contiguous physical pages. N is a power of 2. … … 93 80 94 81 /***************************************************************************************** 95 * This is the low-level physical pages release function. 82 * This is the low-level physical pages release function. It takes the lock protecting 83 * the free_list before register the released page in the relevant free_list. 96 84 * In normal use, you do not need to call it directly, as the recommended way to free 97 85 * physical pages is to call the generic allocator defined in kmem.h. … … 100 88 ****************************************************************************************/ 101 89 void ppm_free_pages( page_t * page ); 90 91 /***************************************************************************************** 92 * This function does the same as the ppm_free_page() function, without taking the lock. 93 * It is used by the hal_ppm_init() function to initialize the pages_tbl[] array, when 94 * there is no concurrent access issue. 95 ***************************************************************************************** 96 * @ page : pointer to the page descriptor to be released 97 ****************************************************************************************/ 98 void ppm_free_pages_nolock( page_t * page ); 102 99 103 100 /***************************************************************************************** … … 170 167 ***************************************************************************************** 171 168 * @ ppm : pointer on PPM allocator. 169 * @ return 0 if PPM is OK / return -1 if PPM not consistent. 172 170 ****************************************************************************************/ 173 voidppm_assert_order( ppm_t * ppm );171 error_t ppm_assert_order( ppm_t * ppm ); 174 172 175 173 #endif /* _PPM_H_ */
Note: See TracChangeset
for help on using the changeset viewer.