Changeset 201


Ignore:
Timestamp:
Feb 24, 2012, 2:07:31 PM (12 years ago)
Author:
alain
Message:

fixing a malicious bug in ICAHE FSM : bad handling of the
speculative access in IDLE state (thanks to Ghassan)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/modules/vci_cc_vcache_wrapper_v4/caba/source/src/vci_cc_vcache_wrapper_v4.cpp

    r199 r201  
    208208      m_dcache_yzmask((~0)<<(uint32_log2(dcache_words) + 2)),
    209209      m_dcache_words(dcache_words),
     210
     211      m_proc_id(proc_id),
    210212
    211213      m_max_frozen_cycles(max_frozen_cycles),
     
    14241426            r_icache_vci_paddr   = paddr;
    14251427
    1426             // Finally, we get the instruction depending on cacheability
     1428            // We enter this section only in case of TLB hit:
     1429            // Finally, we get the instruction depending on cacheability,
     1430            // we send the response to processor, and compute next state
    14271431            if ( cacheable )    // cacheable read
    14281432            {
     1433                if ( (r_icache_vci_paddr.read() & ~PAGE_K_MASK)
     1434                      != (paddr & ~PAGE_K_MASK) )       // speculative access KO
     1435                {
     1436
     1437#ifdef INSTRUMENTATION
     1438m_cpt_icache_spc_miss++;
     1439#endif
     1440                    // we return an invalid response and stay in IDLE state
     1441                    // the cache access will cost one extra cycle.
     1442                    break;
     1443                }
     1444               
    14291445                if ( not cache_hit )    // cache miss
    14301446                {
     
    14401456                        r_icache_miss_req = true;
    14411457                    }
     1458                    break;
    14421459                }
    14431460                else                    // cache hit
    14441461                {
    1445                     if ( (r_icache_vci_paddr.read() & ~PAGE_K_MASK)
    1446                              != (paddr & ~PAGE_K_MASK) )        // speculative access KO
    1447                     {
    1448 
    1449 #ifdef INSTRUMENTATION
    1450 m_cpt_icache_spc_miss++;
    1451 #endif
    1452                         // we return an invalid response
    1453                         // and the cache access will cost one extra cycle.
    1454                         break;
    1455                     }
    1456                     else                                        // speculative access OK
    1457                     {
    14581462     
    14591463#ifdef INSTRUMENTATION
    14601464m_cpt_ins_read++;
    14611465#endif
    1462                         irsp.valid       = true;
    1463                         irsp.instruction = cache_inst;
    1464                     }
     1466                    irsp.valid       = true;
     1467                    irsp.instruction = cache_inst;
    14651468                }
    14661469            }
     
    20512054                        // There is 4 configurations to access the cache,
    20522055                        // depending on the pipe-line state, defined
    2053                         // by the r_dcache_p0_valid flip-flop (P1 stage activated)
    2054                         // and    r_dcache_p1_valid flip-flop (P2 stage activated) :
     2056                        // by the r_dcache_p0_valid (V0) flip-flop : P1 stage activated
     2057                        // and    r_dcache_p1_valid (V1) flip-flop : P2 stage activated
    20552058                        //  V0 / V1 / Data      / Directory / comment                   
    20562059                        //  0  / 0  / read(A0)  / read(A0)  / read speculative access 
     
    27092712                    // SC request:
    27102713                    // - if a valid LL reservation (with the same address) is registered,
    2711                     // we request a SC transaction to CMD FSM and go to the DCACHE_SC_WAIT state
     2714                    // we request a SC transaction to CMD FSM and go to the DCACHE_UNC_WAIT state
    27122715                    // that will directly return the response to the processor, and invalidate
    2713                     // the LL reservation. We don't check a possible hit in dcache, as this is
    2714                     // done by the coherence transaction...
     2716                    // the LL reservation. We don't check a possible write hit in dcache,
     2717                    // as the cache update is done by the coherence transaction...
    27152718                    // - if there is no registerd LL, we just stay in IDLE state, invalidate
    27162719                    // the LL reservation, and return 1 (atomic access failed)
Note: See TracChangeset for help on using the changeset viewer.