src/mem/ruby/structures/Prefetcher.cc
//added by hongyu for prefetch guard. receive sensitive address from L2 when the core is suspicious
added by hongyu for prefetch guard. receive sensitive address from L2 when the core is suspicious
added by hongyu for prefetch guard . receive sensitive address from L2 when the core is suspicious
void 
Prefetcher::observeEviction(Addr address)
{
       bool add_flag=true;
       for (int i=0; i<prefetch_candidate.size(); i++){
         if (prefetch_candidate[i]==address){
           add_flag=false;
         }
       }
       if (add_flag){
         prefetch_candidate.push_back(address);
       }
       if (prefetch_guard_flag%2!=0){
          int temp_prefetch_index=(2-prefetch_index)%prefetch_candidate.size();
             Addr new_addr=makeLineAddress(prefetch_candidate[temp_prefetch_index]);
             DPRINTF(WayEvictMICRO17, "prefetching for %#x, id:%d\n", prefetch_candidate[temp_prefetch_index], temp_prefetch_index);
             m_controller->enqueuePrefetch(new_addr, RubyRequestType_IFETCH);
           prefetch_index+=1;
       }
       if (prefetch_guard_flag==7){
           prefetch_index=0;
           prefetch_guard_flag=0;
       }else{
           prefetch_guard_flag+=1;
       }
}
void Prefetcher :: observeEviction ( Addr address ) { bool add_flag = true ; for ( int i = 0 ; i < prefetch_candidate . size ( ) ; i ++ ) { if ( prefetch_candidate [ i ] == address ) { add_flag = false ; } } if ( add_flag ) { prefetch_candidate . push_back ( address ) ; } if ( prefetch_guard_flag % 2 != 0 ) { int temp_prefetch_index = ( 2 - prefetch_index ) % prefetch_candidate . size ( ) ; Addr new_addr = makeLineAddress ( prefetch_candidate [ temp_prefetch_index ] ) ; DPRINTF ( WayEvictMICRO17 , " \n " , prefetch_candidate [ temp_prefetch_index ] , temp_prefetch_index ) ; m_controller -> enqueuePrefetch ( new_addr , RubyRequestType_IFETCH ) ; prefetch_index += 1 ; } if ( prefetch_guard_flag == 7 ) { prefetch_index = 0 ; prefetch_guard_flag = 0 ; } else { prefetch_guard_flag += 1 ; } }
added by hongyu for prefetch guard.
added by hongyu for prefetch guard .
//collects sensitive addresses. //prefetch once for two evictions. If the prefetching is too frequent, the Gem5 will abort for unknown reason. //}