Changeset 53 for trunk/kernel/mm


Ignore:
Timestamp:
Jun 26, 2017, 4:22:00 PM (7 years ago)
Author:
alain
Message:

Compilation OK pout TSAR

Location:
trunk/kernel/mm
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/kernel/mm/kcm.c

    r50 r53  
    158158
    159159        // get page base address
    160         kcm_page = (kcm_page_t *)ppm_page2base( page );
     160        kcm_page = (kcm_page_t *)ppm_page2vaddr( page );
    161161
    162162        // initialize KCM-page descriptor
  • trunk/kernel/mm/khm.c

    r20 r53  
    5151        // get kernel heap base from PPM
    5252        page_t * page      = ppm_alloc_pages( CONFIG_PPM_HEAP_ORDER );
    53         void   * heap_base = ppm_page2base( page );
     53        void   * heap_base = ppm_page2vaddr( page );
    5454
    5555        // initialize first block (complete heap)
  • trunk/kernel/mm/mapper.c

    r23 r53  
    332332
    333333        // compute pointer in mapper
    334         map_ptr = (uint8_t *)ppm_page2base( page ) + page_offset;
     334        map_ptr = (uint8_t *)ppm_page2vaddr( page ) + page_offset;
    335335
    336336        // compute pointer in buffer
  • trunk/kernel/mm/page.c

    r23 r53  
    245245        void    * dst_base;
    246246
    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" );
    252248
    253249        size = (1 << dst->order) * CONFIG_PPM_PAGE_SIZE;
    254         src_base = ppm_page2base( src );
    255         dst_base = ppm_page2base( dst );
     250        src_base = ppm_page2vaddr( src );
     251        dst_base = ppm_page2vaddr( dst );
    256252
    257253        memcpy( dst_base , src_base , size );
     
    265261
    266262        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 );
    273264
    274265        memset( base , 0 , size );
    275 
    276 // kmem_print_kcm_table();
    277 
    278266}
    279267
     
    283271        printk("*** Page %d : base = %x / flags = %x / order = %d / count = %d\n",
    284272                page->index,
    285                 ppm_page2base( page ),
     273                ppm_page2vaddr( page ),
    286274                page->flags,
    287275                page->order,
  • trunk/kernel/mm/ppm.c

    r50 r53  
    264264}  // end ppm_print()
    265265
    266 //////////////////////////u/////////
    267 void ppm_assert_order( ppm_t * ppm )
     266///////////////////////////////////////
     267error_t ppm_assert_order( ppm_t * ppm )
    268268{
    269269        uint32_t       order;
     
    279279                        page = LIST_ELEMENT( iter , page_t , list );
    280280
    281                         assert( (page->order == order) , __FUNCTION__ , "PPM inconsistency" );
     281                        if( page->order != order )  return -1;
    282282                }
    283283        }
    284284
     285    return 0;
     286
    285287}  // end ppm_assert_order()
    286288
  • trunk/kernel/mm/ppm.h

    r50 r53  
    6969
    7070/*****************************************************************************************
    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 /*****************************************************************************************
    8471 * This is the low-level physical pages allocation function.
    8572 * It allocates N contiguous physical pages. N is a power of 2.
     
    9380
    9481/*****************************************************************************************
    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.
    9684 * In normal use, you do not need to call it directly, as the recommended way to free
    9785 * physical pages is to call the generic allocator defined in kmem.h.
     
    10088 ****************************************************************************************/
    10189void 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 ****************************************************************************************/
     98void ppm_free_pages_nolock( page_t * page );
    10299
    103100/*****************************************************************************************
     
    170167 *****************************************************************************************
    171168 * @ ppm      : pointer on PPM allocator.
     169 * @ return 0 if PPM is OK / return -1 if PPM not consistent.
    172170 ****************************************************************************************/
    173 void ppm_assert_order( ppm_t * ppm );
     171error_t ppm_assert_order( ppm_t * ppm );
    174172
    175173#endif  /* _PPM_H_ */
Note: See TracChangeset for help on using the changeset viewer.