Ignore:
Timestamp:
Feb 14, 2018, 3:39:35 PM (7 years ago)
Author:
alain
Message:

bloup

File:
1 edited

Legend:

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

    r420 r432  
    132132    xptr_t     page_xp;
    133133
    134 gpt_dmsg("\n[DBG] %s : core[%x,%d] enter\n",
    135 __FUNCTION__ , local_cxy , CURRENT_THREAD->core->lid );
     134#if CONFIG_DEBUG_GPT_ACCESS
     135uint32_t cycle = (uint32_t)hal_get_cycles;
     136if( CONFIG_DEBUG_GPT_ACCESS < cycle )
     137printk("\n[DBG] %s : thread %x enter / cycle %d\n",
     138__FUNCTION__, CURRENT_THREAD, cycle );
     139#endif
    136140
    137141    // check page size
     
    157161        gpt->ppn  = ppm_page2ppn( page_xp );
    158162
    159 gpt_dmsg("\n[DBG] %s : core[%x,%d] exit\n",
    160 __FUNCTION__ , local_cxy , CURRENT_THREAD->core->lid );
     163#if CONFIG_DEBUG_GPT_ACCESS
     164cycle = (uint32_t)hal_get_cycles;
     165if( CONFIG_DEBUG_GPT_ACCESS < cycle )
     166printk("\n[DBG] %s : thread %x exit / cycle %d\n",
     167__FUNCTION__, CURRENT_THREAD, cycle );
     168#endif
    161169
    162170        return 0;
     
    332340    uint32_t            tsar_attr;           // PTE attributes for TSAR MMU
    333341
    334 gpt_dmsg("\n[DBG] %s : core[%x,%d] enter for vpn = %x / ppn = %x / gpt_attr = %x\n",
    335 __FUNCTION__ , local_cxy , CURRENT_THREAD->core->lid , vpn , ppn , attr );
    336  
     342#if CONFIG_DEBUG_GPT_ACCESS
     343uint32_t cycle = (uint32_t)hal_get_cycles;
     344if( CONFIG_DEBUG_GPT_ACCESS < cycle )
     345printk("\n[DBG] %s : thread %x enter / vpn %x / attr %x / ppn %x / cycle %d\n",
     346__FUNCTION__, CURRENT_THREAD, vpn, attr, ppn, cycle );
     347#endif
     348
    337349    // compute indexes in PT1 and PT2
    338350    ix1 = TSAR_MMU_IX1_FROM_VPN( vpn );
     
    342354        small = attr & GPT_SMALL;
    343355
    344     // compute tsar_attr from generic attributes
     356    // compute tsar attributes from generic attributes
    345357    tsar_attr = gpt2tsar( attr );
    346358
    347 gpt_dmsg("\n[DBG] %s : core[%x,%d] / vpn = %x / &pt1 = %x / tsar_attr = %x\n",
    348 __FUNCTION__, local_cxy , CURRENT_THREAD->core->lid , vpn , pt1 , tsar_attr );
     359#if (CONFIG_DEBUG_GPT_ACCESS & 1)
     360if( CONFIG_DEBUG_GPT_ACCESS < cycle )
     361printk("\n[DBG] %s : thread %x / vpn %x / &pt1 %x / tsar_attr %x\n",
     362__FUNCTION__, CURRENT_THREAD, vpn, pt1, tsar_attr );
     363#endif
    349364
    350365    // get pointer on PT1[ix1]
     
    377392        pte1 = *pte1_ptr;
    378393       
    379 gpt_dmsg("\n[DBG] %s : core[%x,%d] / vpn = %x / current_pte1 = %x\n",
    380 __FUNCTION__, local_cxy , CURRENT_THREAD->core->lid , vpn , pte1 );
     394#if (CONFIG_DEBUG_GPT_ACCESS & 1)
     395if( CONFIG_DEBUG_GPT_ACCESS < cycle )
     396printk("\n[DBG] %s : thread %x / vpn %x / current_pte1 %x\n",
     397__FUNCTION__, CURRENT_THREAD, vpn, pte1 );
     398#endif
    381399       
    382400        // allocate a PT2 if PT1 entry not valid
     
    419437            pt2     = (uint32_t *)GET_PTR( ppm_ppn2base( pt2_ppn ) );
    420438
    421 gpt_dmsg("\n[DBG] %s : core[%x,%d] / vpn = %x / pte1 = %x / &pt2 = %x\n",
    422 __FUNCTION__, local_cxy , CURRENT_THREAD->core->lid , vpn , pte1 , pt2 );
     439#if (CONFIG_DEBUG_GPT_ACCESS & 1)
     440if( CONFIG_DEBUG_GPT_ACCESS < cycle )
     441printk("\n[DBG] %s : thread %x / vpn %x / pte1 %x / &pt2 %x\n",
     442__FUNCTION__, CURRENT_THREAD, vpn, pte1, pt2 );
     443#endif
    423444       
    424445    }
     
    431452        hal_fence();
    432453
    433 gpt_dmsg("\n[DBG] %s : core[%x,%d] exit / vpn = %x / pte2_attr = %x / pte2_ppn = %x\n",
    434 __FUNCTION__ , local_cxy , CURRENT_THREAD->core->lid , vpn ,
    435 pt2[2 * ix2] , pt2[2 * ix2 + 1] );
    436  
     454#if CONFIG_DEBUG_GPT_ACCESS
     455cycle = (uint32_t)hal_get_cycles;
     456if( CONFIG_DEBUG_GPT_ACCESS < cycle )
     457printk("\n[DBG] %s : thread %x exit / vpn %x / pte2_attr %x / pte2_ppn %x / cycle %d\n",
     458__FUNCTION__, CURRENT_THREAD, vpn, pt2[2 * ix2], pt2[2 * ix2 + 1], cycle );
     459#endif
     460
    437461        return 0;
    438462
     
    738762    ppn_t        dst_pt2_ppn;
    739763
    740 gpt_dmsg("\n[DBG] %s : core[%x,%d] enter for vpn %x\n",
    741 __FUNCTION__ , local_cxy , CURRENT_THREAD->core->lid , vpn );
     764#if CONFIG_DEBUG_GPT_ACCESS
     765uint32_t cycle = (uint32_t)hal_get_cycles;
     766if( CONFIG_DEBUG_GPT_ACCESS < cycle )
     767printk("\n[DBG] %s : thread %x enter / vpn %x / cycle %d\n",
     768__FUNCTION__, CURRENT_THREAD, vpn, cycle );
     769#endif
    742770
    743771    // get remote src_gpt cluster and local pointer
     
    825853            *ppn    = src_pte2_ppn;
    826854       
    827 gpt_dmsg("\n[DBG] %s : core[%x,%d] exit for vpn %x / copy done\n",
    828 __FUNCTION__ , local_cxy , CURRENT_THREAD->core->lid , vpn );
     855#if CONFIG_DEBUG_GPT_ACCESS
     856cycle = (uint32_t)hal_get_cycles;
     857if( CONFIG_DEBUG_GPT_ACCESS < cycle )
     858printk("\n[DBG] %s : thread %x exit / copy done for vpn %x / cycle %d\n",
     859__FUNCTION__, CURRENT_THREAD, vpn, cycle );
     860#endif
    829861
    830862            hal_fence();
     
    837869    *mapped = false;
    838870    *ppn    = 0;
    839    
    840 gpt_dmsg("\n[DBG] %s : core[%x,%d] exit for vpn %x / nothing done\n",
    841 __FUNCTION__ , local_cxy , CURRENT_THREAD->core->lid , vpn );
     871   
     872#if CONFIG_DEBUG_GPT_ACCESS
     873cycle = (uint32_t)hal_get_cycles;
     874if( CONFIG_DEBUG_GPT_ACCESS < cycle )
     875printk("\n[DBG] %s : thread %x exit / nothing done for vpn %x / cycle %d\n",
     876__FUNCTION__, CURRENT_THREAD, vpn, cycle );
     877#endif
    842878
    843879    hal_fence();
     
    918954
    919955/////////////////////////////////////////
    920 void hal_gpt_flip_cow( bool_t  set_cow,
    921                        xptr_t  gpt_xp,
    922                        vpn_t   vpn_base,
    923                        vpn_t   vpn_size )
     956void hal_gpt_set_cow( xptr_t  gpt_xp,
     957                      vpn_t   vpn_base,
     958                      vpn_t   vpn_size )
    924959{
    925960    cxy_t      gpt_cxy;
     
    936971    uint32_t * pt2;
    937972    ppn_t      pt2_ppn;
    938 
    939     uint32_t   old_attr;
    940     uint32_t   new_attr;
     973    uint32_t   attr;
    941974
    942975    // get GPT cluster and local pointer
     
    9671000 
    9681001            // get current PTE2 attributes
    969             old_attr = hal_remote_lw( XPTR( gpt_cxy , &pt2[2*ix2] ) );
     1002            attr = hal_remote_lw( XPTR( gpt_cxy , &pt2[2*ix2] ) );
    9701003
    9711004            // only MAPPED PTEs are modified       
    972             if( old_attr & TSAR_MMU_MAPPED )
     1005            if( attr & TSAR_MMU_MAPPED )
    9731006            {
    974                 if( (set_cow != 0) && (old_attr & TSAR_MMU_WRITABLE) )
    975                 {
    976                     new_attr = (old_attr | TSAR_MMU_COW) & (~TSAR_MMU_WRITABLE);
    977                     hal_remote_sw( XPTR( gpt_cxy , &pt2[2*ix2] ) , new_attr );
    978                 }
    979                 if( (set_cow == 0) && (old_attr & TSAR_MMU_COW ) )
    980                 {
    981                     new_attr = (old_attr | TSAR_MMU_WRITABLE) & (~TSAR_MMU_COW);
    982                     hal_remote_sw( XPTR( gpt_cxy , &pt2[2*ix2] ) , new_attr );
    983                 }
    984             }   // end if PTE2 mapped
    985         }   // end if PTE1 mapped
     1007                attr = (attr | TSAR_MMU_COW) & (~TSAR_MMU_WRITABLE);
     1008                hal_remote_sw( XPTR( gpt_cxy , &pt2[2*ix2] ) , attr );
     1009            }
     1010        }
    9861011    }   // end loop on pages
    9871012
    988 }  // end hal_gpt_flip_cow()
     1013}  // end hal_gpt_set_cow()
    9891014
    9901015//////////////////////////////////////////
Note: See TracChangeset for help on using the changeset viewer.