예제 #1
0
static void DetectCacheAndTLB(size_t& descriptorFlags)
{
	const Descriptors descriptors = GetDescriptors();
	for(Descriptors::const_iterator it = descriptors.begin(); it != descriptors.end(); ++it)
	{
		const Descriptor descriptor = *it;
		if(HandleSpecialDescriptor(descriptor, descriptorFlags))
			continue;

		const Characteristics* characteristics = CharacteristicsFromDescriptor(*it);
		if(!characteristics)
			continue;

		if((descriptorFlags & SKIP_CACHE_DESCRIPTORS) && !characteristics->IsTLB())
			continue;

		x86_x64::Cache cache;
		cache.Initialize(characteristics->Level(), characteristics->Type());
		cache.numEntries    = characteristics->NumEntries();
		cache.entrySize     = characteristics->EntrySize();
		cache.associativity = characteristics->associativity;
		cache.sharedBy      = 1;	// (safe default)
		if(characteristics->IsTLB())
			AddTLB(cache);
		else
			AddCache(cache);
	}
}
예제 #2
0
  void RemoveAndDeleteDescriptors(Descriptors read_descriptors,
                                  Descriptors write_descriptors,
                                  Descriptors delete_descriptors) {
    Descriptors::iterator iter;

    for (iter = read_descriptors.begin(); iter != read_descriptors.end();
         ++iter) {
      m_ss->RemoveReadDescriptor(*iter);
    }
    for (iter = write_descriptors.begin(); iter != write_descriptors.end();
         ++iter) {
      m_ss->RemoveWriteDescriptor(*iter);
    }
    for (iter = delete_descriptors.begin(); iter != delete_descriptors.end();
         ++iter) {
      delete *iter;
    }
    m_ss->Terminate();
  }