Ignore:
Timestamp:
Nov 7, 2017, 3:08:12 PM (7 years ago)
Author:
alain
Message:

First implementation of fork/exec.

File:
1 edited

Legend:

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

    r406 r407  
    143143    error_t       error;
    144144
    145     mapper_dmsg("\n[DMSG] %s : enters for page %d / mapper %x\n",
    146                 __FUNCTION__ , index , mapper );
     145mapper_dmsg("\n[DBG] %s : core[%x,%d] enters for page %d / mapper %x\n",
     146__FUNCTION__ , local_cxy , CURRENT_THREAD->core->lid , index , mapper );
    147147
    148148    thread_t * this = CURRENT_THREAD;
     
    170170        if ( page == NULL )   // missing page => create it and load it from file system
    171171        {
    172             mapper_dmsg("\n[DMSG] %s : missing page => load from device\n", __FUNCTION__ );
     172
     173mapper_dmsg("\n[DBG] %s : core[%x,%d] missing page => load from device\n",
     174__FUNCTION__ , local_cxy , CURRENT_THREAD->core->lid );
    173175
    174176            // allocate one page from PPM
     
    188190            // initialize the page descriptor
    189191            page_init( page );
    190             page_set_flag( page , PG_INIT );
    191             page_set_flag( page , PG_INLOAD );
     192            page_set_flag( page , PG_INIT | PG_INLOAD );
    192193            page_refcount_up( page );
    193194            page->mapper = mapper;
     
    215216            error = vfs_mapper_move_page( page,
    216217                                          true );   // to mapper
    217 
    218218            if( error )
    219219            {
     
    231231            page_clear_flag( page , PG_INLOAD );
    232232
     233mapper_dmsg("\n[DBG] %s : missing page loaded / ppn = %x\n",
     234__FUNCTION__ , ppm_page2ppn(XPTR(local_cxy,page)) );
     235
    233236        }
    234237        else if( page_is_flag( page , PG_INLOAD ) )   // page is loaded by another thread
     
    244247
    245248                // deschedule
    246                 sched_yield( NULL );
     249                sched_yield();
    247250            }
    248251        }
     
    254257    }
    255258
    256     mapper_dmsg("\n[DMSG] %s : exit for page %d / mapper %x / page_desc = %x\n",
    257                 __FUNCTION__ , index , mapper , page );
     259mapper_dmsg("\n[DBG] %s : exit for page %d / mapper %x / page_desc = %x\n",
     260__FUNCTION__ , index , mapper , page );
    258261
    259262    return page;
     
    310313    uint8_t  * buf_ptr;        // current buffer  address
    311314
    312     mapper_dmsg("\n[DMSG] %s : enters / to_buf = %d / buffer = %x\n",
     315    mapper_dmsg("\n[DBG] %s : enters / to_buf = %d / buffer = %x\n",
    313316                __FUNCTION__ , to_buffer , buffer );
    314317
     
    336339        else                       page_count = CONFIG_PPM_PAGE_SIZE;
    337340
    338         mapper_dmsg("\n[DMSG] %s : index = %d / offset = %d / count = %d\n",
     341        mapper_dmsg("\n[DBG] %s : index = %d / offset = %d / count = %d\n",
    339342                    __FUNCTION__ , index , page_offset , page_count );
    340343
     
    351354        buf_ptr = (uint8_t *)buffer + done;
    352355
    353         mapper_dmsg("\n[DMSG] %s : index = %d / buf_ptr = %x / map_ptr = %x\n",
     356        mapper_dmsg("\n[DBG] %s : index = %d / buf_ptr = %x / map_ptr = %x\n",
    354357                    __FUNCTION__ , index , buf_ptr , map_ptr );
    355358
     
    368371    }
    369372
    370     mapper_dmsg("\n[DMSG] %s : exit for buffer %x\n",
     373    mapper_dmsg("\n[DBG] %s : exit for buffer %x\n",
    371374                __FUNCTION__, buffer );
    372375
     
    397400    uint8_t * buffer_ptr = (uint8_t *)GET_PTR( buffer_xp );
    398401
    399     mapper_dmsg("\n[DMSG] %s : to_buf = %d / buf_cxy = %x / buf_ptr = %x / size = %x\n",
    400     __FUNCTION__ , to_buffer , buffer_cxy , buffer_ptr , size );
     402mapper_dmsg("\n[DBG] %s : core[%x,%d] / to_buf = %d / buf_cxy = %x / buf_ptr = %x / size = %x\n",
     403__FUNCTION__, local_cxy, CURRENT_THREAD->core->lid, to_buffer, buffer_cxy, buffer_ptr, size );
    401404
    402405    // compute offsets of first and last bytes in file
     
    408411    uint32_t last  = max_byte >> CONFIG_PPM_PAGE_SHIFT;
    409412
    410     mapper_dmsg("\n[DMSG] %s : first_page = %d / last_page = %d\n",
    411     __FUNCTION__ , first , last );
     413mapper_dmsg("\n[DBG] %s : core[%x,%d] / first_page = %d / last_page = %d\n",
     414__FUNCTION__, local_cxy, CURRENT_THREAD->core->lid, first, last );
    412415
    413416    // compute source and destination clusters
     
    438441        else                       page_count = CONFIG_PPM_PAGE_SIZE;
    439442
    440         mapper_dmsg("\n[DMSG] %s : page_index = %d / offset = %d / bytes = %d\n",
    441                     __FUNCTION__ , index , page_offset , page_count );
     443mapper_dmsg("\n[DBG] %s : core[%x;%d] / page_index = %d / offset = %d / bytes = %d\n",
     444__FUNCTION__ , local_cxy, CURRENT_THREAD->core->lid, index, page_offset, page_count );
    442445
    443446        // get page descriptor
     
    470473    }
    471474
    472     mapper_dmsg("\n[DMSG] %s : exit / buf_cxy = %x / buf_ptr = %x / size = %x\n",
    473     __FUNCTION__ , buffer_cxy , buffer_ptr , size );
     475mapper_dmsg("\n[DBG] %s : core_cxy[%x,%d] / exit / buf_cxy = %x / buf_ptr = %x / size = %x\n",
     476__FUNCTION__, local_cxy, CURRENT_THREAD->core->lid, buffer_cxy, buffer_ptr, size );
    474477
    475478    return 0;
Note: See TracChangeset for help on using the changeset viewer.