コード例 #1
0
void FAT_SectorCache::FlushAll()
{
    for(int i = 0; i < SECTORCACHE_MAXSIZE; i++)
    {
        FlushSector( &m_cacheLines[i] );
    }
}
コード例 #2
0
FAT_SectorCache::FAT_CacheLine* FAT_SectorCache::GetUnusedCacheLine()
{
    FAT_CacheLine* cacheLine;
    FAT_CacheLine* topCandidate = NULL;
    UINT32 counter;
    UINT32 minLRUCounter = 0x7FFFFFFF;
    
    for(int i = 0; i < SECTORCACHE_MAXSIZE; i++)
    {
        cacheLine = &m_cacheLines[i];

        if(!cacheLine->m_buffer)
        {
            return cacheLine;
        }

        counter = cacheLine->GetLRUCounter();
        
        if(counter < minLRUCounter)
        {
            minLRUCounter = counter;
            topCandidate  = cacheLine;
        }
    }

    FlushSector( topCandidate );

    return topCandidate;
}
コード例 #3
0
/////////////////////////////////////////////////////////
// Description:
//  flush content in IOBuffer to real hardware storage
// 
// Input:
//  
//
// output:
//   
//
// Remarks:
// 
// Returns:
void FAT_SectorCache::FlushSector( UINT32 sectorIndex )
{
    FAT_CacheLine* cacheLine = GetCacheLine( sectorIndex );

    if(cacheLine)
    {
        FlushSector( cacheLine );
    }
}
コード例 #4
0
void FAT_SectorCache::Uninitialize()
{
    FAT_CacheLine* cacheLine;
    for(int i = 0; i < SECTORCACHE_MAXSIZE; i++)
    {
        cacheLine = &m_cacheLines[i];
        
        if(cacheLine->m_buffer)
        {
            FlushSector( cacheLine );

            private_free( cacheLine->m_buffer );

            cacheLine->m_buffer = NULL;
        }
    }
}
コード例 #5
0
ファイル: FrotzCache.cpp プロジェクト: 0xPIT/microtouch
	u8* Miss(u16 paddr)
	{
		u8 n = _head;
		if (_flags[n])
		{
			u16 spm = sp >> (CACHEBITS-1);
			u16 a = _addrs[n];
			if (a >= spm)	// Don't flush old stack junk
				FlushSector(a);
		}

		u8* dst = PageData(n);
		memcpy(dst,Seek(paddr),CACHELINE);	// LOAD
		_addrs[n] = paddr;
		_flags[n] = 1;
		return dst;
	}