Changeset 492 for trunk/kernel/mm


Ignore:
Timestamp:
Aug 22, 2018, 11:55:48 PM (6 years ago)
Author:
viala@…
Message:

Refactoring assert calling to conform with new assert macro.

Made with this command for the general case.
find ./kernel/ hal/ -name "*.c" | xargs sed -i -e '/assert(/ s/,[ ]*FUNCTION[ ]*,/,/'

And some done by hand.

Location:
trunk/kernel/mm
Files:
6 edited

Legend:

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

    r464 r492  
    5656#endif
    5757
    58         assert( kcm_page->active , __FUNCTION__ , "kcm_page should be active" );
     58        assert( kcm_page->active , "kcm_page should be active" );
    5959
    6060        // get first block available
    6161        int32_t index = bitmap_ffs( kcm_page->bitmap , kcm->blocks_nr );
    6262
    63         assert( (index != -1) , __FUNCTION__ , "kcm_page should not be full" );
     63        assert( (index != -1) , "kcm_page should not be full" );
    6464
    6565        // allocate block
     
    113113        index = ((uint8_t *)ptr - (uint8_t *)kcm_page - CONFIG_KCM_SLOT_SIZE) / kcm->block_size;
    114114
    115         assert( !bitmap_state( kcm_page->bitmap , index ) , __FUNCTION__ , "page already freed" );
    116         assert( (kcm_page->count > 0) , __FUNCTION__ , "count already zero" );
     115        assert( !bitmap_state( kcm_page->bitmap , index ) , "page already freed" );
     116        assert( (kcm_page->count > 0) , "count already zero" );
    117117
    118118        bitmap_set( kcm_page->bitmap , index );
     
    216216        // the kcm_page descriptor mut fit in the KCM slot
    217217        assert( (sizeof(kcm_page_t) <= CONFIG_KCM_SLOT_SIZE) ,
    218                  __FUNCTION__ , "KCM slot too small\n" );
     218                "KCM slot too small\n" );
    219219
    220220        // initialize lock
     
    329329        kcm_t      * kcm;
    330330
    331         assert( (ptr != NULL) , __FUNCTION__ , "pointer cannot be NULL" );
     331        assert( (ptr != NULL) , "pointer cannot be NULL" );
    332332
    333333        kcm_page = (kcm_page_t *)((intptr_t)ptr & ~CONFIG_PPM_PAGE_MASK);
  • trunk/kernel/mm/khm.c

    r457 r492  
    4040{
    4141        // check config parameters
    42         assert( ((CONFIG_PPM_PAGE_SHIFT + CONFIG_PPM_HEAP_ORDER) < 32 ) , __FUNCTION__ ,
     42        assert( ((CONFIG_PPM_PAGE_SHIFT + CONFIG_PPM_HEAP_ORDER) < 32 ) ,
    4343                 "CONFIG_PPM_HEAP_ORDER too large" );
    4444
     
    142142        spinlock_lock(&khm->lock);
    143143
    144         assert( (current->busy == 1) , __FUNCTION__ , "page already freed" );
     144        assert( (current->busy == 1) , "page already freed" );
    145145
    146146        // release block
  • trunk/kernel/mm/kmem.c

    r486 r492  
    143143        kcm_t    * kcm;
    144144
    145         assert( ((type > 1) && (type < KMEM_TYPES_NR) ) , __FUNCTION__ , "illegal KCM type" );
     145        assert( ((type > 1) && (type < KMEM_TYPES_NR) ) , "illegal KCM type" );
    146146
    147147#if DEBUG_KMEM
     
    198198        flags = req->flags;
    199199
    200         assert( (type < KMEM_TYPES_NR) , __FUNCTION__ , "illegal KMEM request type" );
     200        assert( (type < KMEM_TYPES_NR) , "illegal KMEM request type" );
    201201
    202202#if DEBUG_KMEM
     
    293293        if( req->type >= KMEM_TYPES_NR )
    294294        {
    295                 assert( false , __FUNCTION__ , "illegal request type\n" );
     295                assert( false , "illegal request type\n" );
    296296        }
    297297
  • trunk/kernel/mm/ppm.c

    r486 r492  
    152152        page_t   * pages_tbl   = ppm->pages_tbl;
    153153
    154         assert( !page_is_flag( page , PG_FREE ) , __FUNCTION__ ,
     154        assert( !page_is_flag( page , PG_FREE ) ,
    155155    "page already released : ppn = %x\n" , ppm_page2ppn(XPTR(local_cxy,page)) );
    156156
    157         assert( !page_is_flag( page , PG_RESERVED ) , __FUNCTION__ ,
     157        assert( !page_is_flag( page , PG_RESERVED ) ,
    158158    "reserved page : ppn = %x\n" , ppm_page2ppn(XPTR(local_cxy,page)) );
    159159
     
    215215        ppm_t    * ppm = &LOCAL_CLUSTER->ppm;
    216216
    217         assert( (order < CONFIG_PPM_MAX_ORDER) , __FUNCTION__ ,
     217        assert( (order < CONFIG_PPM_MAX_ORDER) ,
    218218    "illegal order argument = %x\n" , order );
    219219
  • trunk/kernel/mm/vmm.c

    r473 r492  
    7979
    8080    assert( ((CONFIG_VMM_KENTRY_SIZE + CONFIG_VMM_ARGS_SIZE + CONFIG_VMM_ENVS_SIZE)
    81             <= CONFIG_VMM_ELF_BASE) , __FUNCTION__ , "UTILS zone too small\n" );
    82 
    83     assert( (CONFIG_THREAD_MAX_PER_CLUSTER <= 32) , __FUNCTION__ ,
     81            <= CONFIG_VMM_ELF_BASE) , "UTILS zone too small\n" );
     82
     83    assert( (CONFIG_THREAD_MAX_PER_CLUSTER <= 32) ,
    8484            "no more than 32 threads per cluster for a single process\n");
    8585
    8686    assert( ((CONFIG_VMM_STACK_SIZE * CONFIG_THREAD_MAX_PER_CLUSTER) <=
    87              (CONFIG_VMM_VSPACE_SIZE - CONFIG_VMM_STACK_BASE)) , __FUNCTION__ ,
     87             (CONFIG_VMM_VSPACE_SIZE - CONFIG_VMM_STACK_BASE)) ,
    8888             "STACK zone too small\n");
    8989
     
    274274
    275275    // check cluster is reference
    276     assert( (GET_CXY( process->ref_xp ) == local_cxy) , __FUNCTION__,
     276    assert( (GET_CXY( process->ref_xp ) == local_cxy) ,
    277277    "not called in reference cluster\n");
    278278
     
    346346
    347347    // check cluster is reference
    348     assert( (GET_CXY( process->ref_xp ) == local_cxy) , __FUNCTION__,
     348    assert( (GET_CXY( process->ref_xp ) == local_cxy) ,
    349349    "local cluster is not process reference cluster\n");
    350350
     
    386386            vseg     = GET_PTR( vseg_xp );
    387387
    388             assert( (GET_CXY( vseg_xp ) == local_cxy) , __FUNCTION__,
     388            assert( (GET_CXY( vseg_xp ) == local_cxy) ,
    389389            "all vsegs in reference VSL must be local\n" );
    390390
     
    11121112
    11131113            // check small page
    1114             assert( (attr & GPT_SMALL) , __FUNCTION__ ,
     1114            assert( (attr & GPT_SMALL) ,
    11151115            "an user vseg must use small pages" );
    11161116
     
    13801380    uint32_t     flags = vseg->flags;
    13811381
    1382     assert( ( type != VSEG_TYPE_FILE ) , __FUNCTION__ , "illegal vseg type\n" );
     1382    assert( ( type != VSEG_TYPE_FILE ) , "illegal vseg type\n" );
    13831383
    13841384    if( flags & VSEG_DISTRIB )    // distributed => cxy depends on vpn LSB
     
    14481448        xptr_t mapper_xp = vseg->mapper_xp;
    14491449
    1450         assert( (mapper_xp != XPTR_NULL), __FUNCTION__,
     1450        assert( (mapper_xp != XPTR_NULL),
    14511451        "mapper not defined for a FILE vseg\n" );
    14521452       
     
    14861486            xptr_t     mapper_xp = vseg->mapper_xp;
    14871487
    1488             assert( (mapper_xp != XPTR_NULL), __FUNCTION__,
     1488            assert( (mapper_xp != XPTR_NULL),
    14891489            "mapper not defined for a CODE or DATA vseg\n" );
    14901490       
     
    16551655
    16561656    // vseg has been checked by the vmm_handle_page_fault() function
    1657     assert( (vseg != NULL) , __FUNCTION__,
    1658     "vseg undefined / vpn %x / thread %x in process %x / core[%x,%d] / cycle %d\n",
    1659     vpn, this->trdid, process->pid, local_cxy, this->core->lid,
    1660     (uint32_t)hal_get_cycles() );
     1657    assert( (vseg != NULL) , "vseg undefined / vpn %x\n");
    16611658
    16621659    if( cow )  //////////////// copy_on_write request //////////////////////
     
    16691666        hal_gpt_get_pte( &vmm->gpt , vpn , &old_attr , &old_ppn );
    16701667
    1671         assert( (old_attr & GPT_MAPPED), __FUNCTION__,
    1672         "PTE unmapped for a COW exception / vpn %x / thread %x in process %x / cycle %d\n",
    1673         vpn, this, process->pid, (uint32_t)hal_get_cycles() );
     1668        assert( (old_attr & GPT_MAPPED),
     1669          "PTE unmapped for a COW exception / vpn %x\n" );
    16741670
    16751671#if( DEBUG_VMM_GET_PTE & 1 )
  • trunk/kernel/mm/vseg.c

    r473 r492  
    145145    else
    146146    {
    147             assert( false , __FUNCTION__ , "illegal vseg type\n" );
     147            assert( false , "illegal vseg type\n" );
    148148    }
    149149
     
    191191        default:
    192192        {
    193             assert( false, __FUNCTION__, "Illegal vseg type" );
     193            assert( false, "Illegal vseg type" );
    194194            break;
    195195        }
Note: See TracChangeset for help on using the changeset viewer.