NOVA User-Level Environment  Version testbox/changed-memory-timing-317-g320d8b5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
MemCache Class Reference

A cache for physical memory indexed by page number. More...

#include <memcache.h>

Inheritance diagram for MemCache:
MemTlb InstructionCache Halifax

Classes

struct  Buffers
 Cache MMIO registers and pending writes to them. More...
struct  CacheEntry

Public Types

enum  Type {
  TYPE_R = 1u << 0, TYPE_W = 1u << 1, TYPE_RMW = TYPE_R | TYPE_W, TYPE_U = 1u << 2,
  TYPE_RES = 1u << 3, TYPE_X = 1u << 4
}

Public Member Functions

CacheEntryget (unsigned long phys1, unsigned long phys2, unsigned len, Type type)
 Get an entry from the cache or fetch one from memory.
void invalidate (bool writeback)
 Invalidate the cache, thus writeback the buffers.
 MemCache (DBus< MessageMem > &mem, DBus< MessageMemRegion > &memregion)

Public Attributes

bool debug
CacheEntry _values [ASSOZ]
unsigned _newest

Protected Attributes

DBus< MessageMem > & _mem
DBus< MessageMemRegion > & _memregion
unsigned _fault
unsigned _error_code
unsigned _debug_fault_line
unsigned _mtr_in
unsigned _mtr_read
unsigned _mtr_out

Private Types

enum  { SIZE = 64, ASSOZ = 6, BUFFERS = 6, BUFFER_SIZE = 16 + 4 }

Private Member Functions

unsigned slot (unsigned phys)
void buffer_io (bool read, unsigned index)
void invalidate_dirty ()
 Invalidate the oldest dirty entry in the list.

Private Attributes

struct {
   CacheEntry   _values [ASSOZ]
   unsigned   _newest
_sets [SIZE]
MemCache::Buffers _buffers [BUFFERS]
unsigned _newest_buffer
unsigned _oldest_write
unsigned _newest_write

Detailed Description

A cache for physical memory indexed by page number.

Member Enumeration Documentation

anonymous enum
private
Enumerator:
SIZE 
ASSOZ 
BUFFERS 
BUFFER_SIZE 
Enumerator:
TYPE_R 
TYPE_W 
TYPE_RMW 
TYPE_U 
TYPE_RES 
TYPE_X 

Constructor & Destructor Documentation

MemCache::MemCache ( DBus< MessageMem > &  mem,
DBus< MessageMemRegion > &  memregion 
)
inline

Member Function Documentation

void MemCache::buffer_io ( bool  read,
unsigned  index 
)
inlineprivate
CacheEntry* MemCache::get ( unsigned long  phys1,
unsigned long  phys2,
unsigned  len,
Type  type 
)
inline

Get an entry from the cache or fetch one from memory.

What should we do if two different pages are referenced?

We could fallback to dword mode but there is this strange corner case where somebody does an locked operation crossing two non-adjunct pages, where we have to map the two pages into an 8k region and unmap them later on....

Invalidate a dirty entry, as we entry points to the last used buffer it must be the oldest write.

void MemCache::invalidate ( bool  writeback)
inline

Invalidate the cache, thus writeback the buffers.

void MemCache::invalidate_dirty ( )
inlineprivate

Invalidate the oldest dirty entry in the list.

unsigned MemCache::slot ( unsigned  phys)
inlineprivate

Member Data Documentation

MemCache::Buffers MemCache::_buffers[BUFFERS]
private
unsigned MemCache::_debug_fault_line
protected
unsigned MemCache::_error_code
protected
unsigned MemCache::_fault
protected
DBus<MessageMem>& MemCache::_mem
protected
DBus<MessageMemRegion>& MemCache::_memregion
protected
unsigned MemCache::_mtr_in
protected
unsigned MemCache::_mtr_out
protected
unsigned MemCache::_mtr_read
protected
unsigned MemCache::_newest
unsigned MemCache::_newest_buffer
private
unsigned MemCache::_newest_write
private
unsigned MemCache::_oldest_write
private
struct { ... } MemCache::_sets[SIZE]
CacheEntry MemCache::_values[ASSOZ]
bool MemCache::debug

The documentation for this class was generated from the following file: