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

Physical Memory Cache. More...

Classes

class  MemCache
 A cache for physical memory indexed by page number. More...
struct  MemCache::CacheEntry
struct  MemCache::Buffers
 Cache MMIO registers and pending writes to them. More...

Macros

#define READ(NAME)   ({ _mtr_read |= RMTR_##NAME; _cpu->NAME; })
#define WRITE(NAME)
#define FAULT(NAME, VALUE)   { NAME->_debug_fault_line = __LINE__; NAME->_fault = VALUE; }
#define UNIMPLEMENTED(NAME)   { return (FAULT(NAME, FAULT_UNIMPLEMENTED)); }
#define RETRY   { return (FAULT(this, FAULT_RETRY)); }
#define EXCEPTION0(NAME, NR)   { NAME->_error_code = 0; FAULT(NAME, 0x80000300 | NR); }
#define EXCEPTION(NAME, NR, ERROR)   { NAME->_error_code = ERROR; FAULT(NAME, 0x80000b00 | NR); }
#define DE0(X)   { EXCEPTION0(X, 0x0); }
#define UD0   { EXCEPTION0(this, 0x6); return _fault; }
#define NP(X)   { EXCEPTION(this, 0xb, X); return _fault; }
#define SS(X)   { EXCEPTION(this, 0xc, X); return _fault; }
#define SS0   { EXCEPTION(this, 0xc, 0); return _fault; }
#define GP(X)   { EXCEPTION(this, 0xd, X); return _fault; }
#define GP0   { EXCEPTION(this, 0xd, 0); return _fault; }
#define PF(ADDR, ERR)   { _cpu->cr2 = ADDR; _mtr_out |= MTD_CR; EXCEPTION(this, 0xe, ERR); return _fault; }
#define return_move_to_front(set, newest)
 Move CacheEntries to the front of the usage list.
#define search_entry(set, newest)

Detailed Description

Physical Memory Cache.

Copyright (C) 2009-2010, Bernhard Kauer bk@vm.nosp@m.mon..nosp@m.org Economic rights: Technische Universitaet Dresden (Germany)

This file is part of Vancouver.

Vancouver is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation.

Vancouver is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License version 2 for more details.

Macro Definition Documentation

#define DE0 (   X)    { EXCEPTION0(X, 0x0); }
#define EXCEPTION (   NAME,
  NR,
  ERROR 
)    { NAME->_error_code = ERROR; FAULT(NAME, 0x80000b00 | NR); }
#define EXCEPTION0 (   NAME,
  NR 
)    { NAME->_error_code = 0; FAULT(NAME, 0x80000300 | NR); }
#define FAULT (   NAME,
  VALUE 
)    { NAME->_debug_fault_line = __LINE__; NAME->_fault = VALUE; }
#define GP (   X)    { EXCEPTION(this, 0xd, X); return _fault; }
#define GP0   { EXCEPTION(this, 0xd, 0); return _fault; }
#define NP (   X)    { EXCEPTION(this, 0xb, X); return _fault; }
#define PF (   ADDR,
  ERR 
)    { _cpu->cr2 = ADDR; _mtr_out |= MTD_CR; EXCEPTION(this, 0xe, ERR); return _fault; }
#define READ (   NAME)    ({ _mtr_read |= RMTR_##NAME; _cpu->NAME; })
#define RETRY   { return (FAULT(this, FAULT_RETRY)); }
#define return_move_to_front (   set,
  newest 
)
Value:
{ \
if (~old) \
{ \
set[old]._older = set[entry]._older; \
set[entry]._older = newest; \
newest = entry; \
} \
return set + entry; \
}

Move CacheEntries to the front of the usage list.

#define search_entry (   set,
  newest 
)
Value:
unsigned old = ~0; \
unsigned entry = newest; \
for (; ~set[entry]._older; old = entry, entry = set[entry]._older) \
if (set[entry].is_valid(phys1, phys2, len)) \
return_move_to_front(set, newest); \
/* we have at least an assoziativity of two! */ \
assert(~old); \
assert(~entry); \
#define SS (   X)    { EXCEPTION(this, 0xc, X); return _fault; }
#define SS0   { EXCEPTION(this, 0xc, 0); return _fault; }
#define UD0   { EXCEPTION0(this, 0x6); return _fault; }
#define UNIMPLEMENTED (   NAME)    { return (FAULT(NAME, FAULT_UNIMPLEMENTED)); }
#define WRITE (   NAME)
Value:
({ \
_mtr_out |= RMTR_##NAME; \
_cpu->NAME; \
})