Ignore:
Timestamp:
Nov 1, 2018, 12:39:27 PM (5 years ago)
Author:
alain
Message:

Modify the GPT (Generic Page Table) API to support remote accesses,
in order to improve page faults and COW handling.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/hal/tsar_mips32/core/hal_gpt.c

    r570 r587  
    132132    xptr_t     page_xp;
    133133
     134    thread_t * this = CURRENT_THREAD;
     135
    134136#if DEBUG_HAL_GPT_CREATE
    135 uint32_t cycle = (uint32_t)hal_get_cycles;
     137uint32_t cycle = (uint32_t)hal_get_cycles();
    136138if( DEBUG_HAL_GPT_CREATE < cycle )
    137 printk("\n[DBG] %s : thread %x enter / cycle %d\n",
    138 __FUNCTION__, CURRENT_THREAD, cycle );
     139printk("\n[DBG] %s : thread[%x,%x] enter / cycle %d\n",
     140__FUNCTION__, this->process->pid, this->trdid, cycle );
    139141#endif
    140142
     
    152154        if( page == NULL )
    153155    {
    154         printk("\n[ERROR] in %s : cannot allocate memory for PT1\n", __FUNCTION__ );
     156        printk("\n[PANIC] in %s : no memory for PT1 / process %x / cluster %x\n",
     157        __FUNCTION__, this->process->pid, local_cxy );
    155158        return ENOMEM;
    156159    }
     
    162165
    163166#if DEBUG_HAL_GPT_CREATE
    164 cycle = (uint32_t)hal_get_cycles;
     167cycle = (uint32_t)hal_get_cycles();
    165168if( DEBUG_HAL_GPT_CREATE < cycle )
    166 printk("\n[DBG] %s : thread %x exit / cycle %d\n",
    167 __FUNCTION__, CURRENT_THREAD, cycle );
     169printk("\n[DBG] %s : thread[%x,%x] exit / cycle %d\n",
     170__FUNCTION__, this->process->pid, this->trdid, cycle );
    168171#endif
    169172
     
    188191
    189192#if DEBUG_HAL_GPT_DESTROY
    190 uint32_t cycle = (uint32_t)hal_get_cycles;
     193uint32_t   cycle = (uint32_t)hal_get_cycles();
     194thread_t * this  = CURRENT_THREAD;
    191195if( DEBUG_HAL_GPT_DESTROY < cycle )
    192 printk("\n[DBG] %s : thread %x enter / cycle %d\n",
    193 __FUNCTION__, CURRENT_THREAD, cycle );
     196printk("\n[DBG] %s : thread[%x,%x] enter / cycle %d\n",
     197__FUNCTION__, this->process->pid, this->trdid, cycle );
    194198#endif
    195199
     
    230234                pt2_ppn = TSAR_MMU_PTBA_FROM_PTE1( pte1 );
    231235                xptr_t base_xp = ppm_ppn2base( pt2_ppn );
    232                 pt2 = (uint32_t *)GET_PTR( base_xp );
     236                pt2     = GET_PTR( base_xp );
    233237
    234238                // scan the PT2 to release all entries VALID and USER if reference cluster
     
    261265
    262266#if DEBUG_HAL_GPT_DESTROY
    263 cycle = (uint32_t)hal_get_cycles;
     267cycle = (uint32_t)hal_get_cycles();
    264268if( DEBUG_HAL_GPT_DESTROY < cycle )
    265 printk("\n[DBG] %s : thread %x exit / cycle %d\n",
    266 __FUNCTION__, CURRENT_THREAD, cycle );
     269printk("\n[DBG] %s : thread[%x,%x] exit / cycle %d\n",
     270__FUNCTION__, this->process->pid, this->trdid, cycle );
    267271#endif
    268272
     
    309313                pt2_ppn = TSAR_MMU_PTBA_FROM_PTE1( pte1 );
    310314                xptr_t base_xp = ppm_ppn2base ( pt2_ppn );
    311                 pt2 = (uint32_t *)GET_PTR( base_xp );
     315                pt2     = GET_PTR( base_xp );
    312316
    313317                // scan the PT2
     
    330334
    331335
    332 ///////////////////////////////////////
    333 error_t hal_gpt_set_pte( gpt_t   * gpt,
     336//////////////////////////////////////////
     337error_t hal_gpt_set_pte( xptr_t    gpt_xp,
    334338                         vpn_t     vpn,
    335                          uint32_t  attr,     // generic GPT attributes
     339                         uint32_t  attr,     // GPT attributes
    336340                         ppn_t     ppn )
    337341{
    338     uint32_t          * pt1;                 // PT1 base addres
    339         uint32_t          * pte1_ptr;            // pointer on PT1 entry
    340         uint32_t            pte1;                // PT1 entry value
     342    cxy_t               gpt_cxy;             // target GPT cluster
     343    gpt_t             * gpt_ptr;             // target GPT local pointer
     344    uint32_t          * pt1_ptr;             // local pointer on PT1
     345        xptr_t              pte1_xp;             // extended pointer on PT1 entry
     346        uint32_t            pte1;                // PT1 entry value if PTE1
    341347
    342348        ppn_t               pt2_ppn;             // PPN of PT2
    343         uint32_t          * pt2;                 // PT2 base address
     349        uint32_t          * pt2_ptr;             // PT2 base address
    344350
    345351        uint32_t            small;               // requested PTE is for a small page
    346     bool_t              success;             // exit condition for while loop below
    347352
    348353        page_t            * page;                // pointer on new physical page descriptor
     
    354359    uint32_t            tsar_attr;           // PTE attributes for TSAR MMU
    355360
    356 #if DEBUG_HAL_GPT_ACCESS
    357 uint32_t cycle = (uint32_t)hal_get_cycles;
    358 if( DEBUG_HAL_GPT_ACCESS < cycle )
    359 printk("\n[DBG] %s : thread %x enter / vpn %x / attr %x / ppn %x / cycle %d\n",
    360 __FUNCTION__, CURRENT_THREAD, vpn, attr, ppn, cycle );
     361    thread_t * this = CURRENT_THREAD;
     362
     363    // get cluster and local pointer on GPT
     364    gpt_cxy = GET_CXY( gpt_xp );
     365    gpt_ptr = GET_PTR( gpt_xp );
     366
     367#if DEBUG_HAL_GPT_SET_PTE
     368uint32_t cycle = (uint32_t)hal_get_cycles();
     369if( DEBUG_HAL_GPT_SET_PTE < cycle )
     370printk("\n[DBG] %s : thread[%x,%x] enter / vpn %x / attr %x / ppn %x / cluster %x / cycle %d\n",
     371__FUNCTION__, this->process->pid, this->trdid, vpn, attr, ppn, gpt_cxy, cycle );
    361372#endif
    362373
     
    365376    ix2 = TSAR_MMU_IX2_FROM_VPN( vpn );
    366377
    367     pt1   = gpt->ptr;
    368         small = attr & GPT_SMALL;
     378    pt1_ptr = hal_remote_lpt( XPTR( gpt_cxy , &gpt_ptr->ptr ) );
     379        small   = attr & GPT_SMALL;
    369380
    370381    // compute tsar attributes from generic attributes
    371382    tsar_attr = gpt2tsar( attr );
    372383
    373 #if (DEBUG_HAL_GPT_ACCESS & 1)
    374 if( DEBUG_HAL_GPT_ACCESS < cycle )
    375 printk("\n[DBG] %s : thread %x / vpn %x / &pt1 %x / tsar_attr %x\n",
    376 __FUNCTION__, CURRENT_THREAD, vpn, pt1, tsar_attr );
    377 #endif
    378 
    379     // get pointer on PT1[ix1]
    380         pte1_ptr  = &pt1[ix1];
    381 
    382     // PTE1 (big page) are only set for the kernel vsegs, in the kernel init phase.
    383     // There is no risk of concurrent access.
    384         if( small == 0 )
    385     {
    386         // get current pte1 value
    387         pte1 = *pte1_ptr;
    388 
     384    // build extended pointer on PTE1 = PT1[ix1]
     385        pte1_xp = XPTR( gpt_cxy , &pt1_ptr[ix1] );
     386
     387    // get current pte1 value
     388    pte1 = hal_remote_l32( pte1_xp );
     389
     390        if( small == 0 )     // map a big page in PT1
     391    {
    389392        assert( (pte1 == 0) ,
    390393                "try to set a big page in a mapped PT1 entry / PT1[%d] = %x\n", ix1 , pte1 );
    391394     
    392         // set the PTE1
    393                 *pte1_ptr = (tsar_attr  & TSAR_MMU_PTE1_ATTR_MASK) |
    394                     ((ppn >> 9) & TSAR_MMU_PTE1_PPN_MASK);
     395        // set the PTE1 value in PT1
     396        pte1 = (tsar_attr  & TSAR_MMU_PTE1_ATTR_MASK) | ((ppn >> 9) & TSAR_MMU_PTE1_PPN_MASK);
     397        hal_remote_s32( pte1_xp , pte1 );
    395398                hal_fence();
     399
     400#if DEBUG_HAL_GPT_SET_PTE
     401if( DEBUG_HAL_GPT_SET_PTE < cycle )
     402printk("\n[DBG] %s : thread[%x,%x] map PTE1 / cxy %x / ix1 %x / pt1 %x / pte1 %x\n",
     403__FUNCTION__, this->process->pid, this->trdid, gpt_cxy, ix1, pt1_ptr, pte1 );
     404#endif
     405
    396406                return 0;
    397407        }
    398 
    399     // From this point, the requested PTE is a PTE2 (small page)
    400 
    401     // loop to access PTE1 and get pointer on PT2
    402     success = false;
    403     do
    404     {
    405         // get current pte1 value
    406         pte1 = *pte1_ptr;
    407        
    408 #if (DEBUG_HAL_GPT_ACCESS & 1)
    409 if( DEBUG_HAL_GPT_ACCESS < cycle )
    410 printk("\n[DBG] %s : thread %x / vpn %x / current_pte1 %x\n",
    411 __FUNCTION__, CURRENT_THREAD, vpn, pte1 );
    412 #endif
    413        
    414         // allocate a PT2 if PT1 entry not valid
    415         if( (pte1 & TSAR_MMU_MAPPED) == 0 )             // PT1 entry not valid
    416             {
    417             // allocate one physical page for the PT2
    418                 kmem_req_t req;
    419                 req.type  = KMEM_PAGE;
    420                 req.size  = 0;                       // 1 small page
    421                 req.flags = AF_KERNEL | AF_ZERO;
    422             page = (page_t *)kmem_alloc( &req );
     408    else                 // map a small page in PT1 & PT2
     409    {
     410        if( (pte1 & TSAR_MMU_MAPPED) == 0 )    // PT1 entry unmapped => map it
     411        {
     412            // allocate one physical page for PT2
     413            if( gpt_cxy == local_cxy )
     414            {
     415                    kmem_req_t req;
     416                    req.type  = KMEM_PAGE;
     417                    req.size  = 0;                     // 1 small page
     418                    req.flags = AF_KERNEL | AF_ZERO;
     419                    page = (page_t *)kmem_alloc( &req );
     420            }
     421            else
     422            {
     423                rpc_pmem_get_pages_client( gpt_cxy , 0 , &page );
     424            }
     425
    423426            if( page == NULL )
    424427            {
    425                         printk("\n[ERROR] in %s : cannot allocate PT2\n", __FUNCTION__ );
     428                printk("\n[PANIC] in %s : no memory for GPT PT2 / process %x / cluster %x\n",
     429                __FUNCTION__, this->process->pid, gpt_cxy );
    426430                return ENOMEM;
    427431            }
    428432
    429433            // get the PT2 PPN
    430             page_xp = XPTR( local_cxy , page );       
     434            page_xp = XPTR( gpt_cxy , page );       
    431435            pt2_ppn = ppm_page2ppn( page_xp );
    432436
    433             // try to atomicaly set the PT1 entry
     437            // build PTD1 value
    434438            pte1 = TSAR_MMU_MAPPED | TSAR_MMU_SMALL | pt2_ppn;
    435                     success = hal_atomic_cas( pte1_ptr , 0 , pte1 );
    436 
    437             // release allocated PT2 if PT1 entry modified by another thread
    438             if( success == false ) ppm_free_pages( page );
     439
     440            // set the PTD1 value in PT1
     441            hal_remote_s32( pte1_xp , pte1 );
     442
     443#if DEBUG_HAL_GPT_SET_PTE
     444if( DEBUG_HAL_GPT_SET_PTE < cycle )
     445printk("\n[DBG] %s : thread[%x,%x] map PTD1 / cxy %x / ix1 %d / pt1 %x / ptd1 %x\n",
     446__FUNCTION__, this->process->pid, this->trdid, gpt_cxy, ix1, pt1_ptr, pte1 );
     447#endif
    439448        }
    440         else                                           // PT1 entry is valid
     449        else                                   // pt1 entry mapped => use it
    441450        {
    442             // This valid entry must be a PTD1
    443             assert( (pte1 & TSAR_MMU_SMALL) ,
    444             "try to set a small page in a big PT1 entry / PT1[%d] = %x\n", ix1 , pte1 );
    445 
    446             success = true;
     451
     452#if DEBUG_HAL_GPT_SET_PTE
     453if( DEBUG_HAL_GPT_SET_PTE < cycle )
     454printk("\n[DBG] %s : thread[%x,%x] get PTD1 / cxy %x / ix1 %d / pt1 %x / ptd1 %x\n",
     455__FUNCTION__, this->process->pid, this->trdid, gpt_cxy, ix1, pt1_ptr, pte1 );
     456#endif
     457
    447458        }
    448459
    449460        // get PT2 base from pte1
    450461            pt2_ppn = TSAR_MMU_PTBA_FROM_PTE1( pte1 );
    451             pt2     = (uint32_t *)GET_PTR( ppm_ppn2base( pt2_ppn ) );
    452 
    453 #if (DEBUG_HAL_GPT_ACCESS & 1)
    454 if( DEBUG_HAL_GPT_ACCESS < cycle )
    455 printk("\n[DBG] %s : thread %x / vpn %x / pte1 %x / &pt2 %x\n",
    456 __FUNCTION__, CURRENT_THREAD, vpn, pte1, pt2 );
    457 #endif
    458        
     462            pt2_ptr = GET_PTR( ppm_ppn2base( pt2_ppn ) );
     463
     464        // set PTE2 in PT2 (in this order)
     465            hal_remote_s32( XPTR( gpt_cxy , &pt2_ptr[2 * ix2 + 1] ) , ppn );
     466            hal_fence();
     467            hal_remote_s32( XPTR( gpt_cxy , &pt2_ptr[2 * ix2] ) , tsar_attr );
     468            hal_fence();
     469
     470#if DEBUG_HAL_GPT_SET_PTE
     471if( DEBUG_HAL_GPT_SET_PTE < cycle )
     472printk("\n[DBG] %s : thread[%x,%x] map PTE2 / cxy %x / ix2 %x / pt2 %x / attr %x / ppn %x\n",
     473__FUNCTION__, this->process->pid, this->trdid, gpt_cxy, ix2, pt2_ptr, tsar_attr, ppn );
     474#endif
     475
     476            return 0;
    459477    }
    460     while (success == false);
    461 
    462     // set PTE2 in this order
    463         pt2[2 * ix2 + 1] = ppn;
    464         hal_fence();
    465         pt2[2 * ix2]     = tsar_attr;
    466         hal_fence();
    467 
    468 #if DEBUG_HAL_GPT_ACCESS
    469 cycle = (uint32_t)hal_get_cycles;
    470 if( DEBUG_HAL_GPT_ACCESS < cycle )
    471 printk("\n[DBG] %s : thread %x exit / vpn %x / pte2_attr %x / pte2_ppn %x / cycle %d\n",
    472 __FUNCTION__, CURRENT_THREAD, vpn, pt2[2 * ix2], pt2[2 * ix2 + 1], cycle );
    473 #endif
    474 
    475         return 0;
    476 
    477478} // end of hal_gpt_set_pte()
    478479
    479 
    480 /////////////////////////////////////
    481 void hal_gpt_get_pte( gpt_t    * gpt,
     480////////////////////////////////////////
     481void hal_gpt_get_pte( xptr_t     gpt_xp,
    482482                      vpn_t      vpn,
    483483                      uint32_t * attr,
     
    490490    ppn_t      pt2_ppn;
    491491
     492    // get cluster and local pointer on GPT
     493    cxy_t   gpt_cxy = GET_CXY( gpt_xp );
     494    gpt_t * gpt_ptr = GET_PTR( gpt_xp );
     495
     496    // compute indexes in PT1 and PT2
    492497    uint32_t   ix1 = TSAR_MMU_IX1_FROM_VPN( vpn );
    493498    uint32_t   ix2 = TSAR_MMU_IX2_FROM_VPN( vpn );
    494499
    495     // get PTE1 value
    496         pt1  = gpt->ptr;
    497     pte1 = pt1[ix1];
    498 
     500    // get PT1 base
     501    pt1 = (uint32_t *)hal_remote_lpt( XPTR( gpt_cxy , &gpt_ptr->ptr ) );
     502   
     503    // get pte1
     504    pte1 = hal_remote_l32( XPTR( gpt_cxy , &pt1[ix1] ) );
     505
     506    // check PTE1 mapped
    499507        if( (pte1 & TSAR_MMU_MAPPED) == 0 )   // PT1 entry not present
    500508        {
    501509                *attr = 0;
    502510                *ppn  = 0;
     511        return;
    503512        }
    504513
     514    // access GPT
    505515        if( (pte1 & TSAR_MMU_SMALL) == 0 )     // it's a PTE1
    506516        {
     517        // get PPN & ATTR from PT1
    507518                *attr = tsar2gpt( TSAR_MMU_ATTR_FROM_PTE1( pte1 ) );
    508519        *ppn  = TSAR_MMU_PPN_FROM_PTE1( pte1 ) | (vpn & ((1<<TSAR_MMU_IX2_WIDTH)-1));
    509520        }
    510     else                              // it's a PTD1
     521    else                                  // it's a PTD1
    511522    {
    512523        // compute PT2 base address
    513524        pt2_ppn = TSAR_MMU_PTBA_FROM_PTE1( pte1 );
    514         pt2     = (uint32_t*)GET_PTR( ppm_ppn2base( pt2_ppn ) );
    515 
    516             *ppn  = pt2[2*ix2+1] & ((1<<TSAR_MMU_PPN_WIDTH)-1);
    517             *attr = tsar2gpt( pt2[2*ix2] );
     525        pt2     = GET_PTR( ppm_ppn2base( pt2_ppn ) );
     526
     527        // get PPN & ATTR from PT2
     528        *ppn  = hal_remote_l32( XPTR( gpt_cxy , &pt2[2*ix2+1] ) ) & ((1<<TSAR_MMU_PPN_WIDTH)-1);
     529        *attr = tsar2gpt( hal_remote_l32( XPTR( gpt_cxy , &pt2[2*ix2] ) ) );
    518530    }
    519531} // end hal_gpt_get_pte()
     
    528540    ppn_t      pt2_ppn;     // PPN of PT2
    529541    uint32_t * pt2;         // PT2 base address
    530 
    531     ppn_t      ppn;         // PPN of page to be released
    532542
    533543    // get ix1 & ix2 indexes
     
    546556        if( (pte1 & TSAR_MMU_SMALL) == 0 )      // it's a PTE1
    547557        {
    548         // get PPN
    549         ppn = TSAR_MMU_PPN_FROM_PTE1( pte1 );
    550 
    551558        // unmap the big page
    552559        pt1[ix1] = 0;
     
    559566        // compute PT2 base address
    560567        pt2_ppn = TSAR_MMU_PTBA_FROM_PTE1( pte1 );
    561         pt2 = (uint32_t*)GET_PTR( ppm_ppn2base( pt2_ppn ) );
     568        pt2     = GET_PTR( ppm_ppn2base( pt2_ppn ) );
    562569       
    563         // get PPN
    564             ppn = TSAR_MMU_PPN_FROM_PTE2( pt2[2*ix2+1] );
    565 
    566570        // unmap the small page
    567             pt2[2*ix2]   = 0;            // only attr is reset
     571            pt2[2*ix2]   = 0;         
    568572            hal_fence();       
    569573
     
    623627        page_xp = XPTR( local_cxy , page );
    624628        pt2_ppn = ppm_page2ppn( page_xp );
    625         pt2     = (uint32_t *)GET_PTR( ppm_page2base( page_xp ) );
     629        pt2     = GET_PTR( ppm_page2base( page_xp ) );
    626630
    627631        // try to set the PT1 entry
     
    643647            // get the PT2 base address
    644648                        pt2_ppn = TSAR_MMU_PPN_FROM_PTE1( pte1 );
    645                         pt2     = (uint32_t*)GET_PTR( ppm_ppn2base( pt2_ppn ) );
     649                        pt2     = GET_PTR( ppm_ppn2base( pt2_ppn ) );
    646650                }
    647651        }
     
    660664
    661665        // compute pointer on PT2 base
    662             pt2 = (uint32_t *)GET_PTR( ppm_ppn2base( pt2_ppn ) );
     666            pt2 = GET_PTR( ppm_ppn2base( pt2_ppn ) );
    663667    }
    664668   
     
    720724    // get pointer on PT2 base
    721725    pt2_ppn = TSAR_MMU_PPN_FROM_PTE1( pte1 );
    722     pt2     = (uint32_t *)GET_PTR( ppm_ppn2base( pt2_ppn ) );
     726    pt2     = GET_PTR( ppm_ppn2base( pt2_ppn ) );
    723727 
    724728    // get pointer on PTE2
     
    762766    uint32_t   * dst_pt2;   // local pointer on DST PT2
    763767
    764         kmem_req_t   req;       // for dynamic PT2 allocation
     768        kmem_req_t   req;       // for PT2 allocation
    765769
    766770    uint32_t     src_pte1;
     
    776780    ppn_t        dst_pt2_ppn;
    777781
    778 #if DEBUG_HAL_GPT_ACCESS
    779 uint32_t cycle = (uint32_t)hal_get_cycles;
    780 if( DEBUG_HAL_GPT_ACCESS < cycle )
    781 printk("\n[DBG] %s : thread %x enter / vpn %x / cycle %d\n",
    782 __FUNCTION__, CURRENT_THREAD, vpn, cycle );
    783 #endif
    784 
    785782    // get remote src_gpt cluster and local pointer
    786783    src_cxy = GET_CXY( src_gpt_xp );
    787     src_gpt = (gpt_t *)GET_PTR( src_gpt_xp );
     784    src_gpt = GET_PTR( src_gpt_xp );
     785
     786#if DEBUG_HAL_GPT_COPY
     787uint32_t   cycle = (uint32_t)hal_get_cycles();
     788thread_t * this  = CURRENT_THREAD;
     789if( DEBUG_HAL_GPT_COPY < cycle )
     790printk("\n[DBG] %s : thread[%x,%x] enter / vpn %x / src_cxy %x / dst_cxy %x / cycle %d\n",
     791__FUNCTION__, this->process->pid, this->trdid, vpn, src_cxy, local_cxy, cycle );
     792#endif
     793
     794    // get remote src_gpt cluster and local pointer
     795    src_cxy = GET_CXY( src_gpt_xp );
     796    src_gpt = GET_PTR( src_gpt_xp );
    788797
    789798    // get remote src_pt1 and local dst_pt1
     
    837846        // get pointer on src_pt2
    838847        src_pt2_ppn = (ppn_t)TSAR_MMU_PTBA_FROM_PTE1( src_pte1 );
    839         src_pt2     = (uint32_t *)GET_PTR( ppm_ppn2base( src_pt2_ppn ) );
     848        src_pt2     = GET_PTR( ppm_ppn2base( src_pt2_ppn ) );
    840849
    841850        // get pointer on dst_pt2
    842851        dst_pt2_ppn = (ppn_t)TSAR_MMU_PTBA_FROM_PTE1( dst_pte1 );
    843         dst_pt2     = (uint32_t *)GET_PTR( ppm_ppn2base( dst_pt2_ppn ) );
     852        dst_pt2     = GET_PTR( ppm_ppn2base( dst_pt2_ppn ) );
    844853
    845854        // get attr and ppn from SRC_PT2
     
    867876            *ppn    = src_pte2_ppn;
    868877       
    869 #if DEBUG_HAL_GPT_ACCESS
     878#if DEBUG_HAL_GPT_COPY
    870879cycle = (uint32_t)hal_get_cycles;
    871 if( DEBUG_HAL_GPT_ACCESS < cycle )
    872 printk("\n[DBG] %s : thread %x exit / copy done for vpn %x / cycle %d\n",
    873 __FUNCTION__, CURRENT_THREAD, vpn, cycle );
     880if( DEBUG_HAL_GPT_COPY < cycle )
     881printk("\n[DBG] %s : thread[%x,%x] exit / copy done for vpn %x / cycle %d\n",
     882__FUNCTION__, this->process->pid, this->trdid, vpn, cycle );
    874883#endif
    875884
     
    884893    *ppn    = 0;
    885894   
    886 #if DEBUG_HAL_GPT_ACCESS
     895#if DEBUG_HAL_GPT_COPY
    887896cycle = (uint32_t)hal_get_cycles;
    888 if( DEBUG_HAL_GPT_ACCESS < cycle )
    889 printk("\n[DBG] %s : thread %x exit / nothing done for vpn %x / cycle %d\n",
    890 __FUNCTION__, CURRENT_THREAD, vpn, cycle );
     897if( DEBUG_HAL_GPT_COPY < cycle )
     898printk("\n[DBG] %s : thread[%x,%x] exit / nothing done for vpn %x / cycle %d\n",
     899__FUNCTION__, this->process->pid, this->trdid, vpn, cycle );
    891900#endif
    892901
     
    921930    // compute PT2 base address
    922931    pt2_ppn = TSAR_MMU_PTBA_FROM_PTE1( pte1 );
    923     pt2     = (uint32_t*)GET_PTR( ppm_ppn2base( pt2_ppn ) );
     932    pt2     = GET_PTR( ppm_ppn2base( pt2_ppn ) );
    924933
    925934    // get pte2_attr
     
    955964    // compute PT2 base address
    956965    pt2_ppn = TSAR_MMU_PTBA_FROM_PTE1( pte1 );
    957     pt2     = (uint32_t*)GET_PTR( ppm_ppn2base( pt2_ppn ) );
     966    pt2     = GET_PTR( ppm_ppn2base( pt2_ppn ) );
    958967
    959968    // get pte2_attr
     
    989998    // get GPT cluster and local pointer
    990999    gpt_cxy = GET_CXY( gpt_xp );
    991     gpt_ptr = (gpt_t *)GET_PTR( gpt_xp );
     1000    gpt_ptr = GET_PTR( gpt_xp );
    9921001
    9931002    // get local PT1 pointer
     
    10081017            // compute PT2 base address
    10091018            pt2_ppn = TSAR_MMU_PTBA_FROM_PTE1( pte1 );
    1010             pt2     = (uint32_t*)GET_PTR( ppm_ppn2base( pt2_ppn ) );
     1019            pt2     = GET_PTR( ppm_ppn2base( pt2_ppn ) );
    10111020
    10121021            assert( (GET_CXY( ppm_ppn2base( pt2_ppn ) ) == gpt_cxy ),
     
    10501059    // get cluster and local pointer on remote GPT
    10511060    cxy_t   gpt_cxy = GET_CXY( gpt_xp );
    1052     gpt_t * gpt_ptr = (gpt_t *)GET_PTR( gpt_xp );
     1061    gpt_t * gpt_ptr = GET_PTR( gpt_xp );
    10531062
    10541063    // compute indexes in PT1 and PT2
     
    10701079    // get PT2 base from PTE1
    10711080    pt2_ppn = TSAR_MMU_PTBA_FROM_PTE1( pte1 );
    1072     pt2     = (uint32_t *)GET_PTR( ppm_ppn2base( pt2_ppn ) );
    1073 
    1074     // reset PTE2
    1075         hal_remote_s32( XPTR( gpt_cxy, &pt2[2 * ix2]     ) , 0 );
    1076         hal_fence();
     1081    pt2     = GET_PTR( ppm_ppn2base( pt2_ppn ) );
    10771082
    10781083    // set PTE2 in this order
Note: See TracChangeset for help on using the changeset viewer.