Changeset 656 for trunk/kernel/mm/kmem.c


Ignore:
Timestamp:
Dec 6, 2019, 12:07:51 PM (4 years ago)
Author:
alain
Message:

Fix several bugs in the FATFS and in the VFS,
related to the creation of big files requiring
more than 4 Kbytes (one cluster) on device.

File:
1 edited

Legend:

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

    r635 r656  
    4545        flags = req->flags;
    4646
    47     ////////////////////////////////// PPM
     47    //////////////////////
    4848        if( type == KMEM_PPM )
    4949        {
     
    7676        return ptr;
    7777        }
    78     ///////////////////////////////////// KCM
     78    ///////////////////////////
    7979        else if( type == KMEM_KCM )
    8080        {
     
    102102        return ptr;
    103103        }
    104     //////////////////////////////////// KHM
     104    ///////////////////////////
    105105        else if( type == KMEM_KHM )
    106106        {
     
    140140    uint32_t type = req->type;
    141141
     142    //////////////////////
    142143        if( type == KMEM_PPM )
    143144        {
     
    146147        ppm_free_pages( page );
    147148    }
     149    ///////////////////////////
    148150    else if( type == KMEM_KCM )
    149151    {
    150152        kcm_free( req->ptr );
    151153        }
     154    ///////////////////////////
    152155    else if( type == KMEM_KHM )
    153156    {
     
    172175        flags = req->flags;
    173176
    174         ///////////////////////////////// PPM
    175         if( type == KMEM_PPM )
    176         {
    177                 // allocate the number of requested pages
    178                 page_t * page_ptr = ppm_remote_alloc_pages( cxy , order );
    179 
    180                 if( page_ptr == NULL )
     177        //////////////////////
     178        if( type == KMEM_PPM )
     179        {
     180                // allocate the number of requested pages from remote cluster
     181                xptr_t page_xp = ppm_remote_alloc_pages( cxy , order );
     182
     183                if( page_xp == XPTR_NULL )
    181184                {
    182185                        printk("\n[ERROR] in %s : failed for PPM / order %d in cluster %x\n",
     
    185188                }
    186189
    187         xptr_t page_xp = XPTR( cxy , page_ptr );
    188 
    189         // get pointer on buffer from the page descriptor
     190        // get extended pointer on remote buffer
    190191        xptr_t base_xp = ppm_page2base( page_xp );
    191192
     
    193194                if( flags & AF_ZERO ) hal_remote_memset( base_xp , 0 , CONFIG_PPM_PAGE_SIZE );
    194195
    195         void * ptr = GET_PTR( base_xp );
    196196
    197197#if DEBUG_KMEM_REMOTE
     
    201201printk("\n[%s] thread[%x,%x] from PPM / %d page(s) / ppn %x / cxy %x / cycle %d\n",
    202202__FUNCTION__, this->process->pid, this->trdid,
    203 1<<order, ppm_page2ppn(XPTR(local_cxy,ptr)), cxy, cycle );
    204 #endif
    205         return ptr;
    206         }
    207     /////////////////////////////////// KCM
     2031<<order, ppm_page2ppn( page_xp ), cxy, cycle );
     204#endif
     205        return GET_PTR( base_xp );
     206        }
     207    ///////////////////////////
    208208        else if( type == KMEM_KCM )
    209209        {
     
    231231        return ptr;
    232232        }
    233         /////////////////////////////////// KHM
     233        ///////////////////////////
    234234        else if( type == KMEM_KHM )               
    235235        {
     
    250250    uint32_t type = req->type;
    251251
     252    //////////////////////
    252253        if( type == KMEM_PPM )
    253254        {
     
    256257        ppm_remote_free_pages( cxy , page );
    257258    }
     259    ///////////////////////////
    258260    else if( type == KMEM_KCM )
    259261    {
    260262        kcm_remote_free( cxy , req->ptr );
    261263        }
     264    ///////////////////////////
    262265    else if( type == KMEM_KHM )
    263266    {
Note: See TracChangeset for help on using the changeset viewer.